epicentre-msf / redcap

R utilities for interacting with REDCap
https://epicentre-msf.github.io/redcap/
Other
7 stars 3 forks source link

`generate_queries()` and complex branching logic using longitudinal branching, smart variables, etc. #4

Closed januz closed 2 years ago

januz commented 2 years ago

Just came across your package. Looks like an interesting alternative to {REDCapR} and {redcapAPI}!

I am especially interested in your implementation of checking for missingness while accounting for branching logic. We have a very large and complex REDCap project that uses a lot of longitudinal branching logic (e.g., [event_1_arm_1][var] = 1) and smart variables (e.g., [event-name] = "event_1_arm_1"). From looking at your code, your implementation does not account for these more complicated cases but is mostly thought for within-instrument/event branching logic. Is that correct?

Thanks!

patrickbarks commented 2 years ago

Hi there, no it's not able to handle event-specific logic or smart variables unfortunately.

If var "x" has event-specific branching logic like [arm1_event1][var1]=1, the resulting query will just strip off the event component, as in !(var1 = 1) & !is.na(x) .

I think it would be fairly straightforward to build in support for event-specific logic, but I don't have any projects where it's necessary so it might take some time. I haven't used smart variables, but I think it would be quite a bit more difficult to add support for those.

januz commented 2 years ago

Okay, thanks for letting me know!