FirelyTeam / firely-net-sdk

The official Firely .NET SDK for HL7 FHIR
Other
830 stars 344 forks source link

ElementDefinition.slicing.discriminator.path for complex Extensions #1656

Closed ArdonToonstra closed 3 years ago

ArdonToonstra commented 3 years ago

Use case: we want to add multiple, similar, complex extensions to a profile. They are differentiated by a fixed or pattern coding in one of the complex extension, in this case the type extension in ( http://hl7.org/fhir/extension-patient-proficiency.html).

We can't get a correct discriminator.path that gets into the complex extension. We tried: Patient.communication.extension('http://hl7.org/fhir/StructureDefinition/patient-proficiency').extension('type').value

Added some example R4 data. It has one example instance with the different extensions and the related (draft and unfinished) profiles.

example data.zip

ewoutkramer commented 3 years ago

@ArdonToonstra, I fixed this to work with child extensions in a complex extension too, but your example profile is incorrect. This bit is wrong:

<element id="Patient.communication.extension">
         <path value="Patient.communication.extension"/>
         <slicing>
            <discriminator>
               <type value="value"/>
               <path value="url"/>
            </discriminator>
             <discriminator>
                 <type value="value"/>
                 <path value="extension('http://hl7.org/fhir/StructureDefinition/patient-proficiency').extension('type').value"/>
             </discriminator>
            <rules value="open"/>
         </slicing>
</element>

Look at how you specify the discriminator to navigate to extension().extension() while you are already profiling the extension child. This slicing should have been on Patient.communication, not on Patient.communication.extension.