-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
61d38be
commit 2703d23
Showing
51 changed files
with
8,842 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
--- | ||
title: "Outbreak dashboard" | ||
output: | ||
flexdashboard::flex_dashboard: | ||
orientation: columns | ||
vertical_layout: fill | ||
--- | ||
|
||
```{r setup, echo=FALSE} | ||
pacman::p_load(rio, here, tidyverse, flexdashboard, # load packages | ||
flextable, incidence2, epicontacts, DT, janitor) | ||
linelist <- import(here("data", "case_linelists", "linelist_cleaned.rds")) # import data | ||
``` | ||
|
||
## Column 1 {data-width=500} | ||
### Summary and action items | ||
|
||
This report is for the Incident Command team of the fictional outbreak of Ebola cases. **As of `r format(max(linelist$date_hospitalisation, na.rm=T), "%d %B")` there have been `r nrow(linelist)` cases reported as hospitalized.** | ||
|
||
* Several previously-unaffected areas to the West are now reporting cases | ||
* Internal reviews suggest that better communication is needed between district and provincial level data management teams | ||
* Safe and dignified burial teams are reporting difficulties | ||
|
||
### Review data | ||
#### Cases by hospital | ||
```{r} | ||
linelist %>% | ||
count(hospital) %>% | ||
adorn_totals() %>% | ||
rename("Hospital" = hospital, | ||
"Cases" = n) %>% | ||
knitr::kable() | ||
``` | ||
|
||
|
||
## Column 2 {data-width=500} | ||
### Epidemic curve by age | ||
|
||
```{r} | ||
age_outbreak <- incidence(linelist, "date_onset", "week", groups = "age_cat") | ||
plot(age_outbreak, fill = "age_cat", col_pal = muted, title = "") %>% | ||
plotly::ggplotly() | ||
``` | ||
|
||
### Transmission chain (select cases) | ||
```{r} | ||
# load package | ||
pacman::p_load(epicontacts) | ||
## generate contacts | ||
contacts <- linelist %>% | ||
transmute( | ||
infector = infector, | ||
case_id = case_id, | ||
location = sample(c("Community", "Nosocomial"), n(), TRUE), | ||
duration = sample.int(10, n(), TRUE) | ||
) %>% | ||
drop_na(infector) | ||
## generate epicontacts object | ||
epic <- make_epicontacts( | ||
linelist = linelist, | ||
contacts = contacts, | ||
id = "case_id", | ||
from = "infector", | ||
to = "case_id", | ||
directed = TRUE | ||
) | ||
## subset epicontacts object | ||
sub <- epic %>% | ||
subset( | ||
node_attribute = list(date_onset = c(as.Date(c("2014-06-30", "2014-06-01")))) | ||
) %>% | ||
thin("contacts") | ||
# temporal plot | ||
plot( | ||
sub, | ||
x_axis = "date_onset", | ||
node_color = "outcome", | ||
col_pal = c(Death = "firebrick", Recover = "green"), | ||
arrow_size = 0.5, | ||
node_size = 13, | ||
label = FALSE, | ||
height = 700, | ||
width = 700 | ||
) | ||
``` |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
title: "Outbreak Situation Report" | ||
date: "4/24/2021" | ||
output: pdf_document | ||
--- | ||
|
||
```{r setup, echo=FALSE, warning =FALSE, message=F} | ||
pacman::p_load(rio, here, tidyverse, janitor, incidence2, flextable) | ||
linelist <- rio::import(here::here("data", "case_linelists", "linelist_cleaned.rds")) | ||
set_flextable_defaults(fonts_ignore=TRUE) | ||
``` | ||
|
||
This report is for the Incident Command team of the fictional outbreak of Ebola cases. **As of `r format(max(linelist$date_hospitalisation, na.rm=T), "%d %B")` there have been `r nrow(linelist)` cases reported as hospitalized.** | ||
|
||
## Summary table of cases by hospital | ||
|
||
```{r, echo=F, out.height="75%"} | ||
linelist %>% | ||
filter(!is.na(hospital)) %>% | ||
group_by(hospital) %>% | ||
summarise(cases = n(), | ||
deaths = sum(outcome == "Death", na.rm=T), | ||
recovered = sum(outcome == "Recover", na.rm=T)) %>% | ||
adorn_totals() %>% | ||
qflextable() | ||
``` | ||
|
||
## Epidemic curve by age | ||
|
||
```{r, echo=F, warning=F, message=F, out.height = "50%", out.width="75%"} | ||
# create epicurve | ||
age_outbreak <- incidence( | ||
linelist, | ||
date_index = "date_onset", # date of onset for x-axis | ||
interval = "week", # weekly aggregation of cases | ||
groups = "age_cat") | ||
# plot | ||
plot(age_outbreak, n_breaks = 3, fill = "age_cat", col_pal = muted, title = "Epidemic curve by age group") | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.