Answering questions on your mind
I like to build websites that answer questions that are on my mind.
From projects like "Will Robots Take My Job?" (sold), and "How Much is a Bitcoin Worth?" to "Will My Job Give Me Covid?".
Like many people I'm thinking a lot about the US election, due to finish on November 3rd.
With corona virus running rampant throughout the country, more people are voting and voting early. But just how many people have voted, and how does that compare to 2016.
I've been seeing the numbers on news regularly about how many people have voted, and wondered if this information was available in more realtime online.
I found the United States Election Project, a treasure trove of information about voting in the current and past elections.
While the information collected is great, I wanted something that would get straight to the point, answer the question on my mind.
The data is licensed to be useable by others, and easy to access, so I thought I'd take a stab at building something that would answer my question!
Data Models
I decided to keep things simple. I have two data models...
Election
This table holds elections, so that it was easy to query information about the current and past elections.
Voted
This table holds data about votes cast in a specific election, and is design to store data for each state, and aggregated for the country as a whole.
For the purpose of this simple site, I could have flatted this into a single table, but where it doesn't add too much overhead I prefer to normalize my data as much as possible, to setup for future uses, in case I want to add more data or analysis.
Thanks to David Hill for early access to a Figma plugin he is developing, that I used to create this diagram.
Data ingestion
I was able to write a couple of quick Laravel Console commands to import both the current data, and the data from previous years.
For previous years I downloaded the 2016 data and converted to CSV to import them one off.
For 2020, where the information is updated on a regular basis, I scheduled the command to run hourly, that queries that data from the Github hosted pages and updates the local database.
Displaying the data
I wanted to answer the question on my mind in a clear and simple way.
The Laravel project I created was bootstrapped with Jetstream, so uses Tailwind for the styling.
I removed the bootstrap content and replaced it with some simple data that I queried from the database.
I decided on a dark theme, and used the default Tailwind colors to display the data.
Finishing
I added a footer and made a quick open graph image that would be shown when sharing the site, and that was it, project finished.
I registered the domain, added the site to an existing server and I was done.
https://howmanypeoplevoted.com/
In total about 2hours work. Obviously the really hard is bing done by the Election Project. Gathering and publishing the data is a big task.
Let me know what you think on Twitter.