From e920b3e514e717fc05ed524267d3b53e272fec51 Mon Sep 17 00:00:00 2001 From: Naeem Model Date: Mon, 6 Jan 2025 23:55:43 +0000 Subject: Update web app entry point - Rename 'app' -> 'web' - Return shiny app object in entry point function --- inst/web/templates/content.html | 14 ++++++++ inst/web/templates/content/about.html | 28 ++++++++++++++++ inst/web/templates/content/data.html | 12 +++++++ inst/web/templates/content/data/enter-data.html | 9 +++++ .../content/data/enter-data/load-samples.html | 19 +++++++++++ .../content/data/enter-data/manual-entry.html | 11 ++++++ .../content/data/enter-data/required-format.html | 25 ++++++++++++++ .../content/data/enter-data/upload-data.html | 12 +++++++ inst/web/templates/content/data/view-data.html | 3 ++ .../content/data/view-data/data-plots.html | 7 ++++ .../content/data/view-data/data-table.html | 18 ++++++++++ inst/web/templates/content/estimation.html | 13 ++++++++ .../content/estimation/about-estimators.html | 31 +++++++++++++++++ .../content/estimation/about-estimators/id.html | 3 ++ .../content/estimation/about-estimators/idea.html | 4 +++ .../content/estimation/about-estimators/panel.html | 14 ++++++++ .../estimation/about-estimators/seq_bayes.html | 9 +++++ .../content/estimation/about-estimators/wp.html | 6 ++++ .../templates/content/estimation/estimates.html | 3 ++ .../estimation/estimates/add-estimators.html | 16 +++++++++ .../estimation/estimates/add-estimators/id.html | 1 + .../estimation/estimates/add-estimators/idea.html | 1 + .../estimation/estimates/add-estimators/mu.html | 22 ++++++++++++ .../estimates/add-estimators/parameters.html | 7 ++++ .../estimates/add-estimators/seq_bayes.html | 22 ++++++++++++ .../estimation/estimates/add-estimators/wp.html | 39 ++++++++++++++++++++++ .../estimation/estimates/estimates-table.html | 19 +++++++++++ inst/web/templates/content/help.html | 8 +++++ inst/web/templates/content/help/panel.html | 12 +++++++ .../templates/content/help/serial-interval.html | 9 +++++ inst/web/templates/footer.html | 7 ++++ inst/web/templates/navbar.html | 27 +++++++++++++++ inst/web/templates/tabs.html | 14 ++++++++ 33 files changed, 445 insertions(+) create mode 100644 inst/web/templates/content.html create mode 100644 inst/web/templates/content/about.html create mode 100644 inst/web/templates/content/data.html create mode 100644 inst/web/templates/content/data/enter-data.html create mode 100644 inst/web/templates/content/data/enter-data/load-samples.html create mode 100644 inst/web/templates/content/data/enter-data/manual-entry.html create mode 100644 inst/web/templates/content/data/enter-data/required-format.html create mode 100644 inst/web/templates/content/data/enter-data/upload-data.html create mode 100644 inst/web/templates/content/data/view-data.html create mode 100644 inst/web/templates/content/data/view-data/data-plots.html create mode 100644 inst/web/templates/content/data/view-data/data-table.html create mode 100644 inst/web/templates/content/estimation.html create mode 100644 inst/web/templates/content/estimation/about-estimators.html create mode 100644 inst/web/templates/content/estimation/about-estimators/id.html create mode 100644 inst/web/templates/content/estimation/about-estimators/idea.html create mode 100644 inst/web/templates/content/estimation/about-estimators/panel.html create mode 100644 inst/web/templates/content/estimation/about-estimators/seq_bayes.html create mode 100644 inst/web/templates/content/estimation/about-estimators/wp.html create mode 100644 inst/web/templates/content/estimation/estimates.html create mode 100644 inst/web/templates/content/estimation/estimates/add-estimators.html create mode 100644 inst/web/templates/content/estimation/estimates/add-estimators/id.html create mode 100644 inst/web/templates/content/estimation/estimates/add-estimators/idea.html create mode 100644 inst/web/templates/content/estimation/estimates/add-estimators/mu.html create mode 100644 inst/web/templates/content/estimation/estimates/add-estimators/parameters.html create mode 100644 inst/web/templates/content/estimation/estimates/add-estimators/seq_bayes.html create mode 100644 inst/web/templates/content/estimation/estimates/add-estimators/wp.html create mode 100644 inst/web/templates/content/estimation/estimates/estimates-table.html create mode 100644 inst/web/templates/content/help.html create mode 100644 inst/web/templates/content/help/panel.html create mode 100644 inst/web/templates/content/help/serial-interval.html create mode 100644 inst/web/templates/footer.html create mode 100644 inst/web/templates/navbar.html create mode 100644 inst/web/templates/tabs.html (limited to 'inst/web/templates') diff --git a/inst/web/templates/content.html b/inst/web/templates/content.html new file mode 100644 index 0000000..da69f08 --- /dev/null +++ b/inst/web/templates/content.html @@ -0,0 +1,14 @@ +
+
+ {{ htmlTemplate("templates/content/about.html") }} +
+
+ {{ htmlTemplate("templates/content/data.html") }} +
+
+ {{ htmlTemplate("templates/content/estimation.html") }} +
+
+ {{ htmlTemplate("templates/content/help.html") }} +
+
diff --git a/inst/web/templates/content/about.html b/inst/web/templates/content/about.html new file mode 100644 index 0000000..73b75ea --- /dev/null +++ b/inst/web/templates/content/about.html @@ -0,0 +1,28 @@ +

