Skip to content

REDCap Name Conversion

Schmitt, Billy requested to merge name_conversion into master

This merge request introduces two new functions:

  1. validate_var_name(), which is vectorized over a string input and validates that the string(s) conform to the CAM standard for R naming (e.g. GGG.TTT.Optional.Var_name; see man page for more detail). I also decided to begin unit testing with this function, so this introduces a new test folder following the format for using the testthat package.
  2. rename_redcap_vars(), which takes a data frame with raw redcap data and the metadata/data dictionary and uses that data dictionary to rename variables using the ideal name in the field annotation. This is an initial working version and is intended to allow others at CAM to begin working on other sections of the POTS pipeline. Remaining issues (to be addressed with a future merge request):
    • The function does not fix the redcap_event_name fields or instrument_name_complete fields yet as they do not show up in the data dictionary.
    • Type conversions from REDCap types to R types.
    • Addition to data frame attributes with important information (e.g. labels + values, etc.)

I'm not sure if I should expand the scope of this function to include the last 2 bullets or if those should be separate functions in our pipeline. @kp390, I've asked you to review the changes here, but if you are swamped, we can switch to @mpp44. I'd like to have these merged to master by Monday so @ea601 can download data from REDCap with this and test the functions for processing inventories that she's been working on!

Merge request reports

Loading