Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
4de58ea
Add latest screenshot
Mar 26, 2020
7c63f55
Add features changes
Mar 26, 2020
ec1297e
Improve help
Mar 26, 2020
5aa1d09
Update version
Mar 26, 2020
125ce13
Improve help
Mar 26, 2020
2469de6
Modify Readme
Mar 26, 2020
02d51a8
Add more saying
Mar 26, 2020
4b07597
Update threads.json
aesycos Mar 26, 2020
debbde9
Merge pull request #5 from aesycos/patch-1
warengonzaga Mar 26, 2020
40134f4
Merge from Dev
Mar 26, 2020
ef20128
Add supporter name
Mar 26, 2020
689dc40
Change the default message
Mar 26, 2020
f4026fa
One line return
ianvizarra Mar 27, 2020
c3f889a
Removed optional curly brackets
ianvizarra Mar 27, 2020
6092564
Merge pull request #6 from ianvizarra/dev
warengonzaga Mar 27, 2020
e7b19f1
Add route for help
Mar 27, 2020
e24660a
Remove distasteful coffee thing
Mar 27, 2020
16398df
Changes for greedy open source developer
warengonzaga Mar 27, 2020
446bba4
Merge branch 'master' into dev
Mar 27, 2020
a88d078
Add support for HTTPie
tanuck Mar 27, 2020
92f1b19
Merge pull request #11 from tanuck/master
warengonzaga Mar 27, 2020
8650830
Modify readme file
Mar 27, 2020
78a302e
Add new resources
Mar 27, 2020
538c4be
Create FUNDING.yml
warengonzaga Mar 28, 2020
e0ae2ec
Improve Footer
Mar 28, 2020
60a6028
Update version
Mar 28, 2020
1d3064b
Add few tweaks
Mar 28, 2020
c8f4731
Update version
Mar 28, 2020
d63c050
Add new supporter
Mar 28, 2020
48f304f
Historical Graph of Cases and Deaths
ianvizarra Mar 29, 2020
562d7f9
Added Collaborator
ianvizarra Mar 29, 2020
d1c9974
Merge pull request #12 from ianvizarra/dev
warengonzaga Mar 29, 2020
398b65e
Updated Basic Usage and Features
ianvizarra Mar 29, 2020
49bbae6
Reduced height chart
ianvizarra Mar 29, 2020
c3fa367
Merge pull request #13 from ianvizarra/dev
warengonzaga Mar 29, 2020
e661b0b
Better documentation
Mar 29, 2020
8773438
Small Fix
Mar 29, 2020
bff452c
Update version
Mar 29, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

custom: ['https://warengonza.ga/coffee4dev','https://paypal.me/warengonzagaofficial']
115 changes: 82 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,39 +30,104 @@ This simple application offers you the following features...
* Simple layout and easy to understand.
* By country query.
* e.g. (```/country```).
* By country with History Chart
* e.g. (```/history/<country>/``` or append with ```<cases or deaths>```)
* Windows CMD support.
* e.g. (```/cmd``` or ```/cmd/country```).
* Plain or Basic version.
* e.g. (```/plain``` or ```/plain/country```) or (```/basic```, ```/basic/country```).
* Random health saying on footer.

_More features coming soon..._

## Usage
## Basic Usage

### Global Tracking

To track COVID-19 cases on CLI globally, all you need to do is to use CURL or WGET command.

#### CURL

```bash
curl https://covid19tracker.xyz
```

or
#### WGET

```bash
wget -i https://covid19tracker.xyz && cat index.html
```

To track COVID-19 cases on CLI by country, all you need to do is to add country name or code after ```/```.
#### HTTPie

```bash
# visit httpie.org
http http://covid19tracker.xyz
```

### Country Tracking

