|
- report_path_info <- function(report_path) {
- # data-raw/reports/{sboe_id}/all/{report_id}_{received_date}.txt
- x <- fs::path_abs(report_path)
- x <- map(x, path_split) |> list_flatten()
-
- idx_reports <- map_int(x, \(x) which(x == "reports"))
-
- sboe_id <- map2_vec(x, idx_reports, \(x, i) x[i + 1])
- report_id <- map2_int(x, idx_reports, \(x, i) as.integer(strsplit(x[i + 3], "_")[[1]][1]))
-
- sboe_id <- fix_sboe_id_missing(sboe_id, report_id)
-
- tibble(sboe_id, report_id)
- }
-
- 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
- }
|