Skip to content
This repository was archived by the owner on Dec 22, 2023. It is now read-only.

Updated Covid19 Dashboard app #88

Merged
merged 3 commits into from
Oct 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Scripts/Miscellaneous/Covidin Dashboard/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# COVID19 Dashboard using Streamlit
This is app built with streamlit framework to display live covid19 data across the world with help of api.covid19api.com as data source.

### Prerequisites
* streamlit
* requests
* pytablewriter
* datetime

or

`pip3 install requirements.txt`

### How to run the script

`streamlit run covid19.py`

Visit Local URL: http://localhost:8501 to view the app.

### Screenshot
![Screenshot](https://i.imgur.com/zJQhxTq.png)

## *Author Name*
[Aravindha Hariharan M](https://aravindha1234u.github.io)
33 changes: 33 additions & 0 deletions Scripts/Miscellaneous/Covidin Dashboard/covid19.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import streamlit as st
import requests
from pytablewriter import MarkdownTableWriter
from datetime import datetime

response = requests.get('https://api.covid19api.com/summary') # Get Request to pull down data from Covid19 data source
data = response.json()

st.markdown(MarkdownTableWriter(
table_name="Covid19 Worldwide Data",
headers=["Total Confirmed", "Total Recovered", "Total Deaths"],
value_matrix=[[data['Global']['TotalConfirmed'], data['Global']['TotalRecovered'], data['Global']['TotalDeaths']]],
)) # To form a Table for Live World data stat

st.write("")
st.write("**Last Updated Time: {} **".format(datetime.strptime(data['Date'][:-1],"%Y-%m-%dT%H:%M:%S").strftime("%b %d %Y %H:%M:%S")))
# To Display the date & time of Last updated data of Covid19 Reports

st.write("")
country = st.text_input("Enter Country Name:","") # Input to filter according to country name

table_data = [ [i['Country'],i['TotalConfirmed'],i['TotalRecovered'],i['TotalDeaths']] for i in data['Countries'] ]

if country != "":
table_data=[]
table_data = [ [i['Country'],i['TotalConfirmed'],i['TotalRecovered'],i['TotalDeaths']] for i in data['Countries'] if i['Country'].lower() == country.lower() ]
# If country name is not entered then display all Country

st.markdown(MarkdownTableWriter(
table_name="CountryWise Data",
headers=["Country Name", "Confirmed", "Recovered", "Deaths"],
value_matrix=table_data,
)) # table to display countrywise count reports
3 changes: 3 additions & 0 deletions Scripts/Miscellaneous/Covidin Dashboard/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
streamlit
requests
pytablewriter