Welcome to the Rnaught web application

+

+ Rnaught is an R package and web application for estimating the + basic reproduction number + of infectious diseases. For information about using this application, view the + Help tab. + To learn more about the package, visit the online + documentation or + GitHub repository. + Technical details about the estimators featured in this project can be found in the reference + article. +

+

What is the basic reproduction number?

+

+ The basic reproduction number, denoted R0, is defined as the expected number of infections caused + by a single infectious individual when introduced into a totally susceptible population. It assumes that all + individuals in a given population are susceptible to the disease, and that no preventive measures (such as lockdowns + or vaccinations) have been enforced. It is a useful indicator of the transmissibility of an infectious disease during + the early stages of its spread and detection. +

+

+ If R0 < 1, the disease will eventually die out. On the other hand, if + R0 > 1, the disease will spread (the higher the R0, the faster this will + happen). Due to uncertainty of known data about the disease, it is difficult to determine R0 + precisely. Therefore, many estimation methods exist, each based on different assumptions and yielding different + estimates. It is the responsibility of users to employ the most appropriate estimator (or suite of estimators) given + the situation at hand. +

diff --git a/inst/web/templates/content/data.html b/inst/web/templates/content/data.html new file mode 100644 index 0000000..574f003 --- /dev/null +++ b/inst/web/templates/content/data.html @@ -0,0 +1,12 @@ + +
+
+ {{ htmlTemplate("templates/content/data/enter-data.html") }} +
+
+ {{ htmlTemplate("templates/content/data/view-data.html") }} +
+
diff --git a/inst/web/templates/content/data/enter-data.html b/inst/web/templates/content/data/enter-data.html new file mode 100644 index 0000000..254f1d7 --- /dev/null +++ b/inst/web/templates/content/data/enter-data.html @@ -0,0 +1,9 @@ +
+ {{ htmlTemplate("templates/content/data/enter-data/required-format.html") }} + {{ htmlTemplate("templates/content/data/enter-data/manual-entry.html") }} + {{ htmlTemplate("templates/content/data/enter-data/upload-data.html") }} +
+
+
+ {{ htmlTemplate("templates/content/data/enter-data/load-samples.html") }} +
diff --git a/inst/web/templates/content/data/enter-data/load-samples.html b/inst/web/templates/content/data/enter-data/load-samples.html new file mode 100644 index 0000000..2a4f013 --- /dev/null +++ b/inst/web/templates/content/data/enter-data/load-samples.html @@ -0,0 +1,19 @@ +

