Skip to content

Commit 0fb09cf

Browse files
committed
file regex
1 parent a287ac2 commit 0fb09cf

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

backfill_corrections/delphiBackfillCorrection/R/io.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,13 @@ subset_valid_files <- function(files_list, file_type = c("daily", "rollup"), par
101101
switch(file_type,
102102
daily = {
103103
start_dates <- as.Date(
104-
sub("^.*/.*_as_of_([0-9]{8}).parquet$", "\\1", files_list),
104+
sub("^.*/.*_as_of_([0-9]{8})[.]parquet$", "\\1", files_list),
105105
format = date_format
106106
)
107107
end_dates <- start_dates
108108
},
109109
rollup = {
110-
rollup_pattern <- "^.*/.*_from_([0-9]{8})_to_([0-9]{8}).parquet$"
110+
rollup_pattern <- "^.*/.*_from_([0-9]{8})_to_([0-9]{8})[.]parquet$"
111111
start_dates <- as.Date(
112112
sub(rollup_pattern, "\\1", files_list),
113113
format = date_format
@@ -148,7 +148,7 @@ create_name_pattern <- function(indicator, signal,
148148
file_type = c("daily", "rollup")) {
149149
file_type <- match.arg(file_type)
150150
switch(file_type,
151-
daily = str_interp("${indicator}_${signal}_as_of_[0-9]{8}.parquet$"),
152-
rollup = str_interp("${indicator}_${signal}_from_[0-9]{8}_to_[0-9]{8}.parquet$")
151+
daily = str_interp("${indicator}_${signal}_as_of_[0-9]{8}[.]parquet$"),
152+
rollup = str_interp("${indicator}_${signal}_from_[0-9]{8}_to_[0-9]{8}[.]parquet$")
153153
)
154154
}

backfill_corrections/delphiBackfillCorrection/R/main.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ main <- function(params) {
240240

241241
if (params$train_models) {
242242
msg_ts("Removing stored models")
243-
files_list <- list.files(params$cache_dir, pattern="*.model", full.names = TRUE)
243+
files_list <- list.files(params$cache_dir, pattern="[.]model$", full.names = TRUE)
244244
file.remove(files_list)
245245
}
246246

backfill_corrections/delphiBackfillCorrection/R/model.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ get_training_date_range <- function(params) {
299299
# `20220628_20220529_changehc_covid_state_lambda0.1_count_ca_lag5_tau0.9.model`
300300
# where the leading date is the training end date for that model, and the
301301
# second date is the training start date.
302-
model_files <- list.files(params$cache_dir, "202[0-9]{5}_202[0-9]{5}*.model")
302+
model_files <- list.files(params$cache_dir, "^202[0-9]{5}_202[0-9]{5}.*[.]model$")
303303
if (length(model_files) == 0) {
304304
# We know we'll be retraining models today.
305305
training_end_date <- TODAY

0 commit comments

Comments
 (0)