Skip to content

Elizabeth-Warren/iowa-caucus-app

Repository files navigation

Iowa Caucus App

Background and history

The Iowa Caucus App was an internal reporting tool built for the February 3, 2020, Iowa caucuses. The goal was to provide precinct captains supporting Senator Warren with a simple tool to calculate delegate math at each precinct during the caucus. As alignment and realignment progressed throughout the evening, results were reported to a custom-built internal API for the campaign's own analysis. A help section, connected to Zendesk, and phone hotline were set up so that users could get assistance in real time for any problems that arose. It also allowed them to call in results and the end of the night if they ran into any difficulties. Finally, users of the app were able to take a photo of their caucus worksheet and submit it to serve as a final "paper" record.

This is not to be confused with the infamous official Iowa Democratic Party caucus app built by Shadow Inc. In part because of this app, the Warren campaign was able to provide photos and documentation to the IDP to help resolve reporting issues that arose that evening.

The project started in August of 2019, with the goal of having a beta version ready for training volunteer precinct captains starting the week after Thanksgiving.

In terms of app design, this was built as a primarily mobile, offline-first progressive web app. Precinct captains were trained to navigate to the web app in their browser and pin the app to their homescreen. Service workers and persisted state via localStorage were used to provide offline capability so they could still use the app even without reception. If the user tried to make a reporting post to the API while offline, those requests were queued and submitted once they regained network connectivity. Caucus locations were available via the app, but these locations were in flux up until the day of the caucus. To address that, we made a request to a JSON file generated by a cloud function hooked up to a Google spreadsheet that had the latest data. That JSON was also inlined into the app at build time to provide a static backup. Finally, ease of use and accessiblity were central design principles given the diversity of users.

In addition to the tests provided here, we ran 10 million passing test cases on the delegate calculator math to ensure its integrity. There were even anecdotal instances of our calculator app fixing for human error in the math.

The app was hosted on Netlify.

Project setup

# install dependencies
npm install

# copy necessary environment variables
cp .env.sample .env

Compiles and hot-reloads for development

npm run serve

Compiles and minifies for production

npm run build

Lints and fixes files

npm run lint

Run your end-to-end tests

npm run test:e2e

Run your unit tests

npm run test:unit

Logging in

Phone numbers were required to log in so we had a point of contact for users submitting results or help requests. For testing purposes, 555-555-5555 is perfectly fine. For a precinct captain code, you can check the public JSON file linked to in src/services/fetchPrecinct.js, or look at a few of the test cases in tests/e2e/spec, or just enter 1593641.

Technical summary

JavaScript

The Caucus App is a web app built with Vue using the Vue CLI. Other commonly used third-party libraries include:

  • axios - for making HTTP requests
  • date-fns - for date manipulation
  • lodash - for utility functions

Coding conventions are enfroced with Prettier and ESLint, using Vue's recommended linting rules.

CSS and Component Styling

The primary component styling solution being used is Tailwind CSS.

Coding conventions are enforced with Prettier and Stylelint.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages