openelections / openelections-core

Core repo for election results data acquisition, transformation and output.
MIT License
176 stars 95 forks source link

Arkansas datasource #124

Closed ghing closed 10 years ago

ghing commented 10 years ago

The landing page on the SoS site where you can access all election data is http://www.sos.arkansas.gov/electionresults/index.php?ac:show:choose_elec=1

pre-2004 elections

Pre-2004 elections come in a variety of formats including pipe-delimited, XLS and PDF.

For some pre-2004 elections or special elections, results are in a zip file. These zip files often contain pipe-delimited text files.

2004-2011

For many post-2004 elections, raw data is available through a web query interface (such as http://www.sos.arkansas.gov/electionresults/index.php?ac:show:reports=1&elecid=44). It looks like you have to POST to the endpoint in order to get results back. The returned files have an .xls extension but are actually tab-delimited files.

It looks like you can also send a GET request and get valid results with a URL like this:

http://www.sos.arkansas.gov/electionresults/index.php?counties%5B%5D=1&counties%5B%5D=2&counties%5B%5D=3&counties%5B%5D=4&counties%5B%5D=5&counties%5B%5D=6&counties%5B%5D=7&counties%5B%5D=8&counties%5B%5D=9&counties%5B%5D=10&counties%5B%5D=11&counties%5B%5D=12&counties%5B%5D=13&counties%5B%5D=14&counties%5B%5D=15&counties%5B%5D=16&counties%5B%5D=17&counties%5B%5D=18&counties%5B%5D=19&counties%5B%5D=20&counties%5B%5D=21&counties%5B%5D=22&counties%5B%5D=23&counties%5B%5D=24&counties%5B%5D=25&counties%5B%5D=26&counties%5B%5D=27&counties%5B%5D=28&counties%5B%5D=29&counties%5B%5D=30&counties%5B%5D=31&counties%5B%5D=32&counties%5B%5D=33&counties%5B%5D=34&counties%5B%5D=35&counties%5B%5D=36&counties%5B%5D=37&counties%5B%5D=38&counties%5B%5D=39&counties%5B%5D=40&counties%5B%5D=41&counties%5B%5D=42&counties%5B%5D=43&counties%5B%5D=44&counties%5B%5D=45&counties%5B%5D=46&counties%5B%5D=47&counties%5B%5D=48&counties%5B%5D=49&counties%5B%5D=50&counties%5B%5D=51&counties%5B%5D=52&counties%5B%5D=53&counties%5B%5D=54&counties%5B%5D=55&counties%5B%5D=56&counties%5B%5D=57&counties%5B%5D=58&counties%5B%5D=59&counties%5B%5D=60&counties%5B%5D=61&counties%5B%5D=62&counties%5B%5D=63&counties%5B%5D=64&counties%5B%5D=65&counties%5B%5D=66&counties%5B%5D=67&counties%5B%5D=68&counties%5B%5D=69&counties%5B%5D=70&counties%5B%5D=71&counties%5B%5D=72&counties%5B%5D=73&counties%5B%5D=74&counties%5B%5D=75&contests%5B%5D=7&contests%5B%5D=8&contests%5B%5D=9&contests%5B%5D=10&contests%5B%5D=6&contests%5B%5D=5&contests%5B%5D=62&contests%5B%5D=61&contests%5B%5D=35&contests%5B%5D=34&contests%5B%5D=16&contests%5B%5D=4&contests%5B%5D=3&contests%5B%5D=17&contests%5B%5D=44&contests%5B%5D=45&contests%5B%5D=13&contests%5B%5D=78&contests%5B%5D=79&contests%5B%5D=74&contests%5B%5D=90&contests%5B%5D=91&contests%5B%5D=135&contests%5B%5D=11&contests%5B%5D=12&contests%5B%5D=108&contests%5B%5D=109&contests%5B%5D=163&contests%5B%5D=164&contests%5B%5D=40&contests%5B%5D=41&contests%5B%5D=23&contests%5B%5D=38&contests%5B%5D=73&contests%5B%5D=116&contests%5B%5D=178&contests%5B%5D=177&contests%5B%5D=32&contests%5B%5D=33&contests%5B%5D=52&contests%5B%5D=77&contests%5B%5D=103&contests%5B%5D=55&contests%5B%5D=15&contests%5B%5D=42&contests%5B%5D=43&contests%5B%5D=48&contests%5B%5D=89&contests%5B%5D=152&contests%5B%5D=153&contests%5B%5D=154&contests%5B%5D=155&contests%5B%5D=123&contests%5B%5D=122&contests%5B%5D=115&contests%5B%5D=102&contests%5B%5D=56&contests%5B%5D=57&contests%5B%5D=171&contests%5B%5D=127&contests%5B%5D=39&contests%5B%5D=14&contests%5B%5D=53&contests%5B%5D=82&contests%5B%5D=83&contests%5B%5D=1&contests%5B%5D=130&contests%5B%5D=2&contests%5B%5D=117&contests%5B%5D=110&contests%5B%5D=111&contests%5B%5D=54&contests%5B%5D=81&contests%5B%5D=46&contests%5B%5D=104&contests%5B%5D=126&contests%5B%5D=47&contests%5B%5D=94&contests%5B%5D=95&contests%5B%5D=96&contests%5B%5D=137&contests%5B%5D=136&contests%5B%5D=159&contests%5B%5D=158&contests%5B%5D=161&contests%5B%5D=160&contests%5B%5D=98&contests%5B%5D=97&contests%5B%5D=138&contests%5B%5D=139&contests%5B%5D=140&contests%5B%5D=141&contests%5B%5D=142&contests%5B%5D=143&contests%5B%5D=144&contests%5B%5D=145&contests%5B%5D=146&contests%5B%5D=147&contests%5B%5D=148&contests%5B%5D=149&contests%5B%5D=84&contests%5B%5D=150&contests%5B%5D=151&contests%5B%5D=85&contests%5B%5D=86&contests%5B%5D=87&contests%5B%5D=88&contests%5B%5D=58&contests%5B%5D=118&contests%5B%5D=119&contests%5B%5D=179&contests%5B%5D=180&contests%5B%5D=113&contests%5B%5D=114&contests%5B%5D=181&contests%5B%5D=182&contests%5B%5D=76&contests%5B%5D=75&contests%5B%5D=124&contests%5B%5D=131&contests%5B%5D=80&contests%5B%5D=107&contests%5B%5D=50&contests%5B%5D=51&contests%5B%5D=59&contests%5B%5D=60&contests%5B%5D=132&contests%5B%5D=162&contests%5B%5D=166&contests%5B%5D=165&contests%5B%5D=167&contests%5B%5D=168&contests%5B%5D=169&contests%5B%5D=170&contests%5B%5D=68&contests%5B%5D=92&contests%5B%5D=133&contests%5B%5D=112&contests%5B%5D=134&contests%5B%5D=105&contests%5B%5D=106&contests%5B%5D=99&contests%5B%5D=100&contests%5B%5D=63&contests%5B%5D=64&contests%5B%5D=65&contests%5B%5D=67&contests%5B%5D=66&contests%5B%5D=125&contests%5B%5D=101&contests%5B%5D=49&contests%5B%5D=156&contests%5B%5D=157&contests%5B%5D=18&contests%5B%5D=19&contests%5B%5D=20&contests%5B%5D=70&contests%5B%5D=69&contests%5B%5D=93&contests%5B%5D=36&contests%5B%5D=21&contests%5B%5D=22&contests%5B%5D=72&contests%5B%5D=71&contests%5B%5D=172&contests%5B%5D=174&contests%5B%5D=173&contests%5B%5D=120&contests%5B%5D=121&contests%5B%5D=37&contests%5B%5D=175&contests%5B%5D=176&contests%5B%5D=24&contests%5B%5D=25&contests%5B%5D=26&contests%5B%5D=27&contests%5B%5D=28&contests%5B%5D=29&contests%5B%5D=30&contests%5B%5D=31&votes=counts&show_unopp=1&group=county&DOWNLOAD=1&elecid=44&ac%3Ashow%3Areports%3Aextra%3Amakereport%3A1=Create+Report

It looks like the form inputs use surrogate keys for offices, so we'll probably have to write a custom fetcher that scrapes the page for the form values.

2012-

Results for elections including and after 2012 are from a Clarity Elections system. County level results are available at URLs like http://results.enr.clarityelections.com/AR/42843/113233/en/reports.html. The direct links to the zipped precinct-level data files available at http://results.enr.clarityelections.com/AR/42843/113233/reports/detailxls.zip, http://results.enr.clarityelections.com/AR/42843/113233/reports/detailtxt.zip, http://results.enr.clarityelections.com/AR/42843/113233/reports/detailxml.zip

Links to precinct by county results can be found at URLs like http://results.enr.clarityelections.com/AR/42843/113233/en/select-county.html. A single county has links to results at URLs like: http://results.enr.clarityelections.com/AR/Arkansas/42845/112821/en/reports.html, with corresponding detail URLs, but there's no way to determine these URLs. Perhaps scrape them and save in a mappings file?

To do

ghing commented 10 years ago

Added 2013 and 2014 (so far) election metadata to the dashboard.