report_path_info <- function(report_path) { # data-raw/reports/{sboe_id}/all/{report_id}_{received_date}.txt report_path <- fs::path_abs(report_path) x <- fs::path_rel(report_path, here::here("..", "data-raw", "reports")) x <- map(x, path_split) |> list_flatten() tibble( sboe_id = map_vec(x, \(x) x[1]), report_id = map_int(x, \(x) as.integer(strsplit(x[3], "_")[[1]][1])), ) } report_info_in_report_list <- function(files, report_list = tar_read(report_list)) { info <- report_path_info(files) info$path <- files info <- semi_join(info, report_list, by = c("sboe_id", "report_id")) info }