CSSEGISandData / COVID-19

Novel Coronavirus (COVID-19) Cases, provided by JHU CSSE
https://systems.jhu.edu/research/public-health/ncov/
29.12k stars 18.42k forks source link

Turn this into an API #295

Open pascalwhoop opened 4 years ago

pascalwhoop commented 4 years ago

Hi, I'd like to help and turn this csv data into a REST API. I did a quick hack to show that it's easily done but I think people would use this happily and it's nicer to have data shared via an endpoint than via CSV files. As an example, this is my endpoint which just converts the current HEAD csv data from CSSE into JSON documents via pandas

https://opencovid19.com

https://api.opencovid19.com/v1/confirmed https://api.opencovid19.com/v1/deaths https://api.opencovid19.com/v1/recovered https://api.opencovid19.com/v1/populations

If the people running this would appreciate that, I'd be happy to contribute some code that can be deployed as an AppEngine or Cloud Run on GCP

Bost commented 4 years ago

https://quixotic-elf-256313.appspot.com/api/populations

Ha! I've been working on exactly the same thing: https://github.com/Bost/corona_cases/blob/master/src/corona/countries.clj (still under construction)

Is your source code public?

melaniam commented 4 years ago

Having an API would be very useful. This is something I implemented using the data provided in the API (could not call the API directly because of CORS issues): https://c3ewv.csb.app/

The code is here: https://codesandbox.io/s/covid-19-data-chart-c3ewv

Wikunia commented 4 years ago

@pascalwhoop may I ask where you got your populations from? Any change to also have density or size of each country/state? This would be very helpful to have a better perspective on the likelihood of getting infected. Of course this would only be a rough estimate. Besides that it's quite easy to get the latest csv files with raw.githubusercontent.com: i.e https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_19-covid-Confirmed.csv

Edit: If someone is interested in my visualizations: https://opensourc.es/blog/covid-19 I'll update them and will try to make a more interactive version soon. This is for everyone who doesn't like the bubble graphs :wink: New visualization at: https://covid19.opensourc.es

pascalwhoop commented 4 years ago

Ha, awesome! I put it in a repo, let's make it better and then potentially donate it to this repo https://github.com/pascalwhoop/covid19-api @Bost the code is above. It's simple but it works @melaniam sorry about the CORS. let me add a * on CORS. @Wikunia the populations are from https://data.worldbank.org/indicator/SP.POP.TOTL?end=2016&start=2016&view=bar

sametcodes commented 4 years ago

Hey! I made a visualization map by using your REST API. Thanks for it! https://github.com/selmansamet/ncov-disease

melaniam commented 4 years ago

No CORS issues anymore. Updated the app with more data as well: https://c3ewv.csb.app/

melaniam commented 4 years ago

@pascalwhoop how often does the data refresh? I can only see values from yesterday (March 8th).

sametcodes commented 4 years ago

@melaniam it's same for the source file (here). There is no data for 9th.

pascalwhoop commented 4 years ago

@Wikunia @selmansamet @melaniam We opened a small org on github where we want to make the API be community owned and improve it together. I’ll also move it to a proper domain I bought yesterday https://github.com/open-covid19/covid19-api The api will soon be available under api.opencovid19.com/v1/

I’ll update the server to make all keys of the JSON documents camel cases and add more data etc. I’ll also try and make our system more resilient to upstream changes (instead of proxying the data sources I’ll extract data into our own DB).

The goal is an open, community supported rich source of data for many people based on official data sources only.

I’d love for any of you to join and maybe work on the front end with Remon (the other lad) or whatever you want to work on

melaniam commented 4 years ago

@pascalwhoop I'd love to join!