Code Monkey home page Code Monkey logo

m-media-group / covid-19-api Goto Github PK

View Code? Open in Web Editor NEW
397.0 10.0 31.0 99 KB

This is the code running in AWS Lambda powering covid-api.mmediagroup.fr/v1. The API provides realtime and historical data on Coronavirus COVID-19 confirmed cases, deaths, and recovered cases. This API has now been called over 40 million times, thank you!

Home Page: https://covid-api.mmediagroup.fr/v1/cases

License: GNU Affero General Public License v3.0

Python 98.65% Dockerfile 1.35%
historical-data realtime-data coronavirus covid-19 coronavirus-api api aws aws-lambda python3 aws-lambda-python

covid-19-api's Introduction

Covid-19-API

This API deprecated on the 31st of October, 2022.

This is the code running in AWS Lambda powering covid-api.mmediagroup.fr/v1

In our bid to do our part, we've created a free public API for others to build apps upon. The API returns live cases and historical data.

This API has now been called over 30 million times now!

The API has endpoints to handle historical as well as near realtime data (updated once every hour). The average API response time is between 70 and 250 ms but may take up to 3 seconds, depending if the request is in the cache or not.

You can see a human-friendly webpage that uses the API here https://mmediagroup.fr/covid-19.

What the API is for

The API is intended for developers, machines, programs, and other websites to be able to quickly fetch up to date information on the COVID-19 epidemic.

It can be used to build tools and systems that are used for data analysis all the way to websites that act as public dashboards and charts.

Using the API

If you're a developer, you can use the API right now. Please be nice to us and cache the data locally so we don't pay too much :)!

API base:
https://covid-api.mmediagroup.fr/v1

Live cases data

Request:
GET /cases

Optional query parameters

  • country
    • Any country name (case sensitive)
  • ab
    • Any country ISO abbreviation (example: FR) (takes precedence over "country" parameter)
  • continent
    • Any world continent (example: Europe) (takes precedence over "country" parameter)

Example request:

GET /cases?country=France

Example response:

{
  "All": {
    "confirmed": 2604595,
    "recovered": 195365,
    "deaths": 62548,
    "country": "France",
    "population": 64979548,
    "sq_km_area": 551500,
    "life_expectancy": "78.8",
    "elevation_in_meters": 375,
    "continent": "Europe",
    "abbreviation": "FR",
    "location": "Western Europe",
    "iso": 250,
    "capital_city": "Paris",
    "lat": "46.2276",
    "long": "2.2137",
    "updated": "2020/12/26 12:21:56+00"
  },
  "French Guiana": {
    "lat": "4",
    "long": "-53",
    "confirmed": 12685,
    "recovered": 9995,
    "deaths": 71,
    "updated": "2020/12/26 12:21:56+00"
  }
}

Historical cases data

Request:
GET /history

Required query parameters

  • status
    • Confirmed
    • Deaths
    • Recovered (DEPRECIATED)

Optional query parameters

  • country
    • Any country name (case sensitive)
  • ab
    • Any country ISO abbreviation (example: FR) (takes precedence over "country" parameter)
  • continent
    • Any world continent (example: Europe) (takes precedence over "country" parameter)

Example request:

GET /history?country=Germany&status=deaths

Example response:

{
  "All": {
    "country": "Germany",
    "population": 82114224,
    "sq_km_area": 357022,
    "life_expectancy": "77.4",
    "elevation_in_meters": 263,
    "continent": "Europe",
    "abbreviation": "DE",
    "location": "Western Europe",
    "iso": 276,
    "capital_city": "Berlin",
    "dates": {
      "2020-12-25": 29580,
      "2020-12-24": 29330,
      "2020-12-23": 28909,
      "2020-12-22": 28096,
      "2020-12-21": 27110
    }
  }
}

Vaccines data

Request:
GET /vaccines

Optional query parameters

  • country
    • Any country name (case sensitive)
  • ab
    • Any country ISO abbreviation (example: FR) (takes precedence over "country" parameter)
  • continent
    • Any world continent (example: Europe) (takes precedence over "country" parameter)

Example request:

GET /vaccines?country=France

Example response:

