Skip to content
SSHOOTINGPublic
forked from open-covid-19/data

About

Open COVID-19 Dataset

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Latest commit

 

History

164 Commits

Folders and files

Repository files navigation

Open COVID-19 Dataset

This repository contains datasets of historical data related to COVID-19.

Explore the data

A simple visualization tool was built to explore the Open COVID-19 datasets: The Open COVID-19 Explorer.

If you want to see interactive charts with a unique UX, don't miss what @Mahks built using the Open COVID-19 dataset: http://www.starlords3k.com/covid19.php.

You can also check out the great work of @quixote79, a MapBox-powered interactive map site:

If you are using this data, feel free to open an issue and let us know so we can give you a call-out here.

Use the data

The data is available as CSV and JSON files, which are published in Github Pages so they can be served directly to Javascript applications without the need of a proxy to set the correct headers for CORS and content type. Some datasets have a version with all historical data, and another version with only the latest daily data. Some only have the one or the other available. Th datasets available from this project are:

Dataset CSV URL JSON URL
Data Latest, Historical Latest, Historical
Minimal Historical Historical
Metadata Latest Latest
Forecast Latest Latest
Categories Historical Historical

You can find several examples in the examples subfolder with code showcasing of how to load and analyze the data for several programming environments. If you want the short version, here are a few snippets to get started.

Google Colab

You can use Google Colab if you want to run your analysis without having to install anything in your computer, simply go to this URL: https://colab.research.google.com/github/open-covid-19/data.

R

If you prefer R, then this is all you need to do to load the historical data:

data <- read.csv("https://open-covid-19.github.io/data/data.csv")

Python

In Python, you need to have the package pandas installed to get started:

import pandas
data = pandas.read_csv('https://open-covid-19.github.io/data/data.csv')

jQuery

Loading the JSON file using jQuery can be done directly from the output folder, this code snippet loads all historical data into the data variable:

