county case bug, added refresh basemap parameter
This commit is contained in:
parent
38c3ba3fec
commit
3f5e6aa645
4
Makefile
4
Makefile
@ -1,5 +1,9 @@
|
||||
all: osrm TOPS_data_process crashmaps
|
||||
|
||||
osrm: osrm-data osrm-containers
|
||||
|
||||
crashmaps: schoolmaps_PDFs crashmaps_dynamic crashmaps_dynamic_milwaukee crash_data_summaries
|
||||
|
||||
TOPS_data_process: R/TOPS_data_process.Rmd
|
||||
R -e 'library("rmarkdown"); old_path <- Sys.getenv("PATH"); Sys.setenv(PATH = paste(old_path, "/usr/local/bin", sep = ":")); rmarkdown::render(knit_root_dir = "../", output_dir = "./html", input = "./R/TOPS_data_process.Rmd", output_file = "./html/TOPS_data_process.html")'
|
||||
|
||||
|
@ -118,16 +118,16 @@ if(str_to_lower(county_focus) == "all") {
|
||||
# set which school types to generate figures for
|
||||
school_type_focus <- run_parameters$school_type_focus
|
||||
if(str_to_lower(school_type_focus) == "all") {
|
||||
school_type_focus <- unique(WI_schools %>% filter(CTY_DIST %in% str_to_title(county_focus)) %>% pull(SCHOOLTYPE))
|
||||
school_type_focus <- unique(WI_schools %>% pull(SCHOOLTYPE))
|
||||
}
|
||||
|
||||
# set which school types to generate figures for
|
||||
district_focus <- run_parameters$district_focus
|
||||
if(str_to_lower(district_focus) == "all") {
|
||||
district_focus <- unique(WI_schools %>% filter(CTY_DIST %in% str_to_title(county_focus), SCHOOLTYPE %in% school_type_focus, !is.na(DISTRICT_NAME)) %>% pull(DISTRICT_NAME))
|
||||
district_focus <- unique(WI_schools %>% pull(DISTRICT_NAME))
|
||||
}
|
||||
|
||||
school_number <- length(unique(WI_schools %>% filter(CTY_DIST %in% str_to_title(county_focus),
|
||||
school_number <- length(unique(WI_schools %>% filter(str_to_upper(CTY_DIST) %in% county_focus,
|
||||
SCHOOLTYPE %in% school_type_focus,
|
||||
DISTRICT_NAME %in% district_focus) %>%
|
||||
pull(district_school)))
|
||||
@ -257,9 +257,12 @@ generate_school_maps <- function(district) {
|
||||
|
||||
message(paste("***", district, "School District |"))
|
||||
options(ggmap.file_drawer = paste0("basemaps/districts/", district))
|
||||
dir.create(file_drawer(), recursive = TRUE, showWarnings = FALSE)
|
||||
saveRDS(list(), file_drawer("index.rds"))
|
||||
readRDS(file_drawer("index.rds"))
|
||||
if(file.exists(paste0("basemaps/districts/", district, "/index.rds")) & !run_parameters$refresh_basemaps) {
|
||||
readRDS(file_drawer("index.rds"))
|
||||
} else {
|
||||
dir.create(file_drawer(), recursive = TRUE, showWarnings = FALSE)
|
||||
saveRDS(list(), file_drawer("index.rds"))
|
||||
}
|
||||
file_drawer("index.rds")
|
||||
for(school in WI_schools %>%
|
||||
filter(DISTRICT_NAME %in% district,
|
||||
|
3
parameters/.gitignore
vendored
3
parameters/.gitignore
vendored
@ -2,3 +2,6 @@
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
||||
|
||||
# Except the run_parameters template
|
||||
!run_parameters_template.csv
|
2
parameters/run_parameters_template.csv
Normal file
2
parameters/run_parameters_template.csv
Normal file
@ -0,0 +1,2 @@
|
||||
county_focus,school_type_focus,district_focus,parallel,refresh_basemaps
|
||||
ALL,ALL,ALL,TRUE,TRUE
|
|
Loading…
x
Reference in New Issue
Block a user