FHIR Cross-Version Mapping Pack, published by HL7 International / FHIR Infrastructure. This guide is not an authorized publication; it is the continuous build for version 0.1.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/HL7/fhir-cross-version/ and changes regularly. See the Directory of published versions
Page standards status: Draft | Maturity Level: 1 |
<StructureMap xmlns="http://hl7.org/fhir">
<id value="MedicationStatement4to3"/>
<text>
<status value="generated"/>
<div xmlns="http://www.w3.org/1999/xhtml"><pre class="fml">
<span style="color: #cc00cc">/// <b>url</b> = </span><span style="color: blue">'http://hl7.org/fhir/StructureMap/MedicationStatement4to3'</span>
<span style="color: #cc00cc">/// <b>name</b> = </span><span style="color: blue">'MedicationStatement4to3'</span>
<span style="color: #cc00cc">/// <b>title</b> = </span><span style="color: blue">'MedicationStatement Transforms: R4 to R3'</span>
<span style="color: #cc00cc">/// <b>status</b> = </span><span style="color: blue">'active'</span>
<b>uses</b><span style="color: navy"> "</span>http://hl7.org/fhir/4.0/MedicationStatement<span style="color: navy">" </span><b>alias </b>MedicationStatement <b>as </b><b>source</b>
<b>uses</b><span style="color: navy"> "</span>http://hl7.org/fhir/3.0/MedicationStatement<span style="color: navy">" </span><b>alias </b>MedicationStatementR3 <b>as </b><b>target</b>
<b>imports</b><span style="color: navy"> "</span>http://hl7.org/fhir/StructureMap/*4to3<span style="color: navy">"
</span>
<b>group </b>MedicationStatement<span style="color: navy">(</span><b>source</b> <span style="color: maroon">src</span><span style="color: navy"> : </span>MedicationStatement, <b>target</b> <span style="color: maroon">tgt</span><span style="color: navy"> : </span>MedicationStatementR3<span style="color: navy">)</span><b> extends </b>DomainResource<b> <<type+>></b><span style="color: navy"> {
</span> src.identifier<span style="color: navy"><b> -> </b></span>tgt.identifier<span style="color: navy">;</span>
src.basedOn<span style="color: navy"><b> -> </b></span>tgt.basedOn<span style="color: navy">;</span>
src.partOf<span style="color: navy"><b> -> </b></span>tgt.partOf<span style="color: navy">;</span>
src.context<span style="color: navy"><b> -> </b></span>tgt.context<span style="color: navy">;</span>
src<b> where </b>src.extension.where(url = 'http://hl7.org/fhir/3.0/StructureDefinition/extension-MedicationStatement.status').exists()<b> then </b>statusR3<span style="color: navy">(</span><span style="color: maroon">src</span><span style="color: navy">, </span><span style="color: maroon">tgt</span><span style="color: navy">)</span> <i>"status1"</i><span style="color: navy">;</span>
src<b> where </b>src.extension.where(url = 'http://hl7.org/fhir/3.0/StructureDefinition/extension-MedicationStatement.status').empty()<b> then </b>statusNR3<span style="color: navy">(</span><span style="color: maroon">src</span><span style="color: navy">, </span><span style="color: maroon">tgt</span><span style="color: navy">)</span> <i>"status2"</i><span style="color: navy">;</span>
src.category<span style="color: navy"><b> -> </b></span>tgt.category<span style="color: navy">;</span>
src.medication<span style="color: navy"> : </span>CodeableConcept<b> as </b><span style="color: maroon">vs</span><span style="color: navy"><b> -> </b></span>tgt.medication = <b>create</b><span style="color: navy">(</span><span style="color: blue">'CodeableConcept'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">vt</span><b> then </b>CodeableConcept<span style="color: navy">(</span><span style="color: maroon">vs</span><span style="color: navy">, </span><span style="color: maroon">vt</span><span style="color: navy">)</span><span style="color: navy">;</span>
src.medication<span style="color: navy"> : </span>Reference<b> as </b><span style="color: maroon">vs</span><span style="color: navy"><b> -> </b></span>tgt.medication = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Reference'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">vt</span><b> then </b>Reference<span style="color: navy">(</span><span style="color: maroon">vs</span><span style="color: navy">, </span><span style="color: maroon">vt</span><span style="color: navy">)</span><span style="color: navy">;</span>
src.effective<span style="color: navy"> : </span>dateTime<b> as </b><span style="color: maroon">vs</span><span style="color: navy"><b> -> </b></span>tgt.effective = <b>create</b><span style="color: navy">(</span><span style="color: blue">'dateTime'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">vt</span><b> then </b>dateTime<span style="color: navy">(</span><span style="color: maroon">vs</span><span style="color: navy">, </span><span style="color: maroon">vt</span><span style="color: navy">)</span><span style="color: navy">;</span>
src.effective<span style="color: navy"> : </span>Period<b> as </b><span style="color: maroon">vs</span><span style="color: navy"><b> -> </b></span>tgt.effective = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Period'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">vt</span><b> then </b>Period<span style="color: navy">(</span><span style="color: maroon">vs</span><span style="color: navy">, </span><span style="color: maroon">vt</span><span style="color: navy">)</span><span style="color: navy">;</span>
src.dateAsserted<span style="color: navy"><b> -> </b></span>tgt.dateAsserted<span style="color: navy">;</span>
src.informationSource<span style="color: navy"><b> -> </b></span>tgt.informationSource<span style="color: navy">;</span>
src.subject<span style="color: navy"><b> -> </b></span>tgt.subject<span style="color: navy">;</span>
src.derivedFrom<span style="color: navy"><b> -> </b></span>tgt.derivedFrom<span style="color: navy">;</span>
src.reasonCode<b> where </b>src.status = 'not-taken'<span style="color: navy"><b> -> </b></span>tgt.reasonNotTaken<span style="color: navy">;</span>
src.reasonCode<b> where </b>src.status != 'not-taken'<span style="color: navy"><b> -> </b></span>tgt.reasonCode<span style="color: navy">;</span>
src.reasonReference<span style="color: navy"><b> -> </b></span>tgt.reasonReference<span style="color: navy">;</span>
src.note<span style="color: navy"><b> -> </b></span>tgt.note<span style="color: navy">;</span>
src.dosage<span style="color: navy"><b> -> </b></span>tgt.dosage<span style="color: navy">;</span>
<span style="color: navy">}
</span><b>group </b>statusR3<span style="color: navy">(</span><b>source</b> <span style="color: maroon">src</span>, <b>target</b> <span style="color: maroon">tgt</span><span style="color: navy">)</span><span style="color: navy"> {
</span> src.extension<b> as </b><span style="color: maroon">e</span><b> where </b>url = 'http://hl7.org/fhir/3.0/StructureDefinition/extension-MedicationStatement.taken'<b> then</b><span style="color: navy"> {
</span> e.value<span style="color: navy"><b> -> </b></span>tgt.taken<span style="color: navy">;</span>
<span style="color: navy">}</span><span style="color: navy">;</span>
src.extension<b> as </b><span style="color: maroon">e</span><b> where </b>url = 'http://hl7.org/fhir/3.0/StructureDefinition/extension-MedicationStatement.status'<b> then</b><span style="color: navy"> {
</span> e.value<span style="color: navy"><b> -> </b></span>tgt.status<span style="color: navy">;</span>
<span style="color: navy">}</span><span style="color: navy">;</span>
<span style="color: navy">}
</span><b>group </b>statusNR3<span style="color: navy">(</span><b>source</b> <span style="color: maroon">src</span>, <b>target</b> <span style="color: maroon">tgt</span><span style="color: navy">)</span><span style="color: navy"> {
</span> src.status<b> where </b>(value in ('not-taken' | 'unknown')).not()<span style="color: navy"><b> -> </b></span>tgt.status<span style="color: navy">;</span>
src.status<b> where </b>value = 'not-taken'<span style="color: navy"><b> -> </b></span> tgt.status = <span style="color: blue">'completed'</span><span style="color: navy">, </span> tgt.taken = <span style="color: blue">'n'</span><span style="color: navy">;</span>
src.status<b> where </b>value = 'unknown'<span style="color: navy"><b> -> </b></span> tgt.status = <span style="color: blue">'completed'</span><span style="color: navy">, </span> tgt.taken = <span style="color: blue">'unk'</span><span style="color: navy">;</span>
<span style="color: navy">}
</span></pre></div>
</text>
<extension
url="http://hl7.org/fhir/StructureDefinition/structuredefinition-wg">
<valueCode value="fhir"/>
</extension>
<extension
url="http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm">
<valueInteger value="1">
<extension
url="http://hl7.org/fhir/StructureDefinition/structuredefinition-conformance-derivedFrom">
<valueCanonical
value="http://hl7.org/fhir/extensions/ImplementationGuide/hl7.fhir.uv.xver"/>
</extension>
</valueInteger>
</extension>
<extension
url="http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status">
<valueCode value="draft">
<extension
url="http://hl7.org/fhir/StructureDefinition/structuredefinition-conformance-derivedFrom">
<valueCanonical
value="http://hl7.org/fhir/extensions/ImplementationGuide/hl7.fhir.uv.xver"/>
</extension>
</valueCode>
</extension>
<url value="http://hl7.org/fhir/StructureMap/MedicationStatement4to3"/>
<version value="0.1.0"/>
<name value="MedicationStatement4to3"/>
<title value="MedicationStatement Transforms: R4 to R3"/>
<status value="active"/>
<date value="2024-02-22T03:16:50+00:00"/>
<publisher value="HL7 International / FHIR Infrastructure"/>
<contact>
<telecom>
<system value="url"/>
<value value="http://www.hl7.org/Special/committees/fiwg"/>
</telecom>
</contact>
<description value="MedicationStatementTransformsR4toR3"/>
<jurisdiction>
<coding>
<system value="http://unstats.un.org/unsd/methods/m49/m49.htm"/>
<code value="001"/>
</coding>
</jurisdiction>
<structure>
<url value="http://hl7.org/fhir/4.0/MedicationStatement"/>
<mode value="source"/>
<alias value="MedicationStatement"/>
</structure>
<structure>
<url value="http://hl7.org/fhir/3.0/MedicationStatement"/>
<mode value="target"/>
<alias value="MedicationStatementR3"/>
</structure>
<import value="http://hl7.org/fhir/StructureMap/*4to3"/>
<group>
<name value="MedicationStatement"/>
<extends value="DomainResource"/>
<typeMode value="type-and-types"/>
<input>
<name value="src"/>
<type value="MedicationStatement"/>
<mode value="source"/>
</input>
<input>
<name value="tgt"/>
<type value="MedicationStatementR3"/>
<mode value="target"/>
</input>
<rule>
<name value="identifier"/>
<source>
<context value="src"/>
<element value="identifier"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<element value="identifier"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
<dependent>
<name value="DefaultMappingGroupAnonymousAlias"/>
<parameter>
<valueId value="vvv"/>
</parameter>
<parameter>
<valueId value="vvv"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="basedOn"/>
<source>
<context value="src"/>
<element value="basedOn"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<element value="basedOn"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
<dependent>
<name value="DefaultMappingGroupAnonymousAlias"/>
<parameter>
<valueId value="vvv"/>
</parameter>
<parameter>
<valueId value="vvv"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="partOf"/>
<source>
<context value="src"/>
<element value="partOf"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<element value="partOf"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
<dependent>
<name value="DefaultMappingGroupAnonymousAlias"/>
<parameter>
<valueId value="vvv"/>
</parameter>
<parameter>
<valueId value="vvv"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="context"/>
<source>
<context value="src"/>
<element value="context"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<element value="context"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
<dependent>
<name value="DefaultMappingGroupAnonymousAlias"/>
<parameter>
<valueId value="vvv"/>
</parameter>
<parameter>
<valueId value="vvv"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="status1"/>
<source>
<context value="src"/>
<condition
value="src.extension.where(url = 'http://hl7.org/fhir/3.0/StructureDefinition/extension-MedicationStatement.status').exists()"/>
</source>
<dependent>
<name value="statusR3"/>
<parameter>
<valueId value="src"/>
</parameter>
<parameter>
<valueId value="tgt"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="status2"/>
<source>
<context value="src"/>
<condition
value="src.extension.where(url = 'http://hl7.org/fhir/3.0/StructureDefinition/extension-MedicationStatement.status').empty()"/>
</source>
<dependent>
<name value="statusNR3"/>
<parameter>
<valueId value="src"/>
</parameter>
<parameter>
<valueId value="tgt"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="category"/>
<source>
<context value="src"/>
<element value="category"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<element value="category"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
<dependent>
<name value="DefaultMappingGroupAnonymousAlias"/>
<parameter>
<valueId value="vvv"/>
</parameter>
<parameter>
<valueId value="vvv"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="medicationCodeableConcept"/>
<source>
<context value="src"/>
<type value="CodeableConcept"/>
<element value="medication"/>
<variable value="vs"/>
</source>
<target>
<context value="tgt"/>
<element value="medication"/>
<variable value="vt"/>
<transform value="create"/>
<parameter>
<valueString value="CodeableConcept"/>
</parameter>
</target>
<dependent>
<name value="CodeableConcept"/>
<parameter>
<valueId value="vs"/>
</parameter>
<parameter>
<valueId value="vt"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="medicationReference"/>
<source>
<context value="src"/>
<type value="Reference"/>
<element value="medication"/>
<variable value="vs"/>
</source>
<target>
<context value="tgt"/>
<element value="medication"/>
<variable value="vt"/>
<transform value="create"/>
<parameter>
<valueString value="Reference"/>
</parameter>
</target>
<dependent>
<name value="Reference"/>
<parameter>
<valueId value="vs"/>
</parameter>
<parameter>
<valueId value="vt"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="effectiveDateTime"/>
<source>
<context value="src"/>
<type value="dateTime"/>
<element value="effective"/>
<variable value="vs"/>
</source>
<target>
<context value="tgt"/>
<element value="effective"/>
<variable value="vt"/>
<transform value="create"/>
<parameter>
<valueString value="dateTime"/>
</parameter>
</target>
<dependent>
<name value="dateTime"/>
<parameter>
<valueId value="vs"/>
</parameter>
<parameter>
<valueId value="vt"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="effectivePeriod"/>
<source>
<context value="src"/>
<type value="Period"/>
<element value="effective"/>
<variable value="vs"/>
</source>
<target>
<context value="tgt"/>
<element value="effective"/>
<variable value="vt"/>
<transform value="create"/>
<parameter>
<valueString value="Period"/>
</parameter>
</target>
<dependent>
<name value="Period"/>
<parameter>
<valueId value="vs"/>
</parameter>
<parameter>
<valueId value="vt"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="dateAsserted"/>
<source>
<context value="src"/>
<element value="dateAsserted"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<element value="dateAsserted"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
<dependent>
<name value="DefaultMappingGroupAnonymousAlias"/>
<parameter>
<valueId value="vvv"/>
</parameter>
<parameter>
<valueId value="vvv"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="informationSource"/>
<source>
<context value="src"/>
<element value="informationSource"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<element value="informationSource"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
<dependent>
<name value="DefaultMappingGroupAnonymousAlias"/>
<parameter>
<valueId value="vvv"/>
</parameter>
<parameter>
<valueId value="vvv"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="subject"/>
<source>
<context value="src"/>
<element value="subject"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<element value="subject"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
<dependent>
<name value="DefaultMappingGroupAnonymousAlias"/>
<parameter>
<valueId value="vvv"/>
</parameter>
<parameter>
<valueId value="vvv"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="derivedFrom"/>
<source>
<context value="src"/>
<element value="derivedFrom"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<element value="derivedFrom"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
<dependent>
<name value="DefaultMappingGroupAnonymousAlias"/>
<parameter>
<valueId value="vvv"/>
</parameter>
<parameter>
<valueId value="vvv"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="reasonCode"/>
<source>
<context value="src"/>
<element value="reasonCode"/>
<variable value="vvv"/>
<condition value="src.status = 'not-taken'"/>
</source>
<target>
<context value="tgt"/>
<element value="reasonNotTaken"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
<dependent>
<name value="DefaultMappingGroupAnonymousAlias"/>
<parameter>
<valueId value="vvv"/>
</parameter>
<parameter>
<valueId value="vvv"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="reasonCode"/>
<source>
<context value="src"/>
<element value="reasonCode"/>
<variable value="vvv"/>
<condition value="src.status != 'not-taken'"/>
</source>
<target>
<context value="tgt"/>
<element value="reasonCode"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
<dependent>
<name value="DefaultMappingGroupAnonymousAlias"/>
<parameter>
<valueId value="vvv"/>
</parameter>
<parameter>
<valueId value="vvv"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="reasonReference"/>
<source>
<context value="src"/>
<element value="reasonReference"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<element value="reasonReference"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
<dependent>
<name value="DefaultMappingGroupAnonymousAlias"/>
<parameter>
<valueId value="vvv"/>
</parameter>
<parameter>
<valueId value="vvv"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="note"/>
<source>
<context value="src"/>
<element value="note"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<element value="note"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
<dependent>
<name value="DefaultMappingGroupAnonymousAlias"/>
<parameter>
<valueId value="vvv"/>
</parameter>
<parameter>
<valueId value="vvv"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="dosage"/>
<source>
<context value="src"/>
<element value="dosage"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<element value="dosage"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
<dependent>
<name value="DefaultMappingGroupAnonymousAlias"/>
<parameter>
<valueId value="vvv"/>
</parameter>
<parameter>
<valueId value="vvv"/>
</parameter>
</dependent>
</rule>
</group>
<group>
<name value="statusR3"/>
<input>
<name value="src"/>
<mode value="source"/>
</input>
<input>
<name value="tgt"/>
<mode value="target"/>
</input>
<rule>
<name value="extension"/>
<source>
<context value="src"/>
<element value="extension"/>
<variable value="e"/>
<condition
value="url = 'http://hl7.org/fhir/3.0/StructureDefinition/extension-MedicationStatement.taken'"/>
</source>
<rule>
<name value="value"/>
<source>
<context value="e"/>
<element value="value"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<element value="taken"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
<dependent>
<name value="DefaultMappingGroupAnonymousAlias"/>
<parameter>
<valueId value="vvv"/>
</parameter>
<parameter>
<valueId value="vvv"/>
</parameter>
</dependent>
</rule>
</rule>
<rule>
<name value="extension"/>
<source>
<context value="src"/>
<element value="extension"/>
<variable value="e"/>
<condition
value="url = 'http://hl7.org/fhir/3.0/StructureDefinition/extension-MedicationStatement.status'"/>
</source>
<rule>
<name value="value"/>
<source>
<context value="e"/>
<element value="value"/>
<variable value="vvv"/>
</source>
<target>
<context value="tgt"/>
<element value="status"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
<dependent>
<name value="DefaultMappingGroupAnonymousAlias"/>
<parameter>
<valueId value="vvv"/>
</parameter>
<parameter>
<valueId value="vvv"/>
</parameter>
</dependent>
</rule>
</rule>
</group>
<group>
<name value="statusNR3"/>
<input>
<name value="src"/>
<mode value="source"/>
</input>
<input>
<name value="tgt"/>
<mode value="target"/>
</input>
<rule>
<name value="status"/>
<source>
<context value="src"/>
<element value="status"/>
<variable value="vvv"/>
<condition value="(value in ('not-taken' | 'unknown')).not()"/>
</source>
<target>
<context value="tgt"/>
<element value="status"/>
<variable value="vvv"/>
<transform value="create"/>
</target>
<dependent>
<name value="DefaultMappingGroupAnonymousAlias"/>
<parameter>
<valueId value="vvv"/>
</parameter>
<parameter>
<valueId value="vvv"/>
</parameter>
</dependent>
</rule>
<rule>
<name value="status"/>
<source>
<context value="src"/>
<element value="status"/>
<condition value="value = 'not-taken'"/>
</source>
<target>
<context value="tgt"/>
<element value="status"/>
<transform value="copy"/>
<parameter>
<valueString value="completed"/>
</parameter>
</target>
<target>
<context value="tgt"/>
<element value="taken"/>
<transform value="copy"/>
<parameter>
<valueString value="n"/>
</parameter>
</target>
</rule>
<rule>
<name value="status"/>
<source>
<context value="src"/>
<element value="status"/>
<condition value="value = 'unknown'"/>
</source>
<target>
<context value="tgt"/>
<element value="status"/>
<transform value="copy"/>
<parameter>
<valueString value="completed"/>
</parameter>
</target>
<target>
<context value="tgt"/>
<element value="taken"/>
<transform value="copy"/>
<parameter>
<valueString value="unk"/>
</parameter>
</target>
</rule>
</group>
</StructureMap>