The COVID Schools Canada project is a volunteer effort by grassroots group Masks4Canada to compile data on COVID-19 cases and outbreaks in schools across Canada. Their mission is to keep students, parents, teachers, and officials well-informed and ”provide transparency on the full impact of COVID-19 on schools and communities, and advocate for safe school policies,” explains team lead Shraddha Pai.
After reading Shraddha’s engaging Twitter thread about the project, I connected with her to hear the story behind building COVID Schools Canada.
Scaling for national COVID data
Masks4Canada has been advocating for evidence-based public health policy and safe school policies since the COVID-19 pandemic began. In response to a lack of transparency from multiple Provincial governments, the group decided to create a tracker to collect more complete data on how COVID-19 was impacting schools. It quickly grew to a scale that was challenging to maintain, with volunteers needing to manually add new points to their map every day.
“We started with Google My Maps because it was easy to get started. But as the project scaled up and our data grew it became difficult to manage. We were running into the maximum number of points per layer. And the map was getting cluttered because we couldn’t include logic, like filtering by recency.” - Shraddha Pai, Masks4Canada
When they could no longer add additional points, Shraddha and Masks4Canada reached out to their Twitter followers to ask for alternative mapping solutions and connected with the Mapbox Community team.
Joining the Mapbox Community
To help the COVID Schools Canada team transition their project to Mapbox, Community Team program manager Megan Danielson drafted an initial prototype of the map using the Sheet Mapper impact tool and then onboarded the team to map styling and Mapbox GL JS in a live Zoom session. Using Mapbox tutorials and code examples, and with remote support from Megan, the team was able to launch their new map in early 2021.
“We tried to originally go via Google for Non-Profits to stay with Google Maps ecosystem, but as we are not a registered non-profit we didn't have any paperwork to support our application. On the other hand, Mapbox offers a generous free tier with 50K pulls a month and 20K geocode calls. More importantly, they offered a human being to guide us in jump-starting our map. That support really helps with adoption.” - Shraddha Pai, Masks4Canada
The new COVID Schools Canada site pulls data from multiple Google sheets containing geocoded school locations and COVID data, cleans the data, converts it to GeoJSON using csv2geojson, and then loads and styles it onto a web map using Mapbox GL JS, all hosted on a Github Page. The map updates live from the GeoJSON file every time it loads, visualizing the data with data-driven styling rules for circle size and color. Users can also filter the map to display a maximum or minimum of cases or within a particular date range.
“Setting up Mapbox was fun. Cool API, many examples online, large user base. They even have a plugin to pipe directly from a Google sheet. CSV > geojson > github > boom!” - Shraddha Pai, Masks4Canada
A user-friendly data pipeline
On the backend, the Masks4Canada team uses a series of two-sheet Google Sheets workbooks, one for each Province. The first sheet is a list of all schools in the Province and their corresponding latitude and longitude coordinates, generated using the Mapbox permanent geocoding API. The second sheet is the COVID-19 case data with one record per school and a LOOKUP formula that pulls in its corresponding location coordinates from the first sheet.
The COVID-19 case data comes from crowd-sourced submissions to the COVID Schools Canada website, which volunteers review and manually enter into the spreadsheets. The team also uses web scraper scripts written in Perl and Python to pull in data from school board records and other provincial trackers (for British Columbia, Alberta, and Quebec). Every night, volunteers run a data pipeline built with bash, R, and Python that pulls the data from the multiple spreadsheets and processes it into the single, cleaned .csv file that is converted to GeoJSON to power the web map.
The map update helped Masks4Canada streamline their data workflow so volunteers can focus on the nightly data updates without needing to also manually update their map. Now they can get information out to their audiences faster - and with a more user-friendly visualization.
“I had never worked with maps before this project, and it all came together smoothly. Ours is a community service project put together by volunteers with resource constraints, so we really appreciated Mapbox helping us out with one-on-one guidance to get up and running, in addition to the generous free tier.” - Shraddha Pai, Masks4Canada
To date the team has recorded over 55,600 COVID-19 cases across over 2,700 outbreaks in Canadian schools. The routine statistical updates and sharing of evidence-based best practices from around the world have won the team over nearly 10,000 followers on Twitter and widespread media coverage. Bravo, Masks4Canada volunteers!