-
Notifications
You must be signed in to change notification settings - Fork 1
/
ui.R
518 lines (494 loc) · 18.7 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
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
fluidPage(
title = tags$head(
tags$link(
rel = "shortcut icon",
href = "screener_favicon.png"
),
tags$title("DfE Data Screener")
),
# Global ui calls and settings ------------------------------------------------------------------------------------
theme = "acalat_theme.css",
useShinyjs(),
tags$head(includeHTML(("google-analytics.html"))),
shinyFeedback::useShinyFeedback(),
# options(shiny.reactlog = TRUE),
inlineCSS(appLoadingCSS), # set in global.r
# Setting custom disconnect message --------------------------------------------------------------------------------
customDisconnectMessage(
refresh = "Refresh page",
background = "#000000",
colour = "#FFFFFF",
refreshColour = "#337AB7",
overlayColour = "#000000",
overlayOpacity = 0.6,
width = "full",
top = "center",
size = 24
),
# Initial loading screen -------------------------------------------------------------------------------------------
div(
id = "loading-content",
h2("Loading...")
),
hidden(
div(
id = "app-content",
# Application title -----------------------------------------------------------------------------------
titlePanel(
div(HTML("DfE published data QA <h4>QA your data files before uploading to Explore Education Statistics for publication</h4>")),
),
# Initial guidance text -----------------------------------------------------------------------------------
verticalLayout(
br(),
shinyjs::hidden(div(
id = "guidance",
"This app allows you to screen your data files against the Department’s ",
a(href = "https://dfe-analytical-services.github.io/analysts-guide/statistics-production/ud.html", "underlying data standards", target = "_blank", rel = "noopener noreferrer"),
"for Official and National statistical publications. You should make sure that any data files you intend to publish pass all of the data checks before uploading to Explore Education Statistics.",
br(),
br(),
"The code for this app can be found on ",
a(href = "https://github.com/dfe-analytical-services/dfe-published-data-qa", "GitHub", target = "_blank", rel = "noopener noreferrer", .noWS = "after"),
".",
br(),
br(),
strong("How to use the app"),
br(),
"1. Upload your data and associated metadata (.csv) files.",
br(),
"2. Click to screen the files, the screener will run and display the results below. It may take a little while for the results to appear depending on the size of your file.",
br(),
"3. Look through results, amend files in line with any recommendations and re-screen files if necessary.",
br(),
"4. Reset the page if you have another file to check.",
br(),
br(),
strong("Notes"),
br(),
"Currently this app works with files up to 500mb. If you have a file that is bigger than this, please contact us - ",
a(href = "mailto:[email protected]", "[email protected]", .noWS = "after"), ".",
br(),
"This app is constantly being developed, please let us know if you have any suggestions to improve it. If you experience any issues, please take screenshots and email them to us with as much information as possible.",
hr()
)),
# Top panel for data uploads -----------------------------------------------------------------------------------
wellPanel(
tags$style(".shiny-file-input-progress {max-width: 99.8%; padding-left: 1px}"),
fluidRow(
column(
5,
fileInput(
"datafile",
"Upload a data file",
multiple = FALSE,
accept = ".csv"
)
),
column(
5,
fileInput(
"metafile",
"Upload the associated metadata file",
multiple = FALSE,
accept = ".csv"
)
),
column(2,
align = "center", style = "margin-top: 25px;",
# Only show buttons once files are added and remove button once results appear
conditionalPanel(
condition = "output.file_exists == true && output.showresults == false",
uiOutput("uiScreenButton")
),
shinyjs::hidden(div(
id = "reset_button",
uiOutput("uiResetButton")
))
)
)
),
# Main panel showing results -----------------------------------------------------------------------------------
fluidRow(
# Loading screen that appears while tests are running -----------------------------------------------------------------------------------
shinyjs::hidden(div(
id = "loading",
h4("Tests are now running against the files, this may take a few minutes depending on the size of your data file.", align = "center"),
h4("Refresh the page if you wish to cancel the tests running.", align = "center"),
br(),
HTML('<center><img src="duckWaddle.gif"></center>')
)),
# Summarised results -----------------------------------------------------------------------------------
shinyjs::hidden(div(
id = "results",
tabsetPanel(
id = "trendy_tabs",
tabPanel(
title = "Screener results",
value = "tab1",
column(
5,
style = "padding-left:20px;",
h4("Screening progress"),
tags$style("#progress_stage img {max-width: 100%; max-height: 100%}"),
imageOutput("progress_stage", height = "100%"),
hr(),
textOutput("testtime"),
br(),
textOutput("summary_text"),
br(),
textOutput("sum_failed_tests"),
textOutput("sum_combined_tests"),
textOutput("sum_passed_tests"),
textOutput("sum_ignored_tests"),
textOutput("time_taken"),
hr(),
div(
style = "word-break: break-all;",
textOutput("datafilename"),
textOutput("metafilename")
),
hr(),
column(
6,
style = "padding:0px",
"Data file",
br(),
br(),
textOutput("data_size"),
textOutput("data_rows"),
textOutput("data_cols")
),
column(
6,
style = "padding:0px",
"Metadata file",
br(),
br(),
textOutput("meta_size"),
textOutput("meta_rows"),
textOutput("meta_cols")
)
),
# Individual check results tables -----------------------------------------------------------------------------------
column(
7,
uiOutput("ancillary_box"),
uiOutput("passed_box"),
uiOutput("info_box"),
uiOutput("failed_box"),
uiOutput("advisory_box"),
results_box(
message = "all_tests",
table = "table_all_tests"
)
)
# End of column
),
# QA pages -----------------------------------------------------------------------------------
tabPanel(
title = "File previews",
value = "previewTab",
style = "padding-left:20px; padding-right:20px",
br(),
tags$b("View metadata"),
DTOutput("meta_table", width = "100%") %>% withSpinner(),
hr(),
tags$b("Preview datafile"),
DTOutput("data_preview", width = "100%") %>% withSpinner()
),
tabPanel(
title = "What's in this file",
value = "obUnitTab",
style = "padding-left:20px; padding-right:20px",
br(),
fluidRow(
column(
3,
tags$b("What combinations of geography and time are in the data"),
br(),
br(),
"This table lists all the permutations of geographic_level and time_period where at least one row of data exists",
br(),
br(),
"For any unexpected Ns, check the data",
br(),
br(),
"For any legitimate Ns, consider if publishing this data would be worth it"
),
column(
9,
DTOutput("geog_time_perms2", width = "100%") %>% withSpinner()
)
),
hr(),
fluidRow(
column(
3,
tags$b("What filters are present in the data"),
br(),
br(),
"This table lists all the filters and filter levels where at least one row of data exists",
br(),
br(),
"Check all levels you expect to see are there",
br(),
br(),
"Check the names are how you want them to look in EES",
),
column(
9,
uiOutput("tables") %>% withSpinner()
# "Filter combinations missing (on trello/github issue)",
)
),
hr(),
fluidRow(
column(
3,
tags$b("What indicators are present in the data"),
br(),
br(),
"This table lists all the indicators that exist within the data",
br(),
br(),
"Check all the indicators you expect to see are there",
br(),
br(),
"Check the names are how you want them to look in EES"
),
column(
9,
DTOutput("indicators", width = "60%") %>% withSpinner()
)
),
hr(),
fluidRow(
column(
3,
tags$b("Cells missing data"),
br(),
br(),
"This table shows how many cells do not contain data",
br(),
br(),
"How much of your data is unavailable, rounded to 0, not applicable or suppressed?"
),
column(
9,
DTOutput("suppressed_cell_count_table") %>% withSpinner()
)
),
hr()
#
# fluidRow(
# column(
# 3,
# tags$b("Filter combinations"),
# br(),
# "The following filter combinations have no relevant data",
# br(),
# "Are there any expected filter combinations that are missing data?"
# ),
# column(
# 8,
#
# tableOutput("filterperms") %>% withSpinner()
# )
# ),
#
# hr(),
),
tabPanel(
title = "Explore data",
value = "indicatorsTab",
style = "padding-left:20px; padding-right:20px",
br(),
fluidRow(
column(
3,
tags$b("Indicator summary"),
br(),
br(),
"Review indicator-level summaries of your data",
br(),
br(),
"Check to make sure values are sensible - are there any unexpected results when comparing to past time periods?"
),
column(
9,
fluidRow(
column(
4,
selectInput(
inputId = "ind_parameter",
label = "Choose indicator(s):",
choices = "",
multiple = TRUE
)
),
column(
4,
selectInput(
inputId = "geog_parameter",
label = "Choose geographic level(s):",
choices = "",
multiple = TRUE
)
),
column(
4,
align = "left", style = "margin-top: 25px;",
actionButton(
inputId = "submit",
label = "Generate tables"
)
)
)
),
fluidRow(
column(
12,
style = "padding-left:20px; padding-right:20px",
hr(),
uiOutput("table_list")
)
)
)
),
tabPanel(
title = "Year-on-year changes",
value = "outliersTab",
style = "padding-left:20px; padding-right:20px",
br(),
fluidRow(
column(
3,
tags$b("Year-on-year summary"),
br(),
br(),
"Check for any large differences in data from year-to-year",
br(),
br(),
"Empty tables will appear for cases where there are no changes above your set threshold"
),
column(
9,
fluidRow(
column(
4,
uiOutput("outlier_indicator_choice") %>% withSpinner()
),
column(
4,
numericInputIcon(
inputId = "threshold_setting",
label = "Set percentage threshold for outlier:",
min = 0,
value = 20,
icon = list(NULL, icon("percent"))
)
),
column(
4,
align = "left", style = "margin-top: 25px;",
actionButton(
inputId = "submit_outlier",
label = "Generate tables"
)
)
),
fluidRow(
column(
4,
uiOutput("current_time") %>% withSpinner()
),
column(
4,
uiOutput("comparison_time") %>% withSpinner()
),
column(
4,
""
)
)
),
fluidRow(
column(
12,
style = "padding-left:20px; padding-right:20px",
hr(),
uiOutput("table_outlier_list")
)
)
)
),
tabPanel(
title = "Check geography subtotals",
value = "geogTab",
style = "padding-left:20px; padding-right:20px",
br(),
fluidRow(
column(
3,
tags$b("Geography summary"),
br(),
br(),
"Check subtotals for geographies add up",
),
column(
9,
fluidRow(
column(
4,
uiOutput("geog_indicator_choice") %>% withSpinner()
),
column(
4,
""
),
column(
4,
align = "left", style = "margin-top: 25px;",
actionButton(
inputId = "submit_geographies",
label = "Generate tables"
)
)
)
# fluidRow(
# column(
# 4,
# uiOutput("geog_level_choice") %>% withSpinner()
# ),
# column(
# 4,
# uiOutput("geog_sublevel_choice") %>% withSpinner()
# ),
# column(
# 4,
# ''
# )
# ),
),
fluidRow(
column(
12,
style = "padding-left:20px; padding-right:20px",
hr(),
DTOutput("geog_agg2", width = "100%"),
# verbatimTextOutput('file1')
)
)
)
)
) # End of tabsetpanel
))
# End of summarised results div
)
# End of fluidRow
)
# End of verticalLayout
)
)
# End of app content (hidden during initial load)
)