Skip to content

Analyses and visualizes WHO data of the COVID-19 pandemic.

License

Notifications You must be signed in to change notification settings

kariustobias/Covid-19-analysis

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Covid-19-analysis

Docker
Run class snippet

Introduction

Gets the WHO data about COVID-19 from the European Center of Disease Control and visualize them.
Additionally it will calculate some important numbers such as the doubling time and the reproduction number R0. To do so it offers a set of Python classes and functions including a Jupyter notebook to generate PDF reports. The functions are also available through a REST API and the repository offers a C# application in source code to call the REST API. To execute the REST API on your local machine you may want to use Uvicorn which wraps a simple webserver in Python.

Installation

You basically neet to install the JupyterLab, MatPlotLib and Pandas libraries. To use some interactions in the notebook we are using ipywidgets as well.
These are the pip commands to install the packages:

pip install jupyterlab  
pip install pandas  
pip install matplolib  
pip install ipywidgets

If you want to use the REST API on your local machine you have to install Uvicorn and FastAPI as well:

pip install uvicorn
pip install fastapi

In order to get ipywidgets working with jupyter notebook please run the following command:

jupyter nbextension enable --py --sys-prefix widgetsnbextension

If you're using jupyter lab you also have to register the extension:

jupyter labextension install @jupyter-widgets/jupyterlab-manager

Please refer to: https://github.com/jupyter-widgets/ipywidgets/blob/master/README.md

When exectuing the second command you may wonder that the terminal is somehow standing still. Don't worry, start the jupyter notebook in a second terminal using:

jupyter lab

For your convenience we added all of these indivdual installtion to one requirements text file that you can execute using the one and only following command (you will find requirements.txt in the root folder of this project):

pip install -r requirements.txt

Using a Docker image to execute the REST API

To build the Docker image use the following command line:

docker build -t covid_api:latest .

It will take a while to build but finally it will generate a Docker image that you can run using:

docker run -d -p 8080:5000 --name covidREST covid_api:latest 

This will start a Docker container that is running the REST API and that is listing to port 8080. The container name is covidREST. Port 8080 on the host is mapped to port 5000 inside the container. Start a browser and go to the following web site http://localhost:8080/api/data/DE,UK,FR,IT,ES/CumulativeCases You may also want to try some more links such as:

As this REST API is build on the FastAPI framework, the documentation is generated at :8080/docs. You will find a documentation of certain parameters there as well as the possibility to test the API by submitting requests to it.

To stop the Docker image use:

docker stop covidREST 

About

Analyses and visualizes WHO data of the COVID-19 pandemic.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • Jupyter Notebook 99.0%
  • Other 1.0%