Load samples

+ +{{ + checkboxInput(inputId = "covid_canada", label = "COVID-19 Canada, 2020/03/03 - 2020/03/31 (Weekly)", + value = FALSE, width = "100%" + ) +}} +{{ + checkboxInput(inputId = "covid_ontario", label = "COVID-19 Ontario, 2020/03/03 - 2020/03/31 (Weekly)", + value = FALSE, width = "100%" + ) +}} + +
+ +
+ diff --git a/inst/web/templates/content/data/enter-data/manual-entry.html b/inst/web/templates/content/data/enter-data/manual-entry.html new file mode 100644 index 0000000..a6319d9 --- /dev/null +++ b/inst/web/templates/content/data/enter-data/manual-entry.html @@ -0,0 +1,11 @@ + +
+ + +
+ +
+ +
diff --git a/inst/web/templates/content/data/enter-data/required-format.html b/inst/web/templates/content/data/enter-data/required-format.html new file mode 100644 index 0000000..724dd83 --- /dev/null +++ b/inst/web/templates/content/data/enter-data/required-format.html @@ -0,0 +1,25 @@ + + + +
+
+

Manually enter rows or upload a CSV file in the following format:

+

+ Dataset name,Time units,Case counts +

+

+ Time units must be one of + Days or + Weeks, and + Case counts + must be a comma-separated list of one or more non-negative integers. +

+

Example:

+

+ Disease A,Days,1,2,3,4,5,6,7,8,9
+ Disease B,Weeks,3,1,4,1,5,2,9
+ Disease C,Days,2,3,5,7,11,13,17,19 +

+
+
diff --git a/inst/web/templates/content/data/enter-data/upload-data.html b/inst/web/templates/content/data/enter-data/upload-data.html new file mode 100644 index 0000000..740047b --- /dev/null +++ b/inst/web/templates/content/data/enter-data/upload-data.html @@ -0,0 +1,12 @@ + + + + +
+ + +
+ + diff --git a/inst/web/templates/content/data/view-data.html b/inst/web/templates/content/data/view-data.html new file mode 100644 index 0000000..880cf7f --- /dev/null +++ b/inst/web/templates/content/data/view-data.html @@ -0,0 +1,3 @@ +{{ htmlTemplate("templates/content/data/view-data/data-table.html") }} +
+{{ htmlTemplate("templates/content/data/view-data/data-plots.html") }} diff --git a/inst/web/templates/content/data/view-data/data-plots.html b/inst/web/templates/content/data/view-data/data-plots.html new file mode 100644 index 0000000..5019088 --- /dev/null +++ b/inst/web/templates/content/data/view-data/data-plots.html @@ -0,0 +1,7 @@ +

Data plots

+
+ {{ plotly::plotlyOutput(outputId = "data_plot_days") }} +
+
+ {{ plotly::plotlyOutput(outputId = "data_plot_weeks") }} +
diff --git a/inst/web/templates/content/data/view-data/data-table.html b/inst/web/templates/content/data/view-data/data-table.html new file mode 100644 index 0000000..590a5b9 --- /dev/null +++ b/inst/web/templates/content/data/view-data/data-table.html @@ -0,0 +1,18 @@ +

Data table

