SlideShare une entreprise Scribd logo
1  sur  61
How to (not) build an
election map
Jason Norwood-Young
Code4SA
jason@code4sa.org
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
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: http://www.bandwidthblog.com/
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
http://afrith.github.io/election-web
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
http://adrianfrith.com/
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)
• 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
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>
But was it worth it?
Yes, but only because
of the APIs
http://maps.code4sa.org/
http://election-api.code4sa.org/
– Emma Goldman
“If voting changed anything, they’d make it
illegal.”

Contenu connexe

Similaire à How to (not) build an elections map

American Planning Association 2001 New Orleans - Online GIS for economic deve...
American Planning Association 2001 New Orleans - Online GIS for economic deve...American Planning Association 2001 New Orleans - Online GIS for economic deve...
American Planning Association 2001 New Orleans - Online GIS for economic deve...
GIS Planning
 
Information Technology Services 201608 v1.5
Information Technology Services 201608 v1.5Information Technology Services 201608 v1.5
Information Technology Services 201608 v1.5
John Halbert
 

Similaire à How to (not) build an elections map (20)

Big Data
Big DataBig Data
Big Data
 
Data data everywhere
Data data everywhereData data everywhere
Data data everywhere
 
Friending The Statehouse
Friending The StatehouseFriending The Statehouse
Friending The Statehouse
 
ODC BarCamp 2013 - Introduction to Data Journalism
ODC BarCamp 2013 - Introduction to Data JournalismODC BarCamp 2013 - Introduction to Data Journalism
ODC BarCamp 2013 - Introduction to Data Journalism
 
What can be done with Open Data?
What can be done with Open Data?What can be done with Open Data?
What can be done with Open Data?
 
Big Data and You
Big Data and YouBig Data and You
Big Data and You
 
American Planning Association 2001 New Orleans - Online GIS for economic deve...
American Planning Association 2001 New Orleans - Online GIS for economic deve...American Planning Association 2001 New Orleans - Online GIS for economic deve...
American Planning Association 2001 New Orleans - Online GIS for economic deve...
 
IDEAS-Nomination-OH
IDEAS-Nomination-OHIDEAS-Nomination-OH
IDEAS-Nomination-OH
 
Open Data: opportunities and challenges for business and government
Open Data: opportunities and challenges for business and governmentOpen Data: opportunities and challenges for business and government
Open Data: opportunities and challenges for business and government
 
open data: opportunities and challenges for business and government
open data: opportunities and challenges for business and governmentopen data: opportunities and challenges for business and government
open data: opportunities and challenges for business and government
 
OAEO District 8 Meeting
OAEO District 8 MeetingOAEO District 8 Meeting
OAEO District 8 Meeting
 
Real Estatate
Real EstatateReal Estatate
Real Estatate
 
Advanced Research Investigations for SIU Investigators
Advanced Research Investigations for SIU InvestigatorsAdvanced Research Investigations for SIU Investigators
Advanced Research Investigations for SIU Investigators
 
How you could hack the Dutch elections for the last 26 years
How you could hack the Dutch elections for the last 26 yearsHow you could hack the Dutch elections for the last 26 years
How you could hack the Dutch elections for the last 26 years
 
Electronic Voting System
Electronic Voting SystemElectronic Voting System
Electronic Voting System
 
Data data everywhere and not a byte to eat...
Data data everywhere and not a byte to eat...Data data everywhere and not a byte to eat...
Data data everywhere and not a byte to eat...
 
Information Technology Services 201608 v1.5
Information Technology Services 201608 v1.5Information Technology Services 201608 v1.5
Information Technology Services 201608 v1.5
 
Women Social Entrepreneurs in Civic Tech: How Voices of Women Help Us Advance...
Women Social Entrepreneurs in Civic Tech: How Voices of Women Help Us Advance...Women Social Entrepreneurs in Civic Tech: How Voices of Women Help Us Advance...
Women Social Entrepreneurs in Civic Tech: How Voices of Women Help Us Advance...
 
Big Data, Open Data, Big Costs - tim willoughby
Big Data, Open Data, Big Costs  - tim willoughbyBig Data, Open Data, Big Costs  - tim willoughby
Big Data, Open Data, Big Costs - tim willoughby
 
Aligarh Democracy and AI.pptx
Aligarh Democracy and AI.pptxAligarh Democracy and AI.pptx
Aligarh Democracy and AI.pptx
 

Dernier

