From ae8bc3502f38251a97fe7c1e21028eec6718de25 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Wed, 5 Oct 2022 21:17:40 +1100 Subject: [PATCH] fix FHIRPath .is(type) to handle abstract types --- .../java/org/hl7/fhir/r5/utils/FHIRPathEngine.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/FHIRPathEngine.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/FHIRPathEngine.java index 705a3a449..4fbafabb7 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/FHIRPathEngine.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/FHIRPathEngine.java @@ -4503,7 +4503,18 @@ public class FHIRPathEngine { return makeBoolean(false); } } else if (ns.equals("FHIR")) { - return makeBoolean(n.equals(focus.get(0).fhirType())); + if (n.equals(focus.get(0).fhirType())) { + return makeBoolean(true); + } else { + StructureDefinition sd = worker.fetchTypeDefinition(focus.get(0).fhirType()); + while (sd != null) { + if (n.equals(sd.getType())) { + return makeBoolean(true); + } + sd = worker.fetchResource(StructureDefinition.class, sd.getBaseDefinition()); + } + return makeBoolean(false); + } } else { return makeBoolean(false); }