FHIR Chat · Getting all observations in an organization · implementers

Stream: implementers

Topic: Getting all observations in an organization


view this post on Zulip Marius Moga (Dec 09 2021 at 08:08):

Hi,
I have a scenario where the Encounter.reasonReference references many Observation, the Task.encounter references the Encounter and the
Task.owner is either a reference to an Organization or a PractitionerRole.

What I'm trying to do is get all observations of tasks owned by an organization or by an practitioner role who is part of that organization.
For example lets say we have 2 tasks, one owned by Organization Organization/5678 and another owned by PractitionerRole/1234 who is part of Organization/5678. The 2 tasks reference 2 different encounters and each Encounter references a different observation.

This 2 queries work and will return one of the 2 tasks each:

  • Task?owner=Organization/5678 - will return the task owned by the organization
  • Task?owner.organization=Organization/5678 - will return the task owned by the practitioner role

With this I would expect that the next 2 queries to return different observations. Instead they return the same one observation, the one linked to the task owned by the organization:

  • Observation?_has:Encounter:reason-reference:_has:Task:encounter:owner=Organization/5678 - returns observation of task owned by the organization
  • Observation?_has:Encounter:reason-reference:_has:Task:encounter:owner.organization=Organization/5678 - returns observation of task owned by the organization. Was expecting the other one.

Any idea what's wrong here? Maybe I'm are hitting some limitation I'm are not aware of?

I have also tried making the Observation reference an Encounter in Observation.encounter and use this queries:

  • Observation?encounter._has:Task:encounter:owner=Organization/5678 - works and returns the task owned by the organization
  • Observation?encounter._has:Task:encounter:owner.organization=Organization/5678- fails with "Invalid parameter chain: encounter._has:Task:encounter:owner.organization"

So again something about inspecting the owner.organization property seams to not work. I was hoping that by not using an nested revers chain things would be different :)

My question is can I fix this in any way and if not is there a better way of achieving this without changing how things are referenced to much?

Thank you.

view this post on Zulip René Spronk (Dec 09 2021 at 08:44):

Have your tried Observation?encounter._has:Task:encounter:owner:PractitionerRole.organization=Organization/5678 ? If the owner of the Task is a reference to an Organization your search URL will fail, given that Organization doesn't have an 'organization' reference/search parameter.

view this post on Zulip Marius Moga (Dec 09 2021 at 10:24):

Yes I did try this queries:

  • Observation?encounter._has:Task:encounter:owner:PractitionerRole.organization=Organization/5678 - fails with "Invalid parameter chain: encounter._has:Task:encounter:owner:PractitionerRole.organization"
  • Observation?_has:Encounter:reason-reference:_has:Task:encounter:owner:PractitionerRole.organization=Organization/5678 - fails with "Unknown parameter name: Task:owner:PractitionerRole"

I have tried something like this on other occasions as well and could never specify the type in a reverse chain even in simpler scenarios like:

  • Encounter?_has:Task:encounter:owner:PractitionerRole.organization=Organization/5678 - fails with "Unknown parameter name: Task:owner:PractitionerRole.organization"

I have tested all of this with HAPI FHIR v5.4.1 and v5.6.0 (FHIR R4 on both versions).


Last updated: Apr 12 2022 at 19:14 UTC