npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@justalk/covid19ph-api

v3.1.0

Published

API for COVID 19 Cases in the Philippines

Downloads

8

Readme

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 |

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 |

  • 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 ?

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
  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 ?

  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