Stream: fhirpath
Topic: Help using resolve() and is()
Richard Townley-O'Neill (Jan 30 2019 at 06:17):
In Composition.section (where(code.coding.system='http://loinc.org' and code.coding.code='48765-2')) I want to ensure that if there are any instances of Composition.section.entry at least one of them is an AlleryIntolerance.
I have not been able to test FHIRpath statements with resolve().
Should this invariant work?
Composition.section.where(code.coding.system='http://loinc.org' and code.coding.code='48765-2').entry.exists() implies Composition.section.where(code.coding.system='http://loinc.org' and code.coding.code='48765-2').entry.where(resolve().is(AllergyIntolerance)).exists()
How could I test it?
Satya Yelisetti (Feb 22 2019 at 03:06):
Anyone working on this? i have a similar question on how to test resolve() and conformTo() in Fhirpath. I am trying to create a invariant which enforces the reference of a entry in a Composition to be an Observation(a profile sitting elsewhere) and this Observation has a valuecodableconceptin it with '1200661000168109' as a code. I have written a Fhirpath which looks like this :
entry.resolve().conformsTo(‘http://some.observation.profile’) and entry.resolve().all($this is valueCodeableConcept implies code = 1200661000168109)
can anyone please help / direct me to a way we can test resolve() and conformsTo()?
Grahame Grieve (Feb 22 2019 at 03:19):
the "code = " bit needs work. You can test by validating examples
Bryn Rhodes (Feb 26 2019 at 02:18):
@Richard Townley-O'Neill , that should work, but you don't really need the first exists() implies bit, if a section with that code exists and the the entry for the section resolves to an instance of AllergyIntolerance, the exists() would return true.
Bryn Rhodes (Feb 26 2019 at 02:23):
@Satya Yelisetti , entry.where(resolve() is Observation and resolve().conformsTo('http://some.observation.profile') and resolve().where(code.coding.system = 'http://snomed.info/sct' and code.coding.code = '1200661000168109').exists())
Last updated: Apr 12 2022 at 19:14 UTC