-
Notifications
You must be signed in to change notification settings - Fork 3
/
ui.R
162 lines (154 loc) · 7.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
library(shiny)
source("global.R")
ears_parameters <- function() {
tagList(
numericInput("ears_alpha",
"Alpha:",
min = .Machine$double.eps,
max = 1 - .Machine$double.eps,
0.001),
selectInput("ears_method",
label = "EARS Method",
choices = c("C1", "C2", "C3"),
multiple = FALSE,
selected = "C1"),
a("Read documentation", target = "_blank", href = "https://www.rdocumentation.org/packages/surveillance/versions/1.12.1/topics/earsC")
)
}
farringtonFlexible_parameters <- function() {
tagList(
shiny::fluidRow(
column(6, tagList(
numericInput("farringtonflexible_alpha",
"Alpha:",
min = .Machine$double.eps,
max = 1 - .Machine$double.eps,
0.001),
selectInput("farringtonflexible_powertrans",
label = "powertrans: Power transformation",
selected = "2/3",
choices = c("2/3: skewness correction (Default)" = "2/3",
"1/2: for variance stabilizing transformation" = "1/2",
"none" = "none")),
numericInput("farringtonflexible_pastWeeksNotIncluded",
label = "pastWeeksNotIncluded: Number of past weeks to ignore in the calculation:",
min = 1,
max = 100,
value = 26,
step = 1)
)),
column(6, tagList(
numericInput("farringtonflexible_b",
"b: How many years back in time to include when forming the base counts:",
min = 1,
max = 6,
value = 2,
step = 1),
numericInput("farringtonflexible_w",
"w: Window's half-size, i.e. number of weeks to include before and after the current week in each year:",
min = 1,
max = 52,
value = 5,
step = 1),
a("Read documentation", target = "_blank", href = "https://www.rdocumentation.org/packages/surveillance/versions/1.12.1/topics/farringtonFlexible"))
)
)
)
}
glrnb_parameters <- function() {
tagList(
shiny::fluidRow(
column(6,
numericInput("glrnb_c_ARL",
"Threshold in the GLR test, i.e. c_gamma:",
min = 0, value = 5),
numericInput("glrnb_S",
"Number of harmonics to include:",
min = 0, max = 4, value = 1),
checkboxInput("glrnb_trend", "Include trend", value = TRUE)
),
column(6, numericInput("glrnb_theta",
"Detect an increase in cases of X percent (default 20%):",
min = 1, value = 20),
a("Read documentation", target = "_blank", href = "https://www.rdocumentation.org/packages/surveillance/versions/1.12.1/topics/algo.glrnb"))
)
)
}
dataset_choices <- function() {
c(
#"Abattoir Data" = "abattoir",
#"Cases of Campylobacteriosis and Absolute Humidity in Germany 2002-2011" = "campyDE",
#"Surgical failures data" = "deleval",
#"Influenza in Southern Germany" = "fluBYBW",
#"Toy Data for 'twinSIR'" = "foodata",
#"Toy Data for 'twinSIR'" = "fooepidata",
#"Toy Data for 'twinSIR'" = "foofit",
"'Hepatitis A' in 'Oberbergischer Kreis, Olpe, Rhein-Sieg-kreis' (Germany, Nordrhein-Westfalen) and 'Siegenwittgenstein Altenkirchen' (Germany, Rheinland-Pfalz)" = "h1_nrwrp",
#"Hepatitis A in Berlin" = "ha",
#"Hepatitis A in Berlin" = "ha.sts",
#"1861 Measles Epidemic in the City of Hagelloch, Germany" = "hagelloch",
"Hepatitis A in Germany" = "hepatitisA",
#"Hospitalization date for HUS cases of the STEC outbreak in Germany, 2011" = "husO104Hosp",
#"Occurrence of Invasive Meningococcal Disease in Germany" = "imdepi",
#"Occurrence of Invasive Meningococcal Disease in Germany" = "imdepifit",
"Influenza and meningococcal infections in Germany, 2001-2006" = "influMen",
"k1 'Kryptosporidiose' in Germany, 'Baden-Württemberg'" = "k1",
"m1 'Masern' in the 'Landkreis Nordfriesland" = "m1",
"m2 'Masern' in the 'Stadt- und Landkreis Coburg" = "m2",
"m3 'Masern' in the 'Kreis Leer'" = "m3",
"m4 'Masern' in the 'Stadt- und Landkreis Aachen' (Germany, Nordrhein-Westfalen)" = "m4",
"m5 'Masern' in the 'Stadt Verden' (Germany, Niedersachsen)" = "m5",
#"Measles in the Weser-Ems region of Lower Saxony, Germany, 2001-2002" = "measles.weser",
#"Measles in the 16 states of Germany" = "measlesDE",
#"Measles in the Weser-Ems region of Lower Saxony, Germany, 2001-2002" = "measlesWeserEms",
#"Meningococcal infections in France 1985-1995" = "meningo.age",
#"Danish 1994-2008 all cause mortality data for six age groups" = "momo",
"n1 'Norovirus' in 'Stadtkreis Berlin Mitte' (Germany, Berlin)" = "n1",
"n2 'Norovirus' in 'Torgau-Oschatz' (Germany, Sachsen)" = "n2",
"q1.nrwh 'Q-Fever' in the 'Hochsauerlandkreis' (Germany, Westfalen) and in the 'Landkreis Waldeck-Frankenberg' (Germany, Hessen)" = "q1_nrwh",
"q2 'Q-Fieber' in 'München' (Germany, Bayern)" = "q2",
#"Rotavirus cases in Brandenburg, Germany, during 2002-2013 stratified by 5 age categories" = "rotaBB",
"s1 'Salmonella Oranienburg' in Germany" = "s1",
"s2 'Salmonella Agona' in 12 'Bundesländern' of Germany" = "s2",
"s3 'Salmonella Anatum' in Germany" = "s3",
"Salmonella cases in Germany 2001-2014 by data of symptoms onset" = "salmAllOnset",
"Hospitalized Salmonella cases in Germany 2004-2014" = "salmHospitalized",
#"Salmonella Newport cases in Germany 2004-2013" = "salmNewport",
#"Salmonella Agona cases in the UK 1990-1995" = "salmonella.agona",
"Salmonella Hadar cases in Germany 2001-2006" = "shadar"
#"Salmonella Newport cases in Germany 2004-2013" = "stsNewport"
)
}
shinyUI(fluidPage(
includeHTML("github.html"),
titlePanel("Surveillance Algorithm Assistant"),
tags$small("Test surveillance algorithms and tune the parameters."),
fluidRow(
column(8, tabsetPanel(
tabPanel("Algorithms",
selectInput("algorithms", label = "Select algorithms",
selected = c("ears", "farringtonflexible", "glrnb"),
choices = algorithm_choices,
multiple = TRUE),
numericInput("range_min", "Monitor last X weeks:", max = 52 * 4,
min = 2, value = 70)
),
tabPanel("EARSC", ears_parameters()),
tabPanel("Farrington Flexible", farringtonFlexible_parameters()),
tabPanel("Negative Binomial CUSUM", glrnb_parameters()),
tabPanel("Dataset", selectInput("dataset", "Dataset:", selected = "salmAllOnset",
choices = dataset_choices()),
p("Some datasets might require to change specific algorithm parameters."),
numericInput("dataset_last_weeks", "Show last X weeks (0 for all):",
value = 0, min = 0, step = 1),
p("The algorithms are still fitted on the full dataset."))
))
),
hr(),
actionButton("update_algos", "Update charts", class = "btn-success"),
plotly::plotlyOutput("mainPlot"),
p("For each algorithm a seperate chart is shown. Bars show the number of cases per EPI (ISO) week. Red dots indicate an alarm flagged by the respective algorithm. Orange lines represent the upper bounds of the respective algorithm for each week."),
hr(),
textOutput("errors")
)
)