Skip to content

JSON time-series of coronavirus (COVID-19) cases for every US state - updated every 4 hours

License

Notifications You must be signed in to change notification settings

amishpr/covid19-usa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

COVID-19 USA

Main CI

This project checks nytimes/covid-19-data every 4 hours to see if the us-states.csv and us-counties.csv have been updated and then converts them to a JSON format and deploys it to a website for public use.

JSON

timeseries.json

The JSON is grouped by state with each having an array of objects with the following information:

Note:

Some data goes back as early as January 21st, 2020 (Ex. Washington), but most of the data starts after March 1st, 2020.

{
...
    "New York": [
            {
	            "date": "2020-03-01",
		    "fips": "36",
		    "cases": "1",
		    "deaths": "0"
	    },
	    {
		    "date": "2020-03-02",
		    "fips": "36",
		    "cases": "1",
		    "deaths": "0"
	    },
	    {
	            "date": "2020-03-03",
		    "fips": "36",
		    "cases": "2",
		    "deaths": "0"
	    },
    ...
    ],
...
}

Example

Here is an example of using the data with JavaScript:

https://jsfiddle.net/69qbudfn/

fetch("https://amishpr.github.io/covid19-usa/timeseries.json")
  .then(response => response.json())
  .then(data => {
    data."New York".forEach(({ date, fips, cases, deaths }) => {
      console.log(`${date} | Active Cases: ${cases - deaths}`);
      console.log(data);
    });
  });

timeseries-counties.json

The JSON is grouped by state and then county with each county having an array of objects with the following information:

Note:

Some data goes back as early as January 21st, 2020 (Ex. Washington), but most of the data starts after March 1st, 2020.

{
    "Washington": {
		"Snohomish": [
			{
				"date": "2020-01-21",
				"fips": "53061",
				"cases": "1",
				"deaths": "0"
			},
			{
				"date": "2020-01-22",
				"fips": "53061",
				"cases": "1",
				"deaths": "0"
			},
			...
			],
		"Spokane": [
			{
				"date": "2020-02-24",
				"fips": "53063",
				"cases": "4",
				"deaths": "0"
			},
			{
				"date": "2020-02-25",
				"fips": "53063",
				"cases": "4",
				"deaths": "0"
			},
			...
			]
		...
		}
	...
}

Example

Here is an example of using the data with JavaScript:

https://jsfiddle.net/0tw5hf4m/

fetch("https://amishpr.github.io/covid19-usa/timeseries-counties.json")
  .then(response => response.json())
  .then(data => {
    data.Washington.Snohomish.forEach(({ date, fips, cases, deaths }) => {
      	console.log(`${date} | Active Cases: ${cases - deaths}`);
  	console.log(data);
    });
  });

Projects using this dataset (➕Add Yours)

COVID-19 Tracker (repo): Displays current information about COVID-19 cases worldwide and by state for USA.

Adding your project

Please make a pull request adding a link to your project in this README.MD.

Rules:

  • Project must be Open Source
  • On your project cite amishpr/covid19-usa as a data source (with a link) as well as the nytimes/covid-19-data
  • Use the following format:
     [PROJECT NAME](PROJECT URL) ([repo](REPO URL)): DESCRIPTION
    • Note: Replace UPPER CASED values with your own

➕Add a new project to the list

Inspiration / Thank you

Please go checkout: pomber/covid19.

The idea, a lot of my GitHub Action setup, and other files are from that repo.

pomber made a timeseries.json for every country/territory using CSSEGISandData/COVID-19 and I wanted to do the same for every state in the United States.

License

This repository is licensed under the GNU General Public License v3.0.

The data from nytimes/covid-19-data is licensed under their own terms of use.