소스 검색

reorganize targets an ensure up to date

main
Garrick Aden-Buie 3 년 전
부모
커밋
3f6def269c
No known key found for this signature in database
4개의 변경된 파일과 95389개의 추가작업 그리고 9개의 파일을 삭제
  1. +14
    -3
      R/get.R
  2. +12
    -3
      _targets.R
  3. +95361
    -2
      _targets/meta/meta
  4. +2
    -1
      run.R

+ 14
- 3
R/get.R 파일 보기

@@ -176,6 +176,10 @@ get_report_section <- function(
get_raw_report_all <- function(report_id) {
delay()

if (!identical(Sys.getenv("ALLOW_DOWNLOADS"), "true")) {
stop("Shouldn't be downloading reports now...")
}

res <-
req_report_detail(report_id, "all") |>
req_perform()
@@ -185,13 +189,20 @@ get_raw_report_all <- function(report_id) {
resp_body_string(res)
}

save_raw_report_all <- function(report_id, sboe_id) {
save_raw_report_all <- function(report_id, sboe_id, received) {
dir <- here::here("data-raw", "reports", sboe_id)
file_name <- paste0(report_id, "_", received)
path <- path(dir, file_name, ext = "txt")

if (file_exists(path)) {
# We don't need to re-download any reports
return(path)
}

res <- get_raw_report_all(report_id)

dir <- here::here("data-raw", "reports", sboe_id)
dir_create(dir)

path <- path(dir, report_id, ext = "txt")
brio::write_lines(res, path)

invisible(path)

+ 12
- 3
_targets.R 파일 보기

@@ -48,10 +48,19 @@ list(
),
tar_target(report_list_report_id, report_list$report_id),
tar_target(report_list_sboe_id, report_list$sboe_id),
tar_target(report_list_received, report_list$received),
tar_target(
receipts_raw_path,
save_raw_report_all(report_list_report_id, report_list_sboe_id),
pattern = map(report_list_report_id, report_list_sboe_id),
reports_raw_path,
save_raw_report_all(
report_list_report_id,
report_list_sboe_id,
report_list_received
),
pattern = map(
report_list_report_id,
report_list_sboe_id,
report_list_received
),
format = "file_fast"
)
)

+ 95361
- 2
_targets/meta/meta
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


+ 2
- 1
run.R 파일 보기

@@ -6,7 +6,8 @@
# to learn about your options.

Sys.setenv("IN_TARGETS" = "true")
Sys.setenv("ALLOW_DOWNLOADS" = "false")

targets::tar_make_future(workers = 8)
targets::tar_make()
# targets::tar_make_clustermq(workers = 2) # nolint
# targets::tar_make_future(workers = 2) # nolint

Loading…
취소
저장