exportExternalCoding: Export Codebook Mappings for Fields with External...

View source: R/exportExternalCoding.R

exportExternalCodingR Documentation

Export Codebook Mappings for Fields with External Dependencies

Description

These methods enable redcapAPI to obtain a mapping of codes and associated labels for fields that have external dependencies. The fields include SQL fields (dependent on another project) or fields that utilize the BioPortal Ontology modules.

Usage

exportExternalCoding(rcon, fields, ...)

## S3 method for class 'redcapApiConnection'
exportExternalCoding(
  rcon,
  fields = NULL,
  ...,
  batch_size = 1000,
  error_handling = getOption("redcap_error_handling"),
  config = list(),
  api_param = list()
)

Arguments

rcon

A redcapConnection object.

fields

character or NULL. Vector of fields to be returned. If NULL, all fields are returned (unless forms is specified).

...

Arguments to pass to other methods

batch_size

integerish(1) or NULL. When NULL, all records are pulled. Otherwise, the records all pulled in batches of this size.

error_handling

character(1). One of c("error", "null"). An option for how to handle errors returned by the API. see redcapError().

config

A named list. Additional configuration parameters to pass to httr::POST(). These are appended to any parameters in rcon$config.

api_param

A named list. Additional API parameters to pass into the body of the API call. This provides users to execute calls with options that may not otherwise be supported by redcapAPI.

Details

These methods operate by executing two API calls to export first the coded values and then the labeled values of fields with external dependencies. The two exports are then used to generate the code-label mappings for use in casting data.

Fields of type sql are dropdown fields that are populated by a SQL query to another project.

Fields of type bioportal are text fields that have the BioPortal Ontology module enabled as the validation method.

Value

Returns a named list of named character vectors.

Each element is in the list is named for the field it maps.

The character vectors are name-value pairs where the name is the labeled data and the value is the coded data.

Examples

## Not run: 
unlockREDCap(connections = c(rcon = "project_alias"), 
             url = "your_redcap_url", 
             keyring = "API_KEYs", 
             envir = globalenv())
             
exportExternalCoding(rcon)

## End(Not run)
  

nutterb/redcapAPI documentation built on Feb. 11, 2024, 11:20 p.m.