{
  "All": {
    "administered": 7927771,
    "people_vaccinated": 2297100,
    "people_partially_vaccinated": 5630671,
    "country": "France",
    "population": 64979548,
    "sq_km_area": 551500,
    "life_expectancy": "78.8",
    "elevation_in_meters": 375,
    "continent": "Europe",
    "abbreviation": "FR",
    "location": "Western Europe",
    "iso": 250,
    "capital_city": "Paris",
    "lat": "46.2276",
    "long": "2.2137",
    "updated": "2020/12/26 12:21:56+00"
  }
}

Authorization

No authorisation is required to fetch data from the API.

Built using this API

Feel free to share your projects that implement this API!

Data sources

Historical data: https://github.com/CSSEGISandData/COVID-19

Realtime data: https://opendata.arcgis.com/datasets/bbb2e4f589ba40d692fab712ae37b9ac_1.csv

Population data:
https://github.com/M-Media-Group/country-json/blob/master/src/countries-master.json

Vaccine data: https://github.com/govex/COVID-19

Rate limits

A rate limiter is applied. Realistically, the data updates around once an hour so more frequent requests are futile (though possible). Ridiculous amount of requests will result in you being banned.

GNU AGPLv3 Licence

Additionally, we ask you to please not create API's that just use this API as the underlying source.

If you make absurd amounts of requests to our API we will block you. You can contact us to resolve the issue. Please cache the API responses with a lifetime of at least 10 minutes to avoid this happening.

covid-19-api's People

Contributors

criseskhaos avatar masterbrian99 avatar mwargan avatar yano404 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  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  avatar  avatar  avatar  avatar  avatar  avatar

covid-19-api's Issues

Daily data

Include today's confirmed and today's deaths count in the cases data.

I've implemented this on the wrapper I'm using but it would be great having this natively.

Link to the wrapper

Missing updated field

Some countries doesn't have the updated field on the /cases endpoint. This are the ones I have noticed:

  • US
  • China

NA

No issue yet

Add my Go program github to your README :)

Hello,
I talked with you on Reddit a few days ago regarding creating a Golang program that I was using for a personal project and you wanted me to put this here when I began work on it, so now I got it up on github finally! haha. It's still a work in progress , but it does work and it's pretty neat :) im u/lemonizer96 btw. here's my github link https://github.com/Fr0sty404/GoCoronaVirusAPIParser
I also added a special thanks in my README to thank you and I made a link to your public API :)
Thank you for this !

Issue

Does it only show stats of specific countries or it shows global statics well?

Number of vaccinated is wrong

Number of people_vaccinated and people_partially_vaccinated is wrong for certain countries (Canada, India, UK, ...).
For example, /vaccines?country=Canada returns

{
  "All": {
    "administered": 49836,
    "people_vaccinated": 0,
    "people_partially_vaccinated": 0,
    "country": "Canada",
    "population": 36624199,
    "sq_km_area": 9970610,
    "life_expectancy": "79.4",
    "elevation_in_meters": 487,
    "continent": "North America",
    "abbreviation": "CA",
    "location": "North America",
    "iso": 124,
    "capital_city": "Ottawa", 
    "updated": "2021/05/12 00:00:00+00"
  }
}

This is because Province_State column was added by the vaccine data provider.
Data of the country having Province_State column seems to be overwritten by the next row.

, Canada, ...
Alberta, Canada, ...
British Columbia, Canada, ...

I suggest the solutions:

  1. /vaccines?country=foo returns only 'All'.
    {
      "All": {
        "administered": ...,
        "people_vaccinated": ...,
        "people_partially_vaccinated": ...,
        ...
      }
    }
    
  2. /vaccines?country=foo returns "All" and provinces.
    {
     "All": {
       "administered": ...,
       "people_vaccinated": ...,
       "people_partially_vaccinated": ...,
       ...
     },
     "Province1": {
       "administered": ...,
       "people_vaccinated": ...,
       "people_partially_vaccinated": ...,
       ...
     },
     ...
    }
    

{'message': 'Missing Authentication Token'}

Hi,
I would like to use this API but I can not get a response because of the following {'message': 'Missing Authentication Token'}
How do I get an Authentication Token or Sign up for one ?

Inconsistent license information?

In your project, you have a GPLv3 LICENSE file, but in the README, you state that it is licensed under AGPLv3. In addition, you also provide other stipulations such as restrictions for commercial use, while the license allows commercial use.

This results in a lot of ambiguity with how the API should be used or modified.

US Cases data

