Giter Site home page Giter Site logo

covid-19-api's Introduction

COVID-19-API

We are using Johns Hopkins university COVID-19 git repo as source data and converting it into JSON and SQL dump. We have scripts which run periodically to update data in this repository.

Usage

Base path for COVID-19-API is https://mahabub81.github.io/covid-19-api/api/v1.

We have the following endpoints

  1. World summary (https://mahabub81.github.io/covid-19-api/api/v1/world-summary.json)
  2. World summary time series (https://mahabub81.github.io/covid-19-api/api/v1/world-summary-time-series.json)
  3. Countries and their latest update (https://mahabub81.github.io/covid-19-api/api/v1/countries.json)
  4. Time series for all countries, separate endpoint for each country by country ISO code ( Bangladesh, USA, China, India and others country )
  5. Time Series for only USA states (New York, Florida and other US states)

Javascript Code example for world summary

const fetch = require('node-fetch');  
fetch('https://mahabub81.github.io/covid-19-api/api/v1/world-summary.json')  
    .then(res => res.json())  
    .then(json => console.log(json));

output

{
  last_update: '2020-05-10 09:32:31',
  confirmed: 4040289,
  deaths: 279565,
  recovered: 1380716,
  active: 2395111
}

Example for specific country recent update

const fetch = require('node-fetch');  
fetch('https://mahabub81.github.io/covid-19-api/api/v1/countries.json')  
    .then(res => res.json())  
    .then(json => console.log(json.find(country => ( country.iso2.toLowerCase() == 'bd'))));

output

{
  uid: '50',
  iso2: 'BD',
  iso3: 'BGD',
  code3: '50',
  fips: '',
  admin2: '',
  province_state: '',
  country_region: 'Bangladesh',
  lat: '23.685',
  long_: '90.3563',
  combined_key: 'Bangladesh',
  population: '164689383',
  latest: {
    last_updated_at: '2020-05-10',
    confirmed: 14657,
    deaths: 228,
    recovered: 2650,
    active: 11779,
    incident_rate: '8.899784389865617',
    people_tested: '',
    people_hospitalized: '',
    mortality_rate: '1.5555707170635191'
  },
  states: []
}

More Example

SQL dump

MySQL and Postgres dump available, we update the dump periodically while there is an update in source repo. Dump updates are less frequent than the JSON data.

  1. MySQL
  2. Postgres

Working in SQL Example

Postman collection

Postman collection: https://documenter.getpostman.com/view/3629958/SzmfYHVh

Run in your server

To run the projects in your server clone this git repo and go to docker folder. Based on your need you can choose specific docker-compose file.

git clone https://github.com/mahabub81/covid-19-api.git 
cd ./covid-19-api/docker
# run the complete project
docker-compose up -d
#Run Only nginx comment the above line and uncomment the below line
#docker-compose  -f only-nginx.yaml up -d 
# run only the data parser```
#docker-compose  -f only-parser.yaml up -d 

Contributing

Pull requests are always welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

covid-19-api's People

Contributors

mahabub81 avatar mahabubportonics avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

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.