Pre-processed election results for Wisconsin elections
The election results files are located in folders by year. The file names are standardized as described here: http://docs.openelections.net/archive-standardization/
office_table.xlsx
is a table showing the presence or absence of data for each office in each election.
Some data may be missing. This and other known problems are documented at https://github.com/openelections/openelections-data-wi/issues
Warning: Some elections were recounted. Some of the data here are pre-recount results. This occurs in cases when the recounted results are available only in a different form. See Issue 34 for details.
We have included the following offices in our results:
- President
- Senate
- House
- Governor
- Lieutenant Governor
- Attorney General
- State Treasurer
- Secretary Of State
- State Superintendent Of Public Instruction
- State Senate
- State Assembly
- Supreme Court
- Court Of Appeals
- Circuit Court
- District Attorney
parser.py
processes files based on cached metadata in local_data_cache/elections_metadata.json
To update this metadata from the OpenElections API, run python fetch.py wi -m
(fetch.py
fetches data files based on the cached metadata)
To re-parse all data files:
python parser.py
To parse data files for specific elections, append one or more election ids:
python parser.py 426
Elections will be processed in the order they appear in the metadata.
A folder local_data_cache
keeps a local copy of input data files. To update it:
python fetch.py wi
To fetch input files for specific elections, append one or more election ids:
python fetch.py wi 1577 404
Spot tests to check a few records from each results file are in
tests/wi-elections.tests.csv
.
To run, use:
python run_spot_tests.py [<tests_filepath>]
Tests to validate the CSV output using csv-test can be run (2014 example):
npm install
node_modules/csv-test/bin/csv-test tests/csv-test-config.yml '2014/*' tests/csv-test-validators.yml
- Update metadata at openelections.net, note new id #
python fetch.py wi -m
to update local metadata filepython fetch.py wi <id>
to download input data for new election- Pick random records from downloaded data files, add them to tests (at least one record per file)
python parser.py <id>
to parse input data, write results file- Add line(s) from
office_table.csv
tooffice_table.xlsx
python run_spot_tests.py
- Fix any problems found
- Push to repo
- Make PR to update main repo