$.getJSON(`https://open-covid-19.github.io/data/data.json`, data => { ... }

Powershell

You can also use Powershell to get the latest data for a country directly from the command line, for example to query the latest data for Australia:

Invoke-WebRequest 'https://open-covid-19.github.io/data/data_latest.csv' | ConvertFrom-Csv | `
    where Key -eq 'AU' | select Date,CountryName,Confirmed,Deaths

Understand the data

Data

Make sure that you are using the URL linked at the table above and not the raw GitHub file, the latter is subject to change at any moment. The columns of data.csv are:

Name Description Example
Date* ISO 8601 date (YYYY-MM-DD) of the datapoint 2020-03-21
Key CountryCode if country-level data, otherwise ${CountryCode}_${RegionCode} CN_HB
CountryCode ISO 3166-1 code of the country CN
CountryName American English name of the country, subject to change China
RegionCode (Optional) ISO 3166-2 code of the region HB
RegionName (Optional) American English name of the region, subject to change Hubei
Confirmed** Total number of cases confirmed after positive test 67800
Deaths** Total number of deaths from a positive COVID-19 case 3139
Latitude Floating point representing the geographic coordinate 30.9756
Longitude Floating point representing the geographic coordinate 112.2707
Population Total count of humans living in the region TODO

*Date used is reporting date, which generally lags a day from the actual date and is subject to timezone adjustments. Whenever possible, dates consistent with the ECDC daily reports are used.

**Missing values will be represented as nulls, whereas zeroes are used when a true value of zero is reported. For example, US states where deaths are not being reported have null values.

For countries where both country-level and region-level data is available, the entry which has a null value for the RegionCode and RegionName columns indicates country-level aggregation. Please note that, sometimes, the country-level data and the region-level data come from different sources so adding up all region-level values may not equal exactly to the reported country-level value. See the data loading tutorial for more information.

The CountryName and RegionName values are subject to change. You may use them for labels in your application, but you should not assume that they will remain the same in future updates. Instead, use CountryCode and RegionCode to perform joins with other data sources or for filtering within your application.

Metadata

Non-temporal data related to countries and regions. The columns of metadata.csv are:

Name Description Example
Key CountryCode if country-level data, otherwise ${CountryCode}_${RegionCode} US_CA
CountryCode ISO 3166-1 code of the country CN
CountryName American English name of the country, subject to change China
RegionCode (Optional) ISO 3166-2 code of the region HB
RegionName (Optional) American English name of the region, subject to change Hubei
Latitude Floating point representing the geographic coordinate 30.9756
Longitude Floating point representing the geographic coordinate 112.2707
Population Total count of humans living in the region TODO

Minimal

There is a data_minimal.csv with a subset of the columns from data.csv but otherwise identical information:

Name Description Example
Date* ISO 8601 date (YYYY-MM-DD) of the datapoint 2020-03-30
Key CountryCode if country-level data, otherwise ${CountryCode}_${RegionCode} US_CA
Confirmed** Total number of cases confirmed after positive test 6447
Deaths** Total number of deaths from a positive COVID-19 case 133

*Date used is reporting date, which generally lags a day from the actual date and is subject to timezone adjustments. Whenever possible, dates consistent with the ECDC daily reports are used.

**Missing values will be represented as nulls, whereas zeroes are used when a true value of zero is reported. For example, US states where deaths are not being reported have null values.

Forecasting

There is also a short-term forecast dataset available in the output folder as data_forecast.csv, which has the following columns:

Name Description Example
ForecastDate ISO 8601 date (YYYY-MM-DD) of last known datapoint 2020-03-21
Date* ISO 8601 date (YYYY-MM-DD) of the datapoint 2020-03-25
Key CountryCode if country-level data, otherwise ${CountryCode}_${RegionCode} US_CA
Estimated** Total number of cases estimated from forecasting model 66804.567
Confirmed Total number of cases confirmed after positive test 67800

*Date used is reporting date, which generally lags a day from the actual date and is subject to timezone adjustments. Whenever possible, dates consistent with the ECDC daily reports are used.

**An estimate is also provided for dates before the forecast date, which corresponds to the output of the fitted model; this is the a priori estimate. True forecast values are those that have a Date higher than ForecastDate; which are the a posteriori estimates. Another way to distinguish between a priori and a posteriori estimates is to see if a given date has a value for both Confirmed and Estimated (a priori) or if the Confirmed value is null (a posteriori).

Active cases and categories

Another dataset available is data_categories.csv, which has the following columns:

Name Description Example
Date* ISO 8601 date (YYYY-MM-DD) of the datapoint 2020-03-27
Key CountryCode if country-level data, otherwise ${CountryCode}_${RegionCode} US_CA
NewCases Number of reported new cases from previous day 186
NewDeaths Number of reported new deaths from previous day 0
NewMild** Number of estimated new mild cases from previous day 148
NewSevere** Number of estimated new severe cases from previous day 27
NewCritical** Number of estimated new critical cases from previous day 9
CurrentlyMild** Number of estimated mild active cases at this date 819
CurrentlySevere** Number of estimated severe active cases at this date 190
CurrentlyCritical** Number of estimated critical active cases at this date 66

*Date used is reporting date, which generally lags a day from the actual date and is subject to timezone adjustments. Whenever possible, dates consistent with the ECDC daily reports are used.

**See the category estimation notebook for an more thorough explanation of what each category represents and how the estimation is done.

Backwards compatibility

Please note that the following datasets are maintained only to preserve backwards compatibility, but shouldn't be used in any new projects:

Sources of data

Data Source
Country-level worldwide Daily reports from the ECDC portal
Region-level Australia https://covid-19-au.github.io
Country and region-level Italy Italy's Department of Civil Protection
Country and region-level Spain Datadista COVID-19 dataset
Country and region-level metadata Wikipedia
Region-level Brazil https://github.com/elhenrico/covid19-Brazil-timeseries
Region-level China DXY COVID-19 dataset
Region-level France https://github.com/opencovid19-fr/data
Region-level Germany https://github.com/jgehrcke/covid-19-germany-gae
Region-level USA COVID Tracking Project

The data is automatically scraped and parsed using the scripts found in the input folder. This is done daily, and as part of the processing some additional columns are added, like region-level coordinates.

Before updating the outputs, data is spot-checked using various data sources including data from local authorities like Italy's ministry of health and the reports from WHO.

Why another dataset?

This dataset is heavily inspired by the dataset maintained by Johns Hopkins University. Unfortunately, that dataset has intermittently experienced maintenance issues and a lot of applications depend on this critical data being available in a timely manner. Further, the true sources of data for that dataset are still unclear.

Update the data

To update the contents of the output folder, first install the dependencies:

# Install Ghostscript
apt-get install -y ghostscript
# Install Python dependencies
pip install -r requirements.txt

Then run the following scripts to update all datasets:

sh input/update_data.sh

About

Open COVID-19 Dataset

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages