You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
636B

  1. report_path_info <- function(report_path) {
  2. # data-raw/reports/{sboe_id}/all/{report_id}_{received_date}.txt
  3. x <- fs::path_abs(report_path)
  4. x <- map(x, path_split) |> list_flatten()
  5. idx_reports <- map_int(x, \(x) which(x == "reports"))
  6. tibble(
  7. sboe_id = map2_vec(x, idx_reports, \(x, i) x[i + 1]),
  8. report_id = map2_int(x, idx_reports, \(x, i) as.integer(strsplit(x[i + 3], "_")[[1]][1])),
  9. )
  10. }
  11. report_info_in_report_list <- function(files, report_list = tar_read(report_list)) {
  12. info <- report_path_info(files)
  13. info$path <- files
  14. info <- semi_join(info, report_list, by = c("sboe_id", "report_id"))
  15. info
  16. }