Code Monkey home page Code Monkey logo

coronavirus-tracker-cli's Introduction

Coronavirus Tracker CLI

Track The Corona virus stats from your terminal using curl or global command.

Build Status Tweet

Sponsored By Zeit

Live global stats (provided by fight-covid19/bagdes)

Covid-19 Confirmed Covid-19 Deaths

Screenshot

Preview

Data Sources

Note: Source 2 is the default source now if not mentioned

CURL

# Get data from worldometers api i.e source 2
curl https://corona-stats.online

# Get data from source 1
curl https://corona-stats.online?source=1

# Get data from source 2
curl https://corona-stats.online?source=2

# Filter by country /countryCode or /countryName

curl https://corona-stats.online/US
curl https://corona-stats.online/italy
curl https://corona-stats.online/uk?source=2
curl https://corona-stats.online/gb?source=1

# State wise stats of country (Only for US as of now)

curl https://corona-stats.online/US

# Only show top N countries
curl https://corona-stats.online?top=20

# Remove padding and borders from table
curl https://corona-stats.online?minimal=true

# Latest News (Work In Progress)
curl https://corona-stats.online/updates

# Allow emojis (emojis breaks in some terminals)
curl https://corona-stats.online?emojis=true

# Help
curl https://corona-stats.online/help

# Mix up above params (One that I use)
curl 'https://corona-stats.online?top=30&source=2&minimal=true&emojis=true'

API

Add ?format=json at the end of any API to get JSON formatted data.

curl https://corona-stats.online?format=json

Node CLI

Note: NodeJS version 12 recommended. You can download it here.

Install

# Install
npm install coronavirus-tracker-cli -g

# Run command
corona 

# Get source 1 data
corona --source=1
corona -s=1

# Filter by country
corona italy

# state wise stats (only for US as of now)
corona --states=US
corona --st=us

# Filter top N countries
corona --top=10
corona -t=10

# Minimal Compact Table
corona --minimal
corona -m

# Monocolor / No colors
corona --color=false
corona -c=false

# Show emojis
corona --emojis
corona -e

# Confirmed Cases Graph
corona italy --graph
corona italy -g

ToDos

  • Filter by country to get cases by local states.
  • Move from npm to curl
  • Add daily change.
  • Add graphs
  • Add growth rate column ? (double in X days)
  • Add latest updates from reddit / twitter.
  • Find and add regional data - state, county, city, district level data.

Contributors

 project  : curl-corona
 lines    :     3991
 authors  :
  3342 Sagar Karira             83.7%
  356 XhmikosR                  8.9%
  232 Alexandra Parker          5.8%
   26 Lucas Fernandez Nicolau   0.7%
   13 Daniel S                  0.3%
   10 Shelton Koskie            0.3%
    5 Sabu Siyad                0.1%
    4 Mo'men Tawfik             0.1%
    2 Steven                    0.1%
    1 Greg Myers                0.0%

Other Regional Trackers

Related Projects

Sponsored By

License

WTFPL

coronavirus-tracker-cli's People

Contributors

archcorsair avatar burhan avatar cinemast avatar cyberdracula avatar divyanshu013 avatar ebwinters avatar lucasfnicolau avatar monata avatar mtiifa avatar myersg86 avatar pzygielo avatar sagarkarira avatar skoskie avatar ssiyad avatar stevenblack avatar styfle avatar xandris avatar xhmikosr 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coronavirus-tracker-cli's Issues

Open Source Helps!

Thanks for your work to help the people in need! Your site has been added! I currently maintain the Open-Source-COVID-19 page, which collects all open source projects related to COVID-19, including maps, data, news, api, analysis, medical and supply information, etc. Please share to anyone who might need the information in the list, or will possibly contribute to some of those projects. You are also welcome to recommend more projects.

http://open-source-covid-19.weileizeng.com/

Cheers!

Country code does not match anything in the database.

Trying to request a specific country returns the error:

"I am sorry. Something went wrong. Please report it
Country code CA does not match anything in the database. "

