how to (not) build an elections map

61
How to (not) build an election map Jason Norwood-Young Code4SA [email protected]

Upload: jason-norwood-young

Post on 16-Apr-2017

776 views

Category:

News & Politics


3 download

TRANSCRIPT

Page 1: How to (not) build an elections map

How to (not) build an election map

Jason Norwood-YoungCode4SA

[email protected]

Page 2: How to (not) build an elections map

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

Elections 2009

Page 4: How to (not) build an elections map
Page 5: How to (not) build an elections map
Page 6: How to (not) build an elections map
Page 7: How to (not) build an elections map

Then, in 2012…

Page 8: How to (not) build an elections map
Page 9: How to (not) build an elections map

2014HTML Data Mobile

2009Flash Multimedia Web

Page 10: How to (not) build an elections map
Page 11: How to (not) build an elections map
Page 12: How to (not) build an elections map
Page 13: How to (not) build an elections map

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

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
Page 16: How to (not) build an elections map
Page 17: How to (not) build an elections map
Page 18: How to (not) build an elections map
Page 19: How to (not) build an elections map
Page 20: How to (not) build an elections map

That’s nice, but I thought this was about maps, not statistics

Page 21: How to (not) build an elections map

Data Information

Presentation Knowledge

Page 22: How to (not) build an elections map

First, the APIs

Page 23: How to (not) build an elections map
Page 24: How to (not) build an elections map
Page 25: How to (not) build an elections map

Mix in a bit of inspiration

http://afrith.github.io/election-web

Page 26: How to (not) build an elections map

Start visualising

Page 27: How to (not) build an elections map

Our first look - all the provinces, municipalities, wards

Page 28: How to (not) build an elections map

Adding some color

Page 29: How to (not) build an elections map

Pulling back a bit

Page 30: How to (not) build an elections map

Mario Maps!

Page 31: How to (not) build an elections map

Fighting with the maps

Page 32: How to (not) build an elections map

Large parts of the country don’t have wards (2009)

Page 33: How to (not) build an elections map

EC Ward in KZN? WTF

Page 34: How to (not) build an elections map

That’s okay EC, have some KZN islands

Page 35: How to (not) build an elections map

Fighting with the IEC

Page 36: How to (not) build an elections map

Contacting the IEC

(This isn’t a link - it’s an IMAGE)

Page 37: How to (not) build an elections map

At least we had plenty of time for testing…

Page 38: How to (not) build an elections map

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

If only we had known about the FRICKING MYSQL REPLICATION OPTION!

Page 40: How to (not) build an elections map

Voting Day

Page 41: How to (not) build an elections map

May 7, 10:16am

Page 42: How to (not) build an elections map

• 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

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

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

Meanwhile, IEC is giving us bullshit data

which means we’re giving bullshit data

Page 46: How to (not) build an elections map

At 12pm on 8 MayI decided to turn off ward reporting

Page 47: How to (not) build an elections map
Page 48: How to (not) build an elections map

But a few days later(Thanks to Adrian Frith who quickly scraped the data)

Page 49: How to (not) build an elections map

Wards are back, baby!

Page 50: How to (not) build an elections map

And now we have Voting Districts!

Page 51: How to (not) build an elections map
Page 52: How to (not) build an elections map

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

http://adrianfrith.com/

Page 54: How to (not) build an elections map

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

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
Page 57: How to (not) build an elections map

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

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

But was it worth it?

Page 60: How to (not) build an elections map

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

– Emma Goldman

“If voting changed anything, they’d make it illegal.”