To track COVID-19 cases on CLI by country, all you need to do is to append the URL with the country name or country [ISO 3166-1](https://warengonza.ga/iso-3166-1-codes) code.

#### Country Name

```bash
# example usage
curl https://covid19tracker.xyz/philippines
```

or
#### Country ISO 3166-1 Code

```bash
# /ph or /phl is ISO 3166 code of the Philippines
curl https://covid19tracker.xyz/ph
```

#### Country with History Chart

```bash
# shows result with history chart
curl https://covid19tracker.xyz/history/ph
```

```bash
# shows by default a history chart
curl https://covid19tracker.xyz/history/ph/cases
```

```bash
# shows result with history chart
curl https://covid19tracker.xyz/history/ph/deaths
```

## Advance Usage

### Check Update Automagically

```bash
# check update every 10 seconds (where -n 10 is the interval)
watch -n 10 curl https://covid19tracker.xyz
```

### Create a Shortcut Command

```bash
# set a desired alias for the command (replace endcov with your desired alias)
# this will give you a global update
# alias <your alias>="curl https://covid19tracker.xyz"

alias endcov="curl https://covid19tracker.xyz"

# if you want to track a specific country
# alias <your alias>< coutry alias>="curl https://covid19tracker.xyz/<country name, ISO2, ISO3 here>"

alias endcovPH="curl https://covid19tracker.xyz/philippines"
```

## Official Blog

Many people asking me how to properly use my tracker. Here's the blog on [How to Track Coronavirus on Command Line](https://warengonza.ga/covid19-tracker-cli). If you have comments or suggestions please leave it on the comment section of the blog.

## Screenshots

Here's the screeshot of the tracker on CLI...
Expand All @@ -84,7 +149,7 @@ Working on it...

## Contributing

Contributions are welcome, create a pull request to this repo and I will review your code.
Contributions are welcome, create a pull request to this repo and I will review your code. Please consider to submit your pull request to the ```dev``` branch. Thank you!

## Issues

Expand Down Expand Up @@ -114,7 +179,7 @@ If you love this project please consider to support the development by means of

## Supporters and Backers

* your_name_here
* J. Archer, Gonzalo Montes

Wanna see your name here? [Just buy me a coffee](https://www.buymeacoffee.com/warengonzaga)!

Expand All @@ -128,44 +193,28 @@ COVID-19 Tracker CLI is licensed under MIT - <https://opensource.org/licenses/MI

## Sources

* [Novel Coronavirus (2019-nCoV) situation reports](https://www.who.int/emergencies/diseases/novel-coronavirus-2019/situation-reports) - [World Health Organization](https://www.who.int) (WHO)
* [2019 Novel Coronavirus (2019-nCoV) in the U.S.](https://www.cdc.gov/coronavirus/2019-ncov/cases-in-us.html) - [U.S. Centers for Disease Control and Prevention](https://www.cdc.gov) (CDC)
* [Outbreak Notification](http://www.nhc.gov.cn/xcs/yqtb/list_gzbd.shtml) - National Health Commission (NHC) of the People’s Republic of China
* [Novel coronavirus (2019-nCoV)](https://www.health.gov.au/health-topics/novel-coronavirus-2019-ncov) - Australian Government Department of Health
* [Novel coronavirus 2019-nCoV: early estimation of epidemiological parameters and epidemic prediction](https://www.medrxiv.org/content/10.1101/2020.01.23.20018549v2) - Jonathan M. Read et al, Jan. 23,2020.
* [Early Transmissibility Assessment of a Novel Coronavirus in Wuhan, China](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3524675) - Maimuna Majumder and Kenneth D. Mandl, Harvard University - Computational Health Informatics Program - Posted: 24 Jan 2020 Last revised: 27 Jan 2020
* [Report 3: Transmissibility of 2019-nCoV](https://www.imperial.ac.uk/mrc-global-infectious-disease-analysis/news--wuhan-coronavirus) - 25 January 2020 - Imperial College London‌
* [Case fatality risk of influenza A(H1N1pdm09): a systematic review](ttps://www.ncbi.nlm.nih.gov/pmc/articles/PMC3809029) - Epidemiology. Nov. 24, 2013
* [A novel coronavirus outbreak of global health concern](https://www.thelancet.com/journals/lancet/article/PIIS0140-6736(20)30185-9/fulltext#tbl1) - Chen Want et al. The Lancet. January 24, 2020
* [Symptoms of Novel Coronavirus (2019-nCoV)](https://www.cdc.gov/coronavirus/2019-ncov/about/symptoms.html) - CDC
* [China's National Health Commission news conference on coronavirus](https://www.aljazeera.com/news/2020/01/chinas-national-health-commission-news-conference-coronavirus-200126105935024.html) - Al Jazeera. January 26, 2020
* [Wuhan lockdown 'unprecedented', shows commitment to contain virus: WHO representative in China](https://www.reuters.com/article/us-china-health-who/wuhan-lockdown-unprecedented-shows-commitment-to-contain-virus-who-representative-in-china-idUSKBN1ZM1G9) - Reuters. January 23, 2020
* [Statement on the meeting of the International Health Regulations (2005) Emergency Committee regarding the outbreak of novel coronavirus (2019-nCoV)](https://www.who.int/news-room/detail/23-01-2020-statement-on-the-meeting-of-the-international-health-regulations-(2005)-emergency-committee-regarding-the-outbreak-of-novel-coronavirus-(2019-ncov)) - WHO, January 23, 2020
* [International Health Regulations Emergency Committee on novel coronavirus in China](https://www.who.int/news-room/events/detail/2020/01/30/default-calendar/international-health-regulations-emergency-committee-on-novel-coronavirus-in-china) - WHO, January 30, 2020
* [Human-to-human transmission of Wuhan virus outside of China, confirmed in Germany, Japan and Vietnam](https://www.theonlinecitizen.com/2020/01/29/human-to-human-transmission-of-wuhan-virus-outside-of-china-confirmed-in-germany-japan-and-vietnam) - The Online Citizen, Jan. 29, 2020
* [Who: "Live from Geneva on the new #coronavirus outbreak"](https://www.pscp.tv/WHO/1OdJrqEvgaeGX)
* [CDC Confirms Person-to-Person Spread of New Coronavirus in the United States](https://www.cdc.gov/media/releases/2020/p0130-coronavirus-spread.html) - CDC Press Release, Jan. 30, 2020
* [CMO confirms cases of coronavirus in England](https://www.gov.uk/government/news/cmo-confirms-cases-of-coronavirus-in-england) - CMO, UK, Jan. 31, 2020
* [Coronavirus in France: what you need to know](https://www.thelocal.fr/20200131/coronavirus-in-france-what-you-need-to-know) - The Local France, Jan. 31, 2020
* [First two persons infected with coronavirus identified in Russia](https://tass.com/society/1115101) - Tass, Jan. 31, 2020
* [Updated understanding of the outbreak of 2019 novel coronavirus (2019nCoV) in Wuhan, China](https://onlinelibrary.wiley.com/doi/abs/10.1002/jmv.25689?af=R) - Journal of Medical Virology, Jan. 29, 2020
* [Estimating the effective reproduction number of the 2019-nCoV in China](https://www.medrxiv.org/content/10.1101/2020.01.27.20018952v1.full.pdf) - Zhidong Cao et al., Jan. 29, 2020
* [Preliminary estimation of the basic reproduction number of novel coronavirus (2019-nCoV) in China, from 2019 to 2020: A data-driven analysis in the early phase of the outbreak](https://www.sciencedirect.com/science/article/pii/S1201971220300539) - Jan. 30, 2020
* [Coronavirus: Window of opportunity to act, World Health Organization says](https://www.bbc.com/news/world-asia-china-51368873) - BBC, Feb,\. 4, 2020
* [Clinical Characteristics of 138 Hospitalized Patients With 2019 Novel Coronavirus–Infected Pneumonia in Wuhan, China](https://jamanetwork.com/journals/jama/fullarticle/2761044?guestAccessKey=f61bd430-07d8-4b86-a749-bec05bfffb65) - Wang et. al, JAMA, Feb. 7, 2020
* NovelCOVID API based on top of [WorldMeter](https://www.worldometers.info/coronavirus)
* API from [NovelCOVID API](https://github.com/NovelCOVID/API) which based on [WorldMeter](https://www.worldometers.info/coronavirus)

* Data from [CSSE at Johns Hopkins University](https://github.com/CSSEGISandData)

## Related Projects

* <https://github.com/sagarkarira/coronavirus-tracker-cli>

## Other Projects

* [WiFi Passview](https://github.com/warengonzaga/wifi-passview) is an open-source batch script-based program that can recover your WiFi Password easily in seconds.

* [WRN Cleaner](https://github.com/warengonzaga/wrn-cleaner) is an all in one batch script based native PC maintenance and cleaner for Windows.

## Resources

* <https://github.com/soroushchehresa/awesome-coronavirus>
* <https://github.com/fight-covid19/community>

## Author

COVID-19 Tracker CLI is Developed and Maintained by **Waren Gonzaga**
COVID-19 Tracker CLI is Developed and Maintained by **Waren Gonzaga** and **Ian Vizarra**

* **Facebook:** <https://facebook.com/warengonzagaofficial>
* **Twitter:** <https://twitter.com/warengonzaga>
Expand Down
34 changes: 30 additions & 4 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ app.get(['/plain','/cmd','/basic'], async (req, res, next) => {
});

// help options
app.get(['/help','/manual'], async (req, res, next) => {
app.get(['/help','/manual','/cmd/help','/plain/help','/basic/help'], async (req, res, next) => {
const userAgent = req.headers['user-agent'];
if (util.isCommandline(userAgent)) {
await res.send(covid19.help());
Expand Down Expand Up @@ -95,10 +95,36 @@ app.get(['/plain/:country','/cmd/:country','/basic/:country'], async (req, res,
return next();
});

// by historical chart by country
app.get('/history/:country/:chartType(cases|deaths)?', async (req, res, next) => {
const userAgent = req.headers['user-agent'],
countryData = req.params.country,
chartType = req.params.chartType || 'cases',

summary = await axios.get(`${apiBaseURL}/countries/${countryData}`),
history = await axios.get(`${apiBaseURL}/v2/historical/${summary.data.country}`),
all = await axios.get(`${apiBaseURL}/all`),
s = summary.data,
h = history.data;
u = all.data;

if (util.isCommandline(userAgent)) {
await res.send(
covid19.historyCountryTracker(
s.country, s.cases, s.todayCases,
s.deaths, s.todayDeaths, s.recovered,
s.active, s.critical, s.casesPerOneMillion,
u.updated, h, chartType
)
);
return null;
}
return next();
});

app.get('*', (req, res) => res.send(`
Sorry, CLI version is only available at the moment...
\n
Try curl https://covid19tracker.xyz
Welcome to COVID-19 Tracker CLI by Waren Gonzaga
Please visit: https://warengonza.ga/covid19-tracker-cli
\n`));

app.listen(port, () => console.log(`COVID-19 Tracker v${pkg.version} is listening on port ${port}!`));
3 changes: 1 addition & 2 deletions bin/util/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
const { Readable } = require('stream');

const isCommandline = (userAgent) => {
const check = (userAgent.search(/curl|wget/i) !== -1);
return check;
return (userAgent.search(/curl|wget|httpie/i) !== -1);
};

const getStream = (req, res) => {
Expand Down
11 changes: 11 additions & 0 deletions lib/cli/chart.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const chart = require('asciichart');

// generate chart for caes or deaths
exports.generate = (data, type = 'cases') => {
const config = {
height: 7,
format: (x, i) => (' ' + x.toFixed(0)).slice(-' '.length)
};
chartData = Object.values(data.timeline[type]).flat();
return chart.plot(chartData, config);
}
Loading