forked from TheRensselaerIDEA/COVIDMINDER
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.R
executable file
·3255 lines (2974 loc) · 160 KB
/
app.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
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#### Library and Data Imports ####
source("modules/Source.R")
source("modules/data_load.R")
source("modules/preprocessing.R")
source("modules/ggplot_gen.R")
source("modules/leaflet_gen.R")
source("modules/gt_gen.R")
sourceDir("modules/shiny/R")
update_date <- "07-21-2020" # makes it easy to change all occurances when we update
moving.avg.window <- 7 # WARNING: Behavior for moving.avg.window > number of report dates for a region is undefined.
# (i.e. a 20 day window if Catskill Region has 19 report dates.)
height <- "600px"# plot heights
# Leaving this in case we need it
# TODO: Implement other text as strings like this...
rpi_accessibility_link <- "<div class='center'><p><a href='https://info.rpi.edu/statement-of-accessibility'>Rensselaer Statement of Accessibility</a></p></div>"
footer_text <- "<p>COVID<b>MINDER</b> analysis and visualizations</b> are by students and staff
of <a href='http://idea.rpi.edu/'>The Rensselaer Institute for Data Exploration
and Applications</a> at <a href='http://rpi.edu/'>Rensselaer Polytechnic Institute</a>
with generous support from the United Health Foundation. COVID<b>MINDER</b> is an open
source project implemented on the <a href='https://shiny.rstudio.com/'>R Shiny platform</a>;
see the <a href='https://github.com/TheRensselaerIDEA/COVIDMINDER'>COVIDMINDER github</a>
for more information. COVID<b>MINDER</b> was directed by Kristin P. Bennett and John S. Erickson.<br><br>
<img src='comment.png' alt = 'Small text bubble icon' style='float:left;width:40px;margin-right:5px;' >
Thanks for using <b>COVIDMINDER!</b> Please take a few moments
to fill out our short <a href='https://forms.gle/8LwiYAVXXN7mu9wR6'>comments form.</a></p><br><br>
"
#<i><a href='https://info.rpi.edu/statement-of-accessibility'>Rensselaer Statement
#of Accessibility</a></i></div>"
whatisit_text_abt <-"<p>COVID<b>MINDER</b> reveals the regional disparities
in outcomes, determinants, and mediations of the COVID-19 pandemic. Outcomes are the direct
effects of COVID-19. Social and Economic Determinants are pre-existing risk factors that impact
COVID-19 outcomes. Mediations are resources and programs used to combat the pandemic.</p>"
whatisit_text <- "COVIDMINDER reveals the regional disparities in outcomes, determinants, and mediations of the COVID-19 pandemic. Outcomes are the direct effects of COVID-19. Social and Economic Determinants are pre-existing risk factors that impact COVID-19 outcomes. Mediations are resources and programs used to combat the pandemic."
comments_link <-"<img src='comment.png' style='float:left;width:40px;padding-right:2px;' >
Thanks for using <b>COVIDMINDER!</b> Please take a few moments
to fill out our short <a href='https://forms.gle/8LwiYAVXXN7mu9wR6'>comments form.</a><br><br>
<i><a href='https://info.rpi.edu/statement-of-accessibility'>Rensselaer Statement
of Accessibility</a></i>"
# For URL parameterization
url1 <- url2 <- ""
#### UI Code ####
ui <-
tagList(
tags$html(lang = "en-us"),
tags$head(includeHTML("www/analytics.html")),
navbarPage(
id="tab",
theme="style.css",
title=tags$a(class="title-text",
title = whatisit_text,
name = "top",
href = "/",
img(class="logo", src="Rensselaer_round.png", alt="Small Rensselaer Polytechnic Institute Logo"),
HTML("COVID<b>MINDER</b>")),
windowTitle = "COVIDMINDER: Where you live matters",
tabPanel(title = HTML("<div><b>STATE REPORT CARDS</b></div>"),
value = "state_report_cards",
fluidPage(
fluidRow(column(12,
selectInput(inputId = "state_name",
label = "State Selector",
title = "State selecting form tool.",
choices = state.abr$name,
selected = as.character(unlist(ranking[ranking$rank==50, "name"]))),
tags$div(style = "float:right;",
HTML(paste("<b>Date:</b>", update_date))))),
fluidRow(column(12, style="text-align:center;",uiOutput("main_title"))),
tags$br(),
fluidRow(column(8, style="text-align:center;",
tags$b(tags$sup("*"),"States are ranked best to worst by their percentage change in COVID-19 cases over the past ",time.period," days."),
offset=2)),
fluidRow(column(12, style="text-align:center;position:relative;",uiOutput("state.CoT.title"),
plotOutput(outputId = "state.CoT",
height = height,
hover = hoverOpts(id = "state.CoT.hover",
delay = 100,
delayType = "throttle")),
uiOutput("state.CoT.tooltip")),
column(1, downloadButton("state.CoT.dl", label="Download Case Barplot"),offset = 9),
column(12, style="text-align:center;position:relative;",uiOutput("state.DoT.title"),
plotOutput(outputId = "state.DoT",
height = height,
hover = hoverOpts(id = "state.DoT.hover",
delay = 100,
delayType = "throttle")),
uiOutput("state.DoT.tooltip"))),
column(1, downloadButton("state.DoT.dl", label="Download Mortality Barplot"), offset = 9),
fluidRow(column(8, style="text-align:center;",
tags$h2("Flattening the Curve"),
tags$p("Nationwide, states have taken various approaches to mitigate the spread of coronavirus, such as social distancing interventions and encouraging mask use where social distancing is not possible. Studies by the CDC have shown these methods reduce new COVID-19 cases, hospitalizations, and deaths."),
tags$b("Data Source: "), tags$a("CDC", href="https://wwwnc.cdc.gov/eid/article/26/8/20-1093_article"), offset=2)),
tags$br(),
tags$br(),
fluidRow(column(8,gt_output("state.report"),
offset = 2)),
fluidRow(column(12, style="text-align:center;",
tags$h1("County Level Breakdown"))),
fluidRow(column(12, style="text-align:center;position:relative;",uiOutput("state.trends.title"),
tags$div(style = "height:130px;width:100%;text-align:left;padding-left:4%;",
uiOutput("state.report.county.selector"),
radioButtons(inputId = "SRC.rate",
label = "Rate",
choices = c("Overall", "Per/100k"),
selected = "Per/100k")),
tags$div(style="text-align:left;padding-left:4%", "Use the above form to select 1 or multiple Counties."),
plotOutput(outputId = "state.trends",
height=height,
hover = hoverOpts(id = "state.trends.hover",
delay = 100,
delayType = "throttle"),
dblclick = "trends.dbl_click",
brush = brushOpts(
id = "trends.brush",
resetOnNew = TRUE)),
uiOutput("state.trends.tooltip"))),
column(1, downloadButton("state.trends.dl", label="Download Case Trends Plot"), offset = 9),
tags$br(),
fluidRow(column(6, style="text-align:center;",
tags$div(class = "info",
HTML("<h2>Disparity Color Legend</h2>
Colors on maps below represent:<br><br>
<div>
<div><span style='background: #BD0026; font-size: 11px; opacity: 0.7;'>    </span>
<span style='background: #D73027; font-size: 11px; opacity: 0.7;'>    </span>
<span style='background: #F46D43; font-size: 11px; opacity: 0.7;'>    </span> County rate is <strong>Higher</strong> than national average rate</div>
<div><span style='background: #f7f7f7; border:solid 1px; font-size: 11px; opacity: 0.7;'>    </span> County rate is <strong>About Equal</strong> to national average rate</div>
<div><span style='background: #253494; font-size: 11px; opacity: 0.7;'>    </span>
<span style='background: #4575B4; font-size: 11px; opacity: 0.7;'>    </span>
<span style='background: #74ADD1; font-size: 11px; opacity: 0.7;'>    </span> County rate is <strong>Lower</strong> than national average rate</div>
<i style='display:inline;'>Darker shades indicate greater disparity.</i><br><br>
</div>")), offset=3)),
fluidRow(column(6,
tags$div(style = "text-align:center;",uiOutput("state.county.cases")),
radioButtons(inputId = "SRC.case.time",
label = "Time Frame",
choices = c("Daily", "Overall"),
selected = "Daily",
inline = T),
leafletOutput("map.cases", height = height),
column(2, downloadButton("map.cases.dl", label="Download Case Map"), offset=6)),
column(6,
tags$div(style = "text-align:center;",uiOutput("state.county.deaths")),
radioButtons(inputId = "SRC.death.time",
label = "Time Frame",
choices = c("Daily", "Overall"),
selected = "Daily",
inline = T),
leafletOutput("map.deaths", height = height),
column(2, downloadButton("map.deaths.dl", label="Download Mortality Map"), offset = 6))),
tags$br(),
fluidRow(column(12, style="text-align:center;",
tags$h1("Comorbidities"))),
fluidRow(column(12, style="text-align:center;",
uiOutput("determinant.title")),
column(6,
selectInput(inputId = "state.determinant",
label = "Determinant",
title = "Determinant selecting state tool.",
choices = c("Diabetes", "Obesity", "CRD Mortality"),
selected = "Diabetes"),
leafletOutput("maps.determinant", height = height),
column(2, downloadButton("map.determinant.dl", label="Download Determinant Map"), offset = 6), offset = 3),
column(8, style="text-align:center;",
tags$p(textOutput("determinant.text"),
tags$br(),
tags$b("Data Source: "), tags$a("CDC", href="www.cdc.gov/diabetes/data"), ", ",
tags$a("CHR", href =
"https://www.countyhealthrankings.org/explore-health-rankings/measures-data-sources/county-health-rankings-model/health-factors/health-behaviors/diet-exercise/adult-obesity")),
offset = 2
)),
tags$br(),
tags$br()
,fluidRow(column(12, style="text-align:center;",
tags$h1("Rankings")),
tags$a(name = "ranking"),
column(8,
fluidRow(style="float:right;width:250px;",
selectInput(inputId = "entries",
label = "Entries",
title = "Entry amount selecting form tool.",
choices = c(`Show 10` = 10,
`Show 25` = 25,
`Show 50` = 50),
selected = 10,
width = "50%"),
radioButtons(inputId = "rank.order",
label = "Order",
choices = c("Ascending", "Descending"),
selected = "Descending",
width="50%")),
gt_output("ranking.table"), offset = 2))
)
),
tabPanel(title = HTML("<b>NATIONAL REPORT CARD</b>"),
value = "national_report_card",
tags$div(style = "float:right;",
HTML(paste("<b>Date:</b>", update_date))),
fluidRow(column(12, style="text-align:center;",tags$h1("United States Overview"))),
tags$br(),
fluidRow(column(10, style="text-align:center;position:relative;",
tags$h2("United States COVID-19 Case Curve"),
tags$h3("How have United States overall COVID-19 Cases changed over time?"),
plotOutput(outputId = "US.CoT",
height = height,
hover = hoverOpts(id = "US.CoT.hover",
delay = 100,
delayType = "throttle")),
uiOutput("US.CoT.tooltip"), offset = 1),
column(1, downloadButton("US.CoT.dl", label="Download Case Barplot"),offset = 9),
column(10, style="text-align:center;position:relative;",
tags$h2("United States COVID-19 Mortality Curve"),
tags$h3("How have United States overall COVID-19 deaths changed over time?"),
plotOutput(outputId = "US.DoT",
height = height,
hover = hoverOpts(id = "US.DoT.hover",
delay = 100,
delayType = "throttle")),
uiOutput("US.DoT.tooltip"), offset = 1),
column(1, downloadButton("US.DoT.dl", label="Download Mortality Barplot"),offset = 9)),
fluidRow(column(8, style="text-align:center;",
tags$h2("Flattening the Curve"),
tags$p("Nationwide, states have taken various approaches to mitigate the spread of coronavirus, such as social distancing interventions and encouraging mask use where social distancing is not possible. Studies by the CDC have shown these methods reduce new COVID-19 cases, hospitalizations, and deaths."),
tags$b("Data Source: "), tags$a("CDC", href="https://wwwnc.cdc.gov/eid/article/26/8/20-1093_article"), offset=2)),
tags$br(),
tags$br(),
fluidRow(column(8,gt_output("US.report"),
offset = 2)),
fluidRow(column(12, style="text-align:center;",
tags$h1("State Level Breakdown"))),
fluidRow(column(10, style="text-align:center;position:relative;",uiOutput("US.trends.title"),
tags$div(style = "height:130px;text-align:left;padding-left:4%;",
uiOutput("US.report.state.selector"),
radioButtons(inputId = "NRC.rate",
label = "Rate",
choices = c("Overall", "Per/100k"),
selected = "Per/100k")),
tags$div(style="text-align:left;padding-left:4%", "Use the above form to select 1 or multiple States."),
plotOutput(outputId = "US.trends",
height=height,
hover = hoverOpts(id = "US.trends.hover",
delay = 100,
delayType = "throttle"),
dblclick = "trends.dbl_click",
brush = brushOpts(
id = "trends.brush",
resetOnNew = TRUE)),
uiOutput("US.trends.tooltip"), offset = 1),
column(1, downloadButton("US.trends.dl", label="Download Case Trend Plot"), offset = 9)),
tags$br(),
fluidRow(column(4, style="text-align:center;",
tags$div(class = "info",
HTML("<h2>Disparity Color Legend</h2>
Colors on maps below represent:<br><br>
<div>
<div><span style='background: #BD0026; font-size: 11px; opacity: 0.7;'>    </span>
<span style='background: #D73027; font-size: 11px; opacity: 0.7;'>    </span>
<span style='background: #F46D43; font-size: 11px; opacity: 0.7;'>    </span> State rate is<strong> Higher</strong> than national average rate</div>
<div><span style='background: #f7f7f7; border:solid 1px; font-size: 11px; opacity: 0.7;'>    </span> State rate is<strong> About Equal</strong> to national average rate</div>
<div><span style='background: #253494; font-size: 11px; opacity: 0.7;'>    </span>
<span style='background: #4575B4; font-size: 11px; opacity: 0.7;'>    </span>
<span style='background: #74ADD1; font-size: 11px; opacity: 0.7;'>    </span> State rate is<strong> Lower</strong> than national average rate</div>
<i style='display:inline;'>Darker shades indicate greater disparity.</i><br><br>
</div>")), offset=4)),
fluidRow(column(6,
tags$h2(style="text-align:center;", "US COVID-19 Case Hotspots"),
tags$h3(style="text-align:center;", paste0("What are the Nationwide disparities in Daily Case Rates? (",time.period, " day average)")),
radioButtons(inputId = "NRC.case.time",
label = "Time Frame",
choices = c("Daily", "Overall"),
selected = "Daily",
inline = T),
leafletOutput("US.map.cases", height = height),
column(2, downloadButton("US.map.cases.dl", label="Download Case Map"), offset=6)),
column(6,
tags$h2(style="text-align:center;", "US COVID-19 Mortality Hotspots"),
tags$h3(style="text-align:center;", paste0("What are the Nationwide disparities in Daily Mortality Rates? (",time.period, " day average)")),
radioButtons(inputId = "NRC.deaths.time",
label = "Time Frame",
choices = c("Daily", "Overall"),
selected = "Daily",
inline = T),
leafletOutput("US.map.deaths", height = height),
column(2, downloadButton("US.map.deaths.dl", label="Download Mortality Map"), offset = 6)),
column(6,
tags$h2(style="text-align:center;", "US COVID-19 Testing Disparities"),
tags$h3(style="text-align:center;", "What are the Nationwide disparities in COVID-19 Testing?"),
leafletOutput("US.map.testing", height = height),
column(2, downloadButton("US.maps.testing.dl", label="Download Testing Map"), offset = 6), offset = 3
)),
tags$br(),
fluidRow(column(12, style="text-align:center;",
uiOutput("US.determinant.title")),
column(6,
selectInput(inputId = "US.determinant",
label = "Determinant",
title = "Determinant selecting form tool",
choices = c("Diabetes", "Obesity", "CRD Mortality", "Heart Disease Mortality"),
selected = "Diabetes"),
leafletOutput("US.maps.determinant", height = height),
column(2, downloadButton("US.maps.determinant.dl", label="Download Determinant Map"), offset = 6), offset = 3),
column(8, style="text-align:center;",
tags$p(textOutput("US.determinant.text"),
tags$br(),
tags$b("Data Source: "), tags$a("CDC", href="www.cdc.gov/diabetes/data"), ", ",
tags$a("CHR", href =
"https://www.countyhealthrankings.org/explore-health-rankings/measures-data-sources/county-health-rankings-model/health-factors/health-behaviors/diet-exercise/adult-obesity")),
offset = 2
)),
tags$br(),
tags$br(),
fluidRow(column(12, style="text-align:center;",
tags$h1("Rankings")),
tags$a(name = "ranking"),
column(8,
fluidRow(style="float:right;width:250px;",
selectInput(inputId = "US.entries",
label = "Entries",
title = "Entry amount selecting form tool.",
choices = c(`Show 10` = 10,
`Show 25` = 25,
`Show 50` = 50),
selected = 10,
width = "50%"),
radioButtons(inputId = "US.rank.order",
label = "Order",
choices = c("Ascending", "Descending"),
selected = "Descending",
width="50%")),
gt_output("US.ranking.table"), offset = 2))
),
# navbarMenu(menuName = "outcome_plots_menu",
# #HTML("<div style='font-size:90%;line-height:1.3;'><b>OUTCOME (GRAPHS)</b><br>Select a state outcome</div>"),
# HTML("<div><b>OUTCOME (GRAPHS)</b></div>"),
#
# tabPanel(title=tags$div(class="tab-title",style="text-align:center;",
# HTML("<div><b>OUTCOME (NY)</b></br>COVID-19 Trends in new Cases (Region)</div>")),
# value="outcome_ny_new_cases",
# fluidPage(
# fluidRow(class="page_title", tags$h1("OUTCOME: New York trends of new COVID-19 Cases")),
# fluidRow(class="page_title", tags$h2("How have new COVID-19 Cases been mitigated in New York State over time?")),
# fluidRow(class = "map-container",
# column(8, style=paste0("height:",height,";"), id = "mainpanel_ny_new_case",
# tags$div(class = "page_title",
# selectInput(inputId = "NYRegion3",
# label = "NY Regions",
# choices = c("All Regions", sort(unique(covid_NY_TS_plot.cases$Region))),
# selected = "All Regions"),
# dateRangeInput(inputId = "NYDate.ma",
# label = "Date Range",
# min = min(covid_NY_TS_plot.cases$date),
# max = max(covid_NY_TS_plot.cases$date),
# start = as.Date(max(covid_NY_TS_plot.cases$date)) - 31,
# end = max(covid_NY_TS_plot.cases$date)),
# radioButtons(inputId = "rate.ma",
# label = "",
# choices = c("Overall", "Per/100k"),
# selected = "Per/100k")),
# tags$div(class = "NY_case_plots",
# plotOutput(outputId = "NY.cases.ma", height="100%",
# click = clickOpts(id ="NY.cases.TS_click_ma"),
# dblclick = "NY.cases.TS_dblclick",
# brush = brushOpts(
# id = "NY.cases.TS_brush",
# resetOnNew = TRUE))
# ),
# HTML("<div style='position:absolute;bottom:0;'>
# <br>To zoom plot, click and drag, then double-click in select box<br>
# To un-zoom, double-click in plot<br>
# For region details, single-click on line<br>
# </div>")
# ),
# column(4, id = "sidebar_ny_new_case",
# tags$h2("New York Regions Map"),
# img(src="New-York-Regional-Map.png",style="width: 90%;"),
# HTML(paste0("<div>
# <strong>Date: </strong>",update_date,"<br>
# <b>DATA SOURCE:</b> <a href='https://on.ny.gov/39VXuCO'>heath.data.ny.gov (daily)</a>
# </div>")),
# HTML("<h2>Phase One: Capital Region, Central New York, Finger Lakes, Long Island, Mid-Hudson, Mohawk Valley,
# North Country, Southern Tier and Western New York are allowed to partially reopen </h2>"),
# HTML("<b>Data Source:</b> <a href='https://forward.ny.gov/industries-reopening-phase'>NY Gov</a>"),
# uiOutput("click_info_ma")
# ))
# )
# ),
# tabPanel(tags$div(class="tab-title",style="text-align:center;",
# HTML("<div><b>OUTCOME (NY)</b></br>COVID-19 Trends in Mortality (Region)</div>")),
# value="outcome_ny_cases_time",
# fluidPage(
# fluidRow(class="page_title", tags$h1("OUTCOME: New York Counties trends of new COVID-19 Deaths")),
# fluidRow(class="page_title", tags$h2("How have new COVID-19 Deaths been mitigated in New York State over time?")),
# fluidRow(class = "map-container",
#
# column(8, style=paste0("height:",height,";"),id = "mainpanel_ny_CoT",
# tags$div(
# selectInput(inputId = "NYRegion",
# label = "NY Regions",
# choices = c("All Regions", sort(unique(covid_NY_TS_plot.deaths$Region))),
# selected = "All Regions"),
# # selectInput(inputId = "NYCounty",
# # label = "NY Counties",
# # choices = c("All Counties", sort(unique(covid_NY_TS_plot.cases$County))),
# # selected = 1)
# # ),
# dateRangeInput(inputId = "NYDoTDate",
# label = "Date Range",
# min = min(covid_NY_TS_plot.deaths$date),
# max = max(covid_NY_TS_plot.deaths$date),
# start = as.Date(max(covid_NY_TS_plot.deaths$date)) - 31,
# end = max(covid_NY_TS_plot.deaths$date)),
# radioButtons(inputId = "rate.DoT",
# label = "",
# choices = c("Overall", "Per/100k"),
# selected = "Per/100k")),
# tags$div(class = "NY_case_plots",
# plotOutput(outputId = "NY.deaths.ma", height="100%",
# click = clickOpts(id ="NY.cases.TS_click"),
# dblclick = "NY.cases.TS_dblclick",
# brush = brushOpts(
# id = "NY.cases.TS_brush",
# resetOnNew = TRUE))
# ),
# HTML("<div style='position:absolute;bottom:0;'>
# <br>To zoom plot, click and drag, then double-click in select box<br>
# To un-zoom, double-click in plot<br>
# For county details, single-click on line<br>
# </div>")),
# column(4,
# id = "sidebar_ny_CoT",
# tags$h2("New York Regions Map"),
# img(src="New-York-Regional-Map.png",style="width: 90%;"),
# HTML(paste0("<div>
# <strong>Date: </strong>",update_date,"<br>
# <b>DATA SOURCE:</b> <a href='https://on.ny.gov/39VXuCO'>heath.data.ny.gov (daily)</a> and
# <a href='https://usafacts.org/visualizations/coronavirus-covid-19-spread-map/'>USA Facts</a>
# </div>")),
# HTML("<h2>Phase One: Capital Region, Central New York, Finger Lakes, Long Island, Mid-Hudson, Mohawk Valley,
# North Country, Southern Tier and Western New York are allowed to partially reopen </h2>"),
# HTML("<b>Data Source:</b> <a href='https://forward.ny.gov/industries-reopening-phase'>NY Gov</a><br>
# "),
# uiOutput("click_info")
# )
# )
# )
# ),
# tabPanel(title=tags$div(class="tab-title",style="text-align:center;",
# HTML("<div><b>OUTCOME (NY)</b></br>COVID-19 Mortality over Time (County)</div>")),
# value="outcome_ny_cases_time_region",
# fluidPage(
# fluidRow(class="page_title", tags$h1("OUTCOME: New York County COVID-19 Deaths over time")),
# fluidRow(class="page_title", tags$h2("How have COVID-19 Deaths increased across New York State over time?")),
# fluidRow(class = "map-container",
# column(8,style=paste0("height:",height,";"), id = "mainpanel_ny_CoT_region",
# selectInput(inputId = "NYCounty",
# label = "NY Counties",
# choices = c("All Counties", sort(covid_NY_TS_plot.deaths %>%
# filter(Region != "New York City") %>%
# select(County) %>%
# unlist() %>%
# unique() %>%
# c("New York City"))),
# selected = "All Counties"),
# dateRangeInput(inputId = "NYcDoTDate",
# label = "Date Range",
# min = min(covid_NY_TS_plot.deaths$date),
# max = max(covid_NY_TS_plot.deaths$date),
# start = as.Date(max(covid_NY_TS_plot.deaths$date)) - 62,
# end = max(covid_NY_TS_plot.deaths$date)),
# radioButtons(inputId = "rate.cDoT",
# label = "",
# choices = c("Overall", "Per/100k"),
# selected = "Per/100k"),
# tags$div(class = "NY_case_plots",
# plotOutput(outputId = "NY.deaths.TS", height="100%",
# click = clickOpts(id ="NY.cases.TS_click_reg"),
# dblclick = "NY.cases.TS_dblclick",
# brush = brushOpts(
# id = "NY.cases.TS_brush",
# resetOnNew = TRUE))
# ),
# HTML("<div style='position:absolute;bottom:0;'>
# <br>To zoom plot, click and drag, then double-click in select box<br>
# To un-zoom, double-click in plot<br>
# For county details, single-click on line<br>
# </div>")),
# column(4, id = "sidebar_ny_CoT_region",
# tags$h2("New York Regions Map"),
# img(src="New-York-Regional-Map.png",style="width: 90%;"),
# HTML(paste0("<div>
# <strong>Date: </strong>",update_date,"<br>
# <b>DATA SOURCE:</b> <a href='https://on.ny.gov/39VXuCO'>heath.data.ny.gov (daily)</a> and
# <a href='https://usafacts.org/visualizations/coronavirus-covid-19-spread-map/'>USA Facts</a>
# </div>")),
# HTML("<h2>Phase One: Capital Region, Central New York, Finger Lakes, Long Island, Mid-Hudson, Mohawk Valley,
# North Country, Southern Tier and Western New York are allowed to partially reopen </h2>"),
# HTML("<b>Data Source:</b> <a href='https://forward.ny.gov/industries-reopening-phase'>NY Gov</a><br>"),
# uiOutput("click_info_reg"))
# )
# )
# ),
# tabPanel(tags$div(class="tab-title",style="text-align:center;",
# HTML("<div><b>OUTCOME (NY)</b></br>COVID-19 Racial Disparity</div>")),
# value="outcome_ny_racial_disparity",
# fluidPage(
# fluidRow(class="page_title", tags$h1("OUTCOME: New York Racial Disparities of COVID-19 mortality")),
# fluidRow(class="page_title", tags$h2("Do minorities make up a higher percentage of COVID-19 deaths when compared to
# their population percentage? Do New York City and the rest of New York State have
# different disparities in minority COVID-19 deaths?")),
# fluidRow(class = "map-container",
# column(8,style=paste0("height:",height,";"), id = "mainpanel_ny_race",
# plotOutput(outputId = "NY.race.nys", height="50%"),
# plotOutput(outputId = "NY.race.nyc", height="50%")),
# column(4,
# id = "sidebar_ny_race",
# #HTML(whatisit_text),
# HTML("
# <div>
# <a href='https://bit.ly/2Krl5RG'>Evidence suggests</a> that COVID-19 deaths may be higher for certain racial/ethnic groups.<br><br>
# If the percentage of COVID-19 deaths experienced by a racial/ethnic group is higher than that
# group’s population percentage for a region, this suggests that COVID-19 may have a disparate
# impact on that group in that region. Social and economic determinants may contribute to this disparity. <br><br>"),
# HTML("For each racial/ethnic group, the proportion of COVID-19 deaths for that group is:<br>
# <div> <span style='background: #BD0026; border-radius: 50%; font-size: 11px; opacity: 0.7;'>    </span><strong> Higher</strong> than population percentage for disparity index > 0.2</div>
# <div> <span style='background: #f7f7f7; border-radius: 50%; font-size: 11px; opacity: 0.7;'>    </span><strong> About equal</strong> to the population percentage for -0.2 <disparity index < 0.2</div>
# <div> <span style='background: #253494; border-radius: 50%; font-size: 11px; opacity: 0.7;'>    </span><strong> Lower</strong> than population percentage for disparity index < -0.2</div>
# <i>Darker shades indicate greater disparity.</i><br><br>
#
# <strong>Group COVID-19 Death Percentage</strong> = number of COVID-19 deaths for group/total COVID-19 deaths<br>
# <strong>Population Percentage</strong> = number of residents from that group/ total number of residents<br>
# <strong>Death Rate Disparity Index</strong> = log(Group COVID-19 Death Percentage/Population Percentage)
# <br>
# </div>"
# ),
# HTML(paste0("<div>
# <br><br>
# <strong>Date: </strong>",update_date,"<br><br>
# <b>DATA SOURCE:</b> <a href='https://on.ny.gov/2VehafT'>New York State Dept. of Health COVIDTracker (daily)</a><br>
# </div>")))
# )
# )
# ),
# tabPanel(tags$div(class="tab-title",style="text-align:center;",
# HTML("<div><b>OUTCOME (CT)</b></br>COVID-19 Racial Disparity</div>")),
# value="outcome_ct_racial_disparity",
# fluidPage(
# fluidRow(class="page_title", tags$h1("OUTCOME: Connecticut Racial Disparities of COVID-19 mortality")),
# fluidRow(class="page_title", tags$h2("Do minorities in Connecticut make up a higher percentage of COVID-19 deaths when compared to
# their population percentage?")),
# fluidRow(class = "map-container",
# column(8, id = "mainpanel_ct_race",
# plotOutput(outputId = "NY.race.ct", height=height)),
# column(4,
# id = "sidebar_ct_race",
# #HTML(whatisit_text),
# HTML("
# <div>
# <a href='https://bit.ly/2Krl5RG'>Evidence suggests</a> that COVID-19 deaths may be higher for certain racial/ethnic groups.<br><br>
# If the percentage of COVID-19 deaths experienced by a racial/ethnic group is higher than that
# group’s population percentage for a region, this suggests that COVID-19 may have a disparate
# impact on that group in that region. Social and economic determinants may contribute to this disparity. <br><br>"),
# HTML("For each racial/ethnic group, the proportion of COVID-19 deaths for that group is:<br>
# <div> <span style='background: #BD0026; border-radius: 50%; font-size: 11px; opacity: 0.7;'>    </span><strong> Higher</strong> than population percentage for disparity index > 0.2</div>
# <div> <span style='background: #f7f7f7; border-radius: 50%; font-size: 11px; opacity: 0.7;'>    </span><strong> About equal</strong> to the population percentage for -0.2 <disparity index < 0.2</div>
# <div> <span style='background: #253494; border-radius: 50%; font-size: 11px; opacity: 0.7;'>    </span><strong> Lower</strong> than population percentage for disparity index < -0.2</div>
# <i>Darker shades indicate greater disparity.</i><br><br>
#
# <strong>Group COVID-19 Death Percentage</strong> = number of COVID-19 deaths for group/total COVID-19 deaths<br>
# <strong>Population Percentage</strong> = number of residents from that group/ total number of residents<br>
# <strong>Death Rate Disparity Index</strong> = log(Group COVID-19 Death Percentage/Population Percentage)
# <br>
# </div>"
# ),
# HTML(paste0("<div>
# <br><br>
# <strong>Date: </strong>",update_date,"<br><br>
# <b>DATA SOURCE:</b> <a href='https://bit.ly/3bJ77GZ'>ct.gov</a><br>
# </div>")))
# )
# )
# )),
# navbarMenu(menuName = "outcome_maps_menu",
# HTML("<div><b>OUTCOME (MAPS)</b></div>"),
# tabPanel(tags$div(class="tab-title",style="text-align:center;", #For some reason, unresponsive to class
# HTML("<div><b>OUTCOME (USA)</b></br>Mortality Rate</div>")),
# value="outcome_usa_mortality",
# fluidPage(
# fluidRow(class = "page_title",tags$h1("OUTCOME: USA COVID-19 Mortality Rates Disparities")),
# fluidRow(class = "page_title",tags$h2("What are the disparities between states in rates of COVID-19 deaths per 100k population
# when compared to the average USA rate?")),
# fluidRow(class = "map-container",
# column(8,
# id = "mainpanel_us_mort",
# tags$h3(class="map-title", "COVID-19 Mortality Rate Disparities by State Compared to Average US Rate"),
# leafletOutput(outputId = "map.covid_deaths", height=height))
# ,
# column(4,
# id = "sidebar_us_mort",
# #HTML(whatisit_text),
# HTML(paste0("<div>The rate of COVID-19 deaths per 100k in a state is: <br>
# <div> <span style='background: #BD0026; border-radius: 50%; font-size: 11px; opacity: 0.7;'>    </span><strong> Higher</strong> than US avg. rate for disparity index > 0.2</div>
# <div> <span style='background: #f7f7f7; border-radius: 50%; font-size: 11px; opacity: 0.7;'>    </span><strong> About equal</strong> to US avg. rate for -0.2 < disparity index < 0.2</div>
# <div> <span style='background: #253494; border-radius: 50%; font-size: 11px; opacity: 0.7;'>    </span><strong> Lower</strong> than US avg. rate for disparity index < -0.2 </div>
# <i>Darker shades indicate greater disparity.</i><br><br>
#
# <strong>Mortality Rate</strong> = number of COVID-19 deaths per 100K population<br>
# <strong>Death Rate Disparity Index</strong> = log(Mortality Rate in state/mean Mortality Rate of US)<br>
# <strong>Date: </strong>",update_date,"<br><br>
#
# <b>DATA SOURCE:</b> <a href='http://bit.ly/39PMWpD'>JHU CSSE (daily)</a><br>
# </div>
# ")),
# #HTML(footer_text),
# ))),
# #tags$script(src = "style.js")
# ),
# tabPanel(tags$div(class="tab-title",style="text-align:center;", #For some reason, unresponsive to class
# HTML("<div><b>OUTCOME (USA)</b></br>Racial/Ethnic Disparity</div>")),
# value="outcome_usa_racial_disparity",
# fluidPage(
# fluidRow(class="page_title", tags$h1("OUTCOME: Racial/Ethnic Disparities of COVID-19 Mortality")),
# fluidRow(class="page_title", tags$h2("Do minorities make up a higher percentage of COVID-19 deaths across the United States when compared to
# their population percentage?")),
# fluidRow(class="map-container",
# column(8,
# id = "mainpanel_us_mort_race",
# tags$h3(class="map-title", "COVID-19 Mortality Rate Disparities by State by Race/Ethnicity"),
# #HTML("<br><br>"),
# tags$div(class = "select-bar",
# selectInput(inputId = "race",
# label = NULL,
# choices = c("Non-hispanic White"="nhw",
# "Non-hispanic American Indian/Alaska Native"="nhaian",
# "Non-hispanic Asian Pacific Islander"="nhapi",
# "Hispanic/Latino (total)"="hlt",
# "Non-hispanic Black/African American"="nhbaa"),
# selected = "nhbaa")),
# leafletOutput(outputId = "map.covid_deaths.race", height=height)),
# column(4,
# id = "sidebar_us_mort_race",
# #HTML(whatisit_text),
# HTML(paste0("
# <div>
# <a href='https://bit.ly/2Krl5RG'>Evidence suggests</a> that COVID-19 deaths may be higher for certain racial/ethnic groups.<br><br>
# If the percentage of COVID-19 deaths experienced by a racial/ethnic group is higher than that
# group’s population percentage for a region, this suggests that COVID-19 may have a disparate
# impact on that group in that region. Social and economic determinants may contribute to this disparity.
# <br><br>",
#
# "For each racial/ethnic group, the proportion of COVID-19 deaths for that group is:<br>
# <div> <span style='background: #BD0026; border-radius: 50%; font-size: 11px; opacity: 0.7;'>    </span><strong> Higher</strong> than population percentage for disparity index > 0.2</div>
# <div> <span style='background: #f7f7f7; border-radius: 50%; font-size: 11px; opacity: 0.7;'>    </span><strong> About equal</strong> to the population percentage for -0.2 <disparity index < 0.2</div>
# <div> <span style='background: #253494; border-radius: 50%; font-size: 11px; opacity: 0.7;'>    </span><strong> Lower</strong> than population percentage for disparity index < -0.2</div>
# <i>Darker shades indicate greater disparity.</i><br><br>
#
# <strong>Group COVID-19 Death Percentage</strong> = number of COVID-19 deaths for group/total COVID-19 deaths<br>
# <strong>Population Percentage</strong> = number of residents from that group/ total number of residents<br>
# <strong>Death Rate Disparity Index (DI)</strong> = log(Group COVID-19 Death Percentage/Population Percentage)
# <br><br>
# <strong>Date: </strong>",update_date,"<br><br>
# <b>DATA SOURCE:</b> <a href='https://data.cdc.gov/resource/pj7m-y5uh.csv'>data.cdc.gov</a><br>
# </div>"))
# #HTML(footer_text),
# )
#
# )
# ),
# ),
# tabPanel(tags$div(class="tab-title",style="text-align:center;",
# HTML("<div><b>OUTCOME (STATE)</b></br>Mortality Rate</div>")),
# value="outcome_state_mortality",
# fluidPage(
# fluidRow(class="page_title", uiOutput("state_mort_heading")),
# fluidRow(class="map-container",
# column(8,id = "mainpanel_ny_mort",
# uiOutput("state_mort_map_title"),
# tags$div(class = "select-bar",
# selectInput(
# inputId = "state_mort",
# label = NULL,
# choices = state.abr$abr,
# selected = "NY"
# )),
# leafletOutput(outputId = "map.NY.deaths", height = height)),
# column(4,
# id = "sidebar_ny_mort",
# #HTML(whatisit_text),
# HTML(paste0("<div>
# The rate of COVID-19 deaths per 100k in a county is<br>
# <div> <span style='background: #BD0026; border-radius: 50%; font-size: 11px; opacity: 0.7;'>    </span><strong> Higher</strong> than US avg. rate for disparity index > 0.2</div>
# <div> <span style='background: #f7f7f7; border-radius: 50%; font-size: 11px; opacity: 0.7;'>    </span><strong> About equal</strong> to US avg. rate for -0.2 <disparity index < 0.2</div>
# <div> <span style='background: #253494; border-radius: 50%; font-size: 11px; opacity: 0.7;'>    </span><strong> Lower</strong> than US avg. rate for disparity index < -0.2</div>
# <i>Darker shades indicate greater disparity.</i><br><br>
#
# <strong>Mortality Rate</strong> = number of COVID-19 deaths per 100K population<br>
# <strong>Death Rate Disparity Index</strong> = log(Mortality Rate in state/mean Mortality Rate in US)<br>
# <strong>Date: </strong>",update_date,"<br><br>
#
# <b>DATA SOURCE:</b> <a href='http://bit.ly/39PMWpD'>JHU CSSE (daily)</a> and
# <a href='https://usafacts.org/visualizations/coronavirus-covid-19-spread-map/'>USA Facts</a><br>
#
# </div>"))
# #HTML(footer_text),
# ))
#
#
#
# )),
# tabPanel(tags$div(class="tab-title",style="text-align:center;",
# HTML("<div><b>OUTCOME (STATE)</b></br>COVID-19 Cases</div>")),
# value="outcome_state_cases",
# fluidPage(
# fluidRow(class="page_title", uiOutput("state_case_heading")),
# fluidRow(class = "map-container",
# column(8, id = "mainpanel_ny_cases",
# uiOutput("state_case_map_title"),
# tags$div(class = "select-bar",
# selectInput(
# inputId = "state_case",
# label = NULL,
# choices = state.abr$abr,
# selected = "NY"
# )),
# leafletOutput(outputId = "map.NY.cases", height=height)),
# column(4,
# id = "sidebar_ny_cases",
# #HTML(whatisit_text),
# HTML(paste0("<div>
#
# The rate of COVID-19 deaths per 100k in a county is<br>
# <div> <span style='background: #BD0026; border-radius: 50%; font-size: 11px; opacity: 0.7;'>    </span><strong> Higher</strong> than US avg. rate for disparity index > 0.2</div>
# <div> <span style='background: #f7f7f7; border-radius: 50%; font-size: 11px; opacity: 0.7;'>    </span><strong> About equal</strong> to US avg. rate for -0.2 <disparity index < 0.2</div>
# <div> <span style='background: #253494; border-radius: 50%; font-size: 11px; opacity: 0.7;'>    </span><strong> Lower</strong> than US avg. rate for disparity index < -0.2</div>
# <i>Darker shades indicate greater disparity.</i><br><br>
#
# <strong>Mortality Rate</strong> = number of COVID-19 deaths per 100K population<br>
# <strong>Date: </strong>",update_date,"<br><br>
#
# <b>DATA SOURCE:</b> <a href='https://on.ny.gov/39VXuCO'>heath.data.ny.gov (daily)</a><br>
# </div>")),
# )
# )
# )
# )),
# navbarMenu(menuName = "mediation_menu",
# #HTML("<div style='font-size:90%;line-height:1.3;'><b>MEDIATION</b><br>Select a USA mediation</div>"),
# HTML("<div><b>MEDIATION</b></div>"),
# tabPanel(tags$div(class="tab-title",style="text-align:center;",
# HTML("<div><b>MEDIATION (USA)</b></br>COVID-19 Testing</div>")),
# value="mediation_usa_testing",
# fluidPage(
# fluidRow(class="page_title", tags$h1("MEDIATION: Nationwide testing disparities compared to top testing countries")),
# fluidRow(class="page_title", tags$h2("What are the disparities between US states in their rates of COVID-19 testing per 1k population
# when compared to the average rates from other countries? When compared with the current average
# US rate?")),
# fluidRow(class = "map-container",
# column(8, id = "mainpanel_us_test",
# tags$h3(class="map-title", paste0("COVID-19 Testing Rate Disparities by State Compared to Selected Country")),
# HTML("<br><br>"),
# tags$div(class="select-bar",
# selectInput(inputId = "country",
# label = NULL,
# choices = country_testing_choices,
# selected = "de")),
# leafletOutput(outputId = "map.testing", height=height)),
# column(4,
# id = "sidebar_us_test",
# #HTML(whatisit_text),
# HTML(paste0("
# <div>
# Several countries significantly effected by COVID-19 can be used as testing reference rates.
# Some of these countries are regarded as having successfully used testing to “flatten the curve”,
# while others are still in the midst of dealing with the crisis.<br><br>
# The rate of testing per 1k in a state is: <br>
# <div> <span style='background: #253494; border-radius: 50%; font-size: 11px; opacity: 0.7;'>    </span><strong> Higher</strong> than selected country testing rate for disparity index > 0.2</div>
# <div> <span style='background: #f7f7f7; border-radius: 50%; font-size: 11px; opacity: 0.7;'>    </span><strong> About equal</strong> to selected country testing rate for -0.2 < disparity index < 0.2</div>
# <div> <span style='background: #BD0026; border-radius: 50%; font-size: 11px; opacity: 0.7;'>    </span><strong> Lower</strong> than selected country testing rate for disparity index < -0.2</div>
# <i>Darker shades indicate greater disparity.</i><br><br>
#
# <strong>Testing Rate</strong> = number of COVID-19 tests per 1K population <br>
# <strong>Testing Rate Disparity Index</strong> = log(Testing Rate in state/Testing Rate in selected country) <br>
# <strong>Date: </strong>",update_date,"<br><br>
#
# <b>DATA SOURCES:</b> <a href='http://bit.ly/39PMWpD'>JHU CSSE (daily)</a>,
# <a href='https://ourworldindata.org/coronavirus'>Our World in Data</a>
# </div>")))
# )
# )
# ),
# tabPanel(tags$div(class="tab-title",style="text-align:center;",
# HTML("<div><b>MEDIATION (USA)</b></br>Hospital Beds</div>")),
# value="mediation_usa_hospital_beds",
# fluidPage(
# fluidRow(class="page_title", tags$h1("MEDIATION: Nationwide Hospital Bed Disparities vs Italy")),
# fluidRow(class="page_title", tags$h2("What are the disparities between states in the rate of hospital beds
# per 100k population when compared to the rate in Italy?")),
# fluidRow(class = "map-container",
# column(8,id = "mainpanel_us_hosp",
# tags$h3(class="map-title", "COVID-19 Hospital Bed Rate Disparities by State Compared to Average Italian Rate"),
# leafletOutput(outputId = "map.hospital", height=height)),
# column(4,
# id = "sidebar_us_hosp",
# #HTML(whatisit_text),
# HTML(paste0("
# <div>
# Italy has a higher hospital
# bed rate than the US, yet still faced challenges meeting peak COVID bed needs. Thus we use
# Italy’s rate as a minimum target rate.<br><br>
# The rate of hospital beds per 100k in a state is<br>
# <div> <span style='background: #253494; border-radius: 50%; font-size: 11px; opacity: 0.7;'>    </span><strong> Higher</strong> than Italian rate for disparity index > 0.2</div>
# <div> <span style='background: #f7f7f7; border-radius: 50%; font-size: 11px; opacity: 0.7;'>    </span><strong> About equal</strong> to Italian rate for -0.2 <disparity index < 0.2</div>
# <div> <span style='background: #BD0026; border-radius: 50%; font-size: 11px; opacity: 0.7;'>    </span><strong> Lower</strong> than Italian rate for disparity index < -0.2</div>
# <i>Darker shades indicate greater disparity.</i><br><br>
#
# <strong>Testing Rate</strong> = number of COVID-19 tests per 100K population <br>
# <strong>Testing Rate Disparity Index</strong> = log(Testing Rate in state/Testing Rate in Italy) <br>
# <strong>Date: </strong>",update_date,"<br><br>
#
# <b>DATA SOURCE:</b> <a href='https://bit.ly/2V0CYLU'>Kaiser Family Foundation</a><br>
#
# </div>")))
# )
# )
# )),
navbarMenu(menuName ="determinant_menu",
HTML("<div><b>DETERMINANT ANALYSIS</b></div>"),
tabPanel(tags$div(class="tab-title",style="text-align:center;",
HTML("<div><b>DISCLAIMER</b></div>")),
value = "determinant_disclaimer",
fluidRow(column(8, class = "about",
tags$h1("Disclaimer"),
tags$p("Determinant tabs are experimental and expected to change substantially, current displayed data may not be accurate."),
offset = 2)))
#,
# tabPanel(tags$div(class="tab-title",style="text-align:center;",
# HTML("<div><b>DETERMINANT</b></br>USA</div>")),
# value="determinant_usa",
# fluidPage(
# fluidRow(class="page_title", uiOutput("us_det_title")),
# fluidRow(class="page_title", uiOutput("us_det_subtitle")),
# fluidRow(class = "map-container",
# column(8, id = "mainpanel_us_db",
# uiOutput("us_det_map_title"),
# tags$br(),tags$br(),
# tags$div(class = "select-bar",
# selectInput(inputId = "determinant",
# label = NULL,
# choices = c("Diabetes", "Obesity", "CRD Mortality", "Heart Disease Mortality"),
# selected = "Diabetes"
# )),
# leafletOutput(outputId = "map.determinant", height=height)),
# column(4,
# id = "sidebar_us_db",
# uiOutput("sb_us_det_output"),
# HTML(
# "<div>
# <div> <span style='background: #BD0026; border-radius: 50%; font-size: 11px; opacity: 0.7;'>    </span><strong> Higher</strong> than US avg. rate for disparity index > 0.2</div>
# <div> <span style='background: #f7f7f7; border-radius: 50%; font-size: 11px; opacity: 0.7;'>    </span><strong> About equal</strong> to US avg. rate for -0.2 <disparity index < 0.2</div>
# <div> <span style='background: #253494; border-radius: 50%; font-size: 11px; opacity: 0.7;'>    </span><strong> Lower</strong> than US avg. rate for disparity index < -0.2</div>
# <i>Darker shades indicate greater disparity.</i><br><br></div>"),
# uiOutput("sb_us_det_footer")))
# )
# ),
# tabPanel(tags$div(class="tab-title",style="text-align:center;",
# HTML("<div><b>DETERMINANT</b></br>NY</div>")),
# value="determinant_ny",
# fluidPage(
# fluidRow(class="page_title", uiOutput("ny_det_title")),
# fluidRow(class="page_title", uiOutput("ny_det_subtitle")),
# fluidRow(class = "map-container",
# column(8, id = "mainpanel_ny_det",
# uiOutput("ny_det_map_title"),
# tags$br(),tags$br(),
# tags$div(class = "select-bar",
# selectInput(inputId = "determinant_NY",
# label = NULL,
# choices = c("Diabetes", "Obesity"), # , "Obesity", "Heart Disease"
# selected = "Diabetes"
# )),
# leafletOutput(outputId = "map.NY.determinant", height=height)),
# column(4,
# id = "sidebar_ny_det",
# uiOutput("sb_ny_det_output"),
# HTML("
# <div>
# <div> <span style='background: #BD0026; border-radius: 50%; font-size: 11px; opacity: 0.7;'>    </span><strong> Higher</strong> than US avg. rate for disparity index > 0.2</div>
# <div> <span style='background: #f7f7f7; border-radius: 50%; font-size: 11px; opacity: 0.7;'>    </span><strong> About equal</strong> to US avg. rate for -0.2 < disparity index < 0.2</div>
# <div> <span style='background: #253494; border-radius: 50%; font-size: 11px; opacity: 0.7;'>    </span><strong> Lower</strong> than US avg. rate for disparity index < -0.2</div>
# <i>Darker shades indicate greater disparity.</i><br><br>
# </div>"),
# uiOutput("sb_ny_det_footer")))
# )
# )
),
tabPanel(HTML("<div><b>ABOUT</b></div>"),
value="about",
fluidRow(
column(8,offset=2,class="about",
tags$h1("About the Project"),
HTML(whatisit_text_abt),
HTML(footer_text))
)
)
),
### Footer
fluidRow(
column(12, class = "footer",
hr(),
HTML("<a href='?tab=about'>About</a> "),
HTML("<a href='https://idea.rpi.edu/'>Institute for Data Exploration and Applications (IDEA)</a> "),
HTML("<a href='https://github.com/TheRensselaerIDEA/COVIDMINDER'>COVIDMINDER GitHub</a> "),
HTML("<a href='https://info.rpi.edu/statement-of-accessibility'>Accessibility</a> "),
HTML("<a href='https://forms.gle/8LwiYAVXXN7mu9wR6'>
<span title='Thanks for using COVIDMINDER! Please take a few moments to fill out our short comments form.'>Comments</span></a> "),
tags$a(href="#top", "Back to Navbar")
)
)
#,tags$script(src = "style.js")
)
#### Server Code ####
server <- function(input, output, session) {
# Leaflet plot colors
colors <- c("#253494","#4575B4", "#74ADD1","#ABD9E9","#f7f7f7","#FDAE61","#F46D43", "#D73027", "#BD0026")
bins <- c(5, 3, 2, 1, .2, -.2, -1, -2, -3, -5)
# Join NY shape and data, may move to processing
# Render leaflet plot with all information in hover
output$map.testing <- renderLeaflet({
# browser()
country <- input$country # selected country
# modify states to have selected columns for our plot
tests_ldi <- states %>%
select(starts_with("tests_ldi")) %>%
select(ends_with(country))
states <- data.frame(states, "tests_ldi"=unlist(tests_ldi)) # Append to states
pal2 <- leaflet::colorBin(colors, domain = states$tests_ldi, bins = bins, reverse=TRUE)
# browser()
labels2 <- sprintf(
paste0("<strong>%s</strong> State<br/>
Testing Rate vs ", toupper(country)," DI: %.2g<br>
Testing Rate: %.1f /1000"),
states$NAME, states$tests_ldi, states$tests_per_1000
) %>% lapply(htmltools::HTML)
leaflet(states.shapes, width="100%", height="100%") %>%
setView(-96, 37.8, 4) %>% # TODO: Doesn't seem to do anything
addPolygons(
fillColor = ~pal2(states$tests_ldi),
weight = 1,
opacity = 1,
color = "#330000",
dashArray = "1",
fillOpacity = 0.7,
highlight = highlightOptions(
weight = 5,
color = "#666",
dashArray = "",
fillOpacity = 0.7,
bringToFront = TRUE),
label = labels2,
labelOptions = labelOptions(
style = list("font-weight" = "normal", padding = "3px 8px"),
textsize = "15px",
direction = "auto")) %>%
addLegend(pal = pal2,
values = ~states$tests_ldi,
opacity = 0.7,
title = paste0("Disparity Index<br/>US Total Tests vs. ",toupper(country)),
position = "bottomright",
labFormat = function(type, cuts, p) { n = length(cuts)
cuts[n] = paste0(cuts[n]," lower")
# for (i in c(1,seq(3,(n-1)))){cuts[i] = paste0(cuts[i],"—")}
for (i in c(1,seq(2,(n-1)))){cuts[i] = paste0(cuts[i]," — ")}
cuts[2] = paste0(cuts[2]," higher")
paste0(str_remove(cuts[-n],"higher"), str_remove(cuts[-1],"—"))
}
) %>%
addProviderTiles("MapBox", options = providerTileOptions(
id = "mapbox.light"))
})
output$map.determinant <- renderLeaflet({
det <- input$determinant