Coronavirus Global History Data Collector and API
This is sub-project for better understanding, analysis and visualize COVID-19 data in the UK.
Main Project: https://github.com/isjeffcom/coronvirusFigureUK
HTTP GET: http://global.covid19uk.live
/realtime
: Get Real Time Data (provided by https://covid19api.com/)
/current
: Get Saved Global Data (1 Day Delay)
/data?date=<YYYY-MM-DD>
: Search data by date
/data?country=<COUNTRY>
: Search data in country level
/data?date=<YYYY-MM-DD>&country=<COUNTRY>
: Search data by date and country
/data?place=<PROVINCE>
: Search data in province level
/data?date=<YYYY-MM-DD>&place=<PROVINCE>
: Search data by date and province
Standard date format: YYYY-MM-DD
The full countries and provinces list in in /list
, however, as the data is keep updating, run those 2 JS scripts eg. node country.js
can generate a new list.
Be aware
Mainland China
=== China Mainland
Hong Kong
=== PRC Hong Kong
Macau
=== PRC Macau
Taiwan
=== ROC Taiwan (China)
use UK
for early UK data
use United Kingdom
for later UK data
The data collection code in init.py -> main() needs to fit the CSV data format published by JH CSSE. As they have changed data format for 3 times, and maybe more for the future. The script needs to constantly monitor and change if any changed.
There are not much access barriers for this public API. The only thing I ask for is:
PLEASE do not attack or harm the server as this is not build for profit, it's for people to obtain and understand information
PLEASE be careful when you testing this API in your product as it could be potentially create damage
PLEASE make sure you have cached data on your side if you are building a product to customer as this API is not guaranteed 24/7 stable.
- Install Python(2 or 3), git and MySQL to your environment
- Install PyMySQL by
pip install PyMySQL
- Rename
conf_tmp.json
toconf.json
and config your database - Excute
python init.py
That's it, you have global covid-19 data in your database history
table and cached in /data
folder as JSON format
- Install NodeJs
- Excute
npm i && npm run dev
to start up API server
The server will running at: http://localhost:8003
excute python update.py
You can set up a timer for this by corn
or node-schedule
, maybe any, once a day
Thanks for Johns Hopkins CSSE provide this dataset. They are doing a great job.
https://github.com/CSSEGISandData/COVID-19
You can use NodeJs to excute python update by a function I placed in index.js call forceUpdate().
UK API: https://github.com/isjeffcom/coronvirusFigureUK
Global API: https://github.com/isjeffcom/coronavirusDataGlobal
ML Prediction: https://github.com/lamharrison/coronavirus-machine-learning
If you are using this API, please join this discussion board. Keep updated for any significant changes!!
https://spectrum.chat/covid-19-uk-update
WeChat Group: