Skip to content

Commit 33d2fa8

Browse files
committed
Fix load_ips and error masking
Fix TIME_PERIOD argument error in load_ips The TIME_PERIOD argument in load_ips should be one of 2014, 2018, 2021, or 2023, but it was incorrectly set to 2020. This commit updates the call to use 2023. Also fix an issue in the call_with_geo helper that masked errors in some functions (e.g., load_pevs). Previously, call_with_geo() overwrote underlying errors with a GEO_LEVEL error, which was misleading and not the actual cause.
1 parent eb54845 commit 33d2fa8

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

actions/scripts/check_all_loads.R

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ LANGUAGE <- "pt"
2323
RAW_DATA <- FALSE
2424
GEO_LEVEL <- "state"
2525

26+
time_period_by_fn <- list(
27+
load_ips = 2023
28+
)
29+
2630

2731

2832
datasets_by_fn <- list(
@@ -133,18 +137,9 @@ call_with_geo <- function(fn, args, geo_level = "state") {
133137
}
134138

135139
# tenta com geo_level = "state"
136-
res <- tryCatch(
137-
do.call(fn, c(args, list(geo_level = geo_level))),
138-
error = function(e) e
139-
)
140-
141-
# se funcionou, retorna
142-
if (!inherits(res, "error")) {
143-
return(res)
144-
}
140+
res <- do.call(fn, c(args, list(geo_level = geo_level)))
145141

146-
# fallback: tenta sem geo_level
147-
do.call(fn, args)
142+
return(res)
148143
}
149144

150145

@@ -196,7 +191,11 @@ for (fn_name in get_fns) {
196191

197192
args <- list()
198193
if ("dataset" %in% arg_names) args$dataset <- ds
199-
if ("time_period" %in% arg_names) args$time_period <- TIME_PERIOD
194+
if ("time_period" %in% arg_names) {
195+
args$time_period <- if (!is.null(time_period_by_fn[[fn_name]])) {
196+
time_period_by_fn[[fn_name]]
197+
} else {TIME_PERIOD}
198+
}
200199
if ("raw_data" %in% arg_names) args$raw_data <- RAW_DATA
201200
if ("language" %in% arg_names) args$language <- LANGUAGE
202201

0 commit comments

Comments
 (0)