Covid19 REST API's

backtrackbaba

Saiprasad Balasubramanian

Posted on March 23, 2020

Covid19 REST API's

The team at Johns Hopkins University CSSE has been maintaining a database of cases across the globe in CSV files. Pomber, a user on Github has recently converted the same dataset into a JSON file.

My friends - Harsh Jain, Girisha Navani and I took it up as a learning opportunity and decided to work on the data instead of building yet another dashboard. We took the initiative of building a heavily cached, blazingly fast REST interface on top of the data to enable other developers.

GitHub logo backtrackbaba / covid-api

API's to interact with COVID19 dataset by John Hopkins University

Covid API

Introduction

This project builds upon the dataset of John Hopkins University in CSV form which was converted to JSON Time Series format by pomber.

Our project intends to make that set queryable in a manner in which it could be easily consumed to build public dashboards.

Overview

Analyzing the dataset, here are the major points that we came across.

The API's have been mapped to use ISO 3166 standard to query countries instead of names as in the source datasets built upon as it wasn't in a standard format.

The API's consume & return dates as per ISO 8601 standards in yyyy-mm-dd format The dates have been normalized from the underlying dataset by padding single digits in the date and month section.

Authentication

There's no authentication required. Anybody and everybody is welcome to use this widely.

Rate limit

There is no rate limit of any kind but…

Our endpoints are capable of the following:

Country specific historic data: Right from 22nd January to the latest updated day.

Country specific data for a particular date: This gives you an insight into the spread of the virus in a country on a particular date.

Latest Global Count: Gives you the latest updated count of the virus globally

Global count on a particular date: This data gives you a count of the virus globally, on a particular date

Global count in a date range: This gives you the number of cases in a date range

Our project internally consumes Pomber's JSON data and cleans it a bit by changing all the references of Country names to their respective three-character ISO codes and the dates have been standardized to adhere to ISO-8601 specs of yyyy-mm-dd

Additionally, we have taken care to ensure that our APIs are versioned so that they do not affect any downstream users if our upstream data changes.
Johns Hopkins, has yesterday said that their data is going to change a bit which means we too would move on to v2 of our API's by adapting to changes at the same time still maintaining the v1 endpoints.

Upcoming changes in time series tables #1250

We will update the time series tables in the following days, aiming to provide a cleaner and more organized dataset consistent with our new/current naming convention. We will also be reporting a new variable (i.e, testing), as well as data at the county level for the US. All files will continue to be updated daily around 11:59PM UTC.

The followiing specific changes will be made:

  • Three new time series tables will be added for the US. The first two will be the confirmed cases and deaths, reported at the county level. The third, number of tests conducted, will be reported at the state level. These new tables will be named time_series_covid19_confirmed_US.csv, time_series_covid19_deaths_US.csv, time_series_covid19_testing_US.csv, respectively.

  • Changes to the current time series include the removal of the US state and county-level entries, which will be replaced with a new single country level entry for the US. The tables will be renamed time_series_covid19_confirmed_global.csv and time_series_covid19_deaths_global.csv, and time_series_covid19_testing_global.csv, respectively.

  • The ISO code will be added in the global time series tables.

  • The FIPS code will be added in the new US time series tables.

  • We will no longer provide recovered cases.

  • The current set of time series files will be moved to our archive folder, and the new files will be added to the current folder.

Thanks!

Update: time_series_covid19_recovered_global.csv is added.

These are the endpoints that have already been deployed. A few more are in the pipeline and we would love to get the help of open source community in taking initiative this forward!

As Software Developers, there isn't much that we could do on the field to help combat the virus, but the geeks inside us made us take us this initiative to help curtail the spread of false information and rely on the data provided by global experts such as John Hopkins

Github Repository: https://github.com/backtrackbaba/covid-api

Documentation: Postman Docs

Website: https://covidapi.info

P.S: Here's our tech stack

  • Python

  • Flask

  • Redis

  • Gunicorn

  • Nginx

  • PostgreSQL

  • Hosted on DigitalOcean

Do let us know if you have any suggestions or feedback or any other endpoint which could make your life easier. Contributions are always welcome and encouraged!

Hack on!

💖 💪 🙅 🚩
backtrackbaba
Saiprasad Balasubramanian

Posted on March 23, 2020

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Covid19 REST API's
showdev Covid19 REST API's

March 23, 2020