-
Notifications
You must be signed in to change notification settings - Fork 0
/
ui.R
325 lines (309 loc) · 10.6 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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
library(shiny)
library(shinybusy)
library(shinyWidgets)
library(shinydashboard)
header <- dashboardHeader(title="Observational Study Understanding", titleWidth=350)
sidebar <- dashboardSidebar(
sidebarMenu(
id="sidebar",
menuItem("Study definition", tabName="study_definition_tab"),
menuItem("Data Diagnosis", tabName="data_diagnosis_tab"),
menuItem("Data preprocessing", tabName="data_preprocess_tab"),
menuItem("Baseline", tabName="baseline_tab"),
menuItem("Risk factor analysis", tabName="risk_factor_analysis_tab"),
menuItem("Effect estimation", tabName="effect_estimation_tab")
)
)
# Study definition -------------------------------------------------------------
study_def_tab <- tabItem(
tabName="study_definition_tab",
fluidRow(
box(
title="Upload data",
status="primary",
solidHeader=TRUE,
width=10,
height=200,
helpText("A table with columns containing values of variables and rows representing patients."),
fileInput("data_file", "Upload CSV File",
accept=c(
"text/csv",
"text/comma-separated-values,text/plain",
".csv"))
),
box(
title="Analysis type",
status="primary",
solidHeader=TRUE,
width=10,
selectInput("analysis_type", "", choices=c("Association analysis", "Survival analysis"))
),
box(
title="Variable selection",
status="primary",
solidHeader=TRUE,
width=10,
uiOutput("select_vars")
),
box(
title="Exposure",
status="primary",
solidHeader=TRUE,
width=10,
uiOutput("select_exposure")
),
conditionalPanel(
"input.analysis_type == 'Association analysis'",
box(
title="Outcome",
status="primary",
solidHeader=TRUE,
width=10,
helpText("The output should be a continuous variable or a binary variable (0/1)."),
uiOutput("select_outcome")
)
),
conditionalPanel(
"input.analysis_type == 'Survival analysis'",
box(
title="survival time",
status="primary",
solidHeader=TRUE,
width=10,
uiOutput("select_survtime")
),
box(
title="survival event",
status="primary",
solidHeader=TRUE,
width=10,
uiOutput("select_survevent")
)
),
actionButton("data_submit", "Submit", icon("rocket"), width=100,
style="color: #fff; background-color: #337ab7; border-color: #2e6da4")
)
)
# Data diagnosis ---------------------------------------------------------------
data_diagnosis_tab <- tabItem(
tabName="data_diagnosis_tab",
tabsetPanel(
id="data_diagnosis_panel",
tabPanel(
title="Data diagnosis",
fluidRow(
box(
status="primary",
solidHeader=TRUE,
width=10,
DT::dataTableOutput("data_summary")
)
)
),
tabPanel(
title="Data preview",
fluidRow(
box(
status="primary",
solidHeader=TRUE,
width=10,
DT::dataTableOutput("data_preview")
)
)
)
)
)
# Data pre-processing -----------------------------------------------------------
data_preprocess_tab <- tabItem(
tabName="data_preprocess_tab",
fluidRow(
add_busy_bar(color="wheat"),
box(
title="Variable filtering",
status="primary",
solidHeader=TRUE,
width=10,
uiOutput("variable_filter"),
actionButton("update_data1", "Update Data", icon("sync"),
style="color: #fff; background-color: #337ab7; border-color: #2e6da4")
),
box(
title="Data completeness",
status="primary",
solidHeader=TRUE,
width=10,
column(1, offset=1, actionButton("dropna", "Drop empty value", icon("trash"),
style="color: #fff; background-color: #337ab7; border-color: #2e6da4")),
column(1, offset=2, actionButton("simple_impute", "Simple imputation", icon("wrench"),
style="color: #fff; background-color: #337ab7; border-color: #2e6da4")),
column(1, offset=2, actionButton("multiple_impute", "Multiple imputation", icon("toolbox"),
style="color: #fff; background-color: #337ab7; border-color: #2e6da4"))
),
box(
title="Variable classification",
status="primary",
solidHeader=TRUE,
width=10,
height=230,
column(3, uiOutput("select_numeric")),
column(1, br(), actionButton("num2cat", ">>"), br(), br(), actionButton("cat2num", "<<")),
column(3, uiOutput("select_categorical")),
column(1, br(), actionButton("cat2other", ">>"), br(), br(), actionButton("other2cat", "<<")),
column(3, uiOutput("select_other")),
actionButton("update_data2", "Update Data", icon("sync"),
style="color: #fff; background-color: #337ab7; border-color: #2e6da4")
),
box(
title="Data discretization",
status="primary",
solidHeader=TRUE,
width=10,
helpText("Cut point format: 'number,number,number'"),
column(6, uiOutput("split_num")),
column(6, textInput("cutpoint", label="Cut points")),
actionButton("update_data3", "update data", icon("sync"),
style="color: #fff; background-color: #337ab7; border-color: #2e6da4")
),
box(
title="Option mapping",
status="primary",
solidHeader=TRUE,
width=10,
helpText("Map string options to numbers starting from 0."),
uiOutput("map_option"),
actionButton("update_data5", "update data", icon("sync"),
style="color: #fff; background-color: #337ab7; border-color: #2e6da4")
),
box(
title="Dummy variable",
status="primary",
solidHeader=TRUE,
width=10,
height=275,
helpText("Missing data for the target variable should be solved before this step, otherwise, missing data will be assigned with a special string (NA)."),
column(5, uiOutput("select_nondummy")),
column(1, br(), actionButton("nondum2dum", ">>"), br(), br(), actionButton("dum2nondum", "<<")),
column(5, uiOutput("select_dummy")),
actionButton("update_data4", "Update Data", icon("sync"),
style="color: #fff; background-color: #337ab7; border-color: #2e6da4")
)
)
)
# Baseline ---------------------------------------------------------------------
baseline_tab <- tabItem(
tabName="baseline_tab",
fluidRow(
box(
title="Baseline",
status="primary",
solidHeader=TRUE,
width=10,
uiOutput("select_base_vars"),
uiOutput("baseline_title"),
DT::dataTableOutput("table1"),
tags$ul(
tags$li("For categorical variables, apply the chi-square test to test the difference between groups."),
tags$li("For continuous variable,"),
tags$ul(
tags$li(" if the group level is 2, apply t-test to variable in normal distribution,
and Wilcoxon rank sum test to variable in non-normal distribution."),
tags$li(" if the group level is over 2, apply ANOVA to variable in normal distribution,
and Kruskal Wallis test to variable in non-normal distribution.")
)
)
),
box(
title="Propensity Score Matching",
status="primary",
solidHeader=TRUE,
width=10,
helpText("The group should be a binary variable in 0 and 1 before this step."),
uiOutput("select_psm_vars"),
actionButton("psm", "PSM Data", icon("balance-scale"),
style="color: #fff; background-color: #337ab7; border-color: #2e6da4")
)
)
)
# Risk factor analysis ---------------------------------------------------------
risk_factor_tab <- tabItem(
tabName="risk_factor_analysis_tab",
tabsetPanel(
id="univariate_regression_panel",
tabPanel(
title="Univariate analysis",
fluidRow(
box(
status="primary",
solidHeader=TRUE,
width=10,
uiOutput("select_univariate_vars"),
uiOutput("select_univariate_confounders"),
uiOutput("select_univariate_model"),
actionButton("univariate_analyze", "Analyze", icon("calculator"),
style="color: #fff; background-color: #337ab7; border-color: #2e6da4"),
DT::dataTableOutput("univariate_regression_table"),
plotOutput("univariate_forest_fig"),
plotOutput("adjust_univariate_forest_fig")
)
)
),
tabPanel(
title="Multivariate analysis",
fluidRow(
box(
status="primary",
solidHeader=TRUE,
width=10,
uiOutput("select_multivariate_vars"),
uiOutput("select_multivariate_model"),
actionButton("multivariate_analyze", "Analyze", icon("calculator"),
style="color: #fff; background-color: #337ab7; border-color: #2e6da4"),
DT::dataTableOutput("multivariate_regression_table"),
plotOutput("multivariate_forest_fig")
)
)
)
)
)
# Effect estimation ------------------------------------------------------------
effect_estimation_tab <- tabItem(
tabName="effect_estimation_tab",
tabsetPanel(
id="effect_estimation_panel",
tabPanel(
title="Effect estimation",
fluidRow(
box(
status="primary",
solidHeader=TRUE,
width=10,
uiOutput("select_effect_confounders"),
uiOutput("select_effect_model"),
DT::dataTableOutput("effect_estimation_table"),
conditionalPanel(
"input.analysis_type == 'Survival analysis'",
plotOutput("survival_plot")
)
)
)
),
tabPanel(
title="Subgroup analysis",
fluidRow(
box(
status="primary",
solidHeader=TRUE,
width=10,
uiOutput("select_stratify_vars"),
uiOutput("select_stratify_confounders"),
uiOutput("select_stratify_model"),
DT::dataTableOutput("stratify_table")
)
)
)
)
)
body <- dashboardBody(
tabItems(study_def_tab, data_diagnosis_tab, data_preprocess_tab, baseline_tab, risk_factor_tab, effect_estimation_tab)
)
ui <- dashboardPage(header, sidebar, body, title="Observational Study Understanding", skin="blue")