Skip to content

Commit 92fa75e

Browse files
committed
refactor to not have csv fallback
1 parent 9686ab3 commit 92fa75e

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

R/update_hub_target_data.R

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -95,26 +95,20 @@ update_hub_target_data <- function(
9595
}
9696

9797
if (nssp_update_local) {
98-
nssp_dir <- fs::path(
98+
nssp_file_path <- fs::path(
9999
base_hub_path,
100100
"auxiliary-data",
101-
"nssp-raw-data"
101+
"nssp-raw-data",
102+
"latest",
103+
ext = "parquet"
102104
)
103-
nssp_files <- fs::dir_ls(nssp_dir, regexp = "latest\\.(csv|parquet)$")
104105

105-
if (length(nssp_files) == 0) {
106+
if (!fs::file_exists(nssp_file_path)) {
106107
cli::cli_abort(
107-
glue::glue(
108-
"Cannot find NSSP data file (latest.csv or latest.parquet) ",
109-
"in {nssp_dir}."
110-
)
108+
glue::glue("Cannot find NSSP data file at {nssp_file_path}")
111109
)
112110
}
113111

114-
nssp_file_path <- nssp_files[which.max(
115-
fs::path_ext(nssp_files) == "parquet"
116-
)]
117-
118112
raw_nssp_data <- forecasttools::read_tabular(nssp_file_path) |>
119113
dplyr::filter(.data$county == "All") |>
120114
dplyr::select(

0 commit comments

Comments
 (0)