Looking for guidance on how to navigate/combine Encounters and Vitals #1972
-
I am trying to fetch Encounters for a patient with their associated vitals, and not quite getting the model or pattern, looking for some guidance on where to read up on this. First I tried this, and also Include instead of ReverseInclude, but don't seem to get any Observations inside the Encounters.
Then I tried this more convoluted approach
Was then going to iterate over each vital sign Obeservation and match it to the Encounter. I do get the Encounter object populated in the Observation, but it has no Identifier, so then I have a fuzzy match on Encounter.URL which does contain the Encounter ID. And this LINQ query to weed out the Observations that are vital signs seems really unwieldy! Help me... I can tell I am not approaching this right, but don't know where to find this kind of information in the docs... Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 26 replies
-
Why not change your search to ask only for vital signs Observations? The category code that you try to filter on is also available as search parameter: var sp = new SearchParams("subject", patientId);
sp.Add("category", "vital-signs"); So after your two searches you will have Encounters for a Patient and you will have a list of vital signs for that Patient. Am I correct in understanding that the next steps are to determine during which Encounter a vital sign was observed/recorded, so you can set the Observation.encounter to reference the Encounter? obs.Encounter = new ResourceReference (enc.ResourceIdentity().WithoutVersion().ToString()); Not quite sure what you mean by "but it has no Identifier, so then I have a fuzzy match on Encounter.URL which does contain the Encounter ID", so maybe I've skipped over an important detail here. Please clarify further, if my approach does not work. |
Beta Was this translation helpful? Give feedback.
Why not change your search to ask only for vital signs Observations? The category code that you try to filter on is also available as search parameter:
So after your two searches you will have Encounters for a Patient and you will have a list of vital signs for that Patient. Am I correct in understanding that the next steps are to determine during which Encounter a vital sign was observed/recorded, so you can set the Observation.encounter to reference the Encounter?
If so, you should be able to use the Encounter's identity to set the reference, like this: