#' Download Records from Long-Term Care Facility REDcap Project
#'
#' `download_redcap_records()` downloads the records from the CFR REDcap
#' project, which contains information on long term care facility cases.
#'
#' @param api_token API token for CFR REDcap project
#'
#' @return A `tibble` containing all data in the CFR REDcap project
#'
#' @export
download_redcap_records <- function(
api_token = Sys.getenv("redcap_CFR_token")
) {
# URL base for API
api_uri <- "https://redcap.health.tn.gov/redcap/api/"
api_params <- list(
token = api_token,
content = "record",
format = "json",
type = "flat"
)
httr::RETRY(
"POST",
api_uri,
body = api_params,
times = 12L,
pause_cap = 300L
) %>%
httr::stop_for_status() %>%
httr::content(as = "text") %>%
jsonlite::fromJSON() %>%
dplyr::as_tibble()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.