Pablo-source / Shiny-app-using-COVID-data

Shiny app using bootstrap framework, including Plotly and Leaflet interactive charts and maps. It displays confirmed, recovered and death COVID cases, using data from (JHU CSSE) repository.
3 stars 1 forks source link
dplyr leaflet plotly shiny

R GitHub all releases GitHub language count

Shiny-app-using-COVID-data

This is a Shiny app displaying COVID cases over time. Users can explore COVID19 confirmed, recovered and death cases, interacting with maps and charts to visualize these indicators by countries.

Following RAP principles, applied renv::init() to initialise environment and also taken a snapshot of the project with renv::snapshot(), once the Shiny app has ran. The entire environment can be replicated just by running renv::restore() after opening the R project file.

Features:

How to run this Shiny app on your machine

To run this Shiny-app-using-COVID-data app locally, please follow these three steps below:

1-3. Clone Shiny-app-using-COVID-data repo using git on you IDE or your terminal using local Clone HTTPS option https://github.com/Pablo-source/Shiny-app-using-COVID-data.git

git clone https://github.com/Pablo-source/Shiny-app-using-COVID-data.git

Navigate to the cloned repo, then open Rproject by clicking on the Shiny-app-using-COVID-data.Rproj file. This will display the Shiny app files on your "Files" tab in RStudio.

2-3. Run renv::restore() in a new Rscript. The first time the app finshed running, I captured its final state using renv::snapshot() To ensure all required packages are loaded, we reinstall exact packages declared in the project lockfile renv.lock. Then we run renv::restore() to ensure we have all required packages loaded and ready in our R environment.

renv::restore()

If prompted, after running restore() function, choose "1: Activate the project and use the project library." from menu displayed in the R Console.

In the next step when using app_launch_TRIGGER.R script, we will have all required packages for the app loaded by the renv::restore() command.

3-3. Open “app_launch_TRIGGER.R script”

Data downloaded from Johns Hopkins University Center for Systems Science and Engineering (JHU CSSE) repository

Data for this app is produced by the Johns Hopkins University Center for Systems Science and Engineering (JHU CSSE) for their 2019 Novel Coronavirus Visual Dashboard and Supported by ESRI Living Atlas Team and the Johns Hopkins University Applied Physics Lab (JHU APL).

John Hopkins repository stores daily CODIV-19 data files for each country worldwide

https://github.com/CSSEGISandData/COVID-19

Original data to populate this Shiny dashboard can be found in the CSSEGISandData main GitHub website. https://github.com/CSSEGISandData

The set of three specific files used on this Shiny Dashboard, can be found found under the “archived_time_series” folder: https://github.com/CSSEGISandData/COVID-19/tree/master/archived_data/archived_time_series

I have read the data directly into R with an ad hoc function DownloadCOVIDData() using download.file() function with specific URL address for each of the three individual files, this function used the Raw path provided on the GitHub repo location of each of the invidual input files:

These are the three input files read into R directly from the “archived_time_series” folder of the CSSEGISandData/COVID-19 repository:

This is an example of the path for COVID-19 Cofirmed cases file:

1-2. First I located the specific file in the \archived_fime_series folder: https://github.com/CSSEGISandData/COVID-19/blob/master/archived_data/archived_time_series/time_series_19-covid-Confirmed_archived_0325.csv

2-2. Then I obtained the final URL using the “Raw” button. This allows the the download.file() function to download the file directly from the original URL location to my local machine "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/archived_data/archived_time_series/time_series_19-covid-Confirmed_archived_0325.csv",

Shiny app re-design

In August 2024, I introduced several re-design changes to the app. Imrpvpving its design and applying RAP principles to the project:

Back end:

Front end:

This is still an ongoing re-design of this shiny app that will be completed in coming weeks

04_Shiny_App_Including_table_03092024_FMTD

Added legend to Leaflet map

06_Leaflet_map_number_of_deaths_legend

image

10_Plotly_interactive_charts_Germany