Viewing all countries seems to have no data.
image

Feature request: Breakdown of cases in UK by nation/region

Hi,

Any chance you can add the regional data to the UK breakout?
The individual governments upload their data daily around 2pm:
Scotland (has breakdown per region) - https://www.gov.scot/coronavirus-covid-19/
Northern Ireland - https://www.health-ni.gov.uk/news/latest-update-coronavirus-covid-19-4
Wales - https://phw.nhs.wales/news/public-health-wales-statement-on-novel-coronavirus-outbreak/
England (has breakdown per region // click "view" on bottom right to get the CSV file) - https://www.arcgis.com/home/item.html?id=ca796627a2294c51926865748c4a56e8

(other sources for England // UK: https://www.gov.uk/government/publications/covid-19-track-coronavirus-cases)

No status code

I'm getting the following error using source=2
An error occurred with this application. NO_STATUS_CODE_FROM_FUNCTION

Mortality vs CFR

The table lists "Mortality %", while I suspect it actually means Case Fatality Rate (CFR):

From Wikipedia:

Mortality rate, or death rate, is a measure of the number of deaths (in general, or due to a specific cause) in a particular population, scaled to the size of that population, per unit of time. Mortality rate is typically expressed in units of deaths per 1,000 individuals per year; thus, a mortality rate of 9.5 (out of 1,000) in a population of 1,000 would mean 9.5 deaths per year in that entire population, or 0.95% out of the total. It is distinct from "morbidity", which is either the prevalence or incidence of a disease, and also from the incidence rate (the number of newly appearing cases of the disease per unit of time).

From Wikipedia:

In epidemiology, a case fatality rate (CFR) — sometimes called case fatality risk or case fatality ratio — is the proportion of deaths from a certain disease compared to the total number of people diagnosed with the disease for a certain period of time.

Therefore, "mortality" sets the deaths in perspective to entire population of a given region/country after the fact or within a certain time frame, while the CFR sets the current deaths in perspective to some affected case numbers (diseased people).

Can't access site from Iran

$ curl https://corona-stats.online/

curl: (28) Failed to connect to corona-stats.online port 443: Connection timed out

I tried from multiple places.
It seems packets drop.

Palestine showing incorrect data.

image
For some reason, Palestine is showing as 0, but I believe they have like 37 cases as of this morning 3/17 10:00 GMT.

Also, seriously?
"occupied Palestinian territory (PS)"

Data not updated with most recent.

Where are your data sources taken from?

For several countries, the data is not up to date with this tool, as it is on their official sites.
Please explain how to fix this.

E.g. For Lithuania:

$ curl https://corona-stats.online/Lithuania?minimal=true

Rank      State Confirmed  Recovered Deaths Active Mortality % Recovered % 1 Day ▲ 1 Week ▲
Lithuania Total         83         1      1     81        1.20        1.20    34 ▲     75 ▲

Versus:


brave_2020-03-22_15-37-19

{"lietuva":{"region":"Lietuva","confirmed":105,"recovered":1,"deaths":1},"alytus":
{"region":"Alytus","confirmed":0,"recovered":0,"deaths":0},"kaunas":
{"region":"Kaunas","confirmed":18,"recovered":0,"deaths":0},"klaipeda":
{"region":"Klaip\u0117da","confirmed":18,"recovered":0,"deaths":0},"marijampole":
{"region":"Marijampol\u0117","confirmed":0,"recovered":0,"deaths":0},"siauliai":
{"region":"\u0160iauliai","confirmed":3,"recovered":1,"deaths":0},"panevezys":
{"region":"Panev\u0117\u017eys","confirmed":2,"recovered":0,"deaths":0},"taurage":
{"region":"Taurag\u0117","confirmed":0,"recovered":0,"deaths":0},"telsiai":
{"region":"Tel\u0161iai","confirmed":0,"recovered":0,"deaths":0},"utena":
{"region":"Utena","confirmed":0,"recovered":0,"deaths":0},"vilnius":
{"region":"Vilnius","confirmed":59,"recovered":0,"deaths":0}}

and

Cases per 1 Million are not always shown correctly

https://corona-stats.online/IT

╔══════╤════════════╤══════════════╤═════════════╤══════════════╤══════════════╤═══════════╤═════════╤══════════╤════════════════╗
║ Rank │ Country    │ Total Cases  │ New Cases ▲ │ Total Deaths │ New Deaths ▲ │ Recovered │ Active  │ Critical │ Cases / 1M pop ║
╟──────┼────────────┼──────────────┼─────────────┼──────────────┼──────────────┼───────────┼─────────┼──────────┼────────────────╢
║ 1    │ Italy (IT) │       80,589 │     6,203 ▲ │        8,215 │        712 ▲ │    10,361 │  62,013 │    3,612 │              1 ║
╟──────┼────────────┼──────────────┼─────────────┼──────────────┼──────────────┼───────────┼─────────┼──────────┼────────────────╢
║      │ World      │      528,637 │    57,602 ▲ │       23,956 │      2,674 ▲ │   123,364 │ 381,317 │   19,430 │          67.83 ║
╚══════╧════════════╧══════════════╧═════════════╧══════════════╧══════════════╧═══════════╧═════════╧══════════╧════════════════╝

Stay safe. Stay inside.
Code: https://github.com/sagarkarira/coronavirus-tracker-cli
Twitter: https://twitter.com/ekrysis

Last Updated on: 26-Mar-2020 22:03 UTC

UPDATE: Source 2 is now default source
JHU Source 1 table: https://corona-stats.online?source=1
HELP: https://corona-stats.online/help

The cases per 1 million for italy here are shown as 1, but it is actually 1,333 on the worldometer website at the time of writing.

Not sure if this is an issue with the api being used or how it is displayed. It could have something to do with the comma?

Feature request: Regions or Top N

Hi,
Showing all countries in the list takes up too many pages of the terminal,
but it would still be nice to be able to see more than one country.

My suggestion is two-fold:

curl https://corona-stats.online/X

where X is a number (e.g. 20 for "top 20" countries by number of cases)

and/or:

curl https://corona-stats.online/REGION

where region could be like Europe, Scandinavia, Caribbean, Mediterranean, Asia, Oceania, or whatever.

Or just being able to to manually put together a list would be fine too:

curl https://corona-stats.online/SE+DK+NO+FI+IS

for Scandinavia.

Anyways, awesome curl app. Keep up the great work!
Regards,
-F

confirmedByDay, recoveredByDay and deathsByDay arrays in json output

Awesome tool!

I don't understand the numbers inside these arrays. Do each index represent something? It looks like it pertains to a single day. However, I'm not sure what the start date is or reference starting date.

Here's an example where input is Philippines. It's just a snippet from the complete json output

    "confirmedByDay": [
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      0,
      1,
      1,
      1,
      2,
      2,
      2,
      2,
      2,
      3,
      3,
      3,
      3,
      3,
      3,
      3,
      3,
      3,
      3,
      3,
      3,
      3,
      3,
      3,
      3,
      3,
      3,
      3,
      3,
      3,
      3,
      3,
      3,
      3,
      3,
      3,
      3,
      5,
      6,
      10,
      20,
      33,
      49,
      52,
      64,
      111,
      140,
      142,
      187,
      202,
      217,
      230,
      307,
      380
    ],

Thanks!

Render HTML when user-agent is not curl.

I am seeing a lot of requests coming from web browsers.

Sadly I am sending ASCII table which is meant for terminal and is not rendered properly in the browser.

I think creating a simple minimalistic Html table will do the job for these users.

I will pick this up on weekend but if anyone is interested, just let me know.

World data is not consistent

When requesting the data, the information for the World is not correct across the two different requests that I did. I have attached screenshots to show the issue. Both sets of data say they were updated at 6:03 UTC.

cstats1

cstats2

Add a favicon.ico

Currently favicon.ico returns a 404. Would be nice to have a favicon.ico, even a dummy one :)

Add census data for total population

Pretty much as the title says knowing the actual number of people within a country to compare to infection numbers to gauge overall spread within a country. This data should be available through sources such as wikipedia or the official government pages of the respective countries.

Remove HTML code when called from curl

Hello,
I really love your project but the recent changes made it unuable with curl.

Is it possible to remove the HTML when call from curl? Is can be done easily by reading the user-agent header.

Thanks for your work.

APIs for both sources have issues

Hello,

I've tried to use the APIs for both sources, but each have their issues:

Source 1:

  • the statistics for China only display the statistics for the province Hubei, so it's stuck on 67.8k for more than a week (only an API issue, in the table, it's correct)