+
+ {{ DT::dataTableOutput(outputId = "data_table") }} +
+ + + + + + + Export table + diff --git a/inst/web/templates/content/estimation.html b/inst/web/templates/content/estimation.html new file mode 100644 index 0000000..5764057 --- /dev/null +++ b/inst/web/templates/content/estimation.html @@ -0,0 +1,13 @@ + + +
+
+ {{ htmlTemplate("templates/content/estimation/about-estimators.html") }} +
+
+ {{ htmlTemplate("templates/content/estimation/estimates.html") }} +
+
diff --git a/inst/web/templates/content/estimation/about-estimators.html b/inst/web/templates/content/estimation/about-estimators.html new file mode 100644 index 0000000..db2898b --- /dev/null +++ b/inst/web/templates/content/estimation/about-estimators.html @@ -0,0 +1,31 @@ +
+ {{ + htmlTemplate("templates/content/estimation/about-estimators/panel.html", + id = "id", + header = "Incidence Decay (ID)", + reference_label = "Fisman et al. (PloS One, 2013)", + reference_url = "https://doi.org/10.1371/journal.pone.0083622" + ) + }} + {{ + htmlTemplate("templates/content/estimation/about-estimators/panel.html", + id = "idea", header = "Incidence Decay and Exponential Adjustment (IDEA)", + reference_label = "Fisman et al. (PloS One, 2013)", + reference_url = "https://doi.org/10.1371/journal.pone.0083622" + ) + }} + {{ + htmlTemplate("templates/content/estimation/about-estimators/panel.html", + id = "seq_bayes", header = "Sequential Bayes (seqB)", + reference_label = "Bettencourt and Riberio (PloS One, 2008)", + reference_url = "https://doi.org/10.1371/journal.pone.0002185" + ) + }} + {{ + htmlTemplate("templates/content/estimation/about-estimators/panel.html", + id = "wp", header = "White and Pagano (WP)", + reference_label = "White and Pagano (Statistics in Medicine, 2008)", + reference_url = "https://doi.org/10.1002/sim.3136" + ) + }} +
diff --git a/inst/web/templates/content/estimation/about-estimators/id.html b/inst/web/templates/content/estimation/about-estimators/id.html new file mode 100644 index 0000000..fc70b1c --- /dev/null +++ b/inst/web/templates/content/estimation/about-estimators/id.html @@ -0,0 +1,3 @@ +The Incidence Decay (ID) estimator uses the method of least squares to estimate R0. +This method assumes the serial interval is known, and is built under the SIR assumption. +We note that the use of this method might result in the underestimation of R0. diff --git a/inst/web/templates/content/estimation/about-estimators/idea.html b/inst/web/templates/content/estimation/about-estimators/idea.html new file mode 100644 index 0000000..67548f8 --- /dev/null +++ b/inst/web/templates/content/estimation/about-estimators/idea.html @@ -0,0 +1,4 @@ +The Incidence Decay and Exponential Adjustment (ID) estimator is an alternative formulation of the Incidence Decay (ID) model which includes a decay factor to reflect the often observed outbreak decline. +This addresses the potential underestimation of the R0 estimate when using the ID method. +The method of least squares is used to estimate R0, and similar to the ID model, the serial interval is assumed to be known and this method is developed assuming the SIR model. +We note that, since we need to obtain a minimizer of the decay factor to solve the optimization problem, we require that the number of cases in the dataset be at least 2. diff --git a/inst/web/templates/content/estimation/about-estimators/panel.html b/inst/web/templates/content/estimation/about-estimators/panel.html new file mode 100644 index 0000000..98fe155 --- /dev/null +++ b/inst/web/templates/content/estimation/about-estimators/panel.html @@ -0,0 +1,14 @@ +
+

+ +

+
+
+

Reference: {{ reference_label }}

+

{{ htmlTemplate(paste0("templates/content/estimation/about-estimators/", id, ".html")) }}

