aboutsummaryrefslogtreecommitdiff
path: root/inst/app/templates/content/data
diff options
context:
space:
mode:
authorNaeem Model <me@nmode.ca>2024-06-09 16:01:51 +0000
committerNaeem Model <me@nmode.ca>2024-06-09 16:01:51 +0000
commit9fd931aeeba4ab7bdede1a625f64e7024c2b55aa (patch)
treeb59967df497f898e9b8f7e1cd0e345ed0ff71e36 /inst/app/templates/content/data
parent887c57c423ca8318d482a9f85514b3d6f281a696 (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/data')
-rw-r--r--inst/app/templates/content/data/enter-data.html17
-rw-r--r--inst/app/templates/content/data/enter-data/bulk-entry.html48
-rw-r--r--inst/app/templates/content/data/enter-data/entry.html48
-rw-r--r--inst/app/templates/content/data/enter-data/load-samples.html2
-rw-r--r--inst/app/templates/content/data/enter-data/manual-entry.html11
-rw-r--r--inst/app/templates/content/data/enter-data/required-format.html25
-rw-r--r--inst/app/templates/content/data/enter-data/single-entry.html39
-rw-r--r--inst/app/templates/content/data/enter-data/upload-data.html12
-rw-r--r--inst/app/templates/content/data/view-data.html22
-rw-r--r--inst/app/templates/content/data/view-data/data-plots.html7
-rw-r--r--inst/app/templates/content/data/view-data/data-table.html18
11 files changed, 87 insertions, 162 deletions
diff --git a/inst/app/templates/content/data/enter-data.html b/inst/app/templates/content/data/enter-data.html
index 77846fa..254f1d7 100644
--- a/inst/app/templates/content/data/enter-data.html
+++ b/inst/app/templates/content/data/enter-data.html
@@ -1,8 +1,9 @@
-
-<form class="mb-5">
- {{ htmlTemplate("templates/content/data/enter-data/entry.html") }}
-</form>
-<hr>
-<form>
- {{ htmlTemplate("templates/content/data/enter-data/load-samples.html") }}
-</form>
+<form class="mb-5">
+ {{ 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") }}
+</form>
+<hr>
+<form>
+ {{ htmlTemplate("templates/content/data/enter-data/load-samples.html") }}
+</form>
diff --git a/inst/app/templates/content/data/enter-data/bulk-entry.html b/inst/app/templates/content/data/enter-data/bulk-entry.html
deleted file mode 100644
index 30fab06..0000000
--- a/inst/app/templates/content/data/enter-data/bulk-entry.html
+++ /dev/null
@@ -1,48 +0,0 @@
-<h4 class="mb-3">Bulk entry</h4>
-<!-- Button to toggle help text. -->
-<button type="button" class="btn btn-outline-primary btn-sm" id="bulk-help-toggle"
- data-bs-toggle="collapse" data-bs-target="#bulk-help">Show required format</button>
-<!-- Help text for bulk input format. -->
-<div class="collapse mt-2" id="bulk-help">
- <div class="card card-body border-primary">
- <p>Manually enter rows or upload a CSV file in the following format:</p>
- <p class="overflow-x-scroll text-nowrap font-monospace">
- <u>Dataset name</u>,<u>Time units</u>,<u>Case counts</u>
- </p>
- <p>
- <u class="font-monospace">Time units</u> must be one of
- <u class="font-monospace">Days</u> or
- <u class="font-monospace">Weeks</u>, and
- <u class="font-monospace">Case counts</u>
- must be a comma-separated list of one or more non-negative integers.
- </p>
- <p>Example:</p>
- <p class="overflow-x-scroll text-nowrap font-monospace lh-sm">
- Montreal,Days,1,2,3,4,5,6,7,8,9,19<br>
- Ottawa,Weeks,1,2,3,4,5,6,7,8,9,19<br>
- Toronto,Days,1,2,3,4,5,6,7,8,9,19
- </p>
- </div>
-</div>
-<!-- Data input area. -->
-<div class="my-4">
- <label class="form-label" for="data_area">Enter manually</label>
- <textarea id="data_area" class="form-control" rows="3" wrap="off"></textarea>
- <div>
- <small id="data_area_warn" class="form-text text-primary shiny-html-output"></small>
- </div>
- <button id="data_bulk" type="button" class="btn btn-outline-primary btn-sm action-button mt-3">
- <span class="glyphicon glyphicon-plus"></span> Add
- </button>
-</div>
-<!-- File input for data upload (hidden). -->
-<input class="form-control" type="file" id="data_upload" accept="text/csv,text/comma-separated-values,text/plain,.csv">
-<!-- Custom button to trigger file selector for data upload (visible). -->
-<label class="form-label" for="data-upload-select">Upload a CSV file</label>
-<div class="input-group">
- <button id="data-upload-select" type="button" class="btn btn-outline-primary btn-sm">
- <span class="glyphicon glyphicon-file"></span> Select file
- </button>
- <input type="text" id="data-upload-name" class="form-control" placeholder="No file selected" disabled>
-</div>
-<small id="data_upload_warn" class="form-text text-primary shiny-html-output"></small>
diff --git a/inst/app/templates/content/data/enter-data/entry.html b/inst/app/templates/content/data/enter-data/entry.html
deleted file mode 100644
index be43625..0000000
--- a/inst/app/templates/content/data/enter-data/entry.html
+++ /dev/null
@@ -1,48 +0,0 @@
-
-<!-- Button to toggle help text. -->
-<button type="button" class="btn btn-outline-primary btn-sm" id="bulk-help-toggle"
- data-bs-toggle="collapse" data-bs-target="#bulk-help">Show required format</button>
-<!-- Help text for bulk input format. -->
-<div class="collapse mt-2" id="bulk-help">
- <div class="card card-body border-primary">
- <p>Manually enter rows or upload a CSV file in the following format:</p>
- <p class="overflow-x-scroll text-nowrap font-monospace">
- <u>Dataset name</u>,<u>Time units</u>,<u>Case counts</u>
- </p>
- <p>
- <u class="font-monospace">Time units</u> must be one of
- <u class="font-monospace">Days</u> or
- <u class="font-monospace">Weeks</u>, and
- <u class="font-monospace">Case counts</u>
- must be a comma-separated list of one or more non-negative integers.
- </p>
- <p>Example:</p>
- <p class="overflow-x-scroll text-nowrap font-monospace lh-sm">
- Montreal,Days,1,2,3,4,5,6,7,8,9,19<br>
- Ottawa,Weeks,1,2,3,4,5,6,7,8,9,19<br>
- Toronto,Days,1,2,3,4,5,6,7,8,9,19
- </p>
- </div>
-</div>
-<!-- Data input area. -->
-<div class="my-4">
- <label class="form-label" for="data_area">Enter manually</label>
- <textarea id="data_area" class="form-control" rows="3" wrap="off"></textarea>
- <div>
- <small id="data_area_warn" class="form-text text-primary shiny-html-output"></small>
- </div>
- <button id="data_bulk" type="button" class="btn btn-outline-primary btn-sm action-button mt-3">
- <span class="glyphicon glyphicon-plus"></span> Add
- </button>
-</div>
-<!-- File input for data upload (hidden). -->
-<input class="form-control" type="file" id="data_upload" accept="text/csv,text/comma-separated-values,text/plain,.csv">
-<!-- Custom button to trigger file selector for data upload (visible). -->
-<label class="form-label" for="data-upload-select">Upload a CSV file</label>
-<div class="input-group">
- <button id="data-upload-select" type="button" class="btn btn-outline-primary btn-sm">
- <span class="glyphicon glyphicon-file"></span> Select file
- </button>
- <input type="text" id="data-upload-name" class="form-control" placeholder="No file selected" disabled>
-</div>
-<small id="data_upload_warn" class="form-text text-primary shiny-html-output"></small>
diff --git a/inst/app/templates/content/data/enter-data/load-samples.html b/inst/app/templates/content/data/enter-data/load-samples.html
index a42a8c8..2a4f013 100644
--- a/inst/app/templates/content/data/enter-data/load-samples.html
+++ b/inst/app/templates/content/data/enter-data/load-samples.html
@@ -1,4 +1,5 @@
<h4 class="mb-3">Load samples</h4>
+<!-- Checkboxes for sample data. -->
{{
checkboxInput(inputId = "covid_canada", label = "COVID-19 Canada, 2020/03/03 - 2020/03/31 (Weekly)",
value = FALSE, width = "100%"
@@ -9,6 +10,7 @@
value = FALSE, width = "100%"
)
}}
+<!-- Warning text. -->
<div>
<small id="data_samples_warn" class="form-text text-primary shiny-text-output"></small>
</div>
diff --git a/inst/app/templates/content/data/enter-data/manual-entry.html b/inst/app/templates/content/data/enter-data/manual-entry.html
new file mode 100644
index 0000000..a6319d9
--- /dev/null
+++ b/inst/app/templates/content/data/enter-data/manual-entry.html
@@ -0,0 +1,11 @@
+<!-- Data input area (manual entry). -->
+<div class="my-4">
+ <label class="form-label" for="data_area">Enter manually</label>
+ <textarea id="data_area" class="form-control" rows="3" wrap="off"></textarea>
+ <div>
+ <small id="data_area_warn" class="form-text text-primary shiny-html-output"></small>
+ </div>
+ <button id="data_bulk" 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/data/enter-data/required-format.html b/inst/app/templates/content/data/enter-data/required-format.html
new file mode 100644
index 0000000..724dd83
--- /dev/null
+++ b/inst/app/templates/content/data/enter-data/required-format.html
@@ -0,0 +1,25 @@
+<!-- Button to toggle help text. -->
+<button type="button" class="btn btn-outline-primary btn-sm" id="data-format-toggle"
+ data-bs-toggle="collapse" data-bs-target="#data-format">Show required format</button>
+<!-- Help text for data input format. -->
+<div class="collapse mt-2" id="data-format">
+ <div class="card card-body border-primary">
+ <p>Manually enter rows or upload a CSV file in the following format:</p>
+ <p class="overflow-x-scroll text-nowrap font-monospace">
+ <u>Dataset name</u>,<u>Time units</u>,<u>Case counts</u>
+ </p>
+ <p>
+ <u class="font-monospace">Time units</u> must be one of
+ <u class="font-monospace">Days</u> or
+ <u class="font-monospace">Weeks</u>, and
+ <u class="font-monospace">Case counts</u>
+ must be a comma-separated list of one or more non-negative integers.
+ </p>
+ <p>Example:</p>
+ <p class="overflow-x-scroll text-nowrap font-monospace lh-sm">
+ Disease A,Days,1,2,3,4,5,6,7,8,9<br>
+ Disease B,Weeks,3,1,4,1,5,2,9<br>
+ Disease C,Days,2,3,5,7,11,13,17,19
+ </p>
+ </div>
+</div>
diff --git a/inst/app/templates/content/data/enter-data/single-entry.html b/inst/app/templates/content/data/enter-data/single-entry.html
deleted file mode 100644
index 9f249d9..0000000
--- a/inst/app/templates/content/data/enter-data/single-entry.html
+++ /dev/null
@@ -1,39 +0,0 @@
-<h4>Single entry</h4>
-<!-- Dataset name. -->
-<div class="my-3">
- <label class="form-label" for="data_name">Dataset name</label>
- <input name="data_name" class="form-control" type="text">
- <small id="data_name_warn" class="form-text text-primary shiny-text-output"></small>
-</div>
-<!-- Case counts. -->
-<div class="mb-3">
- <label class="form-label" for="data_counts">
- Case counts
- <sup data-bs-toggle="tooltip" data-bs-placement="right"
- data-bs-title="Enter as a comma-separated list of non-negative integers (example: 0,1,1,2,3,5,8,13).">
- [?]
- </sup>
- </label>
- <input name="data_counts" class="form-control" type="text">
- <small id="data_counts_warn" class="form-text text-primary shiny-text-output"></small>
-</div>
-<!-- Time units. -->
-<div class="mb-3">
- <label class="form-label" for="data_units">Time units</label>
- <div class="shiny-input-radiogroup" id="data_units">
- <div class="form-check form-check-inline">
- <label class="form-check-label">
- <input type="radio" class="form-check-input me-2" name="data_units" value="Days">Days
- </label>
- </div>
- <div class="form-check form-check-inline">
- <label class="form-check-label">
- <input type="radio" class="form-check-input me-2" name="data_units" value="Weeks" checked>Weeks
- </label>
- </div>
- </div>
-</div>
-<!-- Submit data. -->
-<button id="data_single" type="button" class="btn btn-outline-primary btn-sm action-button">
- <span class="glyphicon glyphicon-plus"></span> Add
-</button>
diff --git a/inst/app/templates/content/data/enter-data/upload-data.html b/inst/app/templates/content/data/enter-data/upload-data.html
new file mode 100644
index 0000000..740047b
--- /dev/null
+++ b/inst/app/templates/content/data/enter-data/upload-data.html
@@ -0,0 +1,12 @@
+<!-- File input for data upload (hidden). -->
+<input class="form-control" type="file" id="data_upload" accept="text/csv,text/comma-separated-values,text/plain,.csv">
+<!-- Custom button to trigger file selector for data upload (visible). -->
+<label class="form-label" for="data-upload-select">Upload a CSV file</label>
+<div class="input-group">
+ <button id="data-upload-select" type="button" class="btn btn-outline-primary btn-sm">
+ <span class="glyphicon glyphicon-file"></span> Select file
+ </button>
+ <input type="text" id="data-upload-name" class="form-control" placeholder="No file selected" disabled>
+</div>
+<!-- Warning text. -->
+<small id="data_upload_warn" class="form-text text-primary shiny-html-output"></small>
diff --git a/inst/app/templates/content/data/view-data.html b/inst/app/templates/content/data/view-data.html
index 52f1e85..880cf7f 100644
--- a/inst/app/templates/content/data/view-data.html
+++ b/inst/app/templates/content/data/view-data.html
@@ -1,19 +1,3 @@
-<h4>Data table</h4>
-<!-- Data table. -->
-<div class="my-3">
- {{ DT::dataTableOutput(outputId = "data_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="'data_table_rows_selected' in input && input.data_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="data_delete" type="button" class="btn btn-primary btn-sm action-button text-white"
- data-display-if="'data_table_rows_selected' in input && input.data_table_rows_selected.length != 0">
- <span class="glyphicon glyphicon-remove"></span> Delete row(s)
-</button>
-<!-- Button to export data table as a CSV file. -->
-<a id="data_export" type="button" class="btn btn-outline-primary btn-sm shiny-download-link">
- <span class="glyphicon glyphicon-download-alt"></span> Export table
-</a>
+{{ htmlTemplate("templates/content/data/view-data/data-table.html") }}
+<hr>
+{{ htmlTemplate("templates/content/data/view-data/data-plots.html") }}
diff --git a/inst/app/templates/content/data/view-data/data-plots.html b/inst/app/templates/content/data/view-data/data-plots.html
new file mode 100644
index 0000000..5019088
--- /dev/null
+++ b/inst/app/templates/content/data/view-data/data-plots.html
@@ -0,0 +1,7 @@
+<h4>Data plots</h4>
+<div class="container my-5">
+ {{ plotly::plotlyOutput(outputId = "data_plot_days") }}
+</div>
+<div class="container">
+ {{ plotly::plotlyOutput(outputId = "data_plot_weeks") }}
+</div>
diff --git a/inst/app/templates/content/data/view-data/data-table.html b/inst/app/templates/content/data/view-data/data-table.html
new file mode 100644
index 0000000..590a5b9
--- /dev/null
+++ b/inst/app/templates/content/data/view-data/data-table.html
@@ -0,0 +1,18 @@
+<h4>Data table</h4>
+<div class="my-3">
+ {{ DT::dataTableOutput(outputId = "data_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="'data_table_rows_selected' in input && input.data_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="data_delete" type="button" class="btn btn-primary btn-sm action-button text-white"
+ data-display-if="'data_table_rows_selected' in input && input.data_table_rows_selected.length != 0">
+ <span class="glyphicon glyphicon-remove"></span> Delete row(s)
+</button>
+<!-- Button to export data table as a CSV file. -->
+<a id="data_export" type="button" class="btn btn-outline-primary btn-sm shiny-download-link">
+ <span class="glyphicon glyphicon-download-alt"></span> Export table
+</a>