Skip to content

Commit

Permalink
Initial Quarto page created
Browse files Browse the repository at this point in the history
  • Loading branch information
arranhamlet committed Sep 29, 2024
1 parent 61d38be commit 2703d23
Show file tree
Hide file tree
Showing 51 changed files with 8,842 additions and 35 deletions.
1 change: 1 addition & 0 deletions _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ book:
- new_pages/reportfactory.qmd #done
- new_pages/flexdashboard.qmd #done
- new_pages/shiny_basics.qmd #done
- new_pages/quarto.qmd #done

# MISCELLANEOUS
- part: "Miscellaneous"
Expand Down
90 changes: 90 additions & 0 deletions data/quarto/outbreak_dashboard.qmd
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
)
```
525 changes: 525 additions & 0 deletions data/quarto/outbreak_report.html

Large diffs are not rendered by default.

40 changes: 40 additions & 0 deletions data/quarto/outbreak_report.qmd
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.
Loading

0 comments on commit 2703d23

Please sign in to comment.