Source 2:

  • the reported countries are in the wrong order (China with 81.4k is above USA with 104k and Italy with 86.5k) - both an API and a table issue
  • the "top=X" parameter is ignored - it reports all of the ~200 countries (only an API issue)

The URL I use for fetching data is "https://corona-stats.online?format=json&top=10&source=X", where X is 1 or 2.

Since the first API doesn't report recovered cased, I tried to use the second API. But in the second API, it's not possible to get the data from the previous day. The first API had it and it was quite useful...

Feature request: Historical Period

Hi guys, is there a way to implement the cli to bring data from yesterday or the day before, and check the evolution of the pandemic?

Add last_updated information

Hello,
thank's for your job.

I think it is useful to indicate the date and time of the last update of the data.

Your source reports this information in the "last_updated" field, it would be enough to report it in the output.

Thanks

Filter by country not working

after running command corona 'country name', it shows the entire table without filtering out country specific info. I think there is problem with bycountry.js

Remove Spaces in names

Thanks for this tool, but could you please remove spaces from country names?

E.G. United Kingdom -> could be United_Kingdom or UK

windows curl output not formatted.

so when i run curl https://corona-stats.online on windows i get this.
havent realy used curl on windows before.

StatusCode        : 200                                                                                           
StatusDescription : OK                                                                                            
Content           : <!doctype html>                                                                               
                      <html lang="en">                                                                            
                      <head>                                                                                      
                        <meta charset="utf-8">                                                                    
                        <meta name="viewport" content="width=device-width, initial-scale=1">                      
                        <title>Coronavirus Tracker</title>                                                        
                        <style>                                                                                   
                         ...                                                                                      
