Skip to content

Commit

Permalink
Merge pull request #619 from IATI/refactor-pubstats-and-final-pages
Browse files Browse the repository at this point in the history
Refactor publishing statistics and registration agencies
  • Loading branch information
Bjwebb authored Nov 5, 2024
2 parents 54a6e46 + 78e42dd commit 3b24364
Show file tree
Hide file tree
Showing 13 changed files with 150 additions and 91 deletions.
14 changes: 7 additions & 7 deletions dashboard/templates/comprehensiveness_base.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends 'base.html' %}
{% import '_partials/boxes.html' as boxes %}
{% import '_partials/boxes.html' as boxes with context %}

{% block container %}

Expand All @@ -8,10 +8,10 @@
{% endblock %}

<ul class="nav nav-tabs" role="tablist">
<li{% if tab=='summary' %} class="active"{% endif %}><a href="{{ url_for('basic_page', page_name='comprehensiveness') }}">Summary</a></li>
<li{% if tab=='core' %} class="active"{% endif %}><a href="{{ url_for('basic_page', page_name='comprehensiveness_core') }}">Core</a></li>
<li{% if tab=='financials' %} class="active"{% endif %}><a href="{{ url_for('basic_page', page_name='comprehensiveness_financials') }}">Financials</a></li>
<li{% if tab=='valueadded' %} class="active"{% endif %}><a href="{{ url_for('basic_page', page_name='comprehensiveness_valueadded') }}">Value added</a></li>
<li{% if tab=='summary' %} class="active"{% endif %}><a href="{{ url('dash-publishingstats-comprehensiveness') }}">Summary</a></li>
<li{% if tab=='core' %} class="active"{% endif %}><a href="{{ url('dash-publishingstats-comprehensiveness-core') }}">Core</a></li>
<li{% if tab=='financials' %} class="active"{% endif %}><a href="{{ url('dash-publishingstats-comprehensiveness-financials') }}">Financials</a></li>
<li{% if tab=='valueadded' %} class="active"{% endif %}><a href="{{ url('dash-publishingstats-comprehensiveness-valueadded') }}">Value added</a></li>
</ul>

<ul class="list-inline" style="padding: 1em">
Expand All @@ -31,7 +31,7 @@
{% block content %}
<div class="panel panel-default" id="h_table">
<div class="panel-heading">
<span class="pull-right"><a href="{{ url_for('static', filename='comprehensiveness_{}.csv'.format(tab)) }}">(This table as CSV)</a></span>
<span class="pull-right"><a href="{{ static('data/csv/comprehensiveness_{}.csv'.format(tab)) }}">(This table as CSV)</a></span>
<h3 class="panel-title">{% block table_title %}Table of Comprehensiveness values{% endblock %}</h3>
</div>

Expand All @@ -57,7 +57,7 @@ <h3 class="panel-title">{% block table_title %}Table of Comprehensiveness values
<tbody>
{% for row in comprehensiveness.table() %}
<tr>
<td style="border-right: 1px solid #ddd; border-left: 1px solid #ddd;"><a href="{{ url_for('publisher', publisher=row.publisher) }}">{{ row.publisher_title }}</a></td>
<td style="border-right: 1px solid #ddd; border-left: 1px solid #ddd;"><a href="{{ url('dash-headlines-publisher-detail', args=[row.publisher]) }}">{{ row.publisher_title }}</a></td>
{% for column_slug in comprehensiveness.column_slugs[tab] %}
<td style="border-right: 1px solid #ddd; border-left: 1px solid #ddd;">{% if column_slug in row %}
{{ row[column_slug+'_valid'] | round_nicely }}
Expand Down
2 changes: 1 addition & 1 deletion dashboard/templates/comprehensiveness_core.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{% block heading_detail %}
<p>Core elements are those that are mandatory in version 2.01 of the IATI Activity standard. The core elements are: Version, Reporting Organisation, IATI Identifier, Participating Organisation, Title, Description, Status, Activity Date, Sector, and Country or Region.</p>

<p>This table shows the percentage of <strong><em>current</em></strong> activities where the core elements are populated with valid data. (Values in parentheses indicate percentage of activities where elements are populated with any data.) The scoring for the <a href="{{ url_for('basic_page', page_name='summary_stats') }}">Summary Stats page</a> recognises the importance of the core by giving it double weighting in the overall comprehensiveness component.</p>
<p>This table shows the percentage of <strong><em>current</em></strong> activities where the core elements are populated with valid data. (Values in parentheses indicate percentage of activities where elements are populated with any data.) The scoring for the <a href="{{ url('dash-publishingstats-summarystats') }}">Summary Stats page</a> recognises the importance of the core by giving it double weighting in the overall comprehensiveness component.</p>