THE OBSTACLES THAT IMPEDE THE DEVELOPMENT OF BRAZIL IN THE CONTEMPORARY ERA A...
THE OBSTACLES THAT IMPEDE THE DEVELOPMENT OF BRAZIL IN THE CONTEMPORARY ERA A...THE OBSTACLES THAT IMPEDE THE DEVELOPMENT OF BRAZIL IN THE CONTEMPORARY ERA A...
THE OBSTACLES THAT IMPEDE THE DEVELOPMENT OF BRAZIL IN THE CONTEMPORARY ERA A...
Faga1939
 
{Qatar{^🚀^(+971558539980**}})Abortion Pills for Sale in Dubai. .abu dhabi, sh...
{Qatar{^🚀^(+971558539980**}})Abortion Pills for Sale in Dubai. .abu dhabi, sh...{Qatar{^🚀^(+971558539980**}})Abortion Pills for Sale in Dubai. .abu dhabi, sh...
{Qatar{^🚀^(+971558539980**}})Abortion Pills for Sale in Dubai. .abu dhabi, sh...
hyt3577
 
9953056974 Call Girls In Pratap Nagar, Escorts (Delhi) NCR
9953056974 Call Girls In Pratap Nagar, Escorts (Delhi) NCR9953056974 Call Girls In Pratap Nagar, Escorts (Delhi) NCR
9953056974 Call Girls In Pratap Nagar, Escorts (Delhi) NCR
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
The political system of the united kingdom
The political system of the united kingdomThe political system of the united kingdom
The political system of the united kingdom
lunadelior
 

Dernier (20)

declarationleaders_sd_re_greens_theleft_5.pdf
declarationleaders_sd_re_greens_theleft_5.pdfdeclarationleaders_sd_re_greens_theleft_5.pdf
declarationleaders_sd_re_greens_theleft_5.pdf
 
04052024_First India Newspaper Jaipur.pdf
04052024_First India Newspaper Jaipur.pdf04052024_First India Newspaper Jaipur.pdf
04052024_First India Newspaper Jaipur.pdf
 
Group_5_US-China Trade War to understand the trade
Group_5_US-China Trade War to understand the tradeGroup_5_US-China Trade War to understand the trade
Group_5_US-China Trade War to understand the trade
 
05052024_First India Newspaper Jaipur.pdf
05052024_First India Newspaper Jaipur.pdf05052024_First India Newspaper Jaipur.pdf
05052024_First India Newspaper Jaipur.pdf
 
THE OBSTACLES THAT IMPEDE THE DEVELOPMENT OF BRAZIL IN THE CONTEMPORARY ERA A...
THE OBSTACLES THAT IMPEDE THE DEVELOPMENT OF BRAZIL IN THE CONTEMPORARY ERA A...THE OBSTACLES THAT IMPEDE THE DEVELOPMENT OF BRAZIL IN THE CONTEMPORARY ERA A...
THE OBSTACLES THAT IMPEDE THE DEVELOPMENT OF BRAZIL IN THE CONTEMPORARY ERA A...
 
America Is the Target; Israel Is the Front Line _ Andy Blumenthal _ The Blogs...
America Is the Target; Israel Is the Front Line _ Andy Blumenthal _ The Blogs...America Is the Target; Israel Is the Front Line _ Andy Blumenthal _ The Blogs...
America Is the Target; Israel Is the Front Line _ Andy Blumenthal _ The Blogs...
 
