-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.R
137 lines (107 loc) · 7.71 KB
/
server.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
shinyServer(function(input, output, session) {
footer_server('psrcfooter')
leftpanel_server('rgcleftpanel',
contact_name = "Liz Underwood-Bultmann, AICP",
contact_phone = "206-464-6174",
contact_email = "[email protected]",
contact_title = "Principal Planner",
photo_filename = "redmondconnector.jpeg")
leftpanel_server('micleftpanel',
contact_name = "Liz Underwood-Bultmann, AICP",
contact_phone = "206-464-6174",
contact_email = "[email protected]",
contact_title = "Principal Planner",
photo_filename = "portoftacomaindustrialland.jpg")
banner_server('rgcBanner',
banner_title = "Regional Growth Centers",
banner_subtitle = "Centers",
banner_url = "https://www.psrc.org/our-work/centers")
banner_server('micBanner',
banner_title = "Manufacturing/Industrial Centers",
banner_subtitle = "Centers",
banner_url = "https://www.psrc.org/our-work/centers")
demographics_server('rgcDemographics',
center_name = reactive(input$RGC),
center_type = rgc_title)
demographics_server('micDemographics',
center_name = reactive(input$MIC),
center_type = mic_title)
transportation_server('rgcTransportation',
center_name = reactive(input$RGC),
center_type = rgc_title,
center_desc = "rgc")
transportation_server('micTransportation',
center_name = reactive(input$MIC),
center_type = mic_title,
center_desc = "mic")
housing_server('rgcHousing',
center_name = reactive(input$RGC),
center_type = rgc_title)
housing_server('micHousing',
center_name = reactive(input$MIC),
center_type = mic_title)
jobs_server('rgcEmployment',
center_name = reactive(input$RGC),
center_type = rgc_title)
jobs_server('micEmployment',
center_name = reactive(input$MIC),
center_type = mic_title)
overview_server('rgcOverview',
center_name = reactive(input$RGC),
center_type = rgc_title)
overview_server('micOverview',
center_name = reactive(input$MIC),
center_type = mic_title)
form_server('rgcForm',
center_name = reactive(input$RGC),
center_type = rgc_title)
form_server('micForm',
center_name = reactive(input$MIC),
center_type = mic_title)
source_server('rgcSource', center_type = rgc_title)
source_server('micSource', center_type = mic_title)
# Center Summary Data -----------------------------------------------------
rgc_summary_data <- reactive({
create_public_spreadsheet(table_list = list("Population" = pop_hh_hu_data |> select(-"year") |> filter(geography %in% c(input$RGC) & geography_type %in% c(rgc_title) & grouping == "Population"),
"Age" = age_data |> select(-"year") |> filter(geography %in% c(input$RGC) & geography_type %in% c(rgc_title)),
"Race" = race_data |> select(-"year") |> filter(geography %in% c(input$RGC) & geography_type %in% c(rgc_title)),
"Household Income" = income_data |> select(-"year") |> filter(geography %in% c(input$RGC) & geography_type %in% c(rgc_title)),
"Educational Attainment" = education_data |> select(-"year") |> filter(geography %in% c(input$RGC) & geography_type %in% c(rgc_title)),
"Jobs" = employment_data|> select(-"year") |> filter(geography %in% c(input$RGC) & geography_type %in% c(rgc_title)),
"Housing Units" = pop_hh_hu_data |> select(-"year") |> filter(geography %in% c(input$RGC) & geography_type %in% c(rgc_title) & grouping == "Housing Units"),
"Net Housing Units" = unit_data |> select(-"year") |> filter(geography %in% c(input$RGC) & geography_type %in% c(rgc_title)),
"Housing Tenure" = tenure_data |> select(-"year") |> filter(geography %in% c(input$RGC) & geography_type %in% c(rgc_title)),
"Housing Type" = type_data |> select(-"year") |> filter(geography %in% c(input$RGC) & geography_type %in% c(rgc_title)),
"Renter Cost Burden" = burden_data |> select(-"year") |> filter(concept == "Renter Cost Burden" & geography %in% c(input$RGC) & geography_type %in% c(rgc_title)),
"Owner Cost Burden" = burden_data |> select(-"year") |> filter(concept == "Owner Cost Burden" & geography %in% c(input$RGC) & geography_type %in% c(rgc_title)),
"Transit Stops" = transit_stop_data |> st_drop_geometry() |> filter(rgc %in% c(input$RGC)) |> select(-"mic"),
"Resident Mode Share" = mode_data |> select(-"year") |> filter(geography %in% c(input$RGC) & geography_type %in% c(rgc_title)),
"Destination Mode Share" = destination_mode_data |> select(-"year") |> filter(geography %in% c(input$RGC) & geography_type %in% c(rgc_title)),
"Intersection Density" = intersection_density |> filter(name %in% c(input$RGC))
), place_name = input$RGC)
})
mic_summary_data <- reactive({
create_public_spreadsheet(table_list = list("Jobs" = employment_data|> select(-"year") |> filter(geography %in% c(input$MIC) & geography_type %in% c(mic_title)),
"Industrial Jobs" = industrial_jobs |> filter(geography %in% c(input$MIC) & geography_type %in% c(mic_title) & data_year %in% pop_hsg_yrs),
"Population" = pop_hh_hu_data |> select(-"year") |> filter(geography %in% c(input$MIC) & geography_type %in% c(mic_title) & grouping == "Population"),
"Housing Units" = pop_hh_hu_data |> select(-"year") |> filter(geography %in% c(input$MIC) & geography_type %in% c(mic_title) & grouping == "Housing Units"),
"Transit Stops" = transit_stop_data |> st_drop_geometry() |> filter(mic %in% c(input$MIC)) |> select(-"rgc"),
"Destination Mode Share" = destination_mode_data |> select(-"year") |> filter(geography %in% c(input$MIC) & geography_type %in% c(mic_title)),
"Industrial Land" = industrial_land |> filter(geography %in% c(input$MIC) & !(grouping %in% c("Vacant", "Re-developable", "Available")))
), place_name = input$MIC)
})
output$downloadrgcData <- downloadHandler(
filename = function() {
paste0(input$RGC,"_summary_data.xlsx")},
content <- function(file) {
saveWorkbook(rgc_summary_data(), file = file)},
contentType = "application/Excel"
)
output$downloadmicData <- downloadHandler(
filename = function() {
paste0(input$MIC,"_summary_data.xlsx")},
content <- function(file) {
saveWorkbook(mic_summary_data(), file = file)},
contentType = "application/Excel"
)
})