diff --git a/NEWS.md b/NEWS.md index 147392a55..ece933c53 100644 --- a/NEWS.md +++ b/NEWS.md @@ -17,6 +17,7 @@ * The contribution guide has been improved to include more detail on ways to contribute new features/enhancements, report bugs, and improve or suggest vignettes. By @jamesmbaazam in #464 and reviewed by @seabbs. * Updated the code in `inst/CITATION` and added a GitHub Actions workflow to auto-generate `citation.cff` so that the two citation files are always in sync with `DESCRIPTION`. By @jamesmbazam in #467, with contributions from @Bisaloo, and reviewed by @seabbs and @sbfnk. * Updated the documentation of the `reported_cases` argument in `estimate_infections()` and `confirm` column in the `obs` argument of `estimate_truncation()` to allow `numeric` types, not just `integer`. See #594, by @jamesmbaazam, and reviewed by @sbfnk. +* Removed the reporting templates that were previously provided. See #604 by @jamesmbaazam, and reviewed by @sbfnk. ## Package diff --git a/README.Rmd b/README.Rmd index 22c2d94f2..b1d9dc9e5 100644 --- a/README.Rmd +++ b/README.Rmd @@ -142,12 +142,6 @@ A simple example of using the package to estimate a national Rt for Covid-19 can -
Reporting templates - -Rmarkdown templates are provided in the package (`templates`) for semi-automated reporting of estimates. If using these templates to report your results please highlight our [limitations](https://doi.org/10.12688/wellcomeopenres.16006.1) as these are key to understanding the results from `{EpiNow2}` . - -
- ## Contributing We welcome all contributions. If you have identified an issue with the package, diff --git a/README.md b/README.md index c9bb2cc35..44ad931ff 100644 --- a/README.md +++ b/README.md @@ -39,9 +39,9 @@ More details `{EpiNow2}` estimates the time-varying reproduction number on cases by date of infection (using a similar approach to that implemented in -[`{EpiEstim}`](https://github.com/mrc-ide/EpiEstim)). True infections -treated as latent and unobserved, estimated, and then mapped to observed -data (for example cases by date of report) via a series of uncertain +[`{EpiEstim}`](https://github.com/mrc-ide/EpiEstim)). True infections, +treated as latent and unobserved, are estimated and then mapped to +observed data (for example cases by date of report) via one or more delay distributions (in the examples in the package documentation these are an incubation period and a reporting delay) and a reporting model that can include weekly periodicity. @@ -211,18 +211,6 @@ A simple example of using the package to estimate a national Rt for Covid-19 can be found [here](https://gist.github.com/seabbs/163d0f195892cde685c70473e1f5e867). - -
- -Reporting templates - - -Rmarkdown templates are provided in the package (`templates`) for -semi-automated reporting of estimates. If using these templates to -report your results please highlight our -[limitations](https://doi.org/10.12688/wellcomeopenres.16006.1) as these -are key to understanding the results from `{EpiNow2}` . -
## Contributing diff --git a/inst/templates/_add-region-reports.Rmd b/inst/templates/_add-region-reports.Rmd deleted file mode 100644 index 261f759f7..000000000 --- a/inst/templates/_add-region-reports.Rmd +++ /dev/null @@ -1,23 +0,0 @@ -### Regional reports - - -```{r, include = FALSE} -regions <- EpiNow2::get_regions(here::here(region_path)) -show_title <- TRUE -title_depth <- 4 - -region_summaries <- seq_along(regions) %>% - purrr::map(function(region_index) { - index <- region_index - region <- regions[region_index] - region_name <- names(regions)[region_index] - out <- knitr::knit_child( - system.file("templates/_add-region-reports.Rmd", package = "EpiNow2"), - envir = environment()) - }) -``` - - -```{r, results="asis"} -cat(paste(region_summaries, collapse = '\n')) -``` diff --git a/inst/templates/_all-region-summary.Rmd b/inst/templates/_all-region-summary.Rmd deleted file mode 100644 index 7ec2af11e..000000000 --- a/inst/templates/_all-region-summary.Rmd +++ /dev/null @@ -1,31 +0,0 @@ - - -### Reproduction numbers over time in all regions - -```{r, fig.height = 12, fig.width = 8, layout="l-body-outset", out.width = "95%"} -knitr::include_graphics(here::here(summary_path, "rt_plot.png")) -``` - -
-`r paste0("*Figure ", fig_start + 4, ": Time-varying estimate of the effective reproduction number (lightest ribbon = 90% credible interval; darker ribbon = the 50% credible interval, darkest ribbon = 20% credible interval) in all regions. Estimates from existing data are shown up to the ", latest_date, ifelse(report_forecast, " from when forecasts are shown. These should be considered indicative only", ""), ". Estimates based on partial data have been adjusted for right truncation of infections. The horizontal dotted line indicates the target value of 1 for the effective reproduction no. required for control. The vertical dashed line indicates the date of report generation.*")` - -`r paste0("### Confirmed ", case_def, "s and their estimated date of infection in all regions")` - - -```{r, fig.height = 12, fig.width = 8, layout="l-body-outset", out.width = "90%"} -knitr::include_graphics(here::here(summary_path, "infections_plot.png")) -``` - -`r paste0("*Figure ", fig_start + 5, ": Confirmed ", case_def, "s by date of report (bars) and their estimated date of infection (lightest ribbon = 90% credible interval; darker ribbon = the 50% credible interval, darkest ribbon = 20% credible interval) in all regions. Estimates from existing data are shown up to the ", latest_date, ifelse(report_forecast, " from when forecasts are shown. These should be considered indicative only", ""),". Estimates based on partial data have been adjusted for right truncation of infections. The vertical dashed line indicates the date of report generation. Uncertainty has been curtailed to a maximum of ten times the maximum number of reported cases for plotting purposes.*")` - -`r paste0("### Confirmed ", case_def, "s and their estimated date of report in all regions")` - - -```{r, fig.height = 12, fig.width = 8, layout="l-body-outset", out.width = "90%"} -knitr::include_graphics(here::here(summary_path, "reported_cases_plot.png")) -``` - -`r paste0("*Figure ", fig_start + 6, ": Confirmed ", case_def, "s by date of report (bars) and their estimated date of report (lightest ribbon = 90% credible interval; darker ribbon = the 50% credible interval, darkest ribbon = 20% credible interval) in all regions. Estimates from existing data are shown up to the ", latest_date, ifelse(report_forecast, " from when forecasts are shown. These should be considered indicative only", ""),". Estimates based on partial data have been adjusted for right truncation of infections. The vertical dashed line indicates the date of report generation. Uncertainty has been curtailed to a maximum of ten times the maximum number of reported cases for plotting purposes.*")` - - - diff --git a/inst/templates/_region-report.Rmd b/inst/templates/_region-report.Rmd deleted file mode 100644 index 02b57a17c..000000000 --- a/inst/templates/_region-report.Rmd +++ /dev/null @@ -1,52 +0,0 @@ - -```{r, include = FALSE} -knitr::opts_chunk$set(echo = FALSE, eval = TRUE, - fig.width = 12, fig.height = 12, - message = FALSE, - warning = FALSE, - dpi = 300) -``` - - -`r if (show_title) paste0('#### ', stringr::str_to_title(region_name))` - -```{r} -library(tibble) -library(knitr) -library(kableExtra) -library(here) - -if (!exists("case_def")) { - case_def <- "case" -} - -if (!exists("report_growth")) { - report_growth <- TRUE -} -``` - -`r paste(c(rep("#", title_depth), paste0(" Summary (estimates as of the ", latest_date, ")")), collapse = "")` - - -`r paste0("*Table ", summary_tables + index, ": Latest estimates (as of the ", latest_date, ") of the number of confirmed ", case_def, "s by date of infection, the expected change in daily confirmed ", case_def, "s, the effective reproduction number, the growth rate, and the doubling time (when negative this corresponds to the halving time). The median and 90% credible interval is shown for each numeric estimate.*")` -
-```{r} -readRDS(here::here(file.path(region_path, region, "latest/summary.rds"))) %>% -.[, 1:2] %>% -knitr::kable(col.names = c("", "Estimate"), booktabs = TRUE) %>% - kableExtra::kable_styling(latex_options = c("striped", "hold_position"), - full_width = TRUE) -``` - - -`r paste(c(rep("#", title_depth), " Confirmed ", case_def, "s, their estimated date of report, date of infection, and time-varying reproduction number estimates"), collapse = "")` - -```{r, fig.height = 9, fig.width = 8, out.width = "90%"} -knitr::include_graphics(here::here(file.path(region_path, region, "latest/summary_plot.png"))) -``` - -
-`r paste0("*Figure ", summary_figures + 1 + (index - 1) * 2, ": A.) Confirmed ", case_def, "s by date of report (bars) and their estimated date of report. B.) Confirmed ", case_def, "s by date of report (bars) and their estimated date of infection. C.) Time-varying estimate of the effective reproduction number (lightest ribbon = 90% credible interval; darker ribbon = the 50% credible interval, darkest ribbon = 20% credible interval). Estimates from existing data are shown up to the ", latest_date, ifelse(report_forecast, " from when forecasts are shown. These should be considered indicative only", ""), ". Estimates based on partial data have been adjusted for right truncation of infections. The vertical dashed line indicates the date of report generation. Uncertainty has been curtailed to a maximum of ten times the maximum number of reported cases for plotting purposes.*")` - - - diff --git a/inst/templates/_regional-summary.Rmd b/inst/templates/_regional-summary.Rmd deleted file mode 100644 index b1c71219b..000000000 --- a/inst/templates/_regional-summary.Rmd +++ /dev/null @@ -1,131 +0,0 @@ - -```{r, include = FALSE} -knitr::opts_chunk$set(echo = FALSE, eval = TRUE, - fig.width = 12, fig.height = 12, - message = FALSE, - warning = FALSE, - dpi = 400) - -require(knitr) -require(kableExtra) -require(here) - -if (standalone) { - fig_start <- 1 - tab_start <- 1 - }else{ - if (!exists("fig_start")) { - fig_start <- 3 - } - - if (!exists("tab_start")) { - tab_start <- 2 - } - } - -if (!exists("case_def")) { - case_def <- "case" -} - -if (!exists("interactive")) { - interactive <- FALSE -} - -if (interactive) { - require(DT) -} -``` - -`r paste0("### Summary of latest reproduction number and confirmed ", case_def, " count estimates by date of infection")` - -```{r, fig.height = 8, fig.width = 12, out.width = "95%"} -knitr::include_graphics(here::here(file.path(summary_path, "summary_plot.png"))) -``` - -
-`r paste0("*Figure ", fig_start, ": Confirmed ", case_def, "s with date of infection on the ", latest_date, " and the time-varying estimate of the effective reproduction number (lightest ribbon = 90% credible interval; darker ribbon = the 50% credible interval, darkest ribbon = 20% credible interval). Regions are ordered by the number of expected daily confirmed ", case_def, "s and shaded based on the expected change in daily confirmed " , case_def, "s. The horizontal dotted line indicates the target value of 1 for the effective reproduction no. required for control and a single case required for elimination. Uncertainty has been curtailed to a maximum of ten times the maximum number of reported cases for plotting purposes.*")` - -`r paste0("### Reproduction numbers over time in the six regions expected to have the most new confirmed ", case_def, "s")` - -```{r, fig.height = 6, fig.width = 8, layout="l-body-outset", out.width = "95%"} -knitr::include_graphics(here::here(file.path(summary_path, "high_rt_plot.png"))) -``` - -
-`r paste0("*Figure ", fig_start + 1, ": Time-varying estimate of the effective reproduction number (lightest ribbon = 90% credible interval; darker ribbon = the 50% credible interval, darkest ribbon = 20% credible interval) in the regions expected to have the highest number of new confirmed ", case_def, "s. Estimates from existing data are shown up to the ", latest_date, ifelse(report_forecast, " from when forecasts are shown. These should be considered indicative only", ""), ". Estimates based on partial data have been adjusted for right truncation of infections. The vertical dashed line indicates the date of report generation.*")` - -`r paste0("### Confirmed ", case_def, "s and their estimated date of infection in the six regions expected to have the most new confirmed ", case_def, "s")` - -```{r, fig.height = 6, fig.width = 8, layout="l-body-outset", out.width = "95%"} -knitr::include_graphics(here::here(file.path(summary_path, "high_infections_plot.png"))) -``` - -
-`r paste0("*Figure ", fig_start + 2, ": Confirmed ", case_def, "s by date of report (bars) and their estimated date of infection (lightest ribbon = 90% credible interval; darker ribbon = the 50% credible interval, darkest ribbon = 20% credible interval) in the regions expected to have the highest number of new confirmed ", case_def, "s. Estimates from existing data are shown up to the ", latest_date, ifelse(report_forecast, " from when forecasts are shown. These should be considered indicative only", ""), ". Estimates based on partial data have been adjusted for right truncation of infections. The vertical dashed line indicates the date of report generation. Uncertainty has been curtailed to a maximum of ten times the maximum number of reported cases for plotting purposes.*")` - -`r paste0("### Confirmed ", case_def, "s and their estimated date of report in the six regions expected to have the most new confirmed ", case_def, "s")` - -```{r, fig.height = 6, fig.width = 8, layout="l-body-outset", out.width = "95%"} -knitr::include_graphics(here::here(file.path(summary_path, "high_reported_cases_plot.png"))) -``` - -
-`r paste0("*Figure ", fig_start + 3, ": Confirmed ", case_def, "s by date of report (bars) and their estimated date of report (lightest ribbon = 90% credible interval; darker ribbon = the 50% credible interval, darkest ribbon = 20% credible interval) in the regions expected to have the highest number of new confirmed ", case_def, "s. Estimates from existing data are shown up to the ", latest_date, ifelse(report_forecast, " from when forecasts are shown. These should be considered indicative only", ""), ". Estimates based on partial data have been adjusted for right truncation of infections. The vertical dashed line indicates the date of report generation. Uncertainty has been curtailed to a maximum of ten times the maximum number of reported cases for plotting purposes.*")` - - -```{r} -if (!exists("all_regions")) { - all_regions <- TRUE -} - -if (!file.exists((here::here(summary_path, "rt_plot.png")))) { - all_regions <- FALSE -} -``` - -```{r, child = system.file("templates/_all-region-summary.Rmd", package = "EpiNow2"), eval = all_regions} -``` - - -`r paste0("### Latest estimates (as of the ", latest_date, ")")` - - -`r paste0("*Table ", tab_start, ": Latest estimates (as of the ", latest_date, ") of the number of confirmed ", case_def, "s by date of infection, the effective reproduction number, the rate of growth, and the doubling time (when negative this corresponds to the halving time) in each region. The median and 90% credible interval is shown.*")` -
-```{r, layout="l-body-outset", out.width = "90%"} - -if (!interactive) { - data.table::fread(here::here(summary_path, "summary_table.csv")) %>% - knitr::kable(booktabs = TRUE, longtable = TRUE) %>% - kableExtra::landscape() -}else{ - summary_table <- data.table::fread(here::here(summary_path, "summary_table.csv")) - numeric_cols <- - unname(which(apply(summary_table, 2, - function(x) all(grepl("^[0-9e.() -]+$", x))))) - sort_table <- apply(summary_table[, numeric_cols, with = FALSE], 2, - function(x) as.numeric(sub(" \\(.*\\)$", "", x))) - sort_cols <- ncol(summary_table) + seq_len(ncol(sort_table)) - columnDefs <- - c(lapply(seq_along(sort_cols), function(x) { - list(orderData = sort_cols[x] - 1L, - targets = numeric_cols[x] - 1L) - }), - list(list(visible = FALSE, targets = sort_cols - 1L))) - summary_table %>% - cbind(sort_table) %>% - DT::datatable(rownames = FALSE, - extensions = c("Buttons"), - options = list(dom = "Bfrtip", buttons = c("csv"), - columnDefs = columnDefs)) -} -``` - -```{r} -summary_tables <- tab_start -summary_figures <- fig_start + 6 -``` - -```{r, child = system.file("templates/_add-region-reports.Rmd", package = "EpiNow2"), eval = !is.null(region_path)} -``` -