Can LabKey study module handle one-to-many relationships?

Study Forum (Inactive)
Can LabKey study module handle one-to-many relationships? craig.m  2012-03-14 13:02
Status: Closed
 
Hey all,

I hope this is the right forum to post this. I'm trying to import some data into the LabKey study module which has a one-to-many relationship, i.e., "duplicate entries by participant ID and sequence ID". (E.g., a subject's medical history. There may be zero entries, or fifteen, or in between, or beyond.) Right now I have it represented as one row per medical history event, but I can reformat if need be.

Is there any way to get the study module to handle this kind of data? (Ideally without forcing it into a denormalized form, since I don't know what the ultimate upper bound will be.)

Thanks,
Craig
 
 
jeckels responded:  2012-03-14 15:33
Hi Craig,

Yes, you can configure a dataset to use an "Additional Key Column". The combination of participant/sequencenum/additional key needs to be unique. Having one row per event fits nicely with this model.

Your extra key can be any value that you want. Does your existing data already have a natural value, guaranteed to be unique for that participant/sequencenum combination, to use (an event ID, for example)? Alternatively, you could potentially generate a new value to use before importing.

Thanks,
Josh
 
craig.m responded:  2012-03-15 11:29
Excellent, thanks. I'll give it a go. The data doesn't currently have unique index for every case, but it would be easy for me to generate.