|
|
|
@@ -271,3 +271,18 @@ read_from_csv <- function(path="inst/csv/") { |
|
|
|
is_valid_res(res) |
|
|
|
res |
|
|
|
} |
|
|
|
|
|
|
|
#' @export |
|
|
|
read_from_csv_or_fetch <- function(path="inst/") { |
|
|
|
path <- make_directory_path(path) |
|
|
|
res <- tryCatch(read_from_csv(str_c(path, "csv/")), |
|
|
|
error = function(c) NULL) |
|
|
|
if (!is.null(res)) return(res) |
|
|
|
|
|
|
|
fetch_all(str_c(path, "records/"), create=T) |
|
|
|
read_all(str_c(path, "records/")) %>% |
|
|
|
repair() -> |
|
|
|
res |
|
|
|
write_to_csv(res, str_c(path, "csv/"), create=T) |
|
|
|
res |
|
|
|
} |