Hi @mseaton,
As I want to retrieve observations for a visit I am interested in using the existing ObsForPersonDataDefinition. You have mentioned that PersonDataDefs can be used within a visit context. But I think the ObsForPersonDataDefinition may not allow to exactly retrieve observations for a visit. Though it allows to retrieve observation for the patient of a visit, possibly within the same date range as the visit, I don’t think it ensures to exactly retrieve observations for a visit.
Some observations may have been recorded outside of a visit, or 2 visits could overlap in their dates but they would be returned by the ObsForPersonDataDef.
So I see 2 options: Modify the current ObsForPersonDataDefinition to accept a “visit” property and implement this change. This would require to join the encounter and visit tables to the query builder, since observations are really linked to a visit only through their encounter. Or create a new ObsForVisitDataDefinition.
I am willing to implement those changes as soon as possible and PR them but I am not sure which one is best for everyone. What do you think?
(As I have already started to use my own ObsForVisitDataDef, that the simplest for me, but I still can change)
Thanks
Romain