File tree Expand file tree Collapse file tree 1 file changed +21
-8
lines changed
Expand file tree Collapse file tree 1 file changed +21
-8
lines changed Original file line number Diff line number Diff line change @@ -95,15 +95,28 @@ update_hub_target_data <- function(
9595 }
9696
9797 if (nssp_update_local ) {
98- raw_nssp_data <- forecasttools :: read_tabular(
99- fs :: path(
100- base_hub_path ,
101- " auxiliary-data" ,
102- " nssp-raw-data" ,
103- " latest" ,
104- ext = " csv"
98+ nssp_dir <- fs :: path(
99+ base_hub_path ,
100+ " auxiliary-data" ,
101+ " nssp-raw-data"
102+ )
103+ # find latest.* file (csv or parquet)
104+ nssp_files <- fs :: dir_ls(nssp_dir , regexp = " latest\\ .(csv|parquet)$" )
105+
106+ if (length(nssp_files ) == 0 ) {
107+ cli :: cli_abort(
108+ glue :: glue(
109+ " Cannot find NSSP data file (latest.csv or latest.parquet) " ,
110+ " in {nssp_dir}."
111+ )
105112 )
106- ) | >
113+ }
114+
115+ nssp_file_path <- nssp_files [which.max(
116+ fs :: path_ext(nssp_files ) == " parquet"
117+ )]
118+
119+ raw_nssp_data <- forecasttools :: read_tabular(nssp_file_path ) | >
107120 dplyr :: filter(.data $ county == " All" ) | >
108121 dplyr :: select(
109122 " week_end" ,
You can’t perform that action at this time.
0 commit comments