This page contains programs that we created over the course of the project, along with descriptions of the programs.
The parser, readme and requirement files for the Sonoma, Modoc and Plumas 2018 Counties parser.
The parser and readme files for the parser for multiple counties in Indiana.
The parser and readme files for the Muskegon county parser.
Utilities program that includes the following functions:
Table package (used in our parsers). The table package contains Table and Row classes that output data in the proper format. The Row class is used to create an object that is representative of a row in the CSV and a Table represents a collection of rows that will output to a CSV. It has a function to add more rows to the table if it isn't already in the list that was input, and a function to convert the list to a CSV.
Program to take of a csv with a candidate to party mapping (one column is the candidate, another column is the party), and insert it into another csv (where rows are missing party values, but contain candidate names). The program does this by first converting the mapping csv into a dictionary, and then reading the other csv and adding the party in whichever row it detects the candidate name.
Some counties such as the California counties Sonoma, Modoc and Plumas do not contain the party information for each candidate. Instead, the candidate to party mapping was webscraped into a csv file. This program helped put the mapping information into the official Sonoma, Modoc and Plumas post-parser data csv.
Program to clean the csv from Open Elections into a usable form for our data visualization. Cleaning steps include percentage calculations, pivoting the table and more.
Program used to validate csv data by calculating symmetric difference between CSVs and checking strings.