Deploys a Datasette instance with data from the following sources:
- CSSEGISandData/COVID-19 by Johns Hopkins University Center for Systems Science and Engineering (JHU CSSE)
- nytimes/covid-19-data by The New York Times
- datadesk/california-coronavirus-data by The Los Angeles Times
- TheEconomist/covid-19-excess-deaths-tracker by The Economist
- State and county population estimates from the US Census
The Datasette instance lives at https://covid-19.datasettes.com/ and is updated hourly using a scheduled GitHub Action.
More about this project on my blog: COVID-19 numbers in Datasette.
This repository uses the deployment pattern described in Deploying a data API using GitHub Actions and Cloud Run.
Please do not use this tool to share information about COVID-19 without making absolutely sure you understand how the data is structured and sourced.
Recommended reading:
- Why It’s So Freaking Hard To Make A Good COVID-19 Model
- Ten Considerations Before You Create Another Chart About COVID-19
The database is partly built from the daily report CSV files in the Johns Hopkins CSSE csse_covid_19_data
folder - be sure to consult their README for documentation of the fields.
They are actively making changes to how they report data. You should follow their issues closely for updates - for example this issue about switching from reporting USA data at the county to the state level.
The build script for the database makes one alteration to their data: it attempts to fill any missing latitude
and longitude
columns with values from similar rows.
If you are going to make use of those columns, make sure you understand how that backfill mechanism works in case it affects your calculations in some way.
The New York Times has a comprehensive README describing how their data is sourced. You should read it! They announced their data in We’re Sharing Coronavirus Case Data for Every U.S. County.
They are using the data for their Coronavirus in the U.S.: Latest Map and Case Count article.
The Los Angeles Time comprehensive README describes the data in the latimes_agency_totals, latimes_county_totals, latimes_place_totals and latimes_state_totals tables.
See To aid coronavirus fight, The Times releases database of California cases for background on the release of this data.
The data is used for their Tracking coronavirus in California page, which is constantly updated.
The Economist publish the data behind their ongoing interactive Tracking covid-19 excess deaths across countries. Their README describes the data sources they use for individual countries in detail.
This data is imported into the economist_excess_deaths and economist_historical_deaths tables, with one alteration: a cadence
column is added showing if each row is being collected on either a weekly
or monthly
basis.
Two additional tables contain population data from the US Census.
- us_census_state_populations_2019 has data on the estimated 2019 population of different US States, derived from their state population totals.
- us_census_county_populations_2019 has data on estimated 2019 population of different US counties, keyed against county FIPS codes. This data was compiled by Aaron King using U.S. Census Bureau, Population Division, "Annual Estimates of the Resident Population for Counties in the United States: April 1, 2010 to July 1, 2019 (CO-EST2019-ANNRES).
This repository includes CSV data for both of these tables.
The latest_ny_times_counties_with_populations view uses this data to calculate cases and deaths per million for US counties, based on the latest county figures from the New York Times.
- Remember: the number of reported cases is very heavily influenced by the availability of testing.
- This Twitter thread is an excellent overview of the challenges involved in comparing numbers from different states and countries.
- On the 23rd March 2020 Johns Hopkins added four new columns to the daily CSV file:
admin2
,fips
,active
andcombined_key
. These are not present in older CSV files. #4. - Some countries (like Italy) are represented by just the rows with
country_or_region
set toItaly
(andprovince_or_state
set tonull
). Larger countries such as the United States have multiple rows for each day divided into separateprovince_or_state
values - example. - Santa Clara County appears to be represented as
Santa Clara, CA
in some records andSanta Clara County, CA
in others - example. - Passengers from the Diamond Princess cruise are represented by a number of different rows with "From Diamond Princess" in their
province_or_state
column - example. - The latest_ny_times_counties_with_populations view omits some counties, notably all New York City counties, because the New York Times groups all New York City data into rows with
county
equal to "New York City" and an emptyfips
column. Thus total cases represented in latest_ny_times_counties_with_populations are lower than total cases represented in ny_times_us_states by at least the number of cases in New York City.