Validation for Participant IDs

LabKey Support Forum
Validation for Participant IDs schwarza  2023-02-10 09:27
Status: Closed
 

Hello,

Is it possible to create a regex validator for Participant IDs?

If not, is there any other way to enforce constraints on Participant IDs at the time users enter data (e.g., require the IDs to be 10-digit numbers)?

Thank you!

Leah

 
 
mohara responded:  2023-02-13 17:34

Hi Leah:

Unfortunately, study participantIDs don't support regex validation - part of the reason is that a study will create new participants any time data comes in for a participantID that is not already in the study-wide table. That data can come into any dataset, and adding to that 'underlying' study-wide participant table is done as a 'side effect' - it's not possible to directly add rows to that table. Studies aren't set up to restrict to a predetermined list or ID format.

With some custom work, it might be possible to use trigger scripts to accomplish something like that kind of constraint. Every dataset would need to have the same trigger script with that format check on both beforeInsert() and beforeUpdate() - and do error checking/reporting from that script. Another custom option would be a to develop a custom form (such as JavaScript in a wiki) that could be used to validate the data entries before doing the actual insert.

Another option that might meet your needs would be to use conditional formatting after the data is inserted - IDs that didn't meet your criteria could be bolded/highlighted for correction, and the user doing that correcting would then need to 'merge' that 'wrong' participantID with the corrected one. Conditional formatting can't be applied based on regex, but there might be a way to construct filters to find malformed ones.

It looks like this question has also been asked in your organization's Support Portal, so we can follow up further there about what will work best for you.

Thanks,
--Molly

 
schwarza responded:  2023-02-14 09:01

Hi Molly,

Thank you so much for this detailed and helpful reply! I'll discuss with my coworkers and get back to you if there are any other questions.

Leah