diff options
author | Naeem Model <me@nmode.ca> | 2024-06-09 16:01:51 +0000 |
---|---|---|
committer | Naeem Model <me@nmode.ca> | 2024-06-09 16:01:51 +0000 |
commit | 9fd931aeeba4ab7bdede1a625f64e7024c2b55aa (patch) | |
tree | b59967df497f898e9b8f7e1cd0e345ed0ff71e36 /inst/app/templates/content/estimation/estimates | |
parent | 887c57c423ca8318d482a9f85514b3d6f281a696 (diff) |
Update Shiny app
- Remove template/logic for single data entry
- Change 'Add estimators' to 'About estimators'; adding estimators and viewing estimates are now done in the same tab
- Swap rows and columns in estimates table (estimators as row names, datasets as column names)
- Add a separate column for the serial interval to the estimates table
- Add plots for daily and weekly data using the Plotly library
- Remove italics from the subscript in all occurences of 'R_0'
- Fix code/text formatting
Diffstat (limited to 'inst/app/templates/content/estimation/estimates')
8 files changed, 127 insertions, 0 deletions
diff --git a/inst/app/templates/content/estimation/estimates/add-estimators.html b/inst/app/templates/content/estimation/estimates/add-estimators.html new file mode 100644 index 0000000..60111c7 --- /dev/null +++ b/inst/app/templates/content/estimation/estimates/add-estimators.html @@ -0,0 +1,16 @@ +<h4>Add estimators</h4> +<form class="my-3"> + <!-- Dropdown to select estimator. --> + <label class="form-label" for="estimator_select">Select estimator:</label> + <select name="estimator_select" class="form-select"> + <option value="id" selected>Incidence Decay (ID)</option> + <option value="idea">Incidence Decay and Exponential Adjustment (IDEA)</option> + <option value="seq_bayes">Sequential Bayes (seqB)</option> + <option value="wp">White and Pagano (WP)</option> + </select> + <!-- Parameters. --> + {{ 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") }} +</form> diff --git a/inst/app/templates/content/estimation/estimates/add-estimators/id.html b/inst/app/templates/content/estimation/estimates/add-estimators/id.html new file mode 100644 index 0000000..7c35e55 --- /dev/null +++ b/inst/app/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/app/templates/content/estimation/estimates/add-estimators/idea.html b/inst/app/templates/content/estimation/estimates/add-estimators/idea.html new file mode 100644 index 0000000..781349f --- /dev/null +++ b/inst/app/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/app/templates/content/estimation/estimates/add-estimators/mu.html b/inst/app/templates/content/estimation/estimates/add-estimators/mu.html new file mode 100644 index 0000000..8781574 --- /dev/null +++ b/inst/app/templates/content/estimation/estimates/add-estimators/mu.html @@ -0,0 +1,22 @@ +<!-- Serial interval label and help tooltip. --> +<label class="form-label" for="mu_{{ id }}"> + Serial interval + <sup data-bs-toggle="tooltip" data-bs-placement="right" + data-bs-title="The serial interval is the time between when an infected individual (the infector) becomes + symptomatic, to when another individual (who is infected by the infector) becomes symptomatic."> + [?] + </sup> +</label> +<div class="input-group"> + <!-- Serial interval input field. --> + <input name="mu_{{ id }}" class="form-control" type="text"> + <!-- Days/weeks dropdown. --> + <select name="mu_{{ id }}_units" class="form-select"> + <option value="Days" selected>Days</option> + <option value="Weeks">Weeks</option> + </select> +</div> +<!-- Warning text for incorrect values. --> +<div> + <small id="mu_{{ id }}_warn" class="form-text text-primary shiny-text-output"></small> +</div> diff --git a/inst/app/templates/content/estimation/estimates/add-estimators/parameters.html b/inst/app/templates/content/estimation/estimates/add-estimators/parameters.html new file mode 100644 index 0000000..5250e31 --- /dev/null +++ b/inst/app/templates/content/estimation/estimates/add-estimators/parameters.html @@ -0,0 +1,7 @@ +<div class="my-4" data-display-if="input.estimator_select === '{{ id }}'"> + <h5>Parameters</h5> + {{ htmlTemplate(paste0("templates/content/estimation/estimates/add-estimators/", id, ".html")) }} + <button id="add_{{ id }}" type="button" class="btn btn-outline-primary btn-sm action-button mt-3"> + <span class="glyphicon glyphicon-plus"></span> Add + </button> +</div> diff --git a/inst/app/templates/content/estimation/estimates/add-estimators/seq_bayes.html b/inst/app/templates/content/estimation/estimates/add-estimators/seq_bayes.html new file mode 100644 index 0000000..028fabc --- /dev/null +++ b/inst/app/templates/content/estimation/estimates/add-estimators/seq_bayes.html @@ -0,0 +1,22 @@ +<div class="row"> + <!-- Serial interval (mu). --> + <div class="col-md"> + {{ htmlTemplate("templates/content/estimation/estimates/add-estimators/mu.html", id = "seq_bayes") }} + </div> + <!-- Maximum value of the uniform prior (kappa). --> + <div class="col-md mt-2 mt-md-0"> + <!-- Label and help tooltip. --> + <label class="form-label" for="kappa"> + Maximum prior (κ) + <sup data-bs-toggle="tooltip" data-bs-placement="right" data-bs-html="true" + data-bs-title="The initial maximum belief of <em>R</em><sub>0</sub>. The higher this value, the higher + <em>R</em><sub>0</sub> is believed to be prior to the estimation."> + [?] + </sup> + </label> + <!-- Input field. --> + <input name="kappa" class="form-control" type="text" placeholder="Default: 20"> + <!-- Warning text for incorrect values. --> + <small id="kappa_warn" class="form-text text-primary shiny-text-output"></small> + </div> +</div> diff --git a/inst/app/templates/content/estimation/estimates/add-estimators/wp.html b/inst/app/templates/content/estimation/estimates/add-estimators/wp.html new file mode 100644 index 0000000..511170f --- /dev/null +++ b/inst/app/templates/content/estimation/estimates/add-estimators/wp.html @@ -0,0 +1,39 @@ +<!-- Radio buttons to specify whether the serial interval is known. --> +<label class="form-label" for="wp_mu_known">Is the serial interval known?</label> +<div class="shiny-input-radiogroup" id="wp_mu_known"> + <div class="form-check form-check-inline"> + <label class="form-check-label"> + <input type="radio" class="form-check-input me-2" name="wp_mu_known" value="Yes" checked>Yes + </label> + </div> + <div class="form-check form-check-inline"> + <label class="form-check-label"> + <input type="radio" class="form-check-input me-2" name="wp_mu_known" value="No">No + </label> + </div> +</div> +<!-- Show the input field for the serial interval if it is known. --> +<div data-display-if="input.wp_mu_known == 'Yes'" class="mt-2 mt-md-0"> + {{ htmlTemplate("templates/content/estimation/estimates/add-estimators/mu.html", id = "wp") }} +</div> +<!-- Show the input fields for the grid search parameters if the serial interval is unknown. --> +<div data-display-if="input.wp_mu_known == 'No'" class="row"> + <!-- Grid length. --> + <div class="col-md mt-2 mt-md-0"> + <label class="form-label" for="grid_length">Grid length</label> + <input name="grid_length" class="form-control" type="text" placeholder="Default: 100"> + <small id="grid_length_warn" class="form-text text-primary shiny-text-output"></small> + </div> + <!-- Maximum shape. --> + <div class="col-md mt-2 mt-md-0"> + <label class="form-label" for="max_shape">Maximum shape</label> + <input name="max_shape" class="form-control" type="text" placeholder="Default: 10"> + <small id="max_shape_warn" class="form-text text-primary shiny-text-output"></small> + </div> + <!-- Grid length. --> + <div class="col-md mt-2 mt-md-0"> + <label class="form-label" for="max_scale">Maximum scale</label> + <input name="max_scale" class="form-control" type="text" placeholder="Default: 10"> + <small id="max_scale_warn" class="form-text text-primary shiny-text-output"></small> + </div> +</div> diff --git a/inst/app/templates/content/estimation/estimates/estimates-table.html b/inst/app/templates/content/estimation/estimates/estimates-table.html new file mode 100644 index 0000000..4704d03 --- /dev/null +++ b/inst/app/templates/content/estimation/estimates/estimates-table.html @@ -0,0 +1,19 @@ +<h4>Estimates table</h4> +<!-- Estimates table. --> +<div class="my-3"> + {{ DT::dataTableOutput(outputId = "estimates_table") }} +</div> +<!-- Display inactive delete button when no rows are selected. --> +<button type="button" class="btn btn-primary btn-sm text-white" disabled + data-display-if="'estimates_table_rows_selected' in input && input.estimates_table_rows_selected.length == 0"> + <span class="glyphicon glyphicon-remove"></span> Delete row(s) +</button> +<!-- Display active delete button when at least one row is selected. --> +<button id="estimators_delete" type="button" class="btn btn-primary btn-sm action-button text-white" + data-display-if="'estimates_table_rows_selected' in input && input.estimates_table_rows_selected.length != 0"> + <span class="glyphicon glyphicon-remove"></span> Delete row(s) +</button> +<!-- Button to export estimates table as a CSV file. --> +<a id="estimates_export" type="button" class="btn btn-outline-primary btn-sm shiny-download-link"> + <span class="glyphicon glyphicon-download-alt"></span> Export table +</a> |