Giter VIP home page Giter VIP logo

covid-api's Introduction

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 we hope that you use it in a sensible manner and whenever possible cache response for a few hours as the underlying API's are updated thrice a day daily.

Updation

The datasets are updated thrice a day daily. As of now, we manually trigger the updation of our API's as we don't have any downstream notification's sent on updation. We are also working on having a notification mechanism in place to support all the consumers of the API. PR's are always welcome!

Documentation

Postman collection has been created along with documentation for you to get started with this project. Docs can be found here

Examples

  1. How do I get the global data on any given day?

    You could use the /api/v1/global/2020-03-15 endpoint

  2. How do I get the data for a country in a date-range?

    Ex: To get the data for India between 10th and 19th March 2020, you could use /api/v1/country/IND/timeseries/2020-03-10/2020-03-19

  3. How do I get the data for the last record for a country?

    Ex: You'll need to get the last date for any country by hitting the /api/v1/latest-date endpoint and then use that date to query the country endpoint like this /api/v1/country/IND/2020-03-15

Local Setup

Clone the repo locally

git clone https://github.com/backtrackbaba/covid-api.git

Setup a new Python Environment and source it

Python version 3.6+ would be required to run the project

virtualenv -p python3 path/for/environment/covid

source path/for/environment/covid/bin/activate

Set and source the env file

cd path/to/cloned/project

# Change the values of env as per your local setup using example.env

source .env

Starting application

cd path/to/cloned/project

flask run

Seeding the database

Once the local instance of flask is up and running, you could use the /protected/update-db endpoint to start with the seeding of the database

Updating the database

Same as what you did seeding the database, you'll need to hit the same endpoint to start updating the DB with the latest data

Debugging

While developing an endpoint, you could remove the cache decorator from the endpoint and enable it once the whole endpoint is up and running. Changes have been made in v2 to ensure this thing is taken care of automatically in local environment.

While hitting any global endpoints which, you might get into TypeError which is usually caused when JHU, the data provider changes names of any of the countries in the data or add a name which isn't in the country_name_to_iso.json file. You could simply add the same into the file and update the database again

Please open an issue if you get into some other problem and aren't able to figure out why it happened. I'll be glad to discuss any design decisions that you might come across in the code.

Sources

Novel Coronavirus (COVID-19) Cases, provided by JHU CSSE

JSON time-series of coronavirus cases (confirmed, deaths and recovered) per country - updated daily

Contributors

Saiprasad Balasubramanian - LinkedIn - Github

Harsh Jain - LinkedIn

Girisha Navani - LinkedIn

Contributing

Contributions are always welcome and encouraged!! This code was whipped out in a very shot span of time for a friend to query on it. There's some refactoring to be done to remove any hacks and build on in a good manner. Ideas are always welcome

Roadmap

There's a roadmap in mind to build up more endpoints. As of now there are just two endpoints which with plans to add more. I'll put it out here in the Kanban board as link it with the Issues.

License

MIT Licensed

covid-api's People

Contributors

backtrackbaba avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

covid-api's Issues

covidapi.info/api/v1 timing out

Hi,

The endpoing is timing out. You can try with

curl -i -v 'https://covidapi.info/api/v1/country/GBR/timeseries/2020-03-01/2021-07-22' \
  -H 'content-type: application/json'

What timezone are the responses in?

I am trying to display some info on a website received from this endpoint, something along the lines of "40,000 cases as of 04/11/2020" but that date can differ quite a bit depending on where in the world the browser is if I don't know the timezone of the response.

If no timezone information is provided, ISO 8601 formatted dates are to be represented as local time Info here

Thank you for the help!

No updates

Autoupdate is broken? Last update was at 2020-03-26

I'm using fetch and i'm unable to fetch only confirmed

So I tried to use the latest cases of india and fetched that link, from that text, I wanted only the confirmed, recovered and deaths. I can't figure out how to get it. Can someone help me?
Used node-fetch.
.then(result => console.log(result["2020-04-11"].confirmed)))
This is the code I tried, but it just shows TypeError.
I used this because there were no , after result, 2020-04-11 and confirmed.
Thank you!

Data for 2020-04-07

Hello I appreciate this great work.
Why there is no data for 2020-04-17?
best regards.

missing countries

I was searching for data related to Solomon Islands and western Samoa but couldn't get anything from request.

alternative data source?

Thanks for your API/service. Among JSON API-s, I like it most so far.

Many people is disappointed by JSU's dropping the recovered category. As a consequence your source (pomper's) is probably going to drop it too. In the ongoing discussion I have come across an alternative data source which provides the recovered category and also looks like a clean CSV times series data-set: https://github.com/ulklc/covid19-timeseries

You might want to consider it.

Having said that, I am still hoping that JSU reconsiders since I need the state/province resolution.

Historic data is 1 week behind

Hello, thanks for your amazing API.

The historic data for any country seems to be one week behind real time, for eg for India the api as of today (22nd April) shows 17th April as the latest date and the same is true for any other country

Critical cases

  1. Other api's do have critical cases, but this api not. Any alternative source?

  2. Why no filter on contents? ASia, africa etc

  3. Also many countries. Togo for example does not have any data. Why is his? Is it because there are no reported cases in Tonga, Tuvalu, Tajikistan etc ?

Current database design could be improved (i.e for adding things like pagination)

Hi there!

Good job on this project, a data source conforming to ISO 3166 standard is just what I needed for an app a friend and I are making.

The only thing missing was a /countries endpoint, which would list all the countries with their respecting the latest data. I went to add that myself, but I found that the current data model design makes this difficult.

So I propose changing it for something like this (the relationship is one-to-many):
Untitled

That way it could be trivial to add endpoints like the one I'm trying to add (i.e we would just need to join and fetch the latest record for each). I also think that the current endpoints would be simplified (for example, the global count would be a simple sum on the database side).

I don't think it would be too difficult to implement this; I can do it myself but I wanted to consult first since the current logic will be affected. What do you think?

Data delay?

Hi there, first of all thank you for making this!

You said you have the data pulling 3 times a day...I haven't seen the numbers for total confirmed cases change since I looked at the site early this morning. They don't match up with the John Hopkins dashboard. Has the data just not updated yet?

m

certificate errors

Hi,

The API has started returning certificate errors:

curl -i -v 'https://covidapi.info/api/v1/country/FRA/timeseries/2020-01-01/2020-12-19' \
  -H 'Accept: application/json'

returns

*   Trying 134.209.147.6...
* TCP_NODELAY set
* Connected to covidapi.info (134.209.147.6) port 443 (#0)
* ALPN, offering http/1.1
* SSL certificate problem: Invalid certificate chain
* Closing connection 0
curl: (60) SSL certificate problem: Invalid certificate chain
More details here: https://curl.haxx.se/docs/sslcerts.html

Server Migration

The server which hosts CovidAPI is currently at a higher configuration than actually required. There'll be migration on Sunday 23rd August to a smaller server.

There isn't an expected downtime but the API response might be a little slow for 5-10 mins between 4 PM to 6 PM IST.

Service Down?

Hi, thanks for the great work here.
It seems the service is down. Is it being discontinued?
Thanks,
Nuno

Data not updated

Hi! Are you guys still updating all the data? Because I've seen it's not been updated since June 4th. Thank you

Data delayed?

I can only access data from 2 days ago, how can I get the latest data? Do I need to update something?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.