Covid 19
127'555'049
2'789'952
596'790
10'305
12'538
66
146
---
title: "Dashboard Covid19"
output:
flexdashboard::flex_dashboard:
orientation: rows
vertical_layout: fill
social: ["twitter", "facebook", "menu"]
source_code: embed
theme: cerulean
---
```{r setup, include=FALSE}
source("dash_setup.R")
```
```{r definition functions}
source("dash_country_plot.R")
source("dash_motion_tracking.R")
source("dash_motionAnalysis.R")
```
```{r cleaning data from ECDC }
```
```{r clearing data from JHU Data}
source("dash_data_cleaning_JHU.R")
```
Ueberblick
======================================================
Row
-----------------------------------------------------
### Worldwide
```{r first frame}
valueBox(paste("Covid 19" ),ytd,
color = "warning")
```
### COVID19 Infection worldwide
```{r second frame}
x1 <-format( world_total_sum_cases , decimal.mark=",", big.mark="'")
valueBox(x1)
```
### COVID19 Deaths worldwide
```{r third frame}
x1 <-format( world_total_sum_deaths , decimal.mark=",", big.mark="'")
valueBox(x1, color = "red")
```
### COVID19 Infection CH
```{r forte frame}
x1 <-format( ch_sum_cases , decimal.mark=",", big.mark="'")
valueBox(x1)
```
### COVID19 Deaths CH
```{r six frame}
x1 <-format( ch_sum_deaths , decimal.mark=",", big.mark="'")
valueBox(x1, color ="red")
```
### COVID19 Infection last 7 days CH
```{r}
x1 <-format( last_week_conf_sum , decimal.mark=",", big.mark="'")
valueBox(x1)
```
### COVID19 Deaths last 7 days CH
```{r}
x1 <-format( last_week_death_sum , decimal.mark=",", big.mark="'")
valueBox(x1 , color = "red")
```
### COVID19 7 Tages Inzidenz / 100'000 E
```{r}
x1 <-format( inzidenz_7day , decimal.mark=",", big.mark="'")
valueBox(x1)
```
Row
-----------------------------------------------------------------------
### 7 Tage Infektionen im Vergleich
```{r}
country <- c("CHE", "SWE", "FIN", "IRL", "PRT","DEU", "AUT")
lcountry <- length(country)
country_plot(country)
```
### 7 Tages Todesfaelle im Vergleich
```{r}
country <- c("CHE", "SWE", "FIN", "IRL", "PRT","DEU", "AUT")
lcountry <- length(country)
country_plot(country, indicat = "death")
```
Row
---------------------------------------------------------------------
### Rapportierte Infectionen
```{r}
source("dash_merged_data_countries.R")
df.x21 <- merged_data_countries()
p <- ggplot(df.x21, mapping = aes(x = confirmend_cases , y = deaths )) +
geom_point() +
ggrepel::geom_label_repel(ggplot2::aes(label = iso3c, color = iso3c), show.legend = FALSE) +
ggplot2::scale_x_continuous(trans = "log10", labels = scales::comma) +
ggplot2::scale_y_continuous(labels = scales::comma) +
theme_minimal() +
labs(
x = "Reported Confirmend Cases ",
y = "Number of Deaths "
)
plot(p)
```
### Rapportierte INfektionen pro 100`000 Einwohner
```{r}
source("dash_merged_data_countries.R")
df.x21 <- merged_data_countries()
p <- ggplot(df.x21, mapping = aes(x = (confirmend_cases / pop)*100000, y = (deaths/ pop)*100000)) +
geom_point() +
ggrepel::geom_label_repel(ggplot2::aes(label = iso3c, color = iso3c), show.legend = FALSE) +
ggplot2::scale_x_continuous(trans = "log10", labels = scales::comma) +
ggplot2::scale_y_continuous(labels = scales::comma) +
theme_minimal() +
labs(
x = "Reported Confirmend Cases / 100'000 ",
y = "Number of Deaths / 100'000"
)
plot(p)
```
Uebersicht Schweiz
====================================================================
Row
---------------------------------------------------------------------
### 7 Tage Infektionen Schweiz
```{r}
df <- download_merged_data(cached = TRUE, silent = TRUE)
df$date <- as.Date(df$date, format = "%Y/%m/%d")
df_ch <- filter(df, iso3c == "CHE")
df_ch$confirmed_daily <- df_ch$confirmed - lag(df_ch$confirmed)
df_ch$rolling7 = rollmean(df_ch$confirmed_daily, k =7, fill = NA)
p <- ggplot(df_ch, aes(x = date, y = rolling7 )) +
geom_line() +
geom_bar(aes(y = confirmed_daily), stat = "identity", fill = "lightblue") +
theme_minimal()+
xlab("Datum") +
ylab("7 Tages Infektionen")
fig <- ggplotly(p)
fig
```
### 7 Tage Todesfaelle
```{r}
df <- download_merged_data(cached = TRUE, silent = TRUE)
df_ch <- filter(df, iso3c == "CHE")
for (i in 274:279) {
df_ch[i, 5] = 2145 #Korrigieren der Daten in Col "deaths"
}
df_ch$death_daily <- df_ch$deaths - lag(df_ch$deaths)
df_ch$death_rolling7 = rollmean(df_ch$death_daily, k = 7, fill = NA)
p <- ggplot(df_ch, aes(x = date, y = death_rolling7)) +
geom_line() +
geom_bar(aes(y = death_daily), stat = "identity", fill = "lightblue") +
theme_minimal()+
xlab("Datum")+
ylab("7 Tages Todesfaelle")
fig <- ggplotly(p)
fig
```
### Test Situation
```{r}
merged <- download_merged_data(cached = TRUE, silent = TRUE)
ch_merged <- filter(merged, iso3c == "CHE")
fig <- plot_ly(ch_merged, x = ~date, y = ~ total_tests - lag(total_tests), type = "scatter", mode = "lines", name = "Daily Test") %>%
add_trace(x = ~date, y = ~positive_rate, mode = "lines", yaxis = "y2", name = "Positiv Rate") %>%
layout(yaxis2 = list(overlaying = "y", side = "right"))
fig
```
Row
----------------------------------------------------------------
### Chart D
### Chart E
Bewegungsanalyse
=====================================================================
Row
-------------------------------------------------------------------
### Chart A
```{r 7 day Rolling average Switzerland}
df <- download_merged_data(cached = TRUE, silent = TRUE)
df_ch <- filter(df, iso3c == "CHE")
df_ch$confirmed_daily <- df_ch$confirmed - lag(df_ch$confirmed)
df_ch$rolling7 = rollmean(df_ch$confirmed_daily, k =7, fill = NA)
p <- ggplot(df_ch, aes(x = date, y = rolling7 )) +
geom_line() +
geom_bar(aes(y = confirmed_daily), stat = "identity", fill = "lightblue") +
theme_minimal()
fig <- ggplotly(p)
fig
```
### Chart B
Row
---------------------------------------------------------
### Chart C
```{r Motion Tracking Switzerland}
motion_tracking("CHE", "Switzerland")
```
### Chart D
Uebersicht Kantone
============================================================
Row
----------------------------------------------------------
### Chart A
```{r}
source("dash_canton_all.R")
p <- ggplot(canton_all, aes(x = date, y = ncumul_hosp, color = canton)) +
geom_line( aes( group = 2, linetype = canton)) +
facet_wrap( ~canton) +
theme_minimal() +
xlab("Datum") +
ylab("Hospitalisirungen")
fig <- ggplotly(p)
fig
```
### Chart B
```{r}
source("dash_canton_all.R")
p <- ggplot(canton_all, aes(x = date, y = ncumul_ICU, color = canton )) +
geom_line( aes( group = 2, linetype = canton) ) +
facet_wrap(~canton) +
theme_minimal() +
xlab("Datum") +
ylab("Belegung der Intensivbetten")
fig <- ggplotly(p)
fig
```