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