2021
How are people confining where I live?
Country/area: Portugal
Organisation: Público
Organisation size: Big
Publication date: 19 Nov 2020

Credit: Rui Barros
Project description:
The first rules of the portuguese national lockdown were pretty explicit: everyone should stay at home. But that quickly moved into semi-lockdowns, with rules on the weekends or regional rules applied differently depending on how the numbers for that specific place. So we built a news app using Google’s mobility data that allowed everyone exploring the level of confinement for the place where they lived.
Impact reached:
This story allowed everyone to know if people where they lived were staying at home. Since everyone based their opinions on what they saw on the streets or the number of people they saw at the supermarket it created some non-factual ideas about if people were respecting the general idea that you should stay at home.
Techniques/technologies used:
I used R to get the data and do some data transformation. Because data was a variation of those six indicators compared to the values in January, I decided that I should do some transformations to let the users understand those numbers. So I applied a rolling average to let everyone see the trend instead of the numbers – that could vary a lot according to the days. Then, because we had data previous to the first national lockdown, I’ve used the standard deviation for when the country was not on lockdown and when it was to create a scale – non-confinement, confined and somewhat confined. A general value for the municipality was calculated if we had data for at least 3 or the six indicators.
I’ve used the plumber R package to create an API for those values and used Vue.js to build a page with custom links for every municipality available.
What was the hardest part of this project?
Deciding on a methodology that allowed me to create those 3 levels of lockdown. Also, in a more technical problem, because I was avoiding use d3.js for the charts, I thought using chart.js would be easy. But it didn’t offer me the custom choices I wanted, so it was really hard to create a chart with 3 colors dynamically.
What can others learn from this project?
When you present data, you can help people have a more honest conversation. The article was shared on social media by our readers when people were arguing if people were staying at home when they should be. It’s not because you saw a few people at the supermarket that you should assume that no one is staying at home.