-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsite.R
740 lines (724 loc) · 34.7 KB
/
site.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
library(community)
page_head(
title = "Virginia Department of Health Data Commons",
description = "Virginia Department of Health Data Commons.",
icon = "https://uva-bi-sdad.github.io/community_example/icon.svg"
)
page_navbar(
title = "Virginia Department of Health Data Commons",
logo = "https://uva-bi-sdad.github.io/community_example/icon.svg",
input_button("Reset", "reset_selection", "reset.selection", class = "btn-link", note = "Reset the menu inputs to their defaults."),
input_button("Filter", "filter", "open.filter", class = "btn-link"),
list(
name = "Settings",
backdrop = "false",
class = "menu-compact",
items = list(
input_switch("Dark Theme", id = "settings.theme_dark"),
input_switch(
"Color by Rank", id = "settings.color_by_order",
note = paste(
"Switch from coloring by value to coloring by sorted index.",
"This may help differentiate regions with similar values."
)
),
input_select(
"Color Scale Center", options = c("none", "median", "mean"), default = "none",
display = c("None", "Median", "Mean"), id = "settings.color_scale_center",
floating_label = FALSE,
note = "Determines whether and on what the color scale should be centered."
),
input_switch("Hide URL Settings", id = "settings.hide_url_parameters"),
input_switch("Hide Tooltips", id = "settings.hide_tooltips"),
input_switch("Show Missing Years", id = "settings.show_empty_times"),
input_number("Digits", "settings.digits", default = 2, min = 0, max = 6, floating_label = FALSE),
input_select(
"Summary Level", options = c("dataset", "filtered", "all"), default = "dataset",
display = c("All Regions", "Selected Region Types", "Selected Region"), id = "settings.summary_selection",
floating_label = FALSE,
note = paste(
"Determines which regions are included in summaries for box-plots and color scaling;",
"All-Regions are state-wide, Selected Region Types are filtered by the Region Types input, and",
"Selected Region are filtered by region selection."
)
),
'<p class="section-heading">Map Options</p>',
input_select(
"Animations", c("fly", "zoom", "none"), "fly",
note = "Fly animates the whole move to different regions; Zoom only animates changes in zoom level.",
id = "settings.map_animations", floating_label = FALSE
),
input_switch("Background On Top", default_on = TRUE, id = "settings.background_top"),
input_number(
"Outline Weight", "settings.polygon_outline", default = 1.5, step = .5, floating_label = FALSE,
note = "Thickness of the outline around region shapes."
),
input_number(
"Background Outline Weight", "settings.background_polygon_outline", default = 2,
step = .5, floating_label = FALSE
),
input_number(
"Overlay Circle Size", "settings.circle_radius", default = 5, step = 1, floating_label = FALSE,
note = "Radius of the circles that are parts of overlays."
),
input_select(
"Overlay Circle Property", "overlay_properties", id = "settings.circle_property", floating_label = FALSE,
note = "Property to adjust circle size by."
),
'<p class="section-heading">Plot Options</p>',
input_select("Plot Type", c("scatter", "scattergl", "bar"), "scatter", id = "plot_type", floating_label = FALSE),
input_switch("Box Plots", default_on = TRUE, id = "settings.boxplots"),
input_switch(
"Use IQR Whiskers", id = "settings.iqr_box",
note = "Define the extreme fences of the box plots by 1.5 * interquartile range (true) or min and max (false)."
),
input_number(
"Trace Limit", "settings.trace_limit", default = 20, floating_label = FALSE,
note = "Limit the number of plot traces that can be drawn, split between extremes of the variable."
),
'<p class="section-heading">Table Options</p>',
input_switch("Auto-Sort", default_on = TRUE, id = "settings.table_autosort"),
input_switch("Auto-Scroll", default_on = TRUE, id = "settings.table_autoscroll"),
input_select(
"Scroll Behavior", c("instant", "smooth", "auto"), "auto",
id = "settings.table_scroll_behavior", floating_label = FALSE
)
),
foot = list(
input_button("Clear Settings", "reset_storage", "clear_storage", class = "btn-danger")
)
),
list(
name = "About",
items = list(
page_text(c(
paste0(
"This site was made by the [Social and Decision Analytics Division]",
"(https://biocomplexity.virginia.edu/institute/divisions/social-and-decision-analytics)",
" of the [Biocomplexity Institute](https://biocomplexity.virginia.edu) for the ",
"[Virginia Department of Health](https://www.vdh.virginia.gov)."
),
"View its source on [GitHub](https://github.com/uva-bi-sdad/vdh_rural_health_site).",
input_button("Download Loaded Data", "export", query = list(
features = list(geoid = "id", name = "name", region_type = "type")
), class = "btn-full"),
"Credits",
paste(
"Built in [R](https://www.r-project.org) with the",
"[community](https://uva-bi-sdad.github.io/community) package, using these resources:"
)
), class = c("", "", "h5")),
output_credits()
)
)
)
page_panel(
page_section(
wraps = "row",
conditions = c("", "metric_set == rural_health", "metric_set == hoi", "metric_set == unit_profiles"),
input_select(
"Metric Set", c("rural_health", "hoi", "unit_profiles"), 1, c("Rural Health", "Health Equity", "Unit Profiles"),
id = "metric_set"
),
c(
'<p>Office of Rural Health</p>',
paste(
'<img style="margin: auto; width: 35px" alt="Virginia State Office of Rural Health Logo"',
'src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGYAAABeCAYAAADR9mGiAAAK3mlDQ1BJQ0MgUHJvZmlsZQAASImVlwdQU+kWx8+9qYSElhABKaE3QToBpNcACtJBVEISIJQYQkDFhsriCq4FFREsK7oqomBZitgQC7ZFsfcFWQSUdbFgQ81e4BF29817b95/5sv3m5PznXLnfjPnAtBCuWJxJqoCkCWSSiICfVhx8Qks0nNAQBtooA92XF6O2Ds8PBQwje9/1/u7mDemW1Yjsf79//8qNb4ghweAJGKczM/hZWHcgq1BnlgiBcAdxuyG86XiEb6NMUOCFYhx3winjvGXEU4eZbzKqE9UhC/GRgBkKpcrSQWg2mB2Vh4vFYtDDcfYRsQXijAuwNiDl8blY4zlhSlZWfNGeABjM8xfDEBjYMxO/kvM1L/FT5bH53JT5Tz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+tdua827H8hODmozO3OAU8Ern3bzc3A6tZYXkWG1Hm3bJRMY2tfImW3HxWn9isJOCmdlJmfMZQ6ag1QyOmBqQPDFiACvnICyDg2Oelfch+RzB7nsIDgkwgjKXO8YLbxOveat5IkoCjGBmpaTMRl57HDjIcigXWI3aprxOAgyGEVzMRA+9evE2Zf+KkoXg6N/Bo5Bqm4iSAIOK272YiW2oJjH2iXrVBA4ZMKVYzBQGVsn1GySwXrnHQbN9JwNGUOZK9MpqnIiSASOYWTkpcz5vlMFRec2bT65d98iAEYpXAjMzMpY816nkiSgZMIIyo7JD5+8Y2abs16sFHDJgkKKWazFTFW18UYX7jXFNCpNY0a2EuQ46OCYODK5xUSRc/seEbzNx65KcdjNhOHq5M16+R3W+I20aNJKbyoS0HTiijNjxKc71ubwZUX/PjmMOjB2CazKtWeBEAYNfw0XYx1dUKezzQtjroRKnyQn5PBDKIxc3XHJgcCemmylFkVBOY9D8J3EUbZ5EGRyYUn8fcxINSa1TDRhqixLJqwFDZEhqMTVgqC1KJK8GDJEhqcXUgKG2KJG8GjBEhqQWUwOG2qJE8mrAEBmSWsy/wFLhwPnLoTYAAAAASUVORK5CYII=">'
),
'<p class="lead fs-6">- Priority Metrics -</p>'
),
c(
'<p>Office of Health Equity</p>',
'<p class="lead fs-6">- Health Opportunity Index -</p>'
),
c(
'<p>Virginia Cooperative Extension</p>',
'<p class="lead fs-6">- Unit Profiles -</p>'
)
),
conditions = c("metric_set == rural_health", "metric_set == hoi", "metric_set == unit_profiles"),
## RURAL HEALTH PANEL -------------------------------------------------------
page_section(
type = "", id = "rural_health_panel",
'<p class="lead">Education</p>',
input_button(
"Child Readiness",
list(selected_variable = "median_read_pass_rate")
),
'<p class="lead">Broadband</p>',
input_button(
"Households with Broadband",
list(selected_variable = "perc_hh_with_broadband")
),
'<p class="lead">Nutrition and Food Security</p>',
input_button(
"Food Insecurity",
list(selected_variable = "percent_food_insecure")
),
input_button(
"Childhood Food Insecurity",
list(selected_variable = "Child_Food_Insecurity_Rate")
),
'<p class="lead">Healthy Moms And Babies</p>',
input_button(
"APNCU: Inadequate",
list(selected_variable = "inadequate")
),
input_button(
"APNCU: Intermediate",
list(selected_variable = "intermediate")
),
input_button(
"APNCU: Adequate",
list(selected_variable = "adequate")
),
input_button(
"APNCU: Adequate Plus",
list(selected_variable = "adequateplus")
),
'<p class="lead">Access to Health Care Services</p>',
input_button(
"Avoidable Hospitalizations",
list(selected_variable = "prevent_hosp_rate")
),
'<p class="lead">Behavioral Health, Substance Use Disorder and Recovery</p>',
input_button(
"Overdose ED Visits",
list(selected_variable = "avg_monthly_rate")
),
'<p class="lead">Employment/Workforce Development</p>',
input_button(
"Earnings per Job",
list(selected_variable = "earnings_per_job")
),
input_button(
"Employment Rate",
list(selected_variable = "emp_rate")
)
),
## HEALTH OPPORTUNITY INDEX PANEL -------------------------------------------
page_section(
type = "", id = "hoi_panel",
input_button(
"Health Opportunity Index",
list(selected_variable = "health_opportunity_indicator")
),
'<p class="lead" style="font-size:1em;text-weight:bold;">HOI Component Indexes</p>',
input_button(
"Economic Opportunity",
list(selected_variable = "economic_opportunity_indicator")
),
input_button(
"Built Environment",
list(selected_variable = "community_environment_indicator")
),
input_button(
"Consumer Opportunity",
list(selected_variable = "consumer_opportunity_indicator")
),
input_button(
"Social Impact",
list(selected_variable = "wellness_disparity_indicator")
),
'<p class="lead" style="font-size:1em;text-weight:bold;">Related Measures</p>',
input_button(
"Labor Force Participation Rate",
list(selected_variable = "labor_participate_rate_geo20")
),
input_button(
"Employment Access",
list(selected_variable = "employment_access_index_geo20")
),
input_button(
"Income Inequality",
list(selected_variable = "gini_index_geo20")
),
input_button(
"Material Deprivation",
list(selected_variable = "material_deprivation_indicator_geo20")
),
input_button(
"Years of Schooling",
list(selected_variable = "average_years_schooling_geo20")
),
input_button(
"Access to Food (VDH)",
list(selected_variable = "food_access_percentage_geo20")
),
input_button(
"Geographic Mobility",
list(selected_variable = "perc_moving_geo20")
),
input_button(
"Population Density",
list(selected_variable = "population_density_geo20")
),
input_button(
"Segregation",
list(selected_variable = "segregation_indicator_geo20")
),
input_button(
"Walkability",
list(selected_variable = "walkability_index_raw")
),
input_button(
"Affordability (H&T)",
list(selected_variable = "affordability_index_geo20")
),
input_button(
"Environmental Hazard Index",
list(selected_variable = "environmental_hazard_index")
),
input_button(
"Care Access (VDH)",
list(selected_variable = "access_care_indicator_geo20")
),
input_button(
"Incarceration Rate (PPI)",
list(selected_variable = "incarceration_rate_per_100000"))),
## VCE UNIT PROFILES PANEL ------------------------------------------------
page_section(
type = "", id = "unit_profiles",
## DEMOGRAPHIC
'<p class="lead" style="font-size:1em;text-weight:bold;">Demographic Summary</p>',
# Population by Age
input_button(
"Population under 20",
list(selected_variable = "age_under_20_percent_direct")
),
input_button(
"Population between 20 and 64",
list(selected_variable = "age_20_64_percent_direct")
),
input_button(
"Population over 65",
list(selected_variable = "age_65_plus_percent_direct")
),
# Population by Sex
input_button(
"Male Population",
list(selected_variable = "gender_male_percent_direct")
),
input_button(
"Female Population",
list(selected_variable = "gender_female_percent_direct")
),
# Population by Race
input_button(
"White Population",
list(selected_variable = "race_wht_alone_percent_direct")
),
# N. Housing Units
input_button(
"Black or African American Population",
list(selected_variable = "race_afr_amer_alone_percent_direct")
),
input_button(
"American Indian Population",
list(selected_variable = "race_native_alone_percent_direct")
),
input_button(
"Asian/Pacific Islander Population",
list(selected_variable = "race_AAPI_percent_direct")
),
# N. Housing Units
input_button(
"Other Race Population",
list(selected_variable = "race_other_percent_direct")
),
input_button(
"Two or More Races Population",
list(selected_variable = "race_two_or_more_percent_direct")
),
input_button(
"Hispanic Population",
list(selected_variable = "race_hispanic_or_latino_percent_direct")
),
# Households by Income
input_button(
"Median Household Income",
list(selected_variable = "median_household_income")
),
# N. Housing Units
input_button(
"Children Raised by Grandparents",
list(selected_variable = "perc_children_raised_by_GPs")
),
input_button(
"Without vehicle",
list(selected_variable = "perc_no_vehicle")
),
## AGRICULTURE
'<p class="lead" style="font-size:1em;text-weight:bold;">Agriculture Summary</p>',
input_button(
"Cropland Acerage",
list(selected_variable = "total_cropland_acres")
),
input_button(
"Irrigated Cropland Acerage",
list(selected_variable = "total_irrigatedCropland_acre")
),
input_button(
"Number of Cropland Operations",
list(selected_variable = "total_cropland_operations")
),
input_button(
"Expenses towards Animal Industry",
list(selected_variable = "total_animal_expense")
),
input_button(
"Sales of Fruits and Treenuts",
list(selected_variable = "fruit_treeNut_total_sales")
),
input_button(
"Sales of Animal Products",
list(selected_variable = "total_animalProducts_sales")
),
input_button(
"Sales of Commodities",
list(selected_variable = "total_commodity_sales")
),
input_button(
"Sales of Calves",
list(selected_variable = "total_calves_sales")
),
'<p class="lead" style="font-size:1em;text-weight:bold;">Health Summary</p>',
# Mortality
# Morbidity
input_button(
"Poor physical health days",
list(selected_variable = "perc_poor_phys_hlth_days_14_and_over")
),
input_button(
"Poor mental health days",
list(selected_variable = "perc_poor_ment_hlth_days_14_and_over")
),
# Health Behaviors
# Clinical Care
input_button(
"Uninsured",
list(selected_variable = "no_hlth_ins_pct")
),
input_button(
"Primary care physicians",
list(selected_variable = "primcare_cnt")
),
# Social and Economic Factors
# Physical Environment
'<p class="lead" style="font-size:1em;text-weight:bold;">Education Summary</p>',
# School Enrollment
# Educational Attainment
input_button(
"Postsecondary education",
list(selected_variable = "acs_postsecondary_percent")
),
# Percent of Age Group Enrolled
'<p class="lead" style="font-size:1em;text-weight:bold;">Business and Employment Summary</p>'),
# Population
# SIC Codes
# Retail Summary
# Finance, Insurance, Estate Summary
# Service Summary
foot = input_switch("Share use data", "settings.tracking", as.checkbox = TRUE, note = paste(
"Sharing your use data (via Google Analytics) supports this project,",
"and can help us improve the site."
))
)
page_menu(
input_checkbox(
"Starting Layer", c("district", "county", "tract"), 1, c("Districts", "Counties", "Census Tracts"),
id = "starting_shapes", multi = FALSE, note = "Which geographies to show at the state level."
),
page_section(
type = "col",
wraps = "row form-row",
input_combobox(
"Health District", options = "ids", dataset = "district", dataview = "primary_view",
id = "selected_district", clearable = TRUE, note = paste(
"Health districts are sets of counties defined by the Virginia Department of Health."
)
),
input_combobox(
"County", options = "ids", dataset = "county", dataview = "primary_view",
id = "selected_county", selection_subset = "county_subset", clearable = TRUE
),
conditions = c("lock: !selected_county", "starting_shapes != district || selected_district")
),
input_checkbox(
"Region Types", options = c("rural", "mixed", "urban"), id = "region_type", as.switch = TRUE,
note = paste(
"Which region types to include. Types are defined at the county level, so only health districts",
"have mixed types, and all tracts are of the same type as their county."
)
),
page_section(
type = "col",
wraps = "row form-row",
input_combobox(
"Variable", options = "variables", group_feature = "category",
default = "perc_hh_with_broadband", depends = "shapes",
id = "selected_variable", note = paste(
"Determines which variable is shown on the plot's y-axis, in the rank table,",
"and info fields, and used to color map polygons and plot elements."
)
)
),
position = "top",
default_open = TRUE,
sizes = c(1, NA, 1, NA)
)
## `input_variable` can be used to set up logical controls
input_variable("shapes", list(
"starting_shapes == district && !selected_district" = "district",
"starting_shapes == tract || selected_county" = "tract"
), "county")
input_variable("region_select", list(
"shapes == county" = "selected_county"
), "selected_district")
input_variable("selected_region", list(
"selected_county" = "selected_county"
), "selected_district")
input_variable("set_palette", list(
"settings.color_by_order" = "lajolla"
# "color_by_setting == quintile" = "greens5"
), "vik")
input_variable("county_subset", list(
"selected_district" = "siblings"
), "full_filter")
# input_rule("color_by_setting == value", list(settings.color_by_order = FALSE))
# input_rule("color_by_setting != value", list(settings.color_by_order = TRUE))
# input_rule("!settings.color_by_order", list(color_by_setting = "value"))
# input_rule("settings.color_by_order && color_by_setting == value", list(color_by_setting = "rank"))
## `input_dataview` can collect multiple inputs as filters for a shared data view
input_dataview(
"primary_view",
y = "selected_variable",
x = "selected_year",
dataset = "shapes",
ids = "selected_region",
features = c(type = "region_type"),
time_agg = "selected_year",
palette = "set_palette"
)
# use `page_section` to build the page's layout
page_section(
type = "col",
# use `output_` functions to add state and data displays
output_text(c(
"State: Virginia[r selected_county,selected_district]",
"? > Health District: {selected_district}[r selected_county]",
"? > {selected_county}"
), class = "compact"),
output_text(list(
"default" = "Virginia Counties",
"starting_shapes == tract" = "Virginia Census Tracts",
"starting_shapes == district" = "Virginia (Health Districts)[note: Sets of counties defined by the Virginia Department of Health.]",
"selected_district" = "{selected_district} Counties",
"selected_county" = "{selected_county} Census Tracts"
), tag = "h1", class = "text-center"),
page_section(
type = "container-xsm",
input_number(
"Selected Year", min = "filter.time_min", max = "filter.time_max", default = "max",
id = "selected_year", buttons = TRUE, show_range = TRUE, note = paste(
"Year of the selected variable to color the map shapes and plot elements by, and to show on hover."
)
)
),
page_section(
type = "row",
wraps = "col",
sizes = c(NA, 5),
output_map(
list(
list(
name = "tract",
time = 2010,
url = paste0(
"https://raw.githubusercontent.com/uva-bi-sdad/sdc.geographies/main/VA/Census%20Geographies/",
"Tract/2020/data/distribution/va_geo_census_cb_2020_census_tracts.geojson"
)
),
list(
name = "county",
time = 2010,
url = paste0(
"https://raw.githubusercontent.com/uva-bi-sdad/sdc.geographies/main/VA/Census%20Geographies/",
"County/2020/data/distribution/va_geo_census_cb_2020_counties.geojson"
)
),
list(
name = "tract",
time = 2020,
url = paste0(
"https://raw.githubusercontent.com/uva-bi-sdad/sdc.geographies/main/VA/Census%20Geographies/",
"Tract/2020/data/distribution/va_geo_census_cb_2020_census_tracts.geojson"
)
),
list(
name = "county",
time = 2020,
url = paste0(
"https://raw.githubusercontent.com/uva-bi-sdad/sdc.geographies/main/VA/Census%20Geographies/",
"County/2020/data/distribution/va_geo_census_cb_2020_counties.geojson"
)
),
list(
name = "district",
url = paste0(
"https://raw.githubusercontent.com/uva-bi-sdad/sdc.geographies/main/VA/State%20Geographies/Health%20Districts/",
"2020/data/distribution/va_geo_vhd_2020_health_districts.geojson"
)
)
),
dataview = "primary_view",
click = "region_select",
id = "main_map",
subto = c("main_plot", "rank_table", "main_legend"),
options = list(
attributionControl = FALSE,
scrollWheelZoom = FALSE,
center = c(38, -79.5),
zoom = 7,
height = "430px"
),
background_shapes = "county",
tiles = list(
light = list(url = "https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}{r}.png"),
dark = list(url = "https://{s}.basemaps.cartocdn.com/dark_all/{z}/{x}/{y}{r}.png")
),
attribution = list(
list(
name = "Stamen toner-light",
url = "https://stamen.com",
description = "Light-theme map tiles by Stamen Design"
),
list(
name = "CARTO Dark Matter",
url = "https://carto.com/attributions",
description = "Dark-theme map tiles by CARTO"
),
list(
name = "OpenStreetMap",
url = "https://www.openstreetmap.org/copyright"
)
)
),
page_section(
type = "flex-column col",
output_info(
title = "variables.short_name",
dataview = "primary_view",
id = "variable_info_pane",
),
'
<script async src="https://www.googletagmanager.com/gtag/js?id=G-278827H8WK"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag("js", new Date());
gtag("config", "G-278827H8WK");
</script>
<script>
function download_variable(){
var urlParams = new URLSearchParams(window.location.search);
let selectedVar = urlParams.get("selected_variable");
if (selectedVar == null){
selectedVar = "perc_hh_with_broadband"; // The default starting variable name for this repository
}
window.location = "https://github.com/uva-bi-sdad/sdc.measures/raw/main/"+ selectedVar + ".zip";
gtag("event", "file_download", {
"measure": selectedVar
});
}
</script>
<button onclick="download_variable()" id= "download_variable_button" type="button" class="btn popup-button mb-2">Download All</button>
',
page_popup(
"Download Filtered",
page_section(
wraps = "col",
input_select("Table Format", c("tall", "mixed", "wide"), "mixed", id = "export_table_format"),
input_select("File Format", c("csv", "tsv"), "csv", c("CSV", "TSV"), id = "export_file_format")
),
input_button(
"Download", "export", dataview = "primary_view", query = list(
include = "selected_variable",
features = list(geoid = "id", name = "name"),
table_format = "export_table_format", file_format = "export_file_format"
), class = "btn-full"
),
input_button(
"Copy API link", "copy", dataview = "primary_view", query = list(
include = "selected_variable", dataset = "shapes",
features = list(geoid = "id", name = "name"),
table_format = "export_table_format", file_format = "export_file_format"
), class = "btn-full"
)
),
output_info(body = "summary", dataview = "primary_view"),
output_info("Filters", "filter", dataview = "primary_view"),
page_section(
output_info(
title = "features.name",
default = c(title = "Virginia", body = "Hover over or select a region for more information."),
dataview = "primary_view",
subto = c("main_map", "main_plot", "rank_table", "main_legend")
),
output_info(
body = c(
"Region Type" = "features.type",
"variables.long_name" = "selected_variable",
"variables.statement"
),
row_style = c("table", "stack"),
dataview = "primary_view",
subto = c("main_map", "main_plot", "rank_table", "main_legend"),
variable_info = FALSE
)
)
)
),
page_section(
type = "row",
wraps = "col",
sizes = c(5, 7),
page_section(
page_section(
wraps = "col-md",
sizes = c(NA, 1),
output_legend(
"settings.palette", dataview = "primary_view", click = "region_select",
subto = c("main_map", "main_plot", "rank_table"), id = "main_legend"
)
# input_checkbox(
# "Color By", c("value", "rank", "quintile"), 0,
# id = "color_by_setting", multi = FALSE, class = "compact"
# )
),
output_table("selected_variable", dataview = "primary_view", options = list(
info = FALSE,
searching = FALSE,
scrollY = 300,
dom = "<'row't>"
), id = "rank_table", click = "region_select", subto = c("main_map", "main_plot", "main_legend"))
),
output_plot(
x = "time", y = "selected_variable", dataview = "primary_view",
click = "region_select", subto = c("main_map", "rank_table", "main_legend"), id = "main_plot",
options = list(
layout = list(
xaxis = list(title = FALSE, fixedrange = TRUE),
yaxis = list(fixedrange = TRUE, zeroline = FALSE)
),
data = data.frame(
type = c("plot_type", "box"), fillcolor = c(NA, "transparent"),
hoverinfo = c("text", NA), mode = "lines+markers", showlegend = FALSE,
name = c(NA, "Summary"), marker.line.color = "#767676", marker.line.width = 1
),
config = list(modeBarButtonsToRemove = c("select2d", "lasso2d", "sendDataToCloud"))
)
)
)
)