vubiostat / redcapAPI

R interface to REDCap (http://www.project-redcap.org/)
16 stars 26 forks source link

Thoughts on an argument to importRecords() to allow upload of invalid values #330

Closed berryld1 closed 4 months ago

berryld1 commented 4 months ago

EDITED: Just tested it with native call. The API kicks them out. Please disregard and I will close ticket!

Hi, team!

If such an argument already exists, please advise! I didn't find it in the documentation.

Also, if this is impossible due to behavior of the redcap API (the API) itself, please disregard!

Otherwise, please read on! ;)

I've recently had need in a couple of projects to create a pipeline where the user can request addition of a value to a structured variable via the GUI.

Basic idea is - either the variable has a value that means "add a new value", or there's a checkbox for "I need a new value for X field". This then pops out whatever fields needed to specify the new value, and at the moment in the one project where I have this implemented, this then triggers an alert to my team, whereupon we can manually execute an R script that steps through adding the new value to the dd, upload updated dd, update record with new value and close the case.

For the existing project, this is fine, as these particular new values and their addition do need to be adjudicated by a human brain.

For the new project in which we would like to implement a similar brain, human brains can be bypassed, and we could fully automate (but for the dd upload) like so:

  1. checkbox for "add new"
  2. redcap data entry trigger - triggers pipeline when add_new___1 = 1 in any record
  3. update dd with new value, add new user (the "add new" need here is for "assigned study coordinator" - so when we add a name to the list, we also need to give that user access, which is neither here nor there to this question, just FYI)
  4. update record with new value and close the case new value at this point is NOT valid and has no meaning
  5. upload updated dd to a second redcap whose sole purpose is to receive dd uploads --> trigger alert to study team
  6. study team uploads updated dd - new value in #4 now has meaning

***** The sticking point is step #4 - as, currently, of course, the invalid value will get kicked out and not uploaded.

I don't think the redcap API (the API) cares about invalid values? This is purely a redcapAPI (R package) feature?

If I'm wrong about that, then never mind!

But if so, would it be a ton of work to bypass the validation of import values with some bypass_validation or something argument whose default value is F but could be passed as T?