“Where can I vote?” — RIT Election Night Hackathon 2017
On November 8th, I attended the annual election night hackathon held by the FOSS@MAGIC program at the Rochester Institute of Technology. The point of the hackathon was to learn about civic hacking and to watch the local/national election results arrive. We also got to hear from speakers from Second Avenue Learning about Elections Ed that is used to teach students about elections in a non-bias way using historical data about elections.
Project Idea
I came up with a project idea that had to deal with an issue that I’ve seen in the past: There are a number of people who could and should be voting to participate in the democratic process in this country, but don’t because they don’t know where they are supposed to vote. The goal of my project was to create a no-frills way for someone to easily check their voting location using only their state and their address. The project also served as a good opportunity for me to experiment using the Google Civic Information API.
I started by outlining what I needed to do to fit my project idea: First, I needed to create a simple layout where the user inputs and the result of the inputs would be the main focus. To do this, I adapted a layout from another simple project I had worked on recently. I used bootstrap for this, as it was an easy way to clean up the input and yet not distract from the rest of the page. Once I had the initial layout set up, I started on the backend code.
Development
In the case of this project there wasn’t much backend code. I used a simple PHP page to act as a shim between the Google Civic Information API and my application in order to prevent the API key being used. This then sent the JSON data returned by Google’s APIs back to the Javascript requesting it, which actually handled the data and acted on it. This was split into two main calls.
The Elections API
https://www.googleapis.com/civicinfo/v2/elections
This API is provided by google to obtain a list of ongoing elections and their associated internal IDs. These are important for making the voter information request later down the line, since Google requires that you pass an election ID for the election that you want voter information on. In the case of my application, it requests a list of elections and then places them into a select dropdown, allowing the user to pick their election.
The Voter Information API
https://www.googleapis.com/civicinfo/v2/voterinfo
Once the user has selected an election and entered their address, the application makes a request to the API shown above, using the election ID and user provided address as input. This API returns a massive amount of information about the voter at the address, if there is one. This includes the polling locations for the address, any early voting sites, and any associated contests, along with the state voting information. This API call is very important since it allows use to obtain two important pieces of information: A normalized version of the user’s address, and the polling location’s address.
The Map
After obtaining the address, the only thing left to do was display the address and a map with directions. The application used the information obtained from these APIs in conjunction with the Google Maps Javascript API to display a map of the user’s route to their polling place, complete with directions as markers. The address was also provided in case the user wanted to use GPS to locate the voting center in their car.
Reflection & Conclusion
I managed to learn a good amount about Google’s APIs through this project and also managed produce a project that could help some people to express their ideas and opinions in our democratic process.
An example of the application can be seen at my test site and the source code can be found here. To use it, pick a election and give it a residential address in the area that that election covers.
Access to free software is important to the democratic process in our country because it allows people to build and use tools to get their opinions heard and to organize with others.
I want to thank the FOSS@MAGIC program and the professors involved (such as Stephen Jacobs) for putting on this event and giving students an opportunity to learn about civic hacking and have a fun night with other students at the same time. It was also a good way to introduce students to the ideas surrounding Free and Open Source Software.