Today, Publish What You Fund will launch the 2013 Aid Transparency Index, a measure of international aid data usability and accessibility. The United Nations Development Programme (UNDP) is at the forefront of aid transparency; all of their 5,230 projects are published on the IATI Registry and visualized on open.undp.org. This year, UNDP is the top-ranked multilateral organization in aid transparency.
While the IATI Registry provides helpful standardization, the XML framework can be difficult to use for building web applications. Instead, transforming data into a usable API makes available data actionable data. We worked with UNDP to build a static JSON API and power open.undp.org.
Here are the fundamentals we used while working with the IATI Standard to build an API that delivers the data.
1. JSON over XML
APIs need to be fast to power data browsers like open.undp.org. XML files can be too slow for several reasons, but most notably because:
-
XML tree structure doesn’t match the data model of most programming languages
-
Poor data-to-markup ratio
-
Extra coding required to handle
attributes
vsinner
tags, for example one person may use<dog breed="mutt">Penny</dog>
, and another<dog><breed>mutt</breed><name>Penny</name></dog>
.
JSON is now the standard for building scalable applications on the web. It’s human readable, it’s easy to parse, and it’s driving how data is exchanged over the internet.
2. Static APIs
In addition to using JSON, building a static API gives us another speed win. Static APIs also have fewer break points and easily scale. The static API for open.undp.org quickly feeds data to the site and any other consumers through the site documentation.
To build the API, we used Python and the powerful lxml library to parse the XML tree structure into JSON files. Our python script automatically processes the XML data into a structured API. The relative simplicity of the script allows for easy updates and modifications to to fit other datasets from the IATI registry.
3. Dogfood your own work
Building an API to be consumed by open.undp.org gave us complete flexibility to meet the site’s need to filter project data across multiple years, hundreds of donors, countries, and focus areas. These filters provide the best method for browsing project data for visitors and UNDP staff.
We worked closely with the UNDP team to iteratively improve API use within the site — this is a team that gets agile and open source. Just last month, Mark Cardwell, who led the opening of the data, relaunched the site with improved subnational mapping made possible by expanding the API.
All of this work is publicly available on UNDP’s GitHub repository. This is the right way to be open. More organizations need to use open data standards like IATI and publish their work to public repositories for collaboration. Congrats to UNDP for being the top-ranked multilateral organization in this year’s Aid Transparency Index.
Cover adapted from photo by azrasta, CC BY-NC-SA 2.0.
What we're doing.
Latest