Skip to content

Commit

Permalink
Merge pull request #68 from HopkinsIDD/configwriter_fix
Browse files Browse the repository at this point in the history
Configwriter fix
  • Loading branch information
shauntruelove authored Oct 6, 2023
2 parents f065d3d + 4cc949a commit 8a84db7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
8 changes: 4 additions & 4 deletions datasetup/build_covid_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ source(file.path(opt$path, "datasetup/data_setup_source.R"))
# SET DELPHI API KEY ------------------------------------------------------

if (any(grepl("nchs|hhs", opt$gt_data_source))){
if (!is.null(opt$delphi_api_key)){
cat(paste0("Using Environment variable for Delphi API key: ", opt$delphi_api_key))
options(covidcast.auth = opt$delphi_api_key)
} else if (!is.null(config$inference$gt_api_key)){
if (!is.null(config$inference$gt_api_key)){
cat(paste0("Using Config variable for Delphi API key: ", config$inference$gt_api_key))
options(covidcast.auth = config$inference$gt_api_key)
} else if (!is.null(opt$delphi_api_key)){
cat(paste0("Using Environment variable for Delphi API key: ", opt$delphi_api_key))
options(covidcast.auth = opt$delphi_api_key)
} else {
newkey <- readline(prompt = "Please enter your Delphi API key before proceeding:")
#check
Expand Down
16 changes: 10 additions & 6 deletions flepimop/R_packages/config.writer/R/yaml_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -1976,15 +1976,19 @@ seir_chunk <- function(resume_modifier = NULL,
" proportion_exponent: [\n",
" [",rate_propexp_parts, ",\"1\",\"1\",\"1\"],\n",
" [",rate_alpha_parts, ",\"1\",\"1\",\"1\"]]\n",
" rate: [\n",
paste0(sapply(X = na.omit(c(rate_seir_parts, rate_vacc_parts, rate_var_parts, rate_age_parts)),
function(x = X){ paste0(" ",x,",\n")}) ),
" ]\n"),
" rate: [",
ifelse(nchar(rate_seir_parts)<100,
paste(na.omit(c(rate_seir_parts, rate_vacc_parts, rate_var_parts, rate_age_parts)), collapse = ", "),
paste0("\n ", paste(na.omit(c(rate_seir_parts, rate_vacc_parts, rate_var_parts, rate_age_parts)), collapse = ",\n "))),
"]\n"),
paste0(
" proportional_to: [\"source\"]\n",
" proportion_exponent: [[\"1\",\"1\",\"1\",\"1\"]]\n",
" rate: [", paste(na.omit(c(rate_seir_parts, rate_vacc_parts, rate_var_parts, rate_age_parts)), collapse = ", "), "]\n")),
# " rate: [", glue::glue_collapse(na.omit(c(rate_seir_parts, rate_vacc_parts, rate_var_parts, rate_age_parts)), collapse = ", "), "]\n")),
" rate: [",
ifelse(nchar(rate_seir_parts)<100,
paste(na.omit(c(rate_seir_parts, rate_vacc_parts, rate_var_parts, rate_age_parts)), collapse = ", "),
paste0("\n ", paste(na.omit(c(rate_seir_parts, rate_vacc_parts, rate_var_parts, rate_age_parts)), collapse = ",\n "))),
"]\n")),
"\n")

return(tmp)
Expand Down

0 comments on commit 8a84db7

Please sign in to comment.