Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

58 lines
1.8KB

  1. # Created by use_targets().
  2. # Follow the comments below to fill in this target script.
  3. # Then follow the manual to check and run the pipeline:
  4. # https://books.ropensci.org/targets/walkthrough.html#inspect-the-pipeline
  5. # Load packages required to define the pipeline:
  6. library(targets)
  7. # Set target options:
  8. tar_option_set(
  9. packages = strsplit(desc::desc_get_field("Depends"), ", ")[[1]],
  10. # For distributed computing in tar_make(), supply a {crew} controller
  11. # as discussed at https://books.ropensci.org/targets/crew.html.
  12. controller = crew::crew_controller_local(workers = 2)
  13. )
  14. # Run the R scripts in the R/ folder with your custom functions:
  15. tar_source()
  16. # Replace the target list below with your own:
  17. list(
  18. tar_target(year, 2016:2023),
  19. tar_target(report, c("MY", "YE", "Q1", "Q2", "Q3", "Q4")),
  20. tar_target(
  21. doc_list,
  22. get_report_by_year_scrape(year, report),
  23. pattern = cross(year, report)
  24. ),
  25. tar_target(
  26. committees,
  27. doc_list |>
  28. # this is the list of committees and years reported
  29. # if `n_*` changes, we have to go re-read that year
  30. group_by(committee_name, sboe_id, year) |>
  31. summarize(
  32. n_reports = n(),
  33. n_amended = sum(amended),
  34. n_docs = sum(!is.na(report_id)),
  35. ) |>
  36. arrange(sboe_id)
  37. ),
  38. tar_target(
  39. report_list,
  40. doc_list |>
  41. filter(!is.na(report_id)) |>
  42. mutate(received = coalesce(received_data, received_image)) |>
  43. slice_max(received, by = report_id)
  44. ),
  45. tar_target(report_list_report_id, report_list$report_id),
  46. tar_target(report_list_sboe_id, report_list$sboe_id),
  47. tar_target(
  48. receipts_raw_path,
  49. save_raw_report_all(report_list_report_id, report_list_sboe_id),
  50. pattern = map(report_list_report_id, report_list_sboe_id),
  51. format = "file_fast"
  52. )
  53. )