Skip to content

Instantly share code, notes, and snippets.

@Bjwebb
Bjwebb / -
Last active December 30, 2015 08:48
Activities missing from the datastore. Each line shows: difference in number of activities, package name, activities counted by me, activities in the datastore
73779 (total)
5073 sida-998 5566 493
2951 unitedstates-tz 3743 792
2808 unitedstates-usa_regional_crs_2010 3986 1178
2771 unitedstates-ml 3806 1035
2701 eu-998 5184 2483
2596 danida-all 2596 0
2520 minbuza_nl-activities 3921 1401
2230 fco-officialdevelopmentassistanceprogrammespend2012 2736 506
2150 unitedstates-gt 2285 135
<?xml version="1.0" encoding="utf-8"?>
<iati-organisations version="1.02" generated-datetime="2013-06-07T16:24:34.347">
<iati-organisation last-updated-datetime="2012-06-07T16:24:34.347" default-currency="USD" xml:lang="en">
<reporting-org ref="41114" type="40">United Nations Development Programme</reporting-org>
<iati-identifier>41114</iati-identifier>
<name>United Nations Development Programme</name>
<!--Please note, the below forward looking budgets are indicative figures only, and do not fully reflect ongoing resource mobilization efforts.-->
<total-budget>
1991 data/unitedstates/unitedstates-sd_pre_2011_election
1872 data/unitedstates/unitedstates-ne
1845 data/unitedstates/unitedstates-ng
1718 data/unitedstates/unitedstates-af
1630 data/unitedstates/unitedstates-sd
1376 data/unitedstates/unitedstates-pk
1337 data/unitedstates/unitedstates-ml
1329 data/asdb/asdb-activities
1062 data/unitedstates/unitedstates-et
967 data/unitedstates/unitedstates-ug
<b a1="GB-1-201242" a2="GB-COH-03788027-CSCF" a3="GB-COH-03788027-CSCF-542" a4="GB-CHC-208724-CSCF542"/>
<b a1="GB-1-201242" a2="GB-COH-03788027-CSCF" a3="GB-COH-03788027-CSCF-543" a4="GB-CHC-208724-CSCF543"/>
<b a1="GB-1-201242" a2="GB-COH-03788027-CSCF" a3="GB-COH-03788027-CSCF-540" a4="GB-CHC-1079599-BN-2011-UG-DFID-36A"/>
<b a1="GB-1-201242" a2="GB-COH-03788027-CSCF" a3="GB-COH-03788027-CSCF-541" a4="GB-CHC-1079599-BN-2011-GH-DFID-541"/>
<b a1="GB-1-201242" a2="GB-COH-03788027-CSCF" a3="GB-COH-03788027-CSCF-546" a4="GB-CHC-281681-CSCF546"/>
<b a1="GB-1-201242" a2="GB-COH-03788027-CSCF" a3="GB-COH-03788027-CSCF-544" a4="GB-CHC-1001698-UGA001"/>
<b a1="GB-1-201242" a2="GB-COH-03788027-CSCF" a3="GB-COH-03788027-CSCF-545" a4="GB-CHC-1837621-545"/>
<b a1="GB-1-201242" a2="GB-COH-03788027-CSCF" a3="GB-COH-03788027-CSCF-525" a4="GB-CHC-250456-CSCF525"/>
<b a1="GB-1-201242" a2="GB-COH-03788027-CSCF" a3="GB-COH-03788027-CSCF-526" a4="GB-CHC-250456-CSCF526"/>
<b a1="GB-1-201242" a2="GB-COH-03788027-CSCF" a3="GB-COH
GB-1-201242 GB-COH-03788027-CSCF GB-COH-03788027-CSCF-542 GB-CHC-208724-CSCF542
GB-1-201242 GB-COH-03788027-CSCF GB-COH-03788027-CSCF-543 GB-CHC-208724-CSCF543
GB-1-201242 GB-COH-03788027-CSCF GB-COH-03788027-CSCF-540 GB-CHC-1079599-BN-2011-UG-DFID-36A
GB-1-201242 GB-COH-03788027-CSCF GB-COH-03788027-CSCF-541 GB-CHC-1079599-BN-2011-GH-DFID-541
GB-1-201242 GB-COH-03788027-CSCF GB-COH-03788027-CSCF-546 GB-CHC-281681-CSCF546
GB-1-201242 GB-COH-03788027-CSCF GB-COH-03788027-CSCF-544 GB-CHC-1001698-UGA001
GB-1-201242 GB-COH-03788027-CSCF GB-COH-03788027-CSCF-545 GB-CHC-1837621-545
GB-1-201242 GB-COH-03788027-CSCF GB-COH-03788027-CSCF-525 GB-CHC-250456-CSCF525
GB-1-201242 GB-COH-03788027-CSCF GB-COH-03788027-CSCF-526 GB-CHC-250456-CSCF526
GB-1-201242 GB-COH-03788027-CSCF GB-COH-03788027-CSCF-554 GB-COH-4075590-CSCF554
@Bjwebb
Bjwebb / mapping.json
Last active January 21, 2016 14:07
2.02 CSV2IATI mapping template
{
"organisation": {
"reporting-org": {
"text": "",
"ref": "",
"type": ""
},
"default-currency": "",
"lang": "",
"contact-info": {
@Bjwebb
Bjwebb / notes.md
Last active September 18, 2016 15:08
PYCon UK 2016 lighning talk on OCDS

$9,500,000,000,000

I'm going to start with a large number, 9.5 trillion dollars, which as a pile of dollar notes would stretch to the moon and back.

This is the total global spending through govermentment contracting, which is 15% of global GDP.

If you want an accountable govement, it's important to have public data about all this government contracting. Sadly this is often lacking at the moment -

import csv
import json
releases = []
csv.field_size_limit(500 * 1024 * 1024)
with open('uk_contracts_finder2_ocds.csv') as fp:
reader = csv.DictReader(fp)
for row in reader:
import json_merge_patch
import flattentool
import traceback
import requests
import json
import copy
import os
release_schema = requests.get('http://standard.open-contracting.org/schema/1__1__0/release-schema.json').json()
@last-updated-datetime @xml:lang @default-currency @humanitarian @hierarchy @linked-data-uri iati-identifier reporting-org/@ref reporting-org/@type reporting-org/@secondary-reporter reporting-org/narrative/0 reporting-org/narrative/0/@xml:lang title/narrative/0 title/narrative/0/@xml:lang description/0/@type description/0/narrative/0 description/0/narrative/0/@xml:lang participating-org/0/@ref participating-org/0/@type participating-org/0/@role participating-org/0/@activity-id participating-org/0/narrative/0 participating-org/0/narrative/0/@xml:lang other-identifier/0/@ref other-identifier/0/@type other-identifier/0/owner-org/@ref other-identifier/0/owner-org/narrative/0 other-identifier/0/owner-org/narrative/0/@xml:lang activity-status/@code activity-date/0/@type activity-date/0/@iso-date activity-date/0/narrative/0 activity-date/0/narrative/0/@xml:lang contact-info/0/@type contact-info/0/organisation/narrative/0 contact-info/0/organisation/narrative/0/@xml:lang contact-info/0/department/narrative/0 contact-