-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add wrapper for Export Events API method to export event names #457
Comments
@ezraporter, sounds good. I was kinda surprised this function wasn't already in here. How about naming it To make sure I understand, this would be a function that produces something like
where the mappings & arms look like this: uri <- "https://bbmc.ouhsc.edu/redcap/api/"
token <- "0434F0E9CF53ED0587847AB6E51DE762"
REDCapR::redcap_event_instruments(uri, token)$data
#> 15 event instrument metadata records were read from REDCap in 0.2 seconds. The http status code was 200.
#> # A tibble: 15 × 3
#> arm_num unique_event_name form
#> <int> <chr> <chr>
#> 1 1 enrollment_arm_1 demographics
#> 2 1 enrollment_arm_1 contact_info
#> 3 1 enrollment_arm_1 baseline_data
#> 4 1 dose_1_arm_1 patient_morale_questionnaire
#> 5 1 visit_1_arm_1 visit_lab_data
#> 6 1 visit_1_arm_1 patient_morale_questionnaire
#> 7 1 visit_1_arm_1 visit_blood_workup
#> 8 1 visit_1_arm_1 visit_observed_behavior
#> 9 1 dose_2_arm_1 patient_morale_questionnaire
#> 10 1 visit_2_arm_1 visit_lab_data
#> 11 1 visit_2_arm_1 patient_morale_questionnaire
#> 12 1 visit_2_arm_1 visit_blood_workup
#> 13 1 visit_2_arm_1 visit_observed_behavior
#> 14 1 final_visit_arm_1 completion_data
#> 15 1 final_visit_arm_1 completion_project_questionnaire
REDCapR::redcap_arm_export( uri, token)$data
#> The list of arms was retrieved from the REDCap project in 0.1 seconds. The http status code was 200.
#> # A tibble: 2 × 2
#> arm_number arm_name
#> <int> <chr>
#> 1 1 Drug A
#> 2 2 Drug B Created on 2022-12-14 with reprex v2.0.2 |
Sounds good to me!
Slightly different. Those names are actually autogenerated by REDCap by massaging the user-defined event name and mashing it together with the arm number. Export Events gives you access to the actual user-defined event name. Here's some example output from one of our test REDCaps:
|
Beautiful. This looks useful, even beyond REDCapTidieR. Please tell me if I can help. |
Currently
REDCapR
only has wrappers for the Export Instrument-Event Mappings methodredcap_event_instruments()
which gives instrument-event-arm mappings and the Export Arms methodredcap_arm_export()
which gives arm names. For REDCapTidier, we'd like to access the event names to include as metadata. The Export Events method returns those.Export Events functions almost identically to Export Arms so this new function (
redcap_event_export()
?) would be almost identical toredcap_arm_export()
internally.Happy to contribute a PR if this idea has your blessing!
The text was updated successfully, but these errors were encountered: