USAID-OHA-SI / mindthegap

Munges and returns estimates from UNAIDS data.
https://usaid-oha-si.github.io/mindthegap/
Other
4 stars 0 forks source link

Suppress messages #46

Closed achafetz closed 11 months ago

achafetz commented 11 months ago

Improve the UX by suppressing the unnecessary messages.

  1. Update the line below to with the new parameter to silence the file creation message https://github.com/USAID-OHA-SI/mindthegap/blob/93ab563bd68fd8dcee48d7cce4f2628e647ae02f/R/pull_unaids.R#L20 temp_folder <- glamr::temp_folder(quiet = TRUE)

  2. Add the show_progress param to pb_download to suppress message https://github.com/USAID-OHA-SI/mindthegap/blob/93ab563bd68fd8dcee48d7cce4f2628e647ae02f/R/pull_unaids.R#L30-L33

    piggyback::pb_download(file = filename,
              repo = "USAID-OHA-SI/mindthegap",
              tag = version_tag,
              dest = temp_folder,
              show_progress = FALSE)
  3. Specify the column types on read csv https://github.com/USAID-OHA-SI/mindthegap/blob/93ab563bd68fd8dcee48d7cce4f2628e647ae02f/R/pull_unaids.R#L35-L38

    df <- temp_folder %>%
    glamr::return_latest(quiet = TRUE) %>%
    readr::read_csv(
      col_types = list(
        year = "d",
        estimate = "d",
        lower_bound = "d",
        upper_bound = "d",
        pepfar = "l",
        `Achieved 95s with PLHIV base in 2022` = "l",
        `Achieved 95s with relative base in 2022` = "l",
        epi_control = "l",
        .default = "c")
      ) %>%
    dplyr::filter(sheet == data_type)