The /cases endpoint is returning 0 confirmed and 0 deaths for the US

Testing data

Will testing data be available as history data?

Something like /history?status=testing

json

hello guys
How can i access to the attributes in json data ?

Covid 211

{"Afghanistan": {"All": {"confirmed": 130113, "recovered": 77280, "deaths": 5477, "country": "Afghanistan", "population": 35530081, "sq_km_area": 652090, "life_expectancy": "45.9", "elevation_in_meters": null, "continent": "Asia", "abbreviation": "AF", "location": "Southern and Central Asia", "iso": 4, "capital_city": "Kabul", "lat": "33.93911", "long": "67.709953", "updated": "2021/07/08 23:21:23+00"}}, "Albania": {"All": {"confirmed": 132565, "recovered": 130037, "deaths": 2456, "country": "Albania", "population": 2930187, "sq_km_area": 28748, "life_expectancy": "71.6", "elevation_in_meters": null, "continent": "Europe", "abbreviation": "AL", "location": "Southern Europe", "iso": 8, "capital_city": "Tirana", "lat": "41.1533", "long": "20.1683", "updated": "2021/07/08 23:21:23+00"}}, "Algeria": {"All": {"confirmed": 143652, "recovered": 99931, "deaths": 3798, "country": "Algeria", "population": 41318142, "sq_km_area": 2381741, "life_expectancy": > "69.7", "elevation_in_meters" : 800, "co…[]# - - [ ] (~~@emme83 ~~

/vaccines api returns unexpected response

Please check below request details

GET https://covid-api.mmediagroup.fr/v1/vaccines?country=France

Expected Response as per documentation:

{
  "All": {
    "administered": 7927771,
    "people_vaccinated": 2297100,
    "people_partially_vaccinated": 5630671,
    "country": "France",
    "population": 64979548,
    "sq_km_area": 551500,
    "life_expectancy": "78.8",
    "elevation_in_meters": 375,
    "continent": "Europe",
    "abbreviation": "FR",
    "location": "Western Europe",
    "iso": 250,
    "capital_city": "Paris",
    "lat": "46.2276",
    "long": "2.2137",
    "updated": "2020/12/26 12:21:56+00"
  }
}

Actual Response received -

{
    "Global": {
        "All": {
            "population": 7444509223,
            "administered": 0,
            "people_vaccinated": 0,
            "people_partially_vaccinated": 0
        }
    }
}

image

No Active Cases

I know that what you have provided is already too much but if it is possible then it would be really great to add active cases

thank you!
:D

ISO 3166-1 Country codes

Consider using ISO 3166-1 alpha-2 or alpha-3 country codes for accessing the data in a more standardized way.

E.g.
/cases?country=FR for obtain France cases data.

Populations missing for certain countries

There are some populations missing for several countries:
Bahamas, The
Cabo Verde
Congo (Brazzaville)
Congo (Kinshasa)
Cote d'Ivoire
Czechia
Eswatini
Fiji
Gambia, The
Holy See
Korea, South
Kosovo
Montenegro
Russia
Serbia
Sri Lanka
Taiwan*
US

This is likely caused by the country names from the COVID-19 data not matching the names in the population data source.

Cases Endpoint not returning expected Json Load

Hi when i send a request to the cases endpoint. I get the following Json back
https://covid-api.mmediagroup.fr/v1/cases
{"Global": {"All": {"population": 7444509223, "confirmed": 0, "recovered": 0, "deaths": 0}}}

When i use query Parameters i get the same result.
https://covid-api.mmediagroup.fr/v1/cases?country=France

{"Global": {"All": {"population": 7444509223, "confirmed": 0, "recovered": 0, "deaths": 0}}}

Vaccines and History Endpoints are working

adding python naming convention

Most of the names(variables and functions) are written with camel case naming convention while python use underscore case naming convention, i'll try to do s small PR for improvement.

Inconsistend Date Formats

Hi,

i found that the Date Formats on Vaccines and Cases Endpoint are different.

Vaccines:
"2021/12/25 00:00:00+00"

Cases:
"2021-12-25 04:21:37"

I dont know if this is relevant for you, but just wanted to let you knows.

e.g. (Vaccines)
image

e.g.(Cases)
image

Missing authentication token

I cannot access any data for some reason. It worked a few days ago but right now all the country data are gone.

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.