|
|
|
@@ -52,13 +52,12 @@ read_report_section <- function(section, info, report_path) { |
|
|
|
|
|
|
|
read_reports_by_sboe_id <- function(sboe_id) { |
|
|
|
raw_paths <- fs::dir_ls( |
|
|
|
here::here("data-raw", "reports", sboe_id), |
|
|
|
here::here("data-raw", "reports", sboe_id, "all"), |
|
|
|
glob = "*.txt" |
|
|
|
) |
|
|
|
names(raw_paths) <- fs::path_rel(raw_paths, here::here("data-raw", "reports")) |
|
|
|
|
|
|
|
data <- |
|
|
|
raw_paths |> |
|
|
|
raw_paths |> |
|
|
|
map(read_report_file) |> |
|
|
|
transpose() |> |
|
|
|
map(list_rbind) |> |
|
|
|
@@ -101,11 +100,14 @@ write_reports_by_sboe_id <- function(sboe_id) { |
|
|
|
} |
|
|
|
|
|
|
|
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 <- fs::path_split(x)[[1]] |
|
|
|
|
|
|
|
id <- strsplit(x[2], "_")[[1]][1] |
|
|
|
# x[2] is "all" |
|
|
|
|
|
|
|
id <- strsplit(x[3], "_")[[1]][1] |
|
|
|
|
|
|
|
list( |
|
|
|
sboe_id = x[1], |