Merge pull request #17 from lmckenzi/extension-value-slicing

Fixed problem where discriminators containing the extension function …
This commit is contained in:
Grahame Grieve 2019-04-14 09:22:01 +10:00 committed by GitHub
commit ae26c82956
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 73 additions and 4 deletions

View File

@ -4145,10 +4145,12 @@ public class FHIRPathEngine {
List<ElementDefinition> childDefinitions = ProfileUtilities.getChildMap(sd, element);
for (ElementDefinition t : childDefinitions) {
if (t.getPath().endsWith(".extension") && t.hasSliceName()) {
sd = worker.fetchResource(StructureDefinition.class, t.getType().get(0).getProfile().get(0).getValue());
while (sd!=null && !sd.getBaseDefinition().equals("http://hl7.org/fhir/StructureDefinition/Extension"))
sd = worker.fetchResource(StructureDefinition.class, sd.getBaseDefinition());
if (sd.getUrl().equals(targetUrl)) {
StructureDefinition exsd = worker.fetchResource(StructureDefinition.class, t.getType().get(0).getProfile().get(0).getValue());
while (exsd!=null && !exsd.getBaseDefinition().equals("http://hl7.org/fhir/StructureDefinition/Extension"))
exsd = worker.fetchResource(StructureDefinition.class, exsd.getBaseDefinition());
if (exsd.getUrl().equals(targetUrl)) {
if (ProfileUtilities.getChildMap(sd, t).isEmpty())
sd = exsd;
focus = t;
break;
}

View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--<StructureDefinition xmlns="http://hl7.org/fhir" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://hl7.org/fhir ../../../../../../FHIR/schema/fhir-single.xsd">-->
<StructureDefinition xmlns="http://hl7.org/fhir">
<id value="extension-slice-profile"/>
<url value="http://hl7.org/fhir/StructureDefinition/extension-slice-profile"/>
<name value="ExtensionSliceProfile"/>
<status value="draft"/>
<description value="Test slicing by extension with fixed value"/>
<kind value="resource"/>
<abstract value="false"/>
<type value="Patient"/>
<baseDefinition value="http://hl7.org/fhir/StructureDefinition/Patient"/>
<derivation value="constraint"/>
<differential>
<element id="Patient">
<path value="Patient"/>
</element>
<element id="Patient.name">
<path value="Patient.name"/>
<slicing>
<discriminator>
<type value="value"/>
<path value="extension(&#39;http://hl7.org/fhir/StructureDefinition/data-absent-reason&#39;).valueCode"/>
</discriminator>
<rules value="open"/>
</slicing>
</element>
<element id="Patient.name:foo">
<path value="Patient.name"/>
<sliceName value="foo"/>
<min value="1"/>
</element>
<element id="Patient.name:foo.extension:dar">
<path value="Patient.name.extension"/>
<sliceName value="dar"/>
<min value="1"/>
<type>
<code value="Extension"/>
<profile value="http://hl7.org/fhir/StructureDefinition/data-absent-reason"/>
</type>
</element>
<element id="Patient.name:foo.extension:dar.valueCode">
<path value="Patient.name.extension.valueCode"/>
<fixedCode value="unknown"/>
</element>
</differential>
</StructureDefinition>

View File

@ -0,0 +1,13 @@
<Patient xmlns="http://hl7.org/fhir">
<id value="extension-slice"/>
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml">
</div>
</text>
<name>
<extension url="http://hl7.org/fhir/StructureDefinition/data-absent-reason">
<valueCode value="unknown"/>
</extension>
</name>
</Patient>

View File

@ -460,6 +460,13 @@
"version" : "3.0",
"questionnaire" : "questionnaire-enableWhen-test3.xml",
"errorCount": 0
},
"extension-slice.xml" : {
"errorCount": 0,
"profile" : {
"source" : "extension-slice-profile.xml",
"errorCount": 0
}
}
}
}