-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathui.R
236 lines (236 loc) · 11.2 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
function(request) {
shinyUI(
fluidPage(
useShinyjs(),
ui <- dashboardPage(
skin = "black",
dashboardHeader(title = "New Jersey Maternal Mortality Dashboard"),
dashboardSidebar(
width = 170,
sidebarMenu(
menuItem("Interactive Map", tabName = "map", icon = icon("map")),
menuItem("Explore More", tabName = "bars", icon = icon("chart-bar")),
menuItem("How This Works", tabName = "methodology", icon = icon("cogs")),
menuItem("About", tabName = "about", icon = icon("heartbeat")),
menuItem("Source Code", href = "https://github.com/johnsonandjohnson/njmm", icon = icon("github"))
)
),
dashboardBody(
includeCSS("www/jnj_circular/css/stylesheet.css"),
includeCSS("www/njmm_shiny.css"),
tabItems(
tabItem(
tabName = "map",
fluidRow(
column(
width = 3,
box(
sliderInput("mm_slide_year",
label = UI_GLOBALS$MM_YEAR_LABEL,
min = UI_GLOBALS$MM_YEAR_MIN, max = UI_GLOBALS$MM_YEAR_MAX,
value = UI_GLOBALS$MM_YEAR_DEFAULT,
sep = UI_GLOBALS$MM_YEAR_SEP, width = UI_GLOBALS$MM_YEAR_WIDTH,
ticks = TRUE
),
bookmarkButton(id = "bookmark1", label = "Bookmark"),
actionButton("reset_input", "Reset", icon = icon("refresh")),
tippy_this(
elementId = "reset_input",
tooltip = UI_GLOBALS$RESET_TIPPY_TEXT,
placement = UI_GLOBALS$RESET_TIPPY_PLACEMENT
),
width = 12, align = "center"
),
tabBox(
title = "",
width = 12,
tabPanel(
title = div(HTML("Maternal<br>Mortality"), style = "font-size:100%"),
selectInput("mm_select_box",
label = UI_GLOBALS$MM_SELECT_LABEL,
choices = UI_GLOBALS$MM_SELECT_CHOICES,
selected = UI_GLOBALS$MM_SELECT_DEFAULT
),
div(uiOutput("mm_formula"), style = "font-size:75%"),
htmlOutput("demography_select_box"),
conditionalPanel(
condition = "input.mm_select_box == 'mmratio_per_100klb' && input.demography_select_box == 'ethnicity'",
htmlOutput("ethnicity_select_box")
),
conditionalPanel(
condition = "input.demography_select_box == 'age'",
htmlOutput("age_select_box"),
)
),
tabPanel(
div(HTML("Contextual<br>Variables"), style = "font-size:100%"),
selectInput("other_layer_box",
label = h5("Select a contextual variable"),
choices = c(
"Percent Uninsured",
"Percent Covered by Medicaid",
"Difference in NTSV Rate",
"OB/GYN Physicians Per Capita",
"Practitioner Midwives Per Capita",
"Percent Poverty"
),
selected = "Percent Uninsured"
)
)
)
),
column(
width = 9,
splitLayout(
cellWidths = c("50%", "50%"),
box(leafletOutput("new_jersey_map", height = 625) %>% withSpinner(color = "#CA001B"),
width = "50%",
title = uiOutput("map_title", style = "height: 55px")
),
box(
width = "50%",
title = uiOutput("layer_map_title", style = "height: 55px"),
conditionalPanel(
condition = "input.mm_slide_year >= 2010",
leafletOutput("layer_map", height = 625) %>% withSpinner(color = "#CA001B")
)
),
cellArgs = list(style = "padding: 3px; padding-top:0px")
)
)
),
fluidRow(
column(width = 3, " "),
column(
9,
splitLayout(
cellWidths = c("50%", "50%"),
box(infoBox(
title = "",
subtitle = uiOutput("info_box_subtitle"),
uiOutput("info_box"),
color = "red",
icon = shiny::icon("notes-medical")
),
title = uiOutput("info_box_title"),
width = "50%"
),
cellArgs = list(style = "padding: 3px; padding-top:0px")
)
),
),
actionLink(
"footnote_modal",
"Note: Due to the small number of counts in the publicly available data
used to calculate these measures of maternal mortality, the measures of
maternal mortality may be extreme (e.g. MMRatio greater than 1)."
)
),
tabItem(
tabName = "bars",
fluidRow(
column(
4,
box(selectInput("mm_select_box2",
label = UI_GLOBALS$MM_SELECT_LABEL,
choices = UI_GLOBALS$MM_SELECT_CHOICES,
selected = UI_GLOBALS$MM_SELECT_DEFAULT
),
selectInput("mm_county_box",
label = "County",
choices = mmUniqueCounties,
selected = mmUniqueCounties[1]
),
div(uiOutput("mm_formula2"), style = "font-size:75%"),
uiOutput("demography_radio"),
sliderInput("mm_slide_year2",
label = UI_GLOBALS$MM_YEAR_LABEL,
min = UI_GLOBALS$MM_YEAR_MIN, max = UI_GLOBALS$MM_YEAR_MAX,
value = UI_GLOBALS$MM_YEAR_DEFAULT,
sep = UI_GLOBALS$MM_YEAR_SEP, width = UI_GLOBALS$MM_YEAR_WIDTH,
ticks = TRUE
),
bookmarkButton(id = "bookmark2", label = "Bookmark"),
actionButton("reset_input2", "Reset", icon = icon("refresh")),
tippy_this(
elementId = "reset_input2",
tooltip = UI_GLOBALS$RESET_TIPPY_TEXT,
placement = UI_GLOBALS$RESET_TIPPY_PLACEMENT
),
width = "100%",
title = "Input"
)
),
column(
6,
box(plotlyOutput("new_jersey_graph") %>% withSpinner(color = "#CA001B"),
width = "50%", title = uiOutput("graph_title")
),
conditionalPanel(
"input.demography_radio == 'ethnicity' & input.mm_slide_year2 >= 2010",
box(
title = div(icon("info-circle"), "More Info"),
uiOutput("census_tbl_url"),
width = "100%",
solidHeader = TRUE, status = "danger"
)
)
)
),
actionLink(
"explore_more_modal",
"Note: In some cases, we may see MMRatios of all 0 when stratifying by one demographic
variable, but have some nonzero MMRatios when stratifying by a different demographic
variable."
)
),
tabItem(
tabName = "methodology",
h3("Maternal Mortality Ratio (MMRatio)"),
p("The MMRatio is the number of maternal deaths divided by the number of live births."),
UI_GLOBALS$MMRATIO_LATEX %>% withMathJax(),
p("It is also commonly represented as the MMRatio per 100,000 live births which is the
previous quantity multiplied by 100,000."),
br(),
h3("Maternal Mortality Rate (MMRate)"),
p("The MMRate is the number of maternal deaths divided by the number of woman-years
lived between 15 and 49. Woman-years lived is the number of years lived by an
individual in the specified age range within the scope of the calculation.
For annual calculations (such as the ones in this application), this is the same
as the current female population within the specified age range."),
UI_GLOBALS$MMRATE_LATEX %>% withMathJax(),
p("It is also commonly represented as the MMRate per 1,000 woman-years lived which is
the previous quantity multiplied by 1,000."),
br(),
h3("Data Sources"),
data_source_tbl_html(),
br(),
p("Note: Pacific Islander/Non-Hispanic individuals are not available under the choice
of ethnicity/race due to the fact that there were zero maternal deaths in this timeframe."),
p("Note: The following race/ethnicity groups are included in the Other category as they
consistently had very small counts of maternal deaths: American Indian Non-Hispanic,
Other Single Race Non-Hispanic, and Other Two or More Races Non-Hispanic.")
),
tabItem(
tabName = "about",
mainPanel(
h3("This application was created through a partnership between the Johnson & Johnson Women's Health Group
and J&J Advanced Analytics."),
br(),
p(strong("J&J Women's Health Group"), "is an enterprise level team with a vision to better the
health of women now and for future generations. Our mission is to deliver life-changing
healthcare solutions tailored for women through science, solutions, and collective action.
Our group is located within the J&J Office of the Chief Medical Officer, which is an evidence
and science based, ethics and value driven, enterprise wide function at Johnson & Johnson."),
p(strong("J&J Advanced Analytics"), "is a cross functional team within Johnson & Johnson Technology
Services uniquely positioned to solve data science problems across the enterprise."),
br(),
p(strong("Learn more about this effort on Medium -"), a("https://medium.com/johnson-johnson-open-source/maternal-mortality-in-new-jersey-680a52fb5bc5."))
)
)
)
)
)
)
)
}