-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.R
48 lines (44 loc) · 1.38 KB
/
build.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
library(community)
entities_file <- "../social_data_commons/cache/entities.rds"
if (file.exists(entities_file)) {
entities <- readRDS(entities_file)
} else {
file <- tempfile(fileext = ".csv.xz")
download.file(paste0(
"https://raw.githubusercontent.com/uva-bi-sdad/sdc.geographies/main/",
"docs/distribution/geographies_metadata.csv.xz"
), file)
entities <- vroom::vroom(file)
entities <- entities[!duplicated(entities$geoid), c("geoid", "region_name", "region_type")]
saveRDS(entities, entities_file, compress = "xz")
}
datacommons_refresh(
"../social_data_commons",
reset_on_fail = TRUE, dataset_map = structure(entities$region_type, names = entities$geoid, verbose=TRUE)
)
datacommons_map_files("../social_data_commons", overwrite = TRUE)
# # capital region
# datacommons_view(
# "../social_data_commons", "capital_region",
# metadata = entities, entity_info = NULL
# )
#
# # VDH
# datacommons_view(
# "../social_data_commons", "community_example",
# metadata = entities, entity_info = NULL
# )
#
# # Fairfax women and girls
# datacommons_view(
# "../social_data_commons", "fairfax_women_and_girls",
# metadata = entities, entity_info = NULL
# )
# # VDH Parent site
# datacommons_view(
# "../social_data_commons", "vdh_rural_parent",
# metadata = entities, entity_info = NULL
# )
#
# # monitor site
init_datacommons("../social_data_commons", serve = TRUE)