# Created by use_targets(). # Follow the comments below to fill in this target script. # Then follow the manual to check and run the pipeline: # https://books.ropensci.org/targets/walkthrough.html#inspect-the-pipeline # Load packages required to define the pipeline: library(targets) # Set target options: tar_option_set( packages = strsplit(desc::desc_get_field("Depends"), ", ")[[1]], # For distributed computing in tar_make(), supply a {crew} controller # as discussed at https://books.ropensci.org/targets/crew.html. controller = crew::crew_controller_local(workers = 2) ) # Run the R scripts in the R/ folder with your custom functions: tar_source() # Replace the target list below with your own: list( tar_target(year, 2016:2023), tar_target(report, c("MY", "YE", "Q1", "Q2", "Q3", "Q4")), tar_target( doc_list, get_report_by_year_scrape(year, report), pattern = cross(year, report) ), tar_target( committees, doc_list |> # this is the list of committees and years reported # if `n_*` changes, we have to go re-read that year group_by(committee_name, sboe_id, year) |> summarize( n_reports = n(), n_amended = sum(amended), n_docs = sum(!is.na(report_id)), ) |> arrange(sboe_id) ), tar_target( report_list, doc_list |> filter(!is.na(report_id)) |> filter(committee_name == "JOHN BELL COMM" | report_id == 188139) ), tar_target(report_list_report_id, report_list$report_id), tar_target(report_list_sboe_id, report_list$sboe_id), tar_target( receipts, get_report_section(report_list_report_id, "receipts", report_list_sboe_id), pattern = map(report_list_report_id, report_list_sboe_id), format = "parquet" ) )