Real-time election results as Open Data
2019, May 27
Is there a way to know the geospatial boundaries of the cantons?Uhmm… Not sure…
Two weeks before the elections, we got confirmation we would receive the same data the media companies would receive about the election results. We had to think and act quickly. What can we set up in what amount of time?
We decided to host a hackathon, or an electathon, how we decided to call it. Thanks to the people of BeCentral, where Open Knowledge Belgium has its office, we quickly could reserve a meeting room on Saturday before the elections. We set up a page at elections.openknowledge.be and we invited our network. About 10 people showed up, with one common goal: we will build something that, if the data would not have been open, you would never be able to have such an overview. Quickly, 3 main ideas came to exist:
- A one vote one dot map, showing a dot in a color per vote in a canton. We did not prioritize this idea however: it was not straightforward to get a map of the boundaries of all cantons, and the demo code we were working with only worked for static data. It would technically become a challenge to visualize this as more votes came in, although we will keep this idea in mind for the next election. (idea by Leenke)
- A deeplink to the personal achievements of one candidate. The page would be the ultimate vanity metric for politicians.
- A 3D print of a vase that grows bigger when new results come in. The vase gets skewed in the direction of the winning party. We would then try to sell the vase for €30.000, which is the amount the media companies have to pay for the data if the open data was not there.
Group picture! #electathon— Xavier Damman (@xdamman) May 25, 2019
Go team citizens! #Election2019 pic.twitter.com/umaMvgR1YT
We decided to focus on the second idea and create an overview of the votes per candidate. Jonathan created a best-effort API based on these files. The API is publicly available without API keys, and has Cross Origin Resource Headers installed. We also made sure the responses are compressed and the right caching headers were in place. Everyone was now able to start coding upon this. As an example, I coded up a quick codepen displaying the list of candidates per election. This was quickly picked up on Twitter by Thib, who created a nice overview of who you can vote for, and the seat distribution in real-time.
Should be working now, not yet with evolution and currently only with test data https://t.co/elWYVdmkqx (the checkbox adds/removes "?test" from the API call) pic.twitter.com/YtaIuf3vcz— Thib (@tgoelff) May 26, 2019
Michiel is Open Knowledge’s knows all can do everything digital handyman. He decided to implement the wireframes made by Leenke using React. The app was ready just in time for the elections, although we had plenty of more ideas to go into the page. See for example the personal result page of former minister of the Digital Agenda Alexander De Croo.
Achievement unlocked: created a website with election data that’s more up to date than the media. Check out your politician’s preference votes as they become available in real-time: https://t.co/TukDTUvbdf #electathon #opendata #kies19 #vk19 pic.twitter.com/zlFQ50j710— Pieter Colpaert (@pietercolpaert) May 26, 2019
With more than 8000 unique visitors on Sunday of this webpage, we feel extremely proud that we have been able to pull this off. Next elections we will go for more and better data, and more and better visualizations. Playing with the data has given us a great insight in how Belgian elections actually work. We had 6 elections with a total of 6927 candidates (I just checked with Michiel and he knew this number by heart by now).
For me as a Linked Open Data researcher, it became again painfully clear that we need better data management across silos in the government. We stumbled upon a dead end when trying to find geo boundaries for Belgian voting cantons: that should have been a basic dataset. We tried to find the logos of the parties on Wikidata. However, not all parties had a wikidata page, and if they had one, not always was their image up to date. Luckily you can edit wikidata yourself, but for this hackathon we quickly decided to make a file containing all logos and parties. The I files in the election streams should become base registries, always available and not only available for the elections. They should be available as Linked Open Data, so that all the identifiers for e.g., candidates, parties, lists, … could be shared among different datasets. The R files could equally as well use the same domain model as the UK elections with the Election Ontology available at https://ukparliament.github.io/ontologies/election/election-ontology.html. So many ideas to build a much more integrated data publishing strategy at the federal government. Let’s hope there will be a minister of the digital agenda soon: we have plenty of things to tell!