Skip to content

Commit

Permalink
Merge 03804df into ab36974
Browse files Browse the repository at this point in the history
  • Loading branch information
hayfield committed Feb 23, 2017
2 parents ab36974 + 03804df commit 9aa55d4
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 77 deletions.
23 changes: 11 additions & 12 deletions make_csv.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Script to generate CSV files from data in the 'stats-calculated' folder,
# Script to generate CSV files from data in the 'stats-calculated' folder,
# and extra logic in other files in this repository

import unicodecsv
Expand All @@ -10,7 +10,7 @@

def publisher_dicts():
for publisher, activities in data.current_stats['inverted_publisher']['activities'].items():
publisher_stats = data.get_publisher_stats(publisher)
publisher_stats = data.get_publisher_stats(publisher)
yield {
'Publisher Name': publisher_name[publisher],
'Publisher Registry Id': publisher,
Expand Down Expand Up @@ -126,8 +126,8 @@ def publisher_dicts():
writer = unicodecsv.writer(fp)
# Add column headers
writer.writerow([
'Publisher Name',
'Publisher Registry Id',
'Publisher Name',
'Publisher Registry Id',
'2014 IATI Spend (US $m)',
'2015 IATI Spend (US $m)',
'2014 Reference Spend (US $m)',
Expand All @@ -142,7 +142,7 @@ def publisher_dicts():
for row in coverage.table():
# Write each row
writer.writerow([
row['publisher_title'],
row['publisher_title'],
row['publisher'],
row['iati_spend_2014'],
row['iati_spend_2015'],
Expand All @@ -157,14 +157,13 @@ def publisher_dicts():
])


# Transparency indicator CSV file
import transparencyindicator
# Summary Stats CSV file
import summary_stats

with open(os.path.join('out', 'transparencyindicator.csv'), 'w') as fp:
with open(os.path.join('out', 'summary_stats.csv'), 'w') as fp:
writer = unicodecsv.writer(fp)
# Add column headers
writer.writerow(['Publisher Name', 'Publisher Registry Id'] + [header for slug, header in transparencyindicator.columns])
for row in transparencyindicator.table():
writer.writerow(['Publisher Name', 'Publisher Registry Id'] + [header for slug, header in summary_stats.columns])
for row in summary_stats.table():
# Write each row
writer.writerow([row['publisher_title'], row['publisher']] + [row[slug] for slug, header in transparencyindicator.columns])

writer.writerow([row['publisher_title'], row['publisher']] + [row[slug] for slug, header in summary_stats.columns])
10 changes: 5 additions & 5 deletions make_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import forwardlooking
import comprehensiveness
import coverage
import transparencyindicator
import summary_stats
from vars import expected_versions
import text
import datetime
Expand Down Expand Up @@ -133,7 +133,7 @@ def get_codelist_values(codelist_values_for_element):
'comprehensiveness_financials',
'comprehensiveness_valueadded',
'coverage',
'transparencyindicator',
'summary_stats',
'files',
'activities',
'download',
Expand Down Expand Up @@ -166,9 +166,9 @@ def basic_page(page_name):
elif page_name.startswith('coverage'):
kwargs['coverage'] = coverage
parent_page_name = 'coverage'
elif page_name.startswith('transparencyindicator'):
kwargs['transparencyindicator'] = transparencyindicator
parent_page_name = 'transparencyindicator'
elif page_name.startswith('summary_stats'):
kwargs['summary_stats'] = summary_stats
parent_page_name = 'summary_stats'
else:
parent_page_name = page_name
return render_template(page_name+'.html', page=parent_page_name, **kwargs)
Expand Down
6 changes: 3 additions & 3 deletions static/templates/comprehensiveness_core.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
{% 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 transparency indicator 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="summary_stats.html">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.
Dashes: Where a publisher has published to IATI in the past but whose portfolio contains no current activities.
</p>
{% endblock %}

Expand Down Expand Up @@ -65,4 +65,4 @@ <h5>Country or Region</h5>
{% block table_test_methodology_financials %}
{% endblock %}
{% block table_test_methodology_valueadded %}
{% endblock %}
{% endblock %}
3 changes: 1 addition & 2 deletions static/templates/publishing_stats.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% block about %}
<p>The statistics on IATI data that are calculated each night and displayed on this dashboard are now a central part of the service that the Technical Team provides to publishers and users of IATI data alike: for publishers to better understand how to improve their data; for users to assess which data is likely to meet their particular needs; and for the technical team itself to prioritise its commitments to data quality.</p>

<p>It is also important that a consistent approach is developed in the presentation of statistics in IATI's annual report, the Global Partnership's transparency indicator and the dashboard own nightly calculations.This section of the dashboard is focused to do just that.</p>
<p>It is also important that a consistent approach is developed in the presentation of statistics in IATI's annual report and the Dashboard's own nightly calculations, as well as when IATI is asked to contribute to monitoring reports. This section of the Dashboard is focused to do just that.</p>

<p>Each of the pages in this section contains:</p>

Expand All @@ -22,4 +22,3 @@

{% block publishers %}
{% endblock publishers %}

Original file line number Diff line number Diff line change
Expand Up @@ -14,38 +14,33 @@

<div class="panel panel-default" id="h_table">
<div class="panel-heading">
<span class="pull-right"><a href="{{url('transparencyindicator.csv')}}">(This table as CSV)</a></span>
<h3 class="panel-title">GPEDC Transparency Indicator (Proposed methodology)</h3>
<span class="pull-right"><a href="{{url('summary_stats.csv')}}">(This table as CSV)</a></span>
<h3 class="panel-title">Summary Statistics</h3>
</div>


<div class="panel-body">
<p>This table is a consultative version of the IATI Secretariat’s proposal to the Global
Partnership for Effective Development Cooperation for its revised Transparency Indicator.
The indicator assesses <span style="text-decoration: underline;">all</span> IATI publishers by
scoring three dimensions – Timeliness, Forward-looking and Comprehensiveness – and then
adjusting this score by the proportion (by value) of a publisher’s activities covered in
their IATI data. The methodology is explained below the table and in the related Publisher Statistics pages. In summary:</p>
<p>This table assesses <span style="text-decoration: underline;">all</span> IATI publishers by scoring three dimensions – Timeliness, Forward-looking and Comprehensiveness – and then adjusting this score by the proportion (by value) of a publisher’s activities covered in their IATI data (coverage). The methodology is explained below the table and in the related Publisher Statistics pages. In summary:</p>

<p><strong>{Score}</strong> = ( {Timeliness} + {Forward looking} + {Comprehensive} ) / 3 &nbsp; and &nbsp;&nbsp;<strong>{Coverage-adjusted Score}</strong> = {Score} * {Coverage} / 100</p>You are invited to participate in the consultation which is taking place on the <a href="http://discuss.iatistandard.org/c/consultations">IATI Discussion Forum</a></p>
<p><strong>{Score}</strong> = ( {Timeliness} + {Forward looking} + {Comprehensive} ) / 3 &nbsp; and &nbsp; <strong>{Coverage-adjusted Score}</strong> = {Score} * {Coverage} / 100</p>

{% include 'tablesorter_instructions.html' %}
</div>

<table class="table table-striped" id="main_table">
<thead>
<tr>
<th style="vertical-align:middle; border: 1px solid gray;">Publisher Name</th>
{% for column_slug, column_header in transparencyindicator.columns %}
{% for column_slug, column_header in summary_stats.columns %}
<th style="vertical-align:middle; border: 1px solid gray;">{{column_header}}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for row in transparencyindicator.table() %}
{% for row in summary_stats.table() %}
<tr {% if loop.last %} style="border-bottom: 1px solid gray;"{% endif %}>
<td style="border-right: 1px solid gray; border-left: 1px solid gray;"><a href="publisher/{{row.publisher}}.html">{{row.publisher_title}}</a></td>
{% for column_slug, column_header in transparencyindicator.columns %}
{% for column_slug, column_header in summary_stats.columns %}
<td style="border-right: 1px solid gray; border-left: 1px solid gray;">{{row[column_slug]}}</th>
{% endfor %}
</td>
Expand All @@ -63,8 +58,8 @@ <h3 class="panel-title">Narrative</h3>
<div class="panel-body">
<h4>Timeliness</h5>
<p>This is calculated by scoring the assessments made on the <a href="timeliness.html">
frequency</a> and <a href="timeliness_timelag.html">timelag</a> pages on a scale of
0 to 4 (as below), dividing the sum of the twoscores 8 and expressing the result as
frequency</a> and <a href="timeliness_timelag.html">timelag</a> pages on a scale of
0 to 4 (as below), dividing the sum of the twoscores 8 and expressing the result as
a percentage. The methodology used in making the assesments is detailed on the <a href="timeliness.html">frequency</a> and <a href="timeliness_timelag.html">timelag</a> pages.
</p>

Expand Down Expand Up @@ -121,7 +116,7 @@ <h4>Timeliness</h5>
<td>0</td>
</tr>
</table>


<h4>Forward looking</h4>
<p>The average percentage of current activities with budgets for each of the years {{current_year}} - {{current_year + 2}}.
Expand All @@ -140,7 +135,7 @@ <h4>Score</h4>


<h4>Coverage</h4>
<p>The percentage expressed in the <a href="coverage.html">Coverage tab</a> which reflects
<p>The percentage expressed in the <a href="coverage.html">Coverage tab</a> which reflects
the proportion of a publisher's total spend that is reported in IATI format.</p>


Expand All @@ -158,11 +153,11 @@ <h3 class="panel-title">Exceptions</h3>
</div>
<div class="panel-body">
<h5>Secondary reporters</h5>
<p>Publishers who publish all of their activities as a secondary reporter do not appear in this table.
{% if transparencyindicator.secondary_publishers|length > 0 %}
Therefore, a total of {{ transparencyindicator.secondary_publishers|length }} publishers have been excluded in this regard:
<p>Publishers who publish all of their activities as a secondary reporter do not appear in this table.
{% if summary_stats.secondary_publishers|length > 0 %}
Therefore, a total of {{ summary_stats.secondary_publishers|length }} publishers have been excluded in this regard:
<ul>
{% for publisher in transparencyindicator.secondary_publishers %}
{% for publisher in summary_stats.secondary_publishers %}
<li>{{ publisher_name[publisher] }}</li>
{% endfor %}
</ul>
Expand Down
12 changes: 6 additions & 6 deletions static/templates/timeliness.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

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

<div class="panel-heading">
<span class="pull-right"><a href="{{url('timeliness_frequency.csv')}}">(This table as CSV)</a></span>
<h3 class="panel-title">Table of Frequency assessments</h3>
Expand All @@ -19,10 +19,10 @@ <h3 class="panel-title">Table of Frequency assessments</h3>
<p>The table records the number of days in each of the last twelve months on which the most recently recorded transaction date was observed to have changed. (The current month is also displayed for informational purposes, but is not used in the assessment.) </p>

<p><strong>Key:</strong><br/>
<span style="background-color: #f2aaaa">Red flag</span>: Publisher currently publishing future transaction dates.<br/>
<span style="background-color: #f2aaaa">Red flag</span>: Publisher currently publishing future transaction dates.<br/>
<span style="background-color: #fcf8aa">Yellow flag</span>: Publisher not currently publishing future transaction dates, but did report future transactions at some point in the last twelve calendar months (See exceptions).</p>

<p>You are invited to participate in the ongoing consultation on publisher statistics and the transparency indicator which is taking place on the <a href="http://discuss.iatistandard.org/c/consultations">IATI Discussion Forum</a></p>
<p>You are invited to participate in the ongoing consultation on publisher statistics and the summary statistics which is taking place on the <a href="http://discuss.iatistandard.org/c/consultations">IATI Discussion Forum</a></p>
{% include 'tablesorter_instructions.html' %}
</div>

Expand Down Expand Up @@ -97,7 +97,7 @@ <h3 class="panel-title">Narrative</h3>
<div class="panel-body">
<p>The frequency statistics attempt to assess how often any part of a publisher's data is substantively updated.</p>

<p>For the purposes of these statistics an update is assumed to have taken place on any given day when the most recently recorded transaction date across a publisher's entire portfolio is observed to have changed to a more recent date. This approach has been adopted as transactions are the most numerous and most frequently updated elements in the reporting of activities.</p>
<p>For the purposes of these statistics an update is assumed to have taken place on any given day when the most recently recorded transaction date across a publisher's entire portfolio is observed to have changed to a more recent date. This approach has been adopted as transactions are the most numerous and most frequently updated elements in the reporting of activities.</p>

<p>The table of statistics records the number of days in each of the last twelve calendar months (the current month is also displayed for informational purposes, but is not used in the assessment) on which the most recently recorded transaction date was observed to have changed. The dashboard maintains a statistical snapshot of each day, and has been doing so for over a year, which allows for this data to be recalculated on a nightly basis using historical recordings.</p>
</div>
Expand Down Expand Up @@ -215,9 +215,9 @@ <h3 class="panel-title">Exceptions</h3>
</div>
<div class="panel-body">
<p>Future transaction dates disrupt these statistics. For example a publisher might today report a transaction date for each month for the next year and never refresh their data. Over the next year, as each of these future dates move into the past, the statistics would incorrectly give the publisher a frequency assessment of monthly, even though they did not refresh their data.</p>

<p><strong>Future transaction dates may affect the assessments on this page</strong>. Publishers who currently have future transaction dates have a <span style="background-color: #f2aaaa">red flag</span> next to their assessment. A <span style="background-color: #fcf8aa">yellow flag</span> indicates that although a publisher does not currently have future transactions, they did report future transactions at some point over the last twelve calendar months.</p>

<p>In our further work on this dashboard page, we plan to exclude activities in which future transactions dates are reported from these assessments until such time that a publisher's entire portfolio no longer contains any future dates.</s></p>
</div>
</div>
Expand Down
Loading

0 comments on commit 9aa55d4

Please sign in to comment.