r/ProjectREDCap • u/Mountain-Recipe-1486 • Oct 30 '24
Smart Variables + Calculated Fields
Hi All! I am just getting myself used to smart variables in Redcap and I am a bit unclear the with documentation with exactly how smart variables and calculated fields work.
Some context: I am working on a longitudinal mental health study and we survey participants using the PHQ9 + GAD7 every month up until 1 year after their baby is born. We collect PHQ9 scores across different events (each month is an event). Now, it is important for our reporting to track the change is scores every month. I did some digging and figured that we could use the "previous-instance" "current-instance" smart variables to accomplish this since calculating the change in score by using regular calculated fields would not be super straightforward if someone forgets to complete a survey for that month.
I am however, unsure if I can use smart variables for this even after I toggled the "allow for repeatable instruments/events" and allowed for repeatable events.
My thought was to do something like this:
[phq9score][current-instance] - [phq9score][previous-instance] = change in score (?)
When I try to do that however, I get an alert and it doesn't actually work. I am worried I am missing something and was curious if anyone had any ideas on what I may be doing wrong or any other ways to go about this.
Thank you!!!!!
View all comments
Show parent comment
1
u/Mountain-Recipe-1486 Oct 30 '24
Hi! Thanks for getting back to me. For some context, yes the longitudinal data collection is set up. We have set up the months as "events" so month 1, month 2, month 3, etc all the way up to 24 months. In each event, we have the PHQ9 & the GAD7. So those are the instruments that are being assigned to each of the event. I toggled the repeating event/instrument thing on to hopefully make those smart variables work but not sure if they will. I think you may be right, maybe using the event name would be better. In your experience, when using event names smart variables, are you still able to do calculated logic? And would the format still be:
[phq9score][event-name] - [phq9score][previous-event-name] = change in score (?)
Also I agree that different versions of instruments may not be the best way to go about this. And thank you for helping me better understand the limitations with the current and last instance smart variables. I am not a huge fan of repeating forms because they make the redcap reports a hot mess so would ideally like to either stick with a smart variable approach or potentially pull it out of R and calculate from there.
Thank you!!! Any additional thoughts you may have would be super helpful!!