Skip to content

Example MultiSource Extensions

chrisgrenz edited this page Apr 29, 2016 · 2 revisions

Multi-Source Extension

Adding an extension to another (separately defined) extension.

Standard disclaimer: These extensions are contrived for the purpose of illustrating syntax. DO NOT assume that the content exists or is useful in any particular context!

In the instance

<Patient xmlns="http://hl7.org/fhir">
...snip...
	<!-- First extension (Legal Case Flag) -->
	<extension url="http://example.com/fhir/StructureDefinition/patient-legal-case">
		<valueBoolean value="false">
			<!-- Further extended with another extension for Lead Counsel -->
			<extension url="http://example.com/fhir/StructureDefinition/patient-legal-case-lead-counsel">
				<valueReference>
					<display value="J. R. Example, ESQ." />
				</valueReference>
			</extension>
		</valueBoolean>
	</extension>
...snip...

The extension profiles

In this situation, there are two extension profiles, one for "legal case" and one for "lead counsel".

Legal Case:

<differential>
	<element>
		<path value="Element.url" />
		<fixedUri value="http://example.com/fhir/StructureDefinition/patient-legal-case" />
	</element>
	<element>
		<path value="Element.value[x]" />
		<min value="1" />
		<type>
			<code value="boolean" />
		</type>
	</element>
</differential>

And for Lead Counsel:

<differential>
	<element>
		<path value="Element.url" />
		<fixedUri value="http://example.com/fhir/StructureDefinition/patient-legal-case-lead-counsel" />
	</element>
	<element>
		<path value="Element.value[x]" />
		<min value="1" />
		<type>
			<code value="Reference" />
		</type>
	</element>
</differential>

The Resource Profile

To create a profile with both extensions, simply add them at the appropriate path/name as with all other extensions.

<differential>
	<element>
		<path value="Patient.extension" />
		<name value="legalCase" />
		<label value="Legal Case Flag" />
		<type>
			<code value="Extension" />
			<profile value="http://example.com/fhir/StructureDefinition/patient-legal-case" />
		</type>
	</element>
	<element>
		<!-- This is for sure legal.  <path value="Patient.extension.value[x].extension" /> may also be legal. -->
		<path value="Patient.extension.valueBoolean.extension" />
		<name value="legalCase.valueBoolean.leadCounsel" />
		<label value="Lead Counsel" />
		<type>
			<code value="Extension" />
			<profile value="http://example.com/fhir/StructureDefinition/patient-legal-case-lead-counsel" />
		</type>
	</element>
</differential>

Clone this wiki locally