%%capture
%%R
final_mapping <- redcap_event_instruments(
redcap_uri = url,
token,
verbose = TRUE,
config_options = NULL
)$data14 Instrument/Event Map
14.1 Export the Instrument Event Mapping
This shows which instruments are associated with each event in longitudinal projects.
redcap_event_instruments()
export_instrument_event_mappings()
project.export_instrument_event_mappings(format_type='df')| arm_num | unique_event_name | form | |
|---|---|---|---|
| 0 | 1 | personal_info_arm_1 | demographics |
| 1 | 1 | case_intake_arm_1 | symptoms |
| 2 | 1 | case_intake_arm_1 | test_information |
| 3 | 1 | notifications_arm_1 | close_contacts |
| 4 | 1 | notifications_arm_1 | work_information |
Note: Events with multiple instruments (AKA ‘form’) will occupy multiple rows, with one row per instrument.
14.2 Export the Repeated Instrument/Event Mapping (PyCap Only)
In REDCap projects instruments can be set to repeating and in the case of longitudinal projects, events can be set to repeating. You can use the export_repeating_instruments_events function to get a list of repeating events/instruments in your REDCap project.
project.export_repeating_instruments_events(format_type = 'df')| event_name | form_name | custom_form_label | |
|---|---|---|---|
| 0 | case_intake_arm_1 | NaN | NaN |
| 1 | notifications_arm_1 | close_contacts | NaN |
Note in the data export above that form_name is NaN for the ‘case_intake_arm_1’ event. This means that the entire ‘case_intake_arm_1’ is repeating. Whereas, in the ‘noticications_arm_1’ event, the ‘close_contacts’ form is independently repeating (meaning it can endlessly repeat on it’s own within that event). For more informatino on repeating events and isntruments refer to Chapter 2, Chapter 3 and Chapter 4.
If a project is not longitudinal, there will be no event_name exported. If the project has no repeating instruments or events, the API call will fail and the error string will say: “does not contain any repeating instruments and events”