rji-futures-lab / vooc-election-results

Pipeline infrastructure for live 2020 general election results for the Voice of Orange County
MIT License
0 stars 0 forks source link

vooc-election-results

Pipeline infrastructure for live 2020 general election results for the Voice of Orange County.

Proposed pipeline plan

  1. Fetch the results

    a. From each County Registrar of Voters b. From each relevant endpoint of the Secretary of States API

  2. Compare the new results to the previous results.

    a. If different, store a "latest" copy and a datetime-stamped copy.

  3. Parse out results for individual contests

    a. Every contest in OC b. Just the contests with supplementary results for OC contests c. The SoS results are already parsed out.

  4. Compare and store parsed results

  5. Compile final json for each contest with new parsed results

    a. For the vast majority of the OC contests, we will simply update the datetime stamp and the vote counts b. For contests, we will combine vote counts as well.

Bootstrapping

To set up your local dev environment, you need to install both sets of requirements:

pip install -r requirements.txt
pip install -r requirements-dev.txt

You'll also need to set a few environment variables. For this, I'm using direnv.

Deploying

Here's the stack:

To deploy:

source deploy.sh

Which will:

Managing the deployment

To update the deployment:

source update.sh

Note that:

If your update fails, you might try tearing down the entire deployment (except the S3 bucket):

source teardown.sh

And then re-deploying:

source deploy.sh

Updates will also reset the function call frequency. If you just need to modify the schedule, then:

source schedule.sh