FHIR Mapping Language (FML)
0.1.0 - STU 1 World

FHIR Mapping Language (FML), 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/mapping-language-ig/ and changes regularly. See the Directory of published versions

: GroupTypePlus

Page standards status: Informative

Raw xml | Download


<StructureMap xmlns="http://hl7.org/fhir"
              resourceDefinition="http://hl7.org/fhir/StructureDefinition/StructureMap|0.1.0">
  <text>
    <status value="generated"/>
    <div xmlns="http://www.w3.org/1999/xhtml"><p class="res-header-id"><b>Generated Narrative: StructureMap GroupTypePlus</b></p><a name="GroupTypePlus"> </a><a name="hcGroupTypePlus"> </a><pre class="fml">
<span style="color: #cc00cc">/// <b>url</b> = </span><span style="color: blue">'http://hl7.org/fhir/uv/mapping-language/StructureMap/GroupTypePlus'</span>
<span style="color: #cc00cc">/// <b>name</b> = </span><span style="color: blue">'GroupTypePlus'</span>
<span style="color: #cc00cc">/// <b>status</b> = </span><span style="color: blue">'active'</span>
<span style="color: #cc00cc">/// <b>description</b> = </span><span style="color: blue">'Example demonstrating the type+ stereotype that also creates the target type when not fixed'</span>

<b>uses</b><span style="color: navy"> &quot;</span><a href="http://hl7.org/fhir/6.0.0-ballot5/observation.html" title="Observation">http://hl7.org/fhir/StructureDefinition/Observation</a><span style="color: navy">&quot; </span><b>as </b><b>source</b>
<b>uses</b><span style="color: navy"> &quot;</span><a href="http://hl7.org/fhir/6.0.0-ballot5/observation.html" title="Observation">http://hl7.org/fhir/StructureDefinition/Observation</a><span style="color: navy">&quot; </span><b>as </b><b>target</b>
<b>uses</b><span style="color: navy"> &quot;</span><a href="http://hl7.org/fhir/6.0.0-ballot5/patient.html" title="Patient">http://hl7.org/fhir/StructureDefinition/Patient</a><span style="color: navy">&quot; </span><b>as </b><b>source</b>
<b>uses</b><span style="color: navy"> &quot;</span><a href="http://hl7.org/fhir/6.0.0-ballot5/patient.html" title="Patient">http://hl7.org/fhir/StructureDefinition/Patient</a><span style="color: navy">&quot; </span><b>as </b><b>target</b>
<b>uses</b><span style="color: navy"> &quot;</span><a href="http://hl7.org/fhir/6.0.0-ballot5/practitioner.html" title="Practitioner">http://hl7.org/fhir/StructureDefinition/Practitioner</a><span style="color: navy">&quot; </span><b>as </b><b>source</b>
<b>uses</b><span style="color: navy"> &quot;</span><a href="http://hl7.org/fhir/6.0.0-ballot5/practitioner.html" title="Practitioner">http://hl7.org/fhir/StructureDefinition/Practitioner</a><span style="color: navy">&quot; </span><b>as </b><b>target</b>

<b>group </b>UseDefaultTypePlus<span style="color: navy">(</span><b>source</b> <span style="color: maroon">src</span><span style="color: navy"> : </span>Observation, <b>target</b> <span style="color: maroon">tgt</span><span style="color: navy"> : </span>Observation<span style="color: navy">)</span><span style="color: navy"> {
</span>  src.id<span style="color: navy"><b> -&gt; </b></span>tgt.id<span style="color: navy">;</span>
  <span style="color: navy">// </span><span style="color: green">the datatype of contained is Resource (which is the base for all resources)</span>
  <span style="color: navy">// </span><span style="color: green">thus the source/target mapping isn't enough to work out what to do here.</span>
  <span style="color: navy">// </span><span style="color: green">So FML falls back to the &quot;default&quot; map to use given this source type</span>
  src.contained<span style="color: navy"><b> -&gt; </b></span>tgt.contained<span style="color: navy">;</span>
<span style="color: navy">}