+
+
+
diff --git a/inst/web/templates/content/estimation/about-estimators/seq_bayes.html b/inst/web/templates/content/estimation/about-estimators/seq_bayes.html new file mode 100644 index 0000000..8f66ab4 --- /dev/null +++ b/inst/web/templates/content/estimation/about-estimators/seq_bayes.html @@ -0,0 +1,9 @@ +The sequential Bayes (seqB) estimator uses a Bayesian approach to estimate R0 which updates the reproductive number estimate as data accumulates over time. +This approach is based on the SIR model, and assumes that the mean of the serial distribution (ie. the serial interval (SI)) is known. +It is assumed that infectious counts are observed at periodic times (ie. daily, weekly). +This method cannot handle datasets where there are no new infections observed in a time interval, thus, to remedy this, +some manipulation may be necessary to make the times at which infectious counts are observed sufficiently course (ie. weeks instead of days). +Further, this method is also inappropriate in situations where long intervals between cases are observed in the initial stages of the epidemic. +Finally, the R0 approximation behaves similarly to a branching process, which means that throughout, the population size “available” to be infected remains constant. +We note that this assumption does not hold for the SIR/SEIR/SEAIR compartmental models. +As such, seqB estimates should only really be considered early on in an epidemic, ie. before the inflection point of an epidemic, if the dataset being used follows these models. diff --git a/inst/web/templates/content/estimation/about-estimators/wp.html b/inst/web/templates/content/estimation/about-estimators/wp.html new file mode 100644 index 0000000..c6f4580 --- /dev/null +++ b/inst/web/templates/content/estimation/about-estimators/wp.html @@ -0,0 +1,6 @@ +The White and Pagano (WP) estimator uses maximum likelihood estimation to estimate R0. +In this method, the serial interval (SI) is either known, or can be estimated along with R0. +It is assumed that the number of infectious individuals are observable at discrete time points (ie. daily or weekly). +Further, this method also assumes an underlying branching process, which means that throughout, the population size “available” to be infected remains constant. +We note that this assumption does not hold for the SIR/SEIR/SEAIR compartmental models. +As such, WP estimates should only really be considered early on in an epidemic, ie. before the inflection point of an epidemic, if the dataset being used follows these models. diff --git a/inst/web/templates/content/estimation/estimates.html b/inst/web/templates/content/estimation/estimates.html new file mode 100644 index 0000000..bc9124e --- /dev/null +++ b/inst/web/templates/content/estimation/estimates.html @@ -0,0 +1,3 @@ +{{ htmlTemplate("templates/content/estimation/estimates/estimates-table.html") }} +
+{{ htmlTemplate("templates/content/estimation/estimates/add-estimators.html") }} diff --git a/inst/web/templates/content/estimation/estimates/add-estimators.html b/inst/web/templates/content/estimation/estimates/add-estimators.html new file mode 100644 index 0000000..60111c7 --- /dev/null +++ b/inst/web/templates/content/estimation/estimates/add-estimators.html @@ -0,0 +1,16 @@ +

Add estimators

+
+ + + + + {{ htmlTemplate("templates/content/estimation/estimates/add-estimators/parameters.html", id = "id") }} + {{ htmlTemplate("templates/content/estimation/estimates/add-estimators/parameters.html", id = "idea") }} + {{ htmlTemplate("templates/content/estimation/estimates/add-estimators/parameters.html", id = "seq_bayes") }} + {{ htmlTemplate("templates/content/estimation/estimates/add-estimators/parameters.html", id = "wp") }} +
diff --git a/inst/web/templates/content/estimation/estimates/add-estimators/id.html b/inst/web/templates/content/estimation/estimates/add-estimators/id.html new file mode 100644 index 0000000..7c35e55 --- /dev/null +++ b/inst/web/templates/content/estimation/estimates/add-estimators/id.html @@ -0,0 +1 @@ +{{ htmlTemplate("templates/content/estimation/estimates/add-estimators/mu.html", id = "id") }} diff --git a/inst/web/templates/content/estimation/estimates/add-estimators/idea.html b/inst/web/templates/content/estimation/estimates/add-estimators/idea.html new file mode 100644 index 0000000..781349f --- /dev/null +++ b/inst/web/templates/content/estimation/estimates/add-estimators/idea.html @@ -0,0 +1 @@ +{{ htmlTemplate("templates/content/estimation/estimates/add-estimators/mu.html", id = "idea") }} diff --git a/inst/web/templates/content/estimation/estimates/add-estimators/mu.html b/inst/web/templates/content/estimation/estimates/add-estimators/mu.html new file mode 100644 index 0000000..8781574 --- /dev/null +++ b/inst/web/templates/content/estimation/estimates/add-estimators/mu.html @@ -0,0 +1,22 @@ + + +
+ + + + +
+ +
+ +
diff --git a/inst/web/templates/content/estimation/estimates/add-estimators/parameters.html b/inst/web/templates/content/estimation/estimates/add-estimators/parameters.html new file mode 100644 index 0000000..5250e31 --- /dev/null +++ b/inst/web/templates/content/estimation/estimates/add-estimators/parameters.html @@ -0,0 +1,7 @@ +
+
Parameters
+ {{ htmlTemplate(paste0("templates/content/estimation/estimates/add-estimators/", id, ".html")) }} + +
diff --git a/inst/web/templates/content/estimation/estimates/add-estimators/seq_bayes.html b/inst/web/templates/content/estimation/estimates/add-estimators/seq_bayes.html new file mode 100644 index 0000000..028fabc --- /dev/null +++ b/inst/web/templates/content/estimation/estimates/add-estimators/seq_bayes.html @@ -0,0 +1,22 @@ +
+ +
+ {{ htmlTemplate("templates/content/estimation/estimates/add-estimators/mu.html", id = "seq_bayes") }} +
+ +
+ + + + + + +
+
diff --git a/inst/web/templates/content/estimation/estimates/add-estimators/wp.html b/inst/web/templates/content/estimation/estimates/add-estimators/wp.html new file mode 100644 index 0000000..511170f --- /dev/null +++ b/inst/web/templates/content/estimation/estimates/add-estimators/wp.html @@ -0,0 +1,39 @@ + + +
+
+ +
+
+ +
+
+ +
+ {{ htmlTemplate("templates/content/estimation/estimates/add-estimators/mu.html", id = "wp") }} +
+ +
+ +
+ + + +
+ +
+ + + +
+ +
+ + + +
+
diff --git a/inst/web/templates/content/estimation/estimates/estimates-table.html b/inst/web/templates/content/estimation/estimates/estimates-table.html new file mode 100644 index 0000000..4704d03 --- /dev/null +++ b/inst/web/templates/content/estimation/estimates/estimates-table.html @@ -0,0 +1,19 @@ +

