Since then we have completely tore it apart and started from the models up.
An app that would house data of past and future elections accessable by logical urls.
Each election would have a study guide component, a live results component and an archive component.
We are still working on the the transitional phases but the three components do exist. An app is never done. If you wait it will never launch.
How we did it:
A team of four, Ben Turner(performance,backend), Lauren Rabaino(templates,design), Jon Schleuss(fact checking, front end) and of course me(all of the above) spent about 6 weeks of non-stop development using lessons from previous iterations.
This app is really three apps. People,politicians and elections. A person can become a politician who can be part of an election. Why would we add this layer of abstraction? People are crazy and do a lot of things. A person could be a ceo, a politician, a candidate, a race car driver and on and on. We structured our models to take this into account in hopes that later, maybe much later, we would have a wealth on data on a person through out their career.
One of the problems we ran into is that different people have different info. Everyone has a name, everyone has a birthday. Not everyone has tattoo on their arm or a pet named “the sargent”. There was no feasible way to include all of the possible fields on the model with out bloating the form. Solution? Custom fields. WordPress knows all about it. These “custom fields” allow us to attach seemingly arbitrary data to any model. Brilliant? Not so fast. These relationships are costly at the database level. Ben was able to use some django magic with select_related()
With a short amount of time, not enough though was put into how we would display the data. Our views include: all elections, elections by year,all races in an election, race detail, and candidate detail. We added one view to show races flagged with featured for a given election. In the future we hope to do something a little more interesting. Maps? boundaries? addresses? Iterative people, iterative.
I wrote a management command called collect_results that parses each source and puts it into the db using the django orm. This data is dirty so a lot of time was spent writing functions to clean it up. For example the five word name, or the race that was in multiple counties or candidates named Write-in.
Some races attract more attention than others. For example the seattle city mayors race. One of our reporters Emily H. did some amazing data collection through reporting. She was able to enter it into the django admin. There is a custom template argument in the race detail view that allows us to create
This url contained the json for a single race that could be consumed by some simple js.
This becomes extremely useful for instance if we wanted to show the results of a race on a story written for that race. They are also great dynamic teasers into our app.
All of this info is available in many places. We hope to make it easily navigated and be an archive for years to come. It will only get better with each election.