-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathui.R
216 lines (192 loc) · 6.96 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
# UI
ui <- dashboardPage(
dashboardHeader(
title = h3("Health Scotland")
),
dashboardSidebar(
sidebarMenu(
menuItem("Overview", tabName = "overview", icon = icon("align-justify")),
menuItem("Map", tabName = "map", icon = icon("stop")),
menuItem("Regional Overview", tabName = "regional", icon = icon("signal"))
)
),
dashboardBody(
# Changing theme <- this needs to go inside the dashboardBody
shinyDashboardThemes(
theme = "purple_gradient"
),
tabItems(
# First tab content <- general overview
tabItem(
tabName = "overview",
h2("Overview of hospital admissions in Scotland"),
fluidRow(
box(
width = 12,
h3("About"),
h6("This is a dashboard that visualises the annual quantity of patients received
each year by hospitals in Scotland."),
h6("For this overview tab, the data has been broken down by age and sex for patient daycase
activity in the 14 scottish healthboards."),
h6("Source of dataset for this tab:",
tags$a("Public Health Scotland Website",
href = "https://www.opendata.nhs.scot/dataset/annual-inpatient-and-daycase-activity"))
)
),
fluidRow(
box(
width = 3,
selectInput("year", label = h4("Select Year"),
choices = unique(general_age_sex$financial_year),
selected = "2019/20")
),
box(
width = 9,
plotOutput("age_sex_plot")
)
),
fluidRow(
box(
width = 3,
radioButtons("sex", label = h4("Select Gender"),
choices = list("Female" = "Female", "Male" = "Male",
"All" = "All Sexes"),
selected = "All Sexes"),
selectInput("age", label = h4("Select Age Group"),
choices = unique(general_age_sex$age),
selected = "All Ages")
),
box(
width = 9,
plotOutput("agesex_admission_plot")
)
),
fluidRow(
box(
width = 3,
#####
selectInput("year_department",
label = h4("Select Year"),
choices = unique(department_data$financial_year),
selected = "2019/20"),
selectInput("department",
label = h4("Select Department"),
choices = unique(department_data$department)),
actionButton("update", "Thank you NHS")
#####
),
box(
width = 9,
tableOutput("department_table_output")
)
)
),
# Second tab content <- map and graph
tabItem(
tabName = "map",
h2("Spatial data"),
fluidRow(
box(
width = 12,
h3("About"),
h6("This map and graph show the count and ratio (per 100,000 people) of
some of the most common conditions caused by abuse of alcohol throughout Scotland."),
h6("Source of dataset for this tab:",
tags$a("Scottish Government Website",
href = "https://statistics.gov.scot/resource?uri=http%3A%2F%2Fstatistics.gov.scot%2Fdata%2Falcohol-related-hospital-statistics"))
)
),
fluidRow(
column(width = 3,
box(
width = NULL,
selectInput("year_map", label = h4("Select Year"),
choices = unique(alcohol_map_data$year),
selected = "2018/2019")
),
box(
width = NULL,
selectInput("hb", label = h4("Select Health Board"),
choices = unique(alcohol_map_data$HBName),
selected = "Lothian")
),
box(
width = NULL,
radioButtons("ratio_count", label = h4("Select Ratio or Count"),
choices = list("Ratio" = "ratio", "Count" = "count"),
selected = "ratio")
),
box(
width = NULL,
actionButton("update_map", "Show map & graph")
)
),
column(width = 9,
box(
width = NULL,
plotOutput("alcoholic_map")
),
box(
width = NULL,
plotOutput("alcoholic_plot")
)
)
)
),
# Third tab content <- table and graph
tabItem(
tabName = "regional",
h2("Hospital admissions related to alcohol by healthboard"),
fluidRow(
box(
width = 12,
h3("About"),
h6("The graph and table on this tab show a comparison of summarised groups of medical conditions
caused by the abuse of alcohol. Comparisons can be drawn based on NHS healthboards."),
h6("Source of dataset for this tab:",
tags$a("Scottish Government Website",
href = "https://statistics.gov.scot/resource?uri=http%3A%2F%2Fstatistics.gov.scot%2Fdata%2Falcohol-related-hospital-statistics"))
)
),
fluidRow(
column(width = 3,
box(
width = NULL,
selectInput("date_code",
label = h4("Select Year"),
choices = unique(alcohol_table$date_code),
selected = "2018/2019"
)
),
box(
width = NULL,
radioButtons("alcohol_condition",
label = h4("Select Condition"),
choices = unique(alcohol_table$alcohol_condition)
)
),
box(
width = NULL,
radioButtons("type_of_hospital",
label = h4("Select type of hospital"),
choices = unique(alcohol_table$type_of_hospital)
)
)
),
column(width = 9,
box(
width = NULL,
plotOutput("histogram")
),
box(
width = NULL,
div(style = 'overflow-x: scroll',
DT::dataTableOutput("table_output")),
status = "primary"
)
)
)
)
)
)
)