RawContent        : HTTP/1.1 200 OK                                                                               
                    Connection: keep-alive                                                                        
                    access-control-allow-origin: *                                                                
                    access-control-allow-headers: X-Requested-With, Content-Type, Accept                          
                    access-control-allow-methods: GET, POST, PUT, DELETE, OPT...                                  
Forms             : {}                                                                                            
Headers           : {[Connection, keep-alive], [access-control-allow-origin, *], [access-control-allow-headers,   
                    X-Requested-With, Content-Type, Accept], [access-control-allow-methods, GET, POST, PUT,       
                    DELETE, OPTIONS]...}                                                                          
Images            : {}                                                                                            
InputFields       : {}                                                                                            
Links             : {}                                                                                            
ParsedHtml        : System.__ComObject                                                                            
RawContentLength  : 102589                                                      

Add some small css rule to <body>

Just a tip:

Please add the following CSS rules to the in browser for a better look in browsers!

font-family: monospace;
white-space: pre;

Colors not appearing on curl request.

When you run the express server locally, you get colors because I am not stripping ANSI codes. But when you deploy to Zeit now, colors are not coming. Maybe because they are stripping ANSI codes.

I am not able to figure this out. If anyone has any idea please let me know.

Windows support?

Hey, there @sagarkarira, thanks for this!

It appears this doesn't work at all on Windows 10 native cmd. Not sure how hard this would be, I thought I'd report it :)

Annotation 2020-03-16 170812

More frequent updates request

Perhaps hourly / every two hours? So far it's the best tool out there except for the severely outdated information.

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.