Skip to content

national-voter-file/national-voter-file-api

Repository files navigation

National Voter File API

We provide an easy-to-use, modern-era database with voter files for each of the fifty states. It uses a data model that represents a national voter file as well as associated campaign measures in a shared data warehouse.

We want to pull politics into the 21st century, and we're starting from the ground up.

Goals

  • Reliable, up-to-date voter data for every state in the country (including address changes, and redrawn districts)
  • All available via an easy-to-consume REST API
  • For thousands to use our voter file to power their campaigns' donation, canvassing, and phonebanking efforts!

How does it work?

Glad you asked! Simple, we:

1. Collect voter files from every state

We've done nine states so far. We'd love your help collecting them all.

2. Extract and transform that data

Each state does it differently, some (way) worse than others. Using well-tested, state-specific transformer scripts written in Python, we turn them into consistent CSV files.

3. Load that data into a Postgres database

We load the data using Pentaho, and contain the database and its query layer within Docker so that it is platform agnostic.

This sounds awesome! How can I help?

Usage

Interacting with the app

You'll generally interact with the app using mix tasks. You can read the Phoenix documentation here.

Stopping and starting the server

To start the server, run mix phoenix.server.

To stop the server, hit Ctrl+C twice.

Running tests

To run the tests you run MIX_ENV=test mix test.

Linting Code with Credo

Credo is a static code analysis tool for Elixir. In general, we conform to the Credo Style Guide when writing Elixir code. You can run mix credo to check your code for design, readability, and consistency against this guide.

Credo's style guide is influenced by this more popular and exhaustive community Elixir Style Guide. We defer to that guide where the Credo guide is ambiguous, e.g. external module references.

Environment

When contributing to the app, you will not have access to secure environment variables required to run some tests or work on aspects of the app locally. Unfortunately, for security reasons, we cannot provide you with sandboxed keys for doing this on your own.

You can see these variables in .env.example.

Note that, if you're using your own keys, you'll need to create and source the .env file prior to running the application. To do that, you can try something like:

$ cp .env.example .env
$ vi .env # Add your values for the variables.
$ source .env