You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.1KB

  1. spec_export_search_results <- function() {
  2. readr::cols(
  3. `Committee Name` = readr::col_character(),
  4. `SBoE ID` = readr::col_character(),
  5. Year = readr::col_character(),
  6. `Doc Type` = readr::col_character(),
  7. `Doc Name` = readr::col_character(),
  8. Amend = readr::col_character(),
  9. `Received Image` = readr::col_date(format = "%m/%d/%Y"),
  10. `Received Data` = readr::col_date(format = "%m/%d/%Y"),
  11. `Start Date` = readr::col_date(format = "%m/%d/%Y"),
  12. `End Date` = readr::col_date(format = "%m/%d/%Y"),
  13. Image = readr::col_character(),
  14. Data = readr::col_character()
  15. )
  16. }
  17. get_report_by_year_export <- function(year, report) {
  18. res <-
  19. req_report_by_year_export(year, report) |>
  20. req_perform() |>
  21. resp_body_string() |>
  22. readr::read_csv(col_types = spec_export_search_results())
  23. names(res)[which(names(res) == "SBoE ID")] <- "sboe_id"
  24. names(res) <- snakecase::to_snake_case(names(res))
  25. res |>
  26. mutate(amend = amend == "Y") |>
  27. relocate(year, doc_name) |>
  28. group_by(year, doc_name) |>
  29. targets::tar_group()
  30. }