Skip to content

bilevn/covid19api

Repository files navigation

COVID-19 Python Flask API

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 sources

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:

Requirements

  • Python
  • SQLAlchemy supported database (tested with PostgreSQL)

Installation

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

Usage

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

Tests

Test the API:

nosetests .

Test Wikipedia scraping logic:

nosetests datasources

Contribution:

You are welcome to contribute to this project. Here are some ideas on possible new features:

  • Regional data for more countries
  • Historical data

About

COVID-19 Python Flask API with real-time data from Wikipedia

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages