Skip to content

Commit

Permalink
Merge branch 'main' into new_inference
Browse files Browse the repository at this point in the history
  • Loading branch information
jcblemai authored Apr 26, 2024
2 parents 4431f8f + 40207b7 commit 2b720f3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
9 changes: 6 additions & 3 deletions datasetup/build_US_setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ if (length(config$subpop_setup$geodata) > 0) {
# manually remove PR
census_data <- census_data %>% filter(USPS != "PR")


if(!dir.exists(dirname(config$subpop_setup$geodata))){
dir.create(dirname(config$subpop_setup$geodata))}
write.csv(file = file.path(geodata_file), census_data, row.names=FALSE)
print(paste("Wrote geodata file:", file.path(geodata_file)))

Expand All @@ -162,13 +165,13 @@ print(paste("Wrote geodata file:", file.path(geodata_file)))
# MOBILITY DATA (COMMUTER DATA) ------------------------------------------------------------


if(state_level & !file.exists(paste0(config$data_path, "/", config$subpop_setup$mobility))){
if(state_level & !file.exists(paste0(config$subpop_setup$mobility))){

warning(paste("State-level mobility files must be created manually because `build_US_setup.R` does not generate a state-level mobility file automatically. No valid mobility file named", paste0(config$data_path, "/", config$subpop_setup$mobility), "(specified in the config) currently exists. Please check again."))

} else if(state_level & file.exists(paste0(config$data_path, "/", config$subpop_setup$mobility))){
} else if(state_level & file.exists(paste0(config$subpop_setup$mobility))){

warning(paste("Using existing state-level mobility file named", paste0(config$data_path, "/", config$subpop_setup$mobility)))
warning(paste("Using existing state-level mobility file named", paste0(config$subpop_setup$mobility)))

} else{

Expand Down
3 changes: 2 additions & 1 deletion datasetup/build_covid_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,8 @@ us_data <- us_data %>%
# mutate(across(starts_with("incid"), ~ replace_na(.x, 0))) %>%
mutate(across(starts_with("incid"), ~ as.numeric(.x)))


if(!dir.exists(dirname(config$inference$gt_data_path))){
dir.create(dirname(config$inference$gt_data_path))}
# Save
write_csv(us_data, config$inference$gt_data_path)

Expand Down
2 changes: 2 additions & 0 deletions datasetup/build_flu_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ us_data <- us_data %>%
filter(date >= lubridate::as_date(config$start_date) & date <= lubridate::as_date(end_date_)) %>%
filter(!is.na(source))

if(!dir.exists(dirname(config$inference$gt_data_path))){
dir.create(dirname(config$inference$gt_data_path))}
write_csv(us_data, config$inference$gt_data_path)


Expand Down
2 changes: 2 additions & 0 deletions datasetup/build_nonUS_setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ if(opt$w){
}

# Save population geodata
if(!dir.exists(dirname(config$subpop_setup$geodata))){
dir.create(dirname(config$subpop_setup$geodata))}
names(census_data) <- c("subpop","admin2","admin0","pop")
write.csv(file = file.path('geodata.csv'), census_data,row.names=FALSE)

Expand Down

0 comments on commit 2b720f3

Please sign in to comment.