The aim of this project has been to familiarise myself with Streamlit and Altair.
Streamlit is an open-source app-framework for data science and machine learning. Altair is a declarative statistical visualization library for Python, based on Vega and Vega-Lite.
To make the project concrete, I decided to build an interactive app based on the publicly available data recording the current COVID-19 pandemic.
The raw data pulled from the 2019 Novel Coronavirus COVID-19 (2019-nCoV) Data Repository by Johns Hopkins CSSE. Specifically, this app scrapes the data from the web_data
branch.
Clone into the repository using the follow command in your terminal:
$ git clone https://github.com/smu095/streamlit-covid19.git
Navigate to the local repository, create a new virtual environment and install the required packages in a virtual environment, e.g.:
$ cd path/to/local/repo
$ python3 -m venv .venv
$ source .venv/bin/activate
(venv)$ pip install -r requirements.txt
Next, download the most recent data and run the streamlit app by running the following commands:
$ python3 src/scrape.py
$ streamlit run app.py
Alternatively, run the containerised version of the app. To do this, first make sure you have Docker installed. Once installed, navigate to the local repository and run the run.sh
shell script, like this:
$ cd path/to/local/repo
$ ./run.sh
Finally, open your favourite browser and go to http://localhost:8501
to open the app.
- The heatbar subplot for Countries: Confirmed cases since first patient doesn't appear to be interactive in the containerised version. It is unclear why.
- Log-transformation doesn't work when multiple countries are selected in Countries: Confirmed cases since first patient.