We are collecting a ratio variable (i.e. the variable responses will be 1:5, 2:5, 1:7, and so on and so forth). We're collecting this via interviews outside of redcap, and then staff are entering it into a redcap database.
Is it possible to create validation/formatting rules in Redcap so that a data entry person when entering would see the variable field look like the following: [ : ]?
The closest I have come to so far is using the Time validation as a proxy (HH:SS), and then having a note for staff that when they see that error come up, it should be ratio instead of time. But even then, it doesn't show the format that it should be entered in, so I'd have to add another note to instruct them to do it in that format.
Without using external modules, you are limited to the built-in data validation types that REDCap has available for text fields (e.g., date-time, phone number, email, etc.). Those options don't include something like what you're describing for ratios.
There are two options I can think of:
Set up three variables. The first two will be text fields containing the numerator and denominator values of the ratio. Set their data validation type to
integerto enforce clean ratios. The third variable is a normal text field that uses the@CALCTEXTaction tag. For example,ratio_fullwould have@CALCTEXT(if([ration_num]!='' AND [ratio_denom]!='', concat_ws(":", [ratio_num], [ratio_denom]), '')). As long as the numerator and denominator values are not blank, this should concatenate them together with a colon in between.Create one or more data quality rules that execute in real-time on the data entry form. At the very least, the rule should trigger if
not_contains(":", [ratio_var])is TRUE (aka, in the absence of any colon separator). Depending on whether you know whether the ratios should not contain certain values, you can write additional rules enforcing certain lengths or values to the right/left of the colon.