How to (not) build an elections map
Upcoming SlideShare
Loading in...5

How to (not) build an elections map



Code for South Africa built the Mail & Guardian's 2014 General Elections Map ( In this talk by Jason Norwood-Young, first given to the ...

Code for South Africa built the Mail & Guardian's 2014 General Elections Map ( In this talk by Jason Norwood-Young, first given to the Hacks/Hackers group in Cape Town on 30 May 2014, he discusses the trials, tribulations, and more trials of building an elections map.



Total Views
Views on SlideShare
Embed Views



1 Embed 15 15



Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

How to (not) build an elections map How to (not) build an elections map Presentation Transcript

  • How to (not) build an election map Jason Norwood-Young Code4SA
  • Code4SA “Everyone has the right of access to any information held by the state; and any information that is held by another person and that is required for the exercise or protection of any rights.” South African Constitution (Section 32)
  • Elections 2009
  • Then, in 2012…
  • 2014 HTML Data Mobile 2009 Flash Multimedia Web
  • News24 • 1.7 Million Unique Users • 22 Million Page Views • 30,000 app downloads • 102,000 concurrent users • … just on the day after the elections source:
  • Mail & Guardian • Map accounted for 10% of traffic • 5,000 concurrent users on the map • 22,674 unique users • 54,475 sessions • 85,668 pageviews • Avg session duration: 9m29s source: Google Analytics, TechCentral
  • That’s nice, but I thought this was about maps, not statistics
  • Data Information Presentation Knowledge
  • First, the APIs
  • Mix in a bit of inspiration
  • Start visualising
  • Our first look - all the provinces, municipalities, wards
  • Adding some color
  • Pulling back a bit
  • Mario Maps!
  • Fighting with the maps
  • Large parts of the country don’t have wards (2009)
  • EC Ward in KZN? WTF
  • That’s okay EC, have some KZN islands
  • Fighting with the IEC
  • Contacting the IEC (This isn’t a link - it’s an IMAGE)
  • At least we had plenty of time for testing…
  • east we got the API documentation in g Election day: Wednesday 7 May 2014
  • we had known about the FRICKING MYSQL REPLICATION OP
  • Voting Day
  • May 7, 10:16am
  • • 7am - 2pm • Throw out 2009 Wards maps • Throw out seat allocation graphic • Add names to map • Add party flags • 2pm - 3pm • Vote • 3pm - 6pm • Final fixes to map • 6pm - 7pm • Rest, dinner • 7pm - 9pm • Integrate with IEC API • 9pm - 5:54am • PANIC!!!! • 5:54am - 10am • Sleep • 10am onwards • PANIC some more
  • Fun on the day • IEC API reports that a Voting District has changed (pull, not push) • We fetch the changed VD • We fetch the changed Munic (No ward data available) • We fetch the changed Province • Have to do this for Provincial and National • Takes approximately 4 seconds for one result
  • 4 (seconds) * 22,000 (voting districts) * 2 (provincial, national) = 176,000 seconds or 2,933 minutes or 49 hours
  • Meanwhile, IEC is giving us bullshit data which means we’re giving bullshit data
  • At 12pm on 8 May I decided to turn off ward reporting
  • But a few days later (Thanks to Adrian Frith who quickly scraped the data)
  • Wards are back, baby!
  • And now we have Voting Districts!
  • So who did the best maps? • Media24 had the most up-to-date, accurate data • We had the coolest • Adrian Frith had the awesomest (and continues to do the most with the maps) • Everyone else kinda sucked
  • Lessons • Data accuracy should come first, second and third • Don’t trust the data • Check, double-check, triple-check, and then get someone else to check • I’m too old for all-nighters
  • What’re the 2016 Elections going to look like? • Mobile • Waaay more data • A more sophisticated, data-literate reader • They’re maps, Jim, but not as we know it…
  • Tech Stack • Code4SA Elections API • Python (Flask) • • Interface to IEC API • Node.js • Middleware btw Code4SA API and IEC API interface • Python (Flask) • Maps API • Node.js, Topojson, Restify • Front end • D3.js • Bootstrap 3 • CodeKit
  • Embed your own <link rel="stylesheet" href=" <div id="Code4SA" style="height: 100px"></div> <script src="" typ <script>Code4SA.Map.deploy();</script>
  • But was it worth it?
  • Yes, but only because of the APIs
  • – Emma Goldman “If voting changed anything, they’d make it illegal.”