How to (not) build an elections map
-
Upload
jason-norwood-young -
Category
News & Politics
-
view
776 -
download
3
Transcript of How to (not) build an elections map
![Page 1: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/1.jpg)
How to (not) build an election map
Jason Norwood-YoungCode4SA
![Page 2: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/2.jpg)
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
![Page 3: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/3.jpg)
Elections 2009
![Page 4: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/4.jpg)
![Page 5: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/5.jpg)
![Page 6: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/6.jpg)
![Page 7: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/7.jpg)
Then, in 2012…
![Page 8: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/8.jpg)
![Page 9: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/9.jpg)
2014HTML Data Mobile
2009Flash Multimedia Web
![Page 10: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/10.jpg)
![Page 11: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/11.jpg)
![Page 12: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/12.jpg)
![Page 13: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/13.jpg)
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/
![Page 14: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/14.jpg)
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
![Page 15: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/15.jpg)
![Page 16: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/16.jpg)
![Page 17: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/17.jpg)
![Page 18: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/18.jpg)
![Page 19: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/19.jpg)
![Page 20: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/20.jpg)
That’s nice, but I thought this was about maps, not statistics
![Page 21: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/21.jpg)
Data Information
Presentation Knowledge
![Page 22: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/22.jpg)
First, the APIs
![Page 23: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/23.jpg)
![Page 24: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/24.jpg)
![Page 25: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/25.jpg)
Mix in a bit of inspiration
http://afrith.github.io/election-web
![Page 26: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/26.jpg)
Start visualising
![Page 27: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/27.jpg)
Our first look - all the provinces, municipalities, wards
![Page 28: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/28.jpg)
Adding some color
![Page 29: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/29.jpg)
Pulling back a bit
![Page 30: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/30.jpg)
Mario Maps!
![Page 31: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/31.jpg)
Fighting with the maps
![Page 32: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/32.jpg)
Large parts of the country don’t have wards (2009)
![Page 33: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/33.jpg)
EC Ward in KZN? WTF
![Page 34: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/34.jpg)
That’s okay EC, have some KZN islands
![Page 35: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/35.jpg)
Fighting with the IEC
![Page 36: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/36.jpg)
Contacting the IEC
(This isn’t a link - it’s an IMAGE)
![Page 37: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/37.jpg)
At least we had plenty of time for testing…
![Page 38: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/38.jpg)
Well, at least we got the API documentation in good time
Election day: Wednesday 7 May 2014
![Page 39: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/39.jpg)
If only we had known about the FRICKING MYSQL REPLICATION OPTION!
![Page 40: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/40.jpg)
Voting Day
![Page 41: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/41.jpg)
May 7, 10:16am
![Page 42: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/42.jpg)
• 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
![Page 43: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/43.jpg)
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
![Page 44: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/44.jpg)
4 (seconds) * 22,000 (voting districts) * 2 (provincial, national) =176,000 seconds
or2,933 minutes
or49 hours
![Page 45: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/45.jpg)
Meanwhile, IEC is giving us bullshit data
which means we’re giving bullshit data
![Page 46: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/46.jpg)
At 12pm on 8 MayI decided to turn off ward reporting
![Page 47: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/47.jpg)
![Page 48: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/48.jpg)
But a few days later(Thanks to Adrian Frith who quickly scraped the data)
![Page 49: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/49.jpg)
Wards are back, baby!
![Page 50: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/50.jpg)
And now we have Voting Districts!
![Page 51: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/51.jpg)
![Page 52: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/52.jpg)
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
![Page 53: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/53.jpg)
http://adrianfrith.com/
![Page 54: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/54.jpg)
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
![Page 55: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/55.jpg)
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…
![Page 56: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/56.jpg)
![Page 57: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/57.jpg)
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
![Page 58: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/58.jpg)
Embed your own
<link rel="stylesheet" href="http://election-map.code4sa.org/resources/css/style.css"><div id="Code4SA" style="height: 100px"></div><script src="http://election-map.code4sa.org/code4sa-ck.js" type="text/javascript"></script><script>Code4SA.Map.deploy();</script>
![Page 59: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/59.jpg)
But was it worth it?
![Page 60: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/60.jpg)
Yes, but only because of the APIs
http://maps.code4sa.org/
http://election-api.code4sa.org/
![Page 61: How to (not) build an elections map](https://reader035.fdocuments.net/reader035/viewer/2022062523/53eef1908d7f72757f8b750a/html5/thumbnails/61.jpg)
– Emma Goldman
“If voting changed anything, they’d make it illegal.”