An interactive dashboard providing insights to the global COVID-19 pandemic, developed for the Programming for Data Science course at the Univeristy of Bern.
This project aims to create a reporting tool for the Covid-19 outbreak that allows users to explore cases and deaths across countries/regions at specific time spans using data from the WHOβs Global Health Observatory.
Important note The file sizes are now too big because of the cache's etc. it will be resolved as soon as possible. After the file has been downloaded and used, it can be deleted.
mkdir foldernewlycreated
cd foldernewlycreatedYou can directly download the code from GitHub as well, if you want to copy the repository you may use the code below, but it requires git to be installed in the PC
git clone --branch lysanders-branch https://github.com/AdvPythonFS25/Covid-19-Dashboard-Project.git
cd Covid-19-Dashboard-ProjectIf the GitHub repository already has a venv folder, delete it:
rmdir /s /q venvpython -m venv venvvenv\Scripts\activatepip install streamlit pandas numpy matplotlib seaborn requestsstreamlit run src/streamlitApp.pyTo run the dashboard, download the file and run in terminal: (2nd way UNDER DEVELOPMENT MAY NOT WORK):
Requirement : DOCKER Installed, no other things are necessary, streamlit, python etc. docker image does the job for you :)
mkdir foldernewlycreated
cd foldernewlycreatedYou can directly download the code from GitHub as well, if you want to copy the repository you may use the code below, but it requires git to be installed in the PC
git clone --branch lysanders-branch https://github.com/AdvPythonFS25/Covid-19-Dashboard-Project.git
cd Covid-19-Dashboard-Projectcd Covid-19-Dashboard-Projectdocker run -p 8501:8501 covid-dashboard-laniTo run the dashboard, download the file and run in terminal: (1st way)
mkdir foldernewlycreated
cd foldernewlycreatedYou can directly download the code from GitHub as well, if you want to copy the repository you may use the code below, but it requires git to be installed in the PC
git clone --branch lysanders-branch https://github.com/AdvPythonFS25/Covid-19-Dashboard-Project.git
cd Covid-19-Dashboard-ProjectIf the Github repository already has the venv we need to delete it.
rm -rf venvpython3 -m venv venvsource venv/bin/activatepip install streamlit pandas numpy matplotlib seaborn requestsstreamlit run /src/streamlitApp.pyTo run the dashboard, download the file and run in terminal: (2nd way UNDER DEVELOPMENT MAY NOT WORK):
Requirement : DOCKER Installed, no other things are necessary, streamlit, python etc. docker image does the job for you :)
mkdir foldernewlycreatedcd ~/Desktop/foldernewlycreatedYou can directly download the code from GitHub as well, if you want to copy the repository you may use the code below, but it requires git to be installed in the PC
git clone --branch lysanders-branch https://github.com/AdvPythonFS25/Covid-19-Dashboard-Project.gitcd Covid-19-Dashboard-Projectdocker run -p 8501:8501 covid-dashboard-laniDependencies/packages used
- python
- streamlit
- pandas
- numpy
- seaborn
π Statistics calculations and visualisations
PROCESS (PHASE 1 & 2) Phase 1 - 2 Process of creating the project :
At first, we focused on identifying which statistics we could calculate, since we had seven different databases to work with and limited time. Therefore, we gradually built some functions to process the data, along with general utility functions to simplify our workβsuch as data filters and validation helpers. We then built the rest of our code on top of this foundation. At that time, these were the core functions we developed:
1. DataBaseValidator
2. entryCounter
3. numberAuthorizationProduct
4. CountryValidator
5. WHO_regionValidator
6. ISO3Validator
7. Country_codeValidator
8. Product_validator
9. deathRateCountry
10. averageDeathRate
11. deathRateRegion
12. averageDeathRateRegion
13. DeathRateRequest
β¦
In the early stages of the second deliverable, we focused on building out the core functionality of the code as much as possibleβespecially by creating generalized graph functions and similar utilities. This work was mainly completed during the first half of Deliverable 2.
Later, we decided to use Streamlit for better visualizations and shifted our focus to integrating Streamlit during the second half of the deliverable. By the deadline, we ended up with two versions of the code: one that was about 80% complete in a single Python file, and another that was around 30% implemented using Streamlit.
At the end of that phase, the following were the potential next steps we could take with the old code (note: for some functions, the visualizations were unfinished, but most of the other parts were completed):
When that phase ended possible things to do with our old code were these(for some functions graphics wasnβt finished but the others were mostly finished );
Example Usage
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Select statistic to compute: example usage ISO3: TUR,USA,FRA Country code : TR,US,FR Who region : AMR,EUR Income group: LIC,UMC
1 β Death Rate (CFR) (country code)
2 β Rt (Effective Reproduction Number)
3 β Average Daily Cases (country code)
4 β Average Daily Deaths (country code)
5 β Regional Death Rate (country code)
6 β Vaccination Coverage (ISO3)
7 β Booster Dose Rate (ISO3)
8 β Total Vaccination Summary (ISO3)
9 β # Vaccine Authorisations by ISO3
10 β # Vaccine Authorisations by Product
11 β Average Weekly Hospitalisations (ISO3)
12 β Average Monthly Hospitalisations (ISO3)
13 β Daily Time-Series (country code)
14 β Monthly Deaths by Age Group (countries)
15 β Monthly Deaths by Age Group (income groups)
16 β Monthly Deaths by Age Group (WHO regions)
Enter the number of your choice: 3
Choose identifier type:
1 β ISO3 code
2 β Country code
3 β WHO region
4 β Vaccine product name
5 β World-Bank income group
Enter input type number: 2
Enter values (comma-separated): TR,US,FR
Start date (YYYY-MM-DD): 2021-01-01
End date (YYYY-MM-DD): 2022-02-02
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Statistic : Average Daily Cases
IDs type : Country code (2-letter)
IDs : TR, US, FR
Date range : 2021-01-01 β 2022-02-02 (auto-fixed if invalid)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Date range apllied by the system : 2021-01-01 00:00:00 β 2022-02-02 00:00:00
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
2021-01-01 00:00:00 2022-02-02 00:00:00
Statistical result:
Country_code
FR 40067.68
TR 23940.23
US 138533.17
Name: Average, dtype: float64
οΏΌ
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββPhase 2 Deliverable
The Streamlit implementation was unfinished at the time because two versions of the code were being developed simultaneously, as mentioned previously.
In that phase, we attempted to do the following (taken and paraphrased from the second deliverableβs changes): β’ We changed the architecture of our code to integrate the use of the Streamlit UI. β’ We updated our functions for death rate and Rt to reflect the new structure and added visualizations (both Streamlit and the original Python code). β’ Pylint formatting changes were implemented for the earlier Python code; these changes can be found under formatter.md. β’ Abstraction and decomposition: From the beginning of the project, we aimed to design our code with abstraction and decomposition in mind. Additionally, by using the Streamlit UI, users can simply run the app without needing to interact with the source code. Decomposition was achieved by modularizing our codeβeach statistic calculation, data processing step, and plotting logic has its own function.
Phase 3 Deliverable
Afterward, we attempted to import our code into Streamlit using a different approach, but it was inconsistent and not well-structured. Therefore, in Phase 3, we redefined our structure with the following updates: β’ We separated all statistics into different classes, with each database having its own class. Public and private functions are named accordingly; if a function name starts with an underscore _, it is intended to be used only within that class. β’ DataFrames are filtered using a class defined in a file called country_region_wrapper. This modular approach allows for easy extension, as proper filtering is crucial for topics like these. β’ All plots and data outputs are shown on the main page. To support this, we created a reusable layout file shared across the different classes. β’ Unit testing is uploaded. β’ Try and except blocks used in data importation so that if the system can not load the data it will give us an error.
Below is our current UI when the app is running. The code can be run using Docker. We chose Docker to manage containers and dependencies, as this project is still in the development stage. Docker makes it easy to test and explore the project. If desired, the Dockerization setup using Poetry is also provided below.
| Sidebar element / Section | What it means & how it works in our dashboard |
|---|---|
| Pick Start Date / Pick End Date | Lets the user trim all datasets to a custom period. Every metric we calculateβfrom daily cases to vaccinationsβreads the start/end dates you choose here. |
| Select Country or WHO Region β’ Choose at least one region β’ Choose at least one country | Geographic filter. β’ If you pick one or more WHO regions we ignore the country picker. β’ If you pick one or more countries we ignore the region picker. All subsequent statistics are grouped by the field that remains active (Country or WHO_region). |
| Granularity (Daily / Weekly / Monthly) | Global time-resolution selector for line-charts that support resampling. Hospital-related metrics ignore Daily and always resample to Last 7 days or Last 28 days using their own radio. |
| Daily Cases | Shows: β’ mean / median daily cases table β’ distribution plots β’ time-series resampled to the granularity radio. |
| Death Rate | Case-fatality rate (CFR) β computed each day as (Cumulative deaths / Cumulative cases) Γ 100 and then averaged over the selected period. |
| Daily Deaths | Same layout as Daily Cases but for new deaths. |
| Rt Number | Instant reproduction number (new cases Γ· previous-day cases) averaged for each country/region, with distribution and time-series. |
| New Hospitalizations | Tick-box reveals its own Last 7 days / Last 28 days radio. The chosen window decides which column (β¦_last_7days or β¦_last_28days) is analysed. Daily granularity is not offered here. |
| New ICU Admissions | Same behaviour as New Hospitalizations but uses ICU columns. |
| Total Doses | Vaccination snapshot β table & bar-chart of TOTAL_VACCINATIONS summed over the period. |
| % β₯ 1 Dose | Percentage of population with at least one dose (PERSONS_VACCINATED_1PLUS_DOSE_PER100). |
| Booster Coverage % | Booster-dose coverage (PERSONS_BOOSTER_ADD_DOSE_PER100). |
| Deaths by Age and Income | Tick-box adds two multiselects: Age group & WB income level. Metric then shows deaths aggregated by the age/income slices plus your country/region/date filters. |
| Choose window (inside Hospital/ICU sections) | Quick look-back switch: 7-day versus 28-day totals. Updates the plots instantly. |
- Ankitha Kumble
- Lysander Tucker
- Nihat Γmer Karaca
- Δ°lbars Efe Korkmaz
