Stream: conformance
Topic: Profiling Contained resources
Brian Postlethwaite (Feb 19 2020 at 05:37):
I have a use case where I want to have a Patient and Practitioner contained in a MedicationRequest resource, using contained references. I'm struggling to get the slicing defined.
Error in my guide is:
Profile based discriminators must have a type with a profile
This was my first assumption:
<element id="MedicationRequest.contained">
<path value="MedicationRequest.contained" />
<slicing>
<discriminator>
<type value="profile" />
<path value="resolve()" />
</discriminator>
<rules value="closed" />
</slicing>
<max value="2" />
<mustSupport value="true" />
</element>
<element id="MedicationRequest.contained:patient">
<path value="MedicationRequest.contained" />
<sliceName value="patient" />
<min value="1" />
<max value="1" />
<type>
<code value="Resource" />
<profile value="http://fhir.fred.com.au/my-sl/StructureDefinition/mysl-patient" />
</type>
<mustSupport value="true" />
</element>
<element id="MedicationRequest.contained:practitioner">
<path value="MedicationRequest.contained" />
<sliceName value="practitioner" />
<min value="1" />
<max value="1" />
<type>
<code value="Resource" />
<profile value="http://hl7.org/fhir/StructureDefinition/Practitioner" />
</type>
<mustSupport value="true" />
</element>
Grahame Grieve (Feb 19 2020 at 07:40):
sound right to me
Chris Moesel (Feb 19 2020 at 15:08):
Not sure, but might it work if you change the discriminator path to $this.resolve()?
Brian Postlethwaite (Feb 24 2020 at 04:53):
Worked it out, makes sense now that I look at it again.
(Just in case someone else finds this in the future and wondered what happened)
Issue was that I was using resolve() which is intended to follow a reference, not the inline content, so was expecting to have a targetProfile.
Changing the slicing from profile to type was the trick.
So the error message could have been better to indicate that is must have a type with a targetProfile (not profile)
<element id="MedicationRequest.contained">
<path value="MedicationRequest.contained" />
<slicing>
<discriminator>
<type value="type" />
<path value="$this" />
</discriminator>
<rules value="closed" />
</slicing>
<max value="2" />
<mustSupport value="true" />
</element>
<element id="MedicationRequest.contained:patient">
<path value="MedicationRequest.contained" />
<sliceName value="patient" />
<min value="1" />
<max value="1" />
<type>
<code value="Patient" />
<profile value="http://fhir.fred.com.au/my-sl/StructureDefinition/mysl-patient" />
</type>
<mustSupport value="true" />
</element>
<element id="MedicationRequest.contained:practitioner">
<path value="MedicationRequest.contained" />
<sliceName value="practitioner" />
<min value="1" />
<max value="1" />
<type>
<code value="Practitioner" />
</type>
<mustSupport value="true" />
</element>
Last updated: Apr 12 2022 at 19:14 UTC