
This line chart, showing the number of weekly purged and added voters to Ohio’s voter roles, is one of many stats available at ohiovoterstats.webscott.com.
My latest project is a public information site which displays data regarding purged voters in my home state of Ohio.
The data is derived using the downloadable voter files available on the Ohio Secretary of State’s website. The files are updated weekly, and by comparing the voter data in the files for the current week with the ones from the previous week, new and removed voters can be identified. The simplicity of this concept didn’t exactly equate into a simple implementation as I had initially estimated. However, the project so far has been as rewarding as it has been challenging and educational.
Challenges of Building the Stats Page
The statistics page (currently the only page available at the time this post was written) shows summaries of all the collected data for the year in various chart and table data formats. Chart data can be updated to show either statewide data, or specific to a particular county or political district.
The first challenge involved getting the data into a database. First of all, the files are too big to simply upload through phpMyAdmin. PHP code was written to handle the insertion. Second of all, even though this data was being provided by the state, I quickly discovered that the data had some “irregularities”, things like extra quotation marks and backslashes that were causing fields to be improperly parsed when read as csv data. Additional PHP scripts needed to be written to clean up the data before it could be used. I should note that much of these irregularities have been corrected in the most recent data downloads offered by the state, so the IT gurus in Columbus have apparently done a little cleanup.
Once I had all the voter data stored in a database, the next challenge was figuring out how to display it. I’d never built a site with dynamic charts before, and settled on using Chart.js for my first go at it. I’m still second guessing that decision. I love the way you can remove sections of a chart. This feature works great for getting a visual of small slices of a pie chart that are too insignificant to display otherwise. However, I’d like to have percentages displayed over each slice, rather than just total numbers displayed on a mouseover of each slice, and I’ve not yet figured out a way to do that with Chart.js. Perhaps a migration to Google charts or some other chart library will be a future upgrade.
Dynamically updating the charts proved to be a fairly painless experience, thanks to some decent documentation by the Chart.js folks, and 1 or 2 supplemental youtube videos. However, doing so quickly was a bit more problematic. Querying the data from the database for each chart update, despite my best efforts at optimization, proved to be a method that almost guaranteed sluggish performance. I had one advantage though, and that was that I had a finite number of sql queries that needed to be run to generate the chart data for all counties and districts. I decided to run all those queries in a batch process, and store the results in json files. When a user selects a county or district, the appropriate json file is retrieved, and the database is left out of the process.
The next improvement on the to-do list for the stats page will be a better user interface. Currently, the charts are updated by clicking on one of the counties or districts located in the tables below the chart. In other words, the user interface is located on a separate portion of the page than the data results. I need to create something in the chart area that will give this functionality without the need to scroll down the page.
Update 3/20: The user interface has been implemented!
Further features planned for this project include a “purge alert” service, where Ohio voters can sign up for an email alert in the event they are purged from the voter rolls. Once that’s developed, I’ll need to create a regular home page, contact page, maybe some faq’s, a nav menu to link them all together, and in the end I should have a real website!