This function exports some of the basic attributes of a given REDCap project, such as the project's title, if it is longitudinal, if surveys are enabled, the time the project was created and moved to production. Returns a tibble::tibble().
token: The user-specific string that serves as the password for a project. Required.
http_response_encoding: The encoding value passed to httr::content(). Defaults to 'UTF-8'.
locale: a readr::locale() object to specify preferences like number, date, and time formats. This object is passed to readr::read_csv(). Defaults to readr::default_locale().
verbose: A boolean value indicating if messages should be printed to the R console during the operation. The verbose output might contain sensitive information (e.g. PHI), so turn this off if the output might be visible somewhere public. Optional.
config_options: A list of options passed to httr::POST(). See details at httr::httr_options(). Optional.
handle_httr: The value passed to the handle parameter of httr::POST(). This is useful for only unconventional authentication approaches. It should be NULL for most institutions. Optional.
Returns
Currently, a list is returned with the following elements:
data: An R tibble::tibble() of all data access groups of the project.
success: A boolean value indicating if the operation was apparently successful.
status_codes: A collection of http status codes, separated by semicolons. There is one code for each batch attempted.
outcome_messages: A collection of human readable strings indicating the operations' semicolons. There is one code for each batch attempted. In an unsuccessful operation, it should contain diagnostic information.
elapsed_seconds: The duration of the function.
Details
Timezones
Several datetime variables are returned, such as the project's creation_time. For the time to be meaningful, you'll need to set the time zone because this function uses readr::read_csv(), which assigns UTC
if no timezone is specified. Find your server's location listed in base::OlsonNames(), and pass it to readr's readr::locale() function, and then pass that to redcap_project_info_read(). See the examples below
This function casts columns into data types that we think are most natural to use. For example, in_production is cast from a 0/1 to a boolean TRUE/FALSE. All columns not (yet) recognized by REDCapR will be still be returned to the client, but cast as a character. If the REDCap API adds a new column in the future, please alert us in a REDCapR issue and we'll expand the casting specifications.
External Modules
A project's external_modules cell contains all its approved EMs, separated by a column. Consider using a function like tidyr::separate_rows() to create a long data structure.
Examples
## Not run:# Specify your project uri and token(s).uri <-"https://redcap-dev-2.ouhsc.edu/redcap/api/"token_simple <-"9A068C425B1341D69E83064A2D273A70"token_longitudinal <-"DA6F2BB23146BD5A7EA3408C1A44A556"# ---- Simple examplesREDCapR::redcap_project_info_read(uri, token_simple )$data
REDCapR::redcap_project_info_read(uri, token_longitudinal)$data
# ---- Specify timezone# Specify the server's timezone, for example, US Centralserver_locale <- readr::locale(tz ="America/Chicago")d3 <- REDCapR::redcap_project_info_read( uri, token_simple, locale = server_locale
)$data
d3$creation_time
# Alternatively, set timezone to the client's location.client_locale <- readr::locale(tz = Sys.timezone())# ---- Inspect multiple projects in the same tibble# Stack all the projects on top of each other in a (nested) tibble,# starting from a csv of REDCapR test projects.# The native pipes in this snippet require R 4.1+.d_all <- system.file("misc/dev-2.credentials", package ="REDCapR")|> readr::read_csv( comment ="#", col_select = c(redcap_uri, token), col_types = readr::cols(.default = readr::col_character()))|> dplyr::filter(32L== nchar(token))|> purrr::pmap_dfr(REDCapR::redcap_project_info_read, locale = server_locale)# Inspect values stored on the server.d_all$data
# or: View(d_all$data)# Inspect everything returned, including values like the http status code.d_all
## End(Not run)