<p><strong>Key:</strong><br/>
Dashes: Where a publisher has published to IATI in the past but whose portfolio contains no current activities.
Expand Down
47 changes: 0 additions & 47 deletions dashboard/templates/coverage.html

This file was deleted.

6 changes: 3 additions & 3 deletions dashboard/templates/forwardlooking.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends 'base.html' %}
{% import '_partials/boxes.html' as boxes %}
{% import '_partials/boxes.html' as boxes with context %}
{% block content %}
<ul class="list-inline" style="padding: 1em">
<li><a href="#h_table">Table</a></li>
Expand All @@ -20,7 +20,7 @@
<div class="panel panel-default" id="h_table">

<div class="panel-heading">
<span class="pull-right"><a href="{{ url_for('static', filename='forwardlooking.csv') }}">(This table as CSV)</a></span>
<span class="pull-right"><a href="{{ static('data/csv/forwardlooking.csv') }}">(This table as CSV)</a></span>
<h3 class="panel-title">Activities with Forward Looking Budget Allocations</h3>
</div>

Expand Down Expand Up @@ -61,7 +61,7 @@ <h3 class="panel-title">Activities with Forward Looking Budget Allocations</h3>
<tbody>
{% for row in forwardlooking.table() %}
<tr>
<td style="border-right: 1px solid #ddd; border-left: 1px solid #ddd;"><a href="{{ url_for('publisher', publisher=row.publisher) }}">{{ row.publisher_title }}</a></td>
<td style="border-right: 1px solid #ddd; border-left: 1px solid #ddd;"><a href="{{ url('dash-headlines-publisher-detail', args=[row.publisher]) }}">{{ row.publisher_title }}</a></td>

{% for column in row.year_columns %}
{% for year in forwardlooking.years %}
Expand Down
8 changes: 4 additions & 4 deletions dashboard/templates/humanitarian.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends 'base.html' %}
{% import '_partials/boxes.html' as boxes %}
{% import '_partials/boxes.html' as boxes with context %}
{% block content %}

<ul class="list-inline" style="padding: 1em">
Expand All @@ -10,15 +10,15 @@

<div class="panel panel-default" id="h_table">
<div class="panel-heading">
<span class="pull-right"><a href="{{ url_for('static', filename='humanitarian.csv') }}">(This table as CSV)</a></span>
<span class="pull-right"><a href="{{ static('data/csv/humanitarian.csv') }}">(This table as CSV)</a></span>
<h3 class="panel-title">Humanitarian</h3>
</div>


<div class="panel-body">
<p>This table assesses the extent to which IATI publishers are reporting on humanitarian attributes.</p>

<p>The statistics on this page do not form part of the <a href="{{ url_for('basic_page', page_name='summary_stats') }}">Summary Statstics</a>.</p>
<p>The statistics on this page do not form part of the <a href="{{ url('dash-publishingstats-summarystats') }}">Summary Statstics</a>.</p>

{% include '_partials/tablesorter_instructions.html' %}
</div>
Expand All @@ -35,7 +35,7 @@ <h3 class="panel-title">Humanitarian</h3>
<tbody>
{% for row in humanitarian.table() %}
<tr>
<td style="border-right: 1px solid #ddd; border-left: 1px solid #ddd;"><a href="{{ url_for('publisher', publisher=row.publisher) }}">{{ row.publisher_title }}</a></td>
<td style="border-right: 1px solid #ddd; border-left: 1px solid #ddd;"><a href="{{ url('dash-headlines-publisher-detail', args=[row.publisher]) }}">{{ row.publisher_title }}</a></td>
{% for column_slug, _ in humanitarian.columns %}
<td style="border-right: 1px solid #ddd; border-left: 1px solid #ddd;">
{%- if column_slug == 'publisher_type' -%}
Expand Down
8 changes: 4 additions & 4 deletions dashboard/templates/registration_agencies.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends 'base.html' %}
{% import '_partials/boxes.html' as boxes %}
{% import '_partials/boxes.html' as boxes with context %}
{% block content %}

