For the November General Election, the Office of Elections wanted a backup to the Virginia Department of Elections portal, which had gone down during previous elections. We built a small Flask app and deployed it to AWS Lambda and API Gateway with Zappa. The state site stayed up this time and our microservice wasn’t needed, but it was a good proof of concept. The code is available on Bitbucket under the GPLv3.
How It Works
- Voter loads static page on S3
- Voter enters information and clicks Submit
- Page makes AJAX request to API Gateway
- API Gateway invokes Lambda function
- Lambda function executes
- Loads voter data (Hash->Precinct, Status) into memory
- Concatenates and uppercases name and DOB
- Computes SHA-256 hash of the result
- Looks up precinct and status
- Returns precinct and status, or error if not found
- API Gateway returns result
- Page display result, with link to polling place directions
Steps 2-6 take less than 200 ms. Using hashed data requires voters to enter their names exactly as they appear in the roster, but keeps Personally Identifiable Information (PII) out of the deployment package.