Galen Guyer

Full-Stack Software + DevOps Engineer
they/it

RIT COVID Dashboard https://ritcoviddashboard.com


Tracking and graphing historical data is fun and useful for showing trends in data, but RIT provides no historical data. However, our COVID dashboard only shows immediate numbers, with no ways of tracking or seeing trends. I wrote a Python app that scrapes data in real time from the dashboard and provides an API to access current data in JSON format or historical data. Scraping the site is easy enough, and to make it easier I used code from the RIT COVID Tracking Discord Bot, which pulls data in real time from the dashboard for a few Discord servers.

Once that data is retrieved, it's inserted into a SQLite database. However, because the dashboard is updated incrementally, when they updated the dashboard I'd get between 2 and 10 new entries in the database. This becomes massively inconvenient, because each day can have multiple entries and it's just messy. To avoid this, every time the database is updated, if there's any previous entries on the same date, those entries are dropped and only the latest entry is retained.

API


Two endpoints are exposed to access this data at the moment, though as the semester changes more may be created.

The first is /api/v0/latest, which simply shows the current state of the dashboard (with a delay of up to 5 minutes) in JSON format for easy consuption by any other apps that don't want to parse the HTML from the page.

The schema for this endpoint is as follows:

            {
            "alert_level": "String",
            "beds_available": int,
            "isolation_off_campus": int,
            "isolation_on_campus": int,
            "last_updated": "ISO-8601 String",
            "new_staff": int,
            "new_students": int,
            "quarantine_off_campus": int,
            "quarantine_on_campus": int,
            "tests_administered": int,
            "total_staff": int,
            "total_students": int
            }

The other endpoint is /api/v0/history, which contains all the historical data from the year. It will return a array of Objects as defined in the above schema.

For most of the dates in the history endpoint, you'll notice the time is 16:00:00 on all entries. This is because I wrote the app partway through the fall semester so I had to backfill it with data that was sourced from the r/rit community.

Starting on Tuesday, 2020-01-26, the new_students and new_staff fields are -1. This represents the fact RIT removed those statistics from the dashboard. Any negative values in any field should be treated as null.

As always, the source code for the scraper and API is available on GitHub!

Dashboard


Given the simplicity of the official RIT Ready Dashboard, I decided it would be possible to take the data I scraped and present it with additional statistics. I built an unofficial dashboard which uses the history endpoint to provide changes over time along with the current numbers, as well as graphs. There is also the option to show data from only the current semester or show data from the start of the Fall 2020 semester.

The source code for the dashboard is available on GitHub as well!