| data-for-regions-snapshots | R Documentation |
These functions downloads a file posted on the Data for Regions project. You'll need API access to the project (and an API token for it) to use this function.
download_nbs_snapshot() downloads the current snapshot of NBS
investigation data (if posted).
download_pcr_snapshot() downloads the current snapshot of PCR testing data
(if posted).
download_antigen_snapshot() downloads the current snapshot of antigen
testing data (if posted).
download_serology_snapshot() downloads the current snapshot of serology
testing data (if posted).
download_vaccine_snapshot() downloads the current snapshot of vaccination
data (if posted). Note that this is only posted on Tues/Fri, unlike other
snapshot files.
download_nbs_snapshot(
date = Sys.Date(),
api_token = Sys.getenv("redcap_DFR_token"),
redcap_file = "nbs_daily_upload",
directory = paste0("V:/EPI DATA ANALYTICS TEAM/COVID SANDBOX REDCAP DATA/",
"Sandbox data pull Final/"),
new_file = paste0(date, " Final Data Pull.csv"),
force = FALSE
)
download_pcr_snapshot(
date = Sys.Date(),
api_token = Sys.getenv("redcap_DFR_token"),
redcap_file = "lab_pcr",
directory = "V:/EPI DATA ANALYTICS TEAM/COVID SANDBOX REDCAP DATA/MSR PCR/",
new_file = paste0("MSR - All PCRs_", format(Sys.Date(), "%m%d%Y"), ".csv"),
force = FALSE
)
download_antigen_snapshot(
date = Sys.Date(),
api_token = Sys.getenv("redcap_DFR_token"),
redcap_file = "lab_antigen",
directory = "V:/EPI DATA ANALYTICS TEAM/COVID SANDBOX REDCAP DATA/MSR ANTIGEN/",
new_file = paste0("MSR - All Antigens_", format(Sys.Date(), "%m%d%Y"), ".csv"),
force = FALSE
)
download_serology_snapshot(
date = Sys.Date(),
api_token = Sys.getenv("redcap_DFR_token"),
redcap_file = "lab_serology",
directory = "V:/EPI DATA ANALYTICS TEAM/COVID SANDBOX REDCAP DATA/MSR SEROLOGY/",
new_file = paste0("MSR - All Serologies_", format(Sys.Date(), "%m%d%Y"), ".csv"),
force = FALSE
)
download_vaccine_snapshot(
date = Sys.Date(),
api_token = Sys.getenv("redcap_DFR_token"),
redcap_file = "covid_vaccine_data",
directory = path_create("V:/EPI DATA ANALYTICS TEAM/COVID SANDBOX REDCAP DATA/",
"COVID-19 Vaccine Reporting/data/COVID-19 Vaccine data pull/"),
new_file = name_vac_file(date, redcap_file = redcap_file, api_token = api_token),
force = FALSE
)
date |
A |
api_token |
The API token for accessing the Data for Regions REDcap project. This should be stored in an .Renviron file; see env_vars for details. |
redcap_file |
A string indicating the name of the file to download from REDcap |
directory |
A string specifying the save directory; this should usually be left alone |
new_file |
A string specifying the save file name; this should always end in .csv and should usually be left alone |
force |
A logical indicating whether to ignore any existing files
matching |
Invisibly returns the path to the new data file
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.