<div class="row">
Expand All @@ -19,7 +19,7 @@ <h3 class="panel-title">
<th>Publishers</th>
</tr></thead>
<tbody>
{% for registration_agency, count in sorted(registration_agencies.items()) %}
{% for registration_agency, count in func.sorted(registration_agencies.items()) %}
<tr>
<td>{{ registration_agency }}</td>
<td>{{ count }}</td>
Expand Down Expand Up @@ -51,8 +51,8 @@ <h3 class="panel-title">
{% for publisher, count in publishers.items() %}
<tr>
<td><code>{{ orgid|replace(' ', ' ') }}</code></td>
<td><a href="{{ url_for('publisher', publisher=publisher) }}">{{ publisher }}</a></td>
<td><a href="{{ url_for('publisher', publisher=publisher) }}">{{ publisher_name[publisher] }}</a></td>
<td><a href="{{ url('dash-headlines-publisher-detail', args=[publisher]) }}">{{ publisher }}</a></td>
<td><a href="{{ url('dash-headlines-publisher-detail', args=[publisher]) }}">{{ publisher_name[publisher] }}</a></td>
<td>{{ count }}</td>
</tr>
{% endfor %}
Expand Down
16 changes: 8 additions & 8 deletions dashboard/templates/summary_stats.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends 'base.html' %}
{% import '_partials/boxes.html' as boxes %}
{% import '_partials/boxes.html' as boxes with context %}
{% block content %}

<ul class="list-inline" style="padding: 1em">
Expand All @@ -12,7 +12,7 @@

<div class="panel panel-default" id="h_table">
<div class="panel-heading">
<span class="pull-right"><a href="{{ url_for('static', filename='summary_stats.csv') }}">(This table as CSV)</a></span>
<span class="pull-right"><a href="{{ static('data/csv/summary_stats.csv') }}">(This table as CSV)</a></span>
<h3 class="panel-title">Summary Statistics</h3>
</div>

Expand All @@ -37,7 +37,7 @@ <h3 class="panel-title">Summary Statistics</h3>
<tbody>
{% for row in summary_stats.table() %}
<tr>
<td style="border-right: 1px solid #ddd; border-left: 1px solid #ddd;"><a href="{{ url_for('publisher', publisher=row.publisher) }}">{{ row.publisher_title }}</a></td>
<td style="border-right: 1px solid #ddd; border-left: 1px solid #ddd;"><a href="{{ url('dash-headlines-publisher-detail', args=[row.publisher]) }}">{{ row.publisher_title }}</a></td>
{% for column_slug, column_header in summary_stats.columns %}
<td style="border-right: 1px solid #ddd; border-left: 1px solid #ddd;">{% if column_slug == "publisher_type" %}{{ row[column_slug] }}{% else %}{{ row[column_slug] | round_nicely }}{% endif %}</th>
{% endfor %}
Expand All @@ -55,10 +55,10 @@ <h3 class="panel-title">Narrative</h3>
</div>
<div class="panel-body">
<h4>Timeliness</h5>
<p>This is calculated by scoring the assessments made on the <a href="{{ url_for('basic_page', page_name='timeliness') }}">
frequency</a> and <a href="{{ url_for('basic_page', page_name='timeliness_timelag') }}">timelag</a> pages on a scale of
<p>This is calculated by scoring the assessments made on the <a href="{{ url('dash-publishingstats-timeliness') }}">
frequency</a> and <a href="{{ url('dash-publishingstats-timeliness-timelag') }}">timelag</a> pages on a scale of
0 to 4 (as below), dividing the sum of the two scores by 8, and expressing the result as
a percentage. The methodology used in making the assesments is detailed on the <a href="{{ url_for('basic_page', page_name='timeliness') }}">frequency</a> and <a href="{{ url_for('basic_page', page_name='timeliness_timelag') }}">timelag</a> pages.
a percentage. The methodology used in making the assesments is detailed on the <a href="{{ url('dash-publishingstats-timeliness') }}">frequency</a> and <a href="{{ url('dash-publishingstats-timeliness-timelag') }}">timelag</a> pages.
</p>

<table class="table table-striped">
Expand Down Expand Up @@ -118,12 +118,12 @@ <h4>Timeliness</h5>

<h4>Forward looking</h4>
<p>The average percentage of current activities with budgets for each of the years {{ current_year }} - {{ current_year + 2 }}.
The component values and a detailed methodology are displayed on the <a href="{{ url_for('basic_page', page_name='forwardlooking') }}">forward looking</a> page.
The component values and a detailed methodology are displayed on the <a href="{{ url('dash-publishingstats-forwardlooking') }}">forward looking</a> page.
</p>


<h4>Comprehensiveness</h4>
<p>The average of <a href="{{ url_for('basic_page', page_name='comprehensiveness') }}">comprehensiveness</a> averages for core, financials and value-added. The core average has a double-weighting.</p>
<p>The average of <a href="{{ url('dash-publishingstats-comprehensiveness') }}">comprehensiveness</a> averages for core, financials and value-added. The core average has a double-weighting.</p>