Estimates table

+ +
+ {{ DT::dataTableOutput(outputId = "estimates_table") }} +
+ + + + + + + Export table + diff --git a/inst/web/templates/content/help.html b/inst/web/templates/content/help.html new file mode 100644 index 0000000..df4e887 --- /dev/null +++ b/inst/web/templates/content/help.html @@ -0,0 +1,8 @@ +
+ {{ + htmlTemplate("templates/content/help/panel.html", + id = "serial-interval", + header = "What is the serial interval?" + ) + }} +
diff --git a/inst/web/templates/content/help/panel.html b/inst/web/templates/content/help/panel.html new file mode 100644 index 0000000..9eb6e2e --- /dev/null +++ b/inst/web/templates/content/help/panel.html @@ -0,0 +1,12 @@ +
+

+ +

+
+
+ {{ htmlTemplate(paste0("templates/content/help/", id, ".html")) }} +
+
+
diff --git a/inst/web/templates/content/help/serial-interval.html b/inst/web/templates/content/help/serial-interval.html new file mode 100644 index 0000000..e061115 --- /dev/null +++ b/inst/web/templates/content/help/serial-interval.html @@ -0,0 +1,9 @@ +

Reference: Wikipedia +

+ The serial interval (SI) is not one of the estimators. It is a parameter required by most of the estimators, and can + also be estimated by some of them (if not specified). +

+

+ The SI is defined as the average time between successive infections in a chain of transmission (i.e., the time between + the infection of an infected individual and their subsequent transmissions). +

diff --git a/inst/web/templates/footer.html b/inst/web/templates/footer.html new file mode 100644 index 0000000..19d4b0c --- /dev/null +++ b/inst/web/templates/footer.html @@ -0,0 +1,7 @@ + diff --git a/inst/web/templates/navbar.html b/inst/web/templates/navbar.html new file mode 100644 index 0000000..d447fba --- /dev/null +++ b/inst/web/templates/navbar.html @@ -0,0 +1,27 @@ + diff --git a/inst/web/templates/tabs.html b/inst/web/templates/tabs.html new file mode 100644 index 0000000..351b480 --- /dev/null +++ b/inst/web/templates/tabs.html @@ -0,0 +1,14 @@ + -- cgit v1.2.3