Code for South Africa built the Mail & Guardian's 2014 General Elections Map (http://mg.co.za/data/2014-05-07-live-elections-2014-results). 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.
Verified Love Spells in Little Rock, AR (310) 882-6330 Get My Ex-Lover Back
Â
How to (not) build an elections map
1. How to (not) build an
election map
Jason Norwood-Young
Code4SA
jason@code4sa.org
2. 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)
http://code4sa.org
13. 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: http://www.bandwidthblog.com/
14. 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
42. • 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
43. 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
44. 4 (seconds) * 22,000 (voting districts) * 2 (provincial, national) =
176,000 seconds
or
2,933 minutes
or
49 hours
45. Meanwhile, IEC is giving us bullshit data
which means we’re giving bullshit data
46. At 12pm on 8 May
I decided to turn off ward reporting
47.
48. But a few days later
(Thanks to Adrian Frith who quickly scraped the data)
52. 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
54. 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
55. 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…
56.
57. Tech Stack
• Code4SA Elections API
• Python (Flask)
• http://election-api.code4sa.org/
• 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
58. Embed your own
<link rel="stylesheet" href="http://election-map.code4sa.org/res
<div id="Code4SA" style="height: 100px"></div>
<script src="http://election-map.code4sa.org/code4sa-ck.js" typ
<script>Code4SA.Map.deploy();</script>