</span><b>group </b>GroupTypePlusPatient<span style="color: navy">(</span><b>source</b> <span style="color: maroon">src</span><span style="color: navy"> : </span>Patient, <b>target</b> <span style="color: maroon">tgt</span><span style="color: navy"> : </span>Patient<span style="color: navy">)</span><b> &lt;&lt;type+&gt;&gt;</b><span style="color: navy"> {
</span>  src.id<span style="color: navy"><b> -&gt; </b></span>tgt.id<span style="color: navy">;</span>
  src.name<span style="color: navy"><b> -&gt; </b></span>tgt.name<span style="color: navy">;</span>
<span style="color: navy">}

</span><b>group </b>GroupTypePlusPractitioner<span style="color: navy">(</span><b>source</b> <span style="color: maroon">src</span><span style="color: navy"> : </span>Practitioner, <b>target</b> <span style="color: maroon">tgt</span><span style="color: navy"> : </span>Practitioner<span style="color: navy">)</span><b> &lt;&lt;type+&gt;&gt;</b><span style="color: navy"> {
</span>  src.id<span style="color: navy"><b> -&gt; </b></span>tgt.id<span style="color: navy">;</span>
  src.name<span style="color: navy"><b> -&gt; </b></span>tgt.name<span style="color: navy">;</span>
<span style="color: navy">}

</span></pre></div>
  </text>
  <url
       value="http://hl7.org/fhir/uv/mapping-language/StructureMap/GroupTypePlus"/>
  <name value="GroupTypePlus"/>
  <status value="active"/>
  <description
               value="Example demonstrating the type+ stereotype that also creates the target type when not fixed"/>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/Observation"/>
    <mode value="source"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/Observation"/>
    <mode value="target"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/Patient"/>
    <mode value="source"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/Patient"/>
    <mode value="target"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/Practitioner"/>
    <mode value="source"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/Practitioner"/>
    <mode value="target"/>
  </structure>
  <group>
    <name value="UseDefaultTypePlus"/>
    <input>
      <mode value="source"/>
      <name value="src"/>
      <type value="Observation"/>
    </input>
    <input>
      <mode value="target"/>
      <name value="tgt"/>
      <type value="Observation"/>
    </input>
    <rule>
      <source>
        <context value="src"/>
        <element value="id"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="tgt"/>
        <element value="id"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
      <name value="id"/>
    </rule>
    <rule>
      <source>
        <context value="src"/>
        <element value="contained"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="tgt"/>
        <element value="contained"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
      <documentation
                     value="the datatype of contained is Resource (which is the base for all resources)
thus the source/target mapping isn't enough to work out what to do here.
So FML falls back to the &quot;default&quot; map to use given this source type"/>
      <name value="contained"/>
    </rule>
  </group>
  <group>
    <name value="GroupTypePlusPatient"/>
    <input>
      <mode value="source"/>
      <name value="src"/>
      <type value="Patient"/>
    </input>
    <input>
      <mode value="target"/>
      <name value="tgt"/>
      <type value="Patient"/>
    </input>
    <rule>
      <source>
        <context value="src"/>
        <element value="id"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="tgt"/>
        <element value="id"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
      <name value="id"/>
    </rule>
    <rule>
      <source>
        <context value="src"/>
        <element value="name"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="tgt"/>
        <element value="name"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
      <name value="name"/>
    </rule>
    <typeMode value="type-and-types"/>
  </group>
  <group>
    <name value="GroupTypePlusPractitioner"/>
    <input>
      <mode value="source"/>
      <name value="src"/>
      <type value="Practitioner"/>
    </input>
    <input>
      <mode value="target"/>
      <name value="tgt"/>
      <type value="Practitioner"/>
    </input>
    <rule>
      <source>
        <context value="src"/>
        <element value="id"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="tgt"/>
        <element value="id"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
      <name value="id"/>
    </rule>
    <rule>
      <source>
        <context value="src"/>
        <element value="name"/>
        <variable value="vvv"/>
      </source>
      <target>
        <context value="tgt"/>
        <element value="name"/>
        <variable value="vvv"/>
        <transform value="create"/>
      </target>
      <name value="name"/>
    </rule>
    <typeMode value="type-and-types"/>
  </group>
  <id value="GroupTypePlus"/>
  <language value="en"/>
</StructureMap>