-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathui.R
202 lines (191 loc) · 7.06 KB
/
ui.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
################################ Sidebar #####################################
sidebar_menu <- sidebarMenu(id = "my_tabs",
menuItem2("Calculator", tab_name = "calculator",
icon = icon2("calculator")
),
menuItem2("Results", tab_name = "results",
icon = icon2("chart-line")
),
menuItem2("Analysis Details", tab_name = "analysis_details",
icon = icon2("info")
),
menuItem2("References", tab_name = "references",
icon = icon2("info")
)
)
sidebar_menu$attribs$role <- "list"
sidebar_extra <- tagList(
hr(),
fluidRow(
column(width = 12, align = "center",
sidebarSelectInput("sidebar_select")
)
),
hr(),
div(id = "app_info",
p(em("Authors: "), "S. Wang, J. Ihrie"),
p(em("App version: "), glob_app_version),
),
div(id = "mail_to",
"Please",
a("email John Ihrie",
href = "mailto:[email protected]", class = "email-link"
),
"with suggestions or bug reports."
)
)
############################## Calculator ####################################
my_calculator <- tabItem(tabName = "calculator",
tags$section(id = "calculator_section",
tags$h1("Calculator"),
fluidRow(
column(width = 8,
fluidRow(id = "data_choices_div", align = "center",
dataChoicesInput("choose_data_entry")
),
#tableOutput("data_model"), #for testing only
#verbatimTextOutput("data_object"), #for testing only
#verbatimTextOutput("model_results"), #for testing only
#htmlOutput("warning_messages_results_UI"), #for testing only (should be in Results)
fluidRow(id = "manual_data_panel",
experimentDescriptionInput("experiment_description",
title = "Experiment Description",
glob_default_labs, glob_min_labs, glob_max_labs,
glob_default_levels, glob_min_levels, glob_max_levels,
glob_default_size, glob_min_size
),
#tableOutput("manual_test_table"), #for testing only
tags$h2("Lab-Level Data", class = "description-title", align = "center"),
labsInput("lab_data",
glob_max_labs, glob_default_labs, glob_max_levels, glob_default_levels
)
),
shinyjs::hidden(
fluidRow(id = "upload_data_panel", align = "center",
uploadDataUI("upload_file")
)
),
shinyjs::hidden(
fluidRow(id = "example_data_panel", align = "center",
tags$h2("Example Data"),
shinydashboard::box(width = 12,
span(
"Test portion size:", glob_sample_size_example, glob_sample_unit_example,
style = "font-size: 20px;"
),
tags$div(id = "example_data_div",
tableOutput("example_data")
)
)
)
)
),
column(width = 4, align = "left", style = "min-width: 350px;",
fluidRow(
column(width = 10, align = "center", offset = 1,
runAnalysisInput("calculate")
)
),
notes,
data_entry_instructions,
analysis_instructions
)
)
)
)
################################# Results ####################################
my_results <- tabItem(tabName = "results",
tags$section(id = "results_section",
tags$h1("Results"),
fluidRow(
shinyjs::disabled(
downloadResultsUI("spreadsheet")
),
helpText2(
"The Download Results button will be disabled if results are not ready."
)
),
tabsetPanel(id = "mod", type = "tabs",
tabPanel(
title = HTML("<strong>Model Parameters & LOD</strong>"),
value = "model_params", icon = icon2("table"),
column(width = 12,
fluidRow(
tags$h2("Model Parameter Estimates", class = "results-title"),
fluidRow(
valueBoxOutput("log_mean_effect", width = 3),
valueBoxOutput("se_log_mean_effect", width = 3),
valueBoxOutput("sigma", width = 3),
valueBoxOutput("ICC", width = 3)
)
)
),
column(width = 9,
fluidRow(
tags$h2("Level of Detection", class = "results-title"),
valueBoxOutput("LOD", width = 4),
valueBoxOutput("LOD_LCL", width = 4),
valueBoxOutput("LOD_UCL", width = 4)
)
),
column(width = 9,
fluidRow(htmlOutput("warning_messages_results_UI"))#,
#fluidRow(verbatimTextOutput("test_model")) #for testing only
)
),
tabPanel(
title = HTML("<strong>POD Curves</strong>"), value = "pod_curves",
icon = icon2("chart-line"),
tags$div(id = "POD_plots_div",
plotOutput("POD_plots", width = "75%", height = "650px")
)
)
)
)
)
######################### Dashboard layout ###################################
dashboard_header <- dashboardHeader(title = glob_app_title, titleWidth = 275)
dashboard_header[[3]][[3]][[3]][[2]]$attribs$tabindex <- "0"
dashboard_sidebar <- dashboardSidebar(sidebar_menu, sidebar_extra, width = 275)
dashboard_sidebar$attribs$id <- "my_aside" #<aside> element
ui <- dashboardPage(
dashboard_header,
dashboard_sidebar,
dashboardBody(
shinyjs::useShinyjs(),
tags$html(lang = "en-US"),
tags$head(
#https://stackoverflow.com/questions/51294246/how-can-i-include-meta-tags-in-my-r-shiny-app
tags$meta(charset = "utf-8"),
tags$meta(name = "description",
content = paste(
"The MultiLab POD/LOD/ICC R Shiny app is for interlaboratory",
"microbiological method validation studies. This app implements the",
"random intercept complementary log-log model suggested by Jarvis",
"et al. (2019) to estimate probability of detection (POD) and level",
"of detection (LOD) from a multi-laboratory validation study for a",
"qualitative (binary) microbiological assay. This app also",
"calculates the intra-laboratory correlation coefficient (ICC) to",
"estimate the proportion of total variance attributable to",
"between-laboratory variance."
)
),
tags$meta(name = "viewport", content = "width=device-width, initial-scale=1"),
tags$script(withMathJax(), defer = "defer"),
#includeScript("www/jscript.js", defer = "defer"), #for code development only!!!
tags$script(src = glob_js_query, type = "text/javascript", defer = "defer"), #for production
#includeCSS("www/style.css") #for code development only!!!
tags$link(rel = "stylesheet", type = "text/css", href = glob_css_query, defer = "defer") #for production
),
HTML("<main>"),
tabItems(
my_calculator,
my_results,
my_analysis_details,
my_references
),
HTML("</main>")
),
title = glob_page_title
)
################################################################################