Giter VIP home page Giter VIP logo

justalk / covid19ph-api Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 77.2 MB

API for COVID 19 Cases in the Philippines from DOH last update. Get all the informations about the cases in the Philippines in a JSON format. A running live version of the system is available in the readme.md

Home Page: http://13.250.29.32:5000/cases

License: MIT License

JavaScript 100.00%
philippines covid covid19 tracker manila doh coronavirus-tracking coronavirus coronavirus-tracker project

covid19ph-api's Introduction

Alt text

Last version npm Last version Node version Travis Coverage Status Dependency status Last version XO code style

Star the project

API for COVID 19 Cases in the Philippines from DOH last update. Get all the informations about the cases in the Philippines in a JSON format. A running live version of the system is available here : Live Version

Features

  • DOH data download: Download automatically the latest datas from DOH

  • Powerfull API: Complete and fast API for the covid in Philippines

  • Flexible API: With many parameter, it's easy to build your application around it

API

method url description example
GET /cases Return the list of all cases Live Version
GET /cases/total Return the total number of cases in Philippines Live Version
GET /cases/cities/available Return the list of all cities affected Live Version
GET /cases/regions/available Return the list of all region affected Live Version
GET /cases/status/available Return the list of all status possible Live Version
List of all the parameters available for /cases (click to show)

The parameter are query parameter. They can be chain as the example under :

http://13.250.29.32:5000/cases?limit=1&age_lower=20&status=RECOVERED
params type description example
limit number the limit of the result Live Version
skip number skip a number of result Live Version
sort_key number the key use for sorting the result (can only work if sort_order is also defined) Live Version
sort_order number the order of the result : 1 for ascending or -1 for descending (can only work if sort_key is also defined) Live Version
age number the exact age of the cases Live Version
age_upper number Upper limit for age Live Version
age_lower number Lower limit for age Live Version
sex string All the cases with a certain sex : 'M' or 'F' Live Version
pregnant boolean All the cases pregnant : true or false Live Version
quarantined boolean All the cases quarantined : true or false Live Version
status string All the cases with the same status : List of status available Live Version
city string All the cases in the same city : List of city available Live Version
region string All the cases in the same region : List of region available Live Version
date_start_case date (format: MM/DD/YYYY) All the cases started at an exact date Live Version
date_start_case_before date (format: MM/DD/YYYY) All the cases started before an exact date Live Version
date_start_case_after date (format: MM/DD/YYYY) All the cases started after an exact date Live Version
date_result_release date (format: MM/DD/YYYY) All the cases with the result released at an exact date Live Version
date_result_release_before date (format: MM/DD/YYYY) All the cases with the result released before an exact date Live Version
date_result_release_after date (format: MM/DD/YYYY) All the cases with the result released after an exact date Live Version
date_result_positive date (format: MM/DD/YYYY) All the cases with a positive result at an exact date Live Version
date_result_positive_before date (format: MM/DD/YYYY) All the cases with a positive result before an exact date Live Version
date_result_positive_after date (format: MM/DD/YYYY) All the cases with a positive result after an exact date Live Version
date_recover date (format: MM/DD/YYYY) All the cases who recover at an exact date Live Version
date_recover_before date (format: MM/DD/YYYY) All the cases who recover before an exact date Live Version
date_recover_after date (format: MM/DD/YYYY) All the cases who recover after an exact date Live Version
date_died date (format: MM/DD/YYYY) All the cases who died at an exact date Live Version
date_died_before date (format: MM/DD/YYYY) All the cases who died before an exact date Live Version
date_died_after date (format: MM/DD/YYYY) All the cases who recover after an exact date Live Version
Additionnals informations (click to show)
  • The live version has a limit of 1000 cases showing by default. The limit can be change to higher value by setting the value parameter.
  • The sort_key and sort_order has to be use together for working.
  • The parameters can be mixed together for mixing your particular query.
  • The datas are updated every week.
  • Some datas fields can be empty because the datas from DOH are let with empty field.

How does it work ?

Few explanation on the cron job (click to show)

The cron has been set in the crontab with this setting :

crontab -e
0 0 * * * curl http://0.0.0.0:5000/cron/cases
  1. Download the notice PDF from DOH : http://bit.ly/DataDropPH
  2. Parse the file for finding the link of the google drive where the datas are uploaded
  3. Download the csv file with the data
  4. Fill up the database used by the API
Few explanation on the API (click to show)
  1. The api first check what is the parameter send and if it's a valid parameter (libs)
  2. The api then build the filter that gonna be use by mongodb (services)
  3. The api then return the result (dbs)

How to install the development version ?

Steps with informations (click to show)
  1. Cloning the repository
git cloning https://github.com/JustalK/COVID19PH-API.git
  1. Install all the dependencies
npm install
  1. Create an environnement file and fill up the information missing depending of your system
NODE_ENV=production

API_NAME=COVID19-PH
HOST=localhost
PORT=5000

CASES_LIMIT_GETTER=1000

DB_NAME=
DB_URI_DATA=
DB_URI_LOG=
DB_USER_DATA=
DB_PASS_DATA=
DB_HOST_LOG=
DB_PORT_LOG=
DB_NAME_LOG=
DB_USER_LOG=
DB_PASS_LOG=
  • NODE_ENV: The type of the environnement file
  • API_NAME: The name of the API
  • HOST: The host of the API
  • PORT: The port of the API
  • CASES_LIMIT_GETTER: The limit of cases that can be fetch without params
  • DB_NAME: The name of the database
  • DB_URI_DATA: The url of the database
  • DB_URI_LOG: The url of the log of the database
  • DB_USER_DATA: The user of the database
  • DB_PASS_DATA: The pass of the database
  1. Create a google credential secret file form the developer file :
{
  "type": "service_account",
  "project_id": "",
  "private_key_id": "",
  "private_key": "",
  "client_email": "",
  "client_id": "",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": ""
}

For not sending the key to everyone, I am using the secrethub, so the file is not present inside the repository.

  1. Activate on the google console the google drive API

License

MIT - Copyright © JUSTAL Kevin

covid19ph-api's People

Contributors

justalk avatar

Watchers

 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.