FHIR Chat · Resolve reveference + check coding · fhirpath

Stream: fhirpath

Topic: Resolve reveference + check coding


view this post on Zulip Christian Nau (Apr 09 2021 at 10:01):

Hi,
I'm trying to create a FHIRPath expression for checking if a Location is part of another location of a specific phsysical type.
If found this hint to comparing codeable-concepts wit ~ https://www.hl7.org/fhir/fhirpath.html#changes
But I don't know how to "create" the value for comparison.
What I have so far:
partOf.exists() and partOf.resolve().physicalType ~ <missing part for system=http://terminology.hl7.org/CodeSystem/location-physical-type + code=wa>
Can anyone point me to the right direction please?

view this post on Zulip Lloyd McKenzie (Apr 09 2021 at 13:06):

partOf.resolve().physicalType.where(system='http://terminology.hl7.org/CodeSystem/location-physical-type' and code='wa').exists() should work

view this post on Zulip Christian Nau (Apr 09 2021 at 14:07):

@Lloyd McKenzie Thanks for your answer. I tested it within a Profile. When validating a new instance of a location against this profile it fails for this constraint. But I double checked this referenced location exists and has the correct coding for physical-type. What could be the issue?

view this post on Zulip Lloyd McKenzie (Apr 09 2021 at 16:39):

Ah, missed the coding. Try:
partOf.resolve().physicalType.coding.where(system='http://terminology.hl7.org/CodeSystem/location-physical-type' and code='wa').exists()

view this post on Zulip Christian Nau (Apr 15 2021 at 07:21):

This didn't work for me. I don't know the reason.
But I have found another solution to my problem (kudos to @Patrick Werner ): using a constraint on partOf to only be a reference to my other Location-profile.
For anyone interested:
Expressed in fsh notation:

Profile:    MyWard
Parent:     Location
* physicalType 1..1 MS
* physicalType = http://terminology.hl7.org/CodeSystem/location-physical-type#wa


Profile:    MyBed
Parent:     Location
Description: "A bed as part of a ward of a hospital."
* partOf 1..1 MS
* partOf only Reference(MyWard)

Last updated: Apr 12 2022 at 19:14 UTC