Real-time coronavirus API based on COVID-19 data from Wikipedia. The API is written in Python with Flask framework. This is a simplified version of the API used by Routitude COVID-19 Monitoring Service.
The API provides data with basic statistics such as the number of confirmed cases, the number of deaths and the number of recovered patients for almost each country, with administrative divisions for United States and Russia.
Data comes from Wikipedia pages describing current status of coronavirus outbreak in different countries. At this moment the project retrieves COVID-19 statistics from the following Wikipedia pages:
- 2019-20 Coronavirus pandemic by country and territory
- 2020 coronavirus pandemic in Russia
- Timeline of the 2020 coronavirus pandemic in the United States
- Python
- SQLAlchemy supported database (tested with PostgreSQL)
Install requirements:
pip install -r requiremets
Set database URI environment variable:
export COVID19API_DB_URI=<your database uri>
Set up database:
python manage.py db upgrade
The following command updates the data in the project database. You can run it manually or with the help of automation tools whenever you want to update COVID-19 data to provide the most recent coronavirus statistics from Wikipedia through the API.
python manage.py update_covid_data
Run Flask development server:
python app.py
Test the API:
nosetests .
Test Wikipedia scraping logic:
nosetests datasources
You are welcome to contribute to this project. Here are some ideas on possible new features:
- Regional data for more countries
- Historical data