download_integrated_data: Download Data from the Integrated Data Tool REDcap Project

View source: R/download.R

download_integrated_dataR Documentation

Download Data from the Integrated Data Tool REDcap Project

Description

download_integrated_data connects to the Integrated Data Tool REDcap project via an API token and downloads the data currently available in the case interviews report.

Usage

download_integrated_data(
  date = Sys.Date(),
  api_token = Sys.getenv("redcap_NIT_token"),
  directory = paste0("V:/EPI DATA ANALYTICS TEAM/COVID SANDBOX REDCAP DATA/",
    "Integrated data tool Case Interviews/data/"),
  new_file = paste0("integrated_data_", date, ".csv"),
  force = FALSE
)

Arguments

date

A Date indicating the date of the file to download

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.

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 date and directory

Details

download_integrated_data downloads data as above and saves to the file directory and file specified in directory and new_file (by default, it saves to directory V:/EPI DATA ANALYTICS TEAM/COVID SANDBOX REDCAP DATA/Integrated data tool Case Interviews/ and file integrated_data_YYYY-MM-DD.csv.) Only change this if you're doing some custom analysis; by default, load_integrated_data will look here for data to import.

To use download_integrated_data you'll need an API access key for the associated REDcap project. Please contact jesse.smith@shelbycountytn.gov or karim.gilani@shelbycountytn.gov for more information.

Best practice is to save this API access token in a separate file; see env_vars for details.

Value

Invisibly returns the path to the new data file


jesse-smith/coviData documentation built on Jan. 14, 2023, 11:08 a.m.