Learn R Programming

redcapAPI (version 2.7.4)

importMetaData: Import Meta Data (Data Dictionary) to a Project

Description

This method allows you to import metadata (i.e., Data Dictionary) into a project. Notice: Because of this method's destructive nature, it is only available for use for projects in Development status.

Usage

importMetaData(rcon, data, ...)

# S3 method for redcapApiConnection importMetaData( rcon, data, refresh = TRUE, ..., field_types = REDCAP_METADATA_FIELDTYPE, validation_types = REDCAP_METADATA_VALIDATION_TYPE, error_handling = getOption("redcap_error_handling"), config = list(), api_param = list() )

Arguments

rcon

a redcapConnection object.

data

data.frame with the Meta Data to import.

...

Additional arguments to pass to other methods.

refresh

logical(1). When TRUE, the cached metadata and instruments will be refreshed after the import.

field_types

character giving the acceptable field types when validating the field_type column.

validation_types

character giving the acceptable values for the text_validation_or_show_slider_number column.

error_handling

An option for how to handle errors returned by the API. see redcap_error

config

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

api_param

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

Field names may start with a letter, have any number of letters, numbers, or underscores, and end in either a letter or a number. All letters must be lowercase (the function will coerce them to lower before checking for duplicate field names).

Form names may start with a letter, have any number of letters, numbers, or underscores, and end in either a letter or a number. All letters must be lowercase (the function will coerce them to lower before checking for duplicate field names).

Field types may be one of REDCAP_METADATA_FIELDTYPE. In the event that a new field type is added to REDCap and redcapAPI isn't yet updated, you may add additional values via c(REDCAP_METADATA_FIELDTYPE, "new_type").

Validation types may be one of REDCAP_METADATA_VALIDATION_TYPE or NA. AS with field types, additional values can be appended if necessary. Only fields that have a field type of "text" or "slider" should have a validation type. "slider" fields should be either NA (do not display the selected number) or "number".

For multiple choice fields, the selection choices take the format of "code1, label1 | ... | coden, labeln". For slider fields, the format is "left_value | mid_value | right_value". Any of those values may be an empty character, but the two pipes are required, nonetheless.

For calculated fields, the values in "select_choices_or_calculations" are currently unvalidated.

All of the values between brackets in the branching logic must be either a field name or an existing unique event name (such as "event_1_arm_1")