<h4>Score</h4>
Expand Down
6 changes: 3 additions & 3 deletions dashboard/templates/timeliness.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{% extends 'timeliness_base.html' %}
{% import '_partials/boxes.html' as boxes %}
{% import '_partials/boxes.html' as boxes with context %}

{% block frequency_li %} class="active"{% endblock %}

{% block content %}
<div class="panel panel-default" id="h_table">

<div class="panel-heading">
<span class="pull-right"><a href="{{ url_for('static', filename='timeliness_frequency.csv') }}">(This table as CSV)</a></span>
<span class="pull-right"><a href="{{ static('data/csv/timeliness_frequency.csv') }}">(This table as CSV)</a></span>
<h3 class="panel-title">Table of Frequency assessments</h3>
</div>

Expand Down Expand Up @@ -45,7 +45,7 @@ <h3 class="panel-title">Table of Frequency assessments</h3>
<tbody>
{% for publisher, publisher_title, per_month, assessment, hft, first_published_band in timeliness.publisher_frequency_sorted() %}
<tr>
<td style="border-right: 1px solid #ddd;"><a href="{{ url_for('publisher', publisher=publisher) }}">{{ publisher_title }}</a></td>
<td style="border-right: 1px solid #ddd;"><a href="{{ url('dash-headlines-publisher-detail', args=[publisher]) }}">{{ publisher_title }}</a></td>
<td data-index="{{ timeliness.first_published_band_index(first_published_band) }}" style="border-left: 1px solid #ddd; border-right: 1px solid #ddd;">{{ first_published_band }}</td>
{% for month in timeliness.previous_months_reversed %}
<td {% if not per_month[month] %}class="text-muted"{% endif %}>{{ per_month[month] or 0 }}</td>
Expand Down
6 changes: 3 additions & 3 deletions dashboard/templates/timeliness_base.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends 'base.html' %}
{% import '_partials/boxes.html' as boxes %}
{% import '_partials/boxes.html' as boxes with context %}

{% block container %}

Expand All @@ -8,8 +8,8 @@
{% endblock %}

<ul class="nav nav-tabs" role="tablist">
<li{% block frequency_li %}{% endblock %}><a href="{{ url_for('basic_page', page_name='timeliness') }}">Frequency</a></li>
<li{% block timelag_li %}{% endblock %}><a href="{{ url_for('basic_page', page_name='timeliness_timelag') }}">Time lag</a></li>
<li{% block frequency_li %}{% endblock %}><a href="{{ url('dash-publishingstats-timeliness') }}">Frequency</a></li>
<li{% block timelag_li %}{% endblock %}><a href="{{ url('dash-publishingstats-timeliness-timelag') }}">Time lag</a></li>
</ul>

<ul class="list-inline" style="padding: 1em">
Expand Down
6 changes: 3 additions & 3 deletions dashboard/templates/timeliness_timelag.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{% extends 'timeliness_base.html' %}
{% import '_partials/boxes.html' as boxes %}
{% import '_partials/boxes.html' as boxes with context %}

{% block timelag_li %} class="active"{% endblock %}

{% block content %}
<div class="panel panel-default" id="h_table">

<div class="panel-heading">
<span class="pull-right"><a href="{{ url_for('static', filename='timeliness_timelag.csv') }}">(This table as CSV)</a></span>
<span class="pull-right"><a href="{{ static('data/csv/timeliness_timelag.csv') }}">(This table as CSV)</a></span>
<h3 class="panel-title">Table of Time lag assessments</h3>
</div>

Expand Down Expand Up @@ -42,7 +42,7 @@ <h3 class="panel-title">Table of Time lag assessments</h3>
<tbody>
{% for publisher, publisher_title, per_month, assessment, hft in timeliness.publisher_timelag_sorted() %}
<tr>
<td style="border-right: 1px solid #ddd; border-left: 1px solid #ddd;"><a href="{{ url_for('publisher', publisher=publisher) }}">{{ publisher_title }}</a></td>
<td style="border-right: 1px solid #ddd; border-left: 1px solid #ddd;"><a href="{{ url('dash-headlines-publisher-detail', args=[publisher]) }}">{{ publisher_title }}</a></td>
{% for month in timeliness.previous_months_reversed %}
<td {% if not per_month[month] %}class="text-muted"{% endif %}>{{ per_month[month] or 0 }}</td>
{% endfor %}
Expand Down
Loading

0 comments on commit 3b24364

Please sign in to comment.