Embed-2 (1).pdfb[k[k[[k[kkkpkdpokkdpkopko
Embed-2 (1).pdfb[k[k[[k[kkkpkdpokkdpkopkoEmbed-2 (1).pdfb[k[k[[k[kkkpkdpokkdpkopko
Embed-2 (1).pdfb[k[k[[k[kkkpkdpokkdpkopko
 
*Navigating Electoral Terrain: TDP's Performance under N Chandrababu Naidu's ...
*Navigating Electoral Terrain: TDP's Performance under N Chandrababu Naidu's ...*Navigating Electoral Terrain: TDP's Performance under N Chandrababu Naidu's ...
*Navigating Electoral Terrain: TDP's Performance under N Chandrababu Naidu's ...
 
Politician uddhav thackeray biography- Full Details
Politician uddhav thackeray biography- Full DetailsPolitician uddhav thackeray biography- Full Details
Politician uddhav thackeray biography- Full Details
 
{Qatar{^🚀^(+971558539980**}})Abortion Pills for Sale in Dubai. .abu dhabi, sh...
{Qatar{^🚀^(+971558539980**}})Abortion Pills for Sale in Dubai. .abu dhabi, sh...{Qatar{^🚀^(+971558539980**}})Abortion Pills for Sale in Dubai. .abu dhabi, sh...
{Qatar{^🚀^(+971558539980**}})Abortion Pills for Sale in Dubai. .abu dhabi, sh...
 
China's soft power in 21st century .pptx
China's soft power in 21st century   .pptxChina's soft power in 21st century   .pptx
China's soft power in 21st century .pptx
 
Embed-4.pdf lkdiinlajeklhndklheduhuekjdh
Embed-4.pdf lkdiinlajeklhndklheduhuekjdhEmbed-4.pdf lkdiinlajeklhndklheduhuekjdh
Embed-4.pdf lkdiinlajeklhndklheduhuekjdh
 
Gujarat-SEBCs.pdf pfpkoopapriorjfperjreie
Gujarat-SEBCs.pdf pfpkoopapriorjfperjreieGujarat-SEBCs.pdf pfpkoopapriorjfperjreie
Gujarat-SEBCs.pdf pfpkoopapriorjfperjreie
 
Transformative Leadership: N Chandrababu Naidu and TDP's Vision for Innovatio...
Transformative Leadership: N Chandrababu Naidu and TDP's Vision for Innovatio...Transformative Leadership: N Chandrababu Naidu and TDP's Vision for Innovatio...
Transformative Leadership: N Chandrababu Naidu and TDP's Vision for Innovatio...
 
KING VISHNU BHAGWANON KA BHAGWAN PARAMATMONKA PARATOMIC PARAMANU KASARVAMANVA...
KING VISHNU BHAGWANON KA BHAGWAN PARAMATMONKA PARATOMIC PARAMANU KASARVAMANVA...KING VISHNU BHAGWANON KA BHAGWAN PARAMATMONKA PARATOMIC PARAMANU KASARVAMANVA...
KING VISHNU BHAGWANON KA BHAGWAN PARAMATMONKA PARATOMIC PARAMANU KASARVAMANVA...
 
422524114-Patriarchy-Kamla-Bhasin gg.pdf
422524114-Patriarchy-Kamla-Bhasin gg.pdf422524114-Patriarchy-Kamla-Bhasin gg.pdf
422524114-Patriarchy-Kamla-Bhasin gg.pdf
 
06052024_First India Newspaper Jaipur.pdf
06052024_First India Newspaper Jaipur.pdf06052024_First India Newspaper Jaipur.pdf
06052024_First India Newspaper Jaipur.pdf
 
9953056974 Call Girls In Pratap Nagar, Escorts (Delhi) NCR
9953056974 Call Girls In Pratap Nagar, Escorts (Delhi) NCR9953056974 Call Girls In Pratap Nagar, Escorts (Delhi) NCR
9953056974 Call Girls In Pratap Nagar, Escorts (Delhi) NCR
 
Job-Oriеntеd Courses That Will Boost Your Career in 2024
Job-Oriеntеd Courses That Will Boost Your Career in 2024Job-Oriеntеd Courses That Will Boost Your Career in 2024
Job-Oriеntеd Courses That Will Boost Your Career in 2024
 
The political system of the united kingdom
The political system of the united kingdomThe political system of the united kingdom
The political system of the united kingdom
 

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
  • 4.
  • 5.
  • 6.
  • 8.
  • 10.
  • 11.
  • 12.
  • 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
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20. That’s nice, but I thought this was about maps, not statistics
  • 23.
  • 24.
  • 25. Mix in a bit of inspiration http://afrith.github.io/election-web
  • 27. Our first look - all the provinces, municipalities, wards
  • 32. Large parts of the country don’t have wards (2009)
  • 33. EC Ward in KZN? WTF
  • 34. That’s okay EC, have some KZN islands
  • 36. Contacting the IEC (This isn’t a link - it’s an IMAGE)
  • 37. At least we had plenty of time for testing…
  • 38. east we got the API documentation in g Election day: Wednesday 7 May 2014
  • 39. we had known about the FRICKING MYSQL REPLICATION OP
  • 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)
  • 50. And now we have Voting Districts!
  • 51.
  • 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>
  • 59. But was it worth it?
  • 60. Yes, but only because of the APIs http://maps.code4sa.org/ http://election-api.code4sa.org/
  • 61. – Emma Goldman “If voting changed anything, they’d make it illegal.”