Skip to content

Extract, transform and load election results posted online by local U.S. election officials

License

Notifications You must be signed in to change notification settings

SCPR/local-election-results-etl

 
 

Repository files navigation

Extract, transform and load election results posted online by local U.S. election officials.

Supports

  • California Secretary of State
  • Los Angeles County Registrar-Recorder/County Clerk
  • New York State Board of Elections
  • Iowa Secretary of State

Latest files

File S3 URL Pages URL
California Secretary of State ca_secretary_of_state/latest.json
Los Angeles County los_angeles_county/latest.json
New York State Board of Elections ny_state_board_of_elections/latest.json
KPCC kpcc/latest.json kpcc/latest.json

Getting started

Clone the repository and move into your code directory. Install the Python dependencies.

pipenv install --dev

Install pre-commit hooks.

pipenv run pre-commit install

Create a .env file and fill it with the following Amazon Web Services services, which will authorize you to upload your files to an S3 bucket.

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=
AWS_BUCKET=

If you want a common prefix on all objects uploaded to your bucket, add this optional variable.

AWS_PATH_PREFIX=your-prefix/

Command pipeline

Download the raw data from the source websites.

pipenv run python -m src.los_angeles_county.download
pipenv run python -m src.ca_secretary_of_state.download
pipenv run python -m src.ny_state_board_of_elections.download

Transform the data into something we want to publish.

pipenv run python -m src.los_angeles_county.transform
pipenv run python -m src.ca_secretary_of_state.transform
pipenv run python -m src.ny_state_board_of_elections.transform

Export results to CSV.

pipenv run python -m src.export

Upload data to Amazon S3.

pipenv run python -m src.upload kpcc

About

Extract, transform and load election results posted online by local U.S. election officials

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 80.8%
  • Python 17.1%
  • Makefile 2.1%