Loading repository dataβ¦
Loading repository dataβ¦
A-HA-823 / repository
π¦ A simple and fast (< 200ms) API for tracking the global coronavirus (COVID-19, SARS-CoV-2) outbreak. It's written in python using the π₯ FastAPI framework. Supports multiple sources!
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
Provides up-to-date data about Coronavirus outbreak. Includes numbers about confirmed cases, deaths and recovered. Support multiple data-sources.
Live global stats (provided by fight-covid19/bagdes) from this API:
Specify source parameter with ?source=nyt. NYT also provides a timeseries! To view timelines of cases by US counties use ?source=nyt&timelines=true
JHU (our main data provider) no longer provides data for amount of recoveries, and as a result, the API will be showing 0 for this statistic. Apologies for any inconvenience. Hopefully we'll be able to find an alternative data-source that offers this.
Currently 3 different data-sources are available to retrieve the data:
jhu - https://github.com/CSSEGISandData/COVID-19 - Worldwide Data repository operated by the Johns Hopkins University Center for Systems Science and Engineering (JHU CSSE).
csbs - https://www.csbs.org/information-covid-19-coronavirus - U.S. County data that comes from the Conference of State Bank Supervisors.
nyt - https://github.com/nytimes/covid-19-data - The New York Times is releasing a series of data files with cumulative counts of coronavirus cases in the United States. This API provides the timeseries at the US county level.
jhu data-source will be used as a default source if you don't specify a source parameter in your request.
All endpoints are located at coronavirus-tracker-api.herokuapp.com/v2/ and are accessible via https. For instance: you can get data per location by using this URL:
https://coronavirus-tracker-api.herokuapp.com/v2/locations
You can open the URL in your browser to further inspect the response. Or you can make this curl call in your terminal to see the prettified response:
curl https://coronavirus-tracker-api.herokuapp.com/v2/locations | json_pp
Consume our API through our super awesome and interactive SwaggerUI (on mobile, use the mobile friendly ReDocs instead for the best experience).
The OpenAPI json definition can be downloaded at https://coronavirus-tracker-api.herokuapp.com/openapi.json
Getting the data-sources that are currently available to Coronavirus Tracker API to retrieve the data of the pandemic.
GET /v2/sources
Sample response
{
"sources": [
"jhu",
"csbs",
"nyt"
]
}
Getting latest amount of total confirmed cases, deaths, and recovered.
GET /v2/latest
Query String Parameters
| Query string parameter | Description | Type |
|---|---|---|
| source | The data-source where data will be retrieved from (jhu/csbs/nyt). Default is jhu | String |
Sample response
{
"latest": {
"confirmed": 197146,
"deaths": 7905,
"recovered": 80840
}
}
Getting latest amount of confirmed cases, deaths, and recovered per location.
GET /v2/locations/:id
Path Parameters
| Path parameter | Required/Optional | Description | Type |
|---|---|---|---|
| id | OPTIONAL | The unique location id for which you want to call the Locations Endpoint. The list of valid location IDs (:id) can be found in the locations response: /v2/locations | Integer |
Query String Parameters
| Query string parameter | Description | Type |
|---|---|---|
| source | The data-source where data will be retrieved from (jhu/csbs/nyt). Default is jhu | String |
GET /v2/locations/39
Sample response
{
"location": {
"id": 39,
"country": "Norway",
"country_code": "NO",
"country_population": 5009150,
"province": "",
"county": "",
"last_updated": "2020-03-21T06:59:11.315422Z",
"coordinates": { },
"latest": { },
"timelines": {
"confirmed": {
"latest": 1463,
"timeline": {
"2020-03-16T00:00:00Z": 1333,
"2020-03-17T00:00:00Z": 1463
}
},
"deaths": { },
"recovered": { }
}
}
}
GET /v2/locations
Query String Parameters
| Query string parameter | Description | Type |
|---|---|---|
| source | The data-source where data will be retrieved from.Value can be: jhu/csbs/nyt. Default is jhu | String |
| country_code | The ISO (alpha-2 country_code) to the Country/Province for which you're calling the Endpoint | String |
| timelines | To set the visibility of timelines (daily tracking).Value can be: 0/1. Default is 0 (timelines are not visible) | Integer |
Sample response
{
"latest": {
"confirmed": 272166,
"deaths": 11299,
"recovered": 87256
},
"locations": [
{
"id": 0,
"country": "Thailand",
"country_code": "TH",
"country_population": 67089500,
"province": "",
"county": "",
"last_updated": "2020-03-21T06:59:11.315422Z",
"coordinates": {
"latitude": "15",
"longitude": "101"
},
"latest": {
"confirmed": 177,
"deaths": 1,
"recovered": 41
}
},
{
"id": 39,
"country": "Norway",
"country_code": "NO",
"province": "",
"county": "",
"last_updated": "2020-03-21T06:59:11.315422Z",
"coordinates": {
"latitude": "60.472",
"longitude": "8.4689"
},
"latest": {
"confirmed": 1463,
"deaths": 3,
"recovered": 1
}
}
]
}
Response definitions
| Response Item | Description | Type |
|---|---|---|
| {latest} | The total amount of confirmed cases, deaths and recovered for all the locations | Object |
| {latest}/confirmed | The up-to-date total number of confirmed cases for all the locations within the data-source | Integer |
| {latest}/deaths | The up-to-date total amount of deaths for all the locations within the data-source | Integer |
| {latest}/recovered | The up-to-date total amount of recovered for all the locations within the data-source | Integer |
| {locations} | The collection of locations contained within the data-source | Object |
| {location} | Information that identifies a location | Object |
| {latest} | The amount of confirmed cases, deaths and recovered related to the specific location | Object |
| {locations}/{location}/{latest}/confirmed | The up-to-date number of confirmed cases related to the specific location | Integer |
| {locations}/{location}/{latest}/deaths | The up-to-date number of deaths related to the specific location | Integer |
| {locations}/{location}/{latest}/recovered | The up-to-date number of recovered related to the specific location | Integer |
| {locations}/{location}/id |