SGHI FHIR Profile Implementation Guide
0.1.0 - ci-build

SGHI FHIR Profile Implementation Guide, published by Kathurima Kimathi. 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/savannahghi/sil_fhir_profile_ig/ and changes regularly. See the Directory of published versions

## : Encounter Transforms: R4 → SGHI R5 - XML Representation

Active as of 2026-04-27

Raw xml | Download

    <StructureMap xmlns="http://hl7.org/fhir">
      <id value="Encounter4toSGHI5"/>
      <text>
        <status value="generated"/>
        <div xmlns="http://www.w3.org/1999/xhtml"><p class="res-header-id"><b>Generated Narrative: StructureMap Encounter4toSGHI5</b></p><a name="Encounter4toSGHI5"> </a><a name="hcEncounter4toSGHI5"> </a><pre class="fml">
    <span style="color: #cc00cc">/// <b>url</b> = </span><span style="color: blue">'https://fhir.slade360.co.ke/fhir/StructureMap/Encounter4toSGHI5'</span>
    <span style="color: #cc00cc">/// <b>name</b> = </span><span style="color: blue">'Encounter4toSGHI5'</span>
    <span style="color: #cc00cc">/// <b>title</b> = </span><span style="color: blue">'Encounter Transforms: R4 → SGHI R5'</span>
    <span style="color: #cc00cc">/// <b>status</b> = </span><span style="color: blue">'active'</span>

    <b>uses</b><span style="color: navy"> &quot;</span>http://hl7.org/fhir/4.0/StructureDefinition/Encounter<span style="color: navy">&quot; </span><b>alias </b>EncounterR4 <b>as </b><b>source</b>
    <b>uses</b><span style="color: navy"> &quot;</span><a href="StructureDefinition-encounter.html" title="SGHI Encounter">https://fhir.slade360.co.ke/fhir/StructureDefinition/encounter</a><span style="color: navy">&quot; </span><b>alias </b>SGHIEncounter <b>as </b><b>target</b>

    <b>imports</b><span style="color: navy"> &quot;</span>http://hl7.org/fhir/StructureMap/*4to5<span style="color: navy">&quot;
    </span>
    <b>group </b>SGHIEncounter<span style="color: navy">(</span><b>source</b> <span style="color: maroon">src</span><span style="color: navy"> : </span>EncounterR4, <b>target</b> <span style="color: maroon">tgt</span><span style="color: navy"> : </span>SGHIEncounter<span style="color: navy">)</span><b> extends </b>DomainResource<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.active<span style="color: navy"><b> -&gt; </b></span>tgt.active = <span style="color: blue">'true'</span><span style="color: navy">;</span>
      src.language<span style="color: navy"><b> -&gt; </b></span>tgt.language<span style="color: navy">;</span>
      src<span style="color: navy"><b> -&gt; </b></span>tgt.text = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Narrative'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">tgt_n</span><b> then</b><span style="color: navy"> {
    </span>    src<span style="color: navy"><b> -&gt; </b></span>tgt_n.status = <span style="color: blue">'generated'</span> <i>&quot;settextstatus&quot;</i><span style="color: navy">;</span>
        src<span style="color: navy"><b> -&gt; </b></span>tgt_n.div = <span style="color: blue">'&lt;div xmlns=\&quot;http://www.w3.org/1999/xhtml\&quot;&gt;&lt;h1&gt;Generated text&lt;/h1&gt;&lt;/div&gt;'</span> <i>&quot;settextdiv&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;createhardcodedtext&quot;</i><span style="color: navy">;</span>
      src<b> as </b><span style="color: maroon">sc</span><b> where </b>identifier.exists().not()<span style="color: navy"><b> -&gt; </b></span>tgt.identifier = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Identifier'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">tt_id</span><b> then</b><span style="color: navy"> {
    </span>    src.id<b> as </b><span style="color: maroon">uuid</span><span style="color: navy"><b> -&gt; </b></span>tt_id.value = <span style="color: maroon">uuid</span> <i>&quot;creating id&quot;</i><span style="color: navy">;</span>
        src<span style="color: navy"><b> -&gt; </b></span>tt_id.use = <span style="color: blue">'official'</span> <i>&quot;creating use&quot;</i><span style="color: navy">;</span>
        src<span style="color: navy"><b> -&gt; </b></span>tt_id.type<b> as </b><span style="color: maroon">ty</span><b> then</b><span style="color: navy"> {
    </span>      src<span style="color: navy"><b> -&gt; </b></span>ty.coding = <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">ty_c</span><b> then</b><span style="color: navy"> {
    </span>        src<span style="color: navy"><b> -&gt; </b></span>ty_c.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/identifier-codesystem'</span> <i>&quot;creating coding&quot;</i><span style="color: navy">;</span>
            src<span style="color: navy"><b> -&gt; </b></span>ty_c.code = <span style="color: blue">'fhir-id'</span> <i>&quot;creating code&quot;</i><span style="color: navy">;</span>
            src<span style="color: navy"><b> -&gt; </b></span>ty_c.display = <span style="color: blue">'FHIR Id'</span> <i>&quot;creating display&quot;</i><span style="color: navy">;</span>
          <span style="color: navy">}</span> <i>&quot;creating identifier type&quot;</i><span style="color: navy">;</span>
          src<span style="color: navy"><b> -&gt; </b></span>tt_id.system = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/CodeSystem/identifier-codesystem'</span> <i>&quot;creating system&quot;</i><span style="color: navy">;</span>
          src.serviceProvider<b> as </b><span style="color: maroon">sp</span><span style="color: navy"><b> -&gt; </b></span>tt_id.assigner = <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">t_assigner</span><b> then</b><span style="color: navy"> {
    </span>        sp.reference<span style="color: navy"><b> -&gt; </b></span>t_assigner.reference<span style="color: navy">;</span>
            sp.display<span style="color: navy"><b> -&gt; </b></span>t_assigner.display<span style="color: navy">;</span>
          <span style="color: navy">}</span><span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;creating identifier type&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;creating identifier&quot;</i><span style="color: navy">;</span> <span style="color: navy">// </span><span style="color: green">Create identifier</span>
      src.episodeOfCare<b> as </b><span style="color: maroon">se</span><span style="color: navy"><b> -&gt; </b></span>tgt.episodeOfCare = <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">te</span><b> then</b><span style="color: navy"> {
    </span>    se.reference<span style="color: navy"><b> -&gt; </b></span>te.reference<span style="color: navy">;</span>
        se.id<span style="color: navy"><b> -&gt; </b></span>te.id<span style="color: navy">;</span>
        se.display<b> where </b>display.exists()<span style="color: navy"><b> -&gt; </b></span>te.display<span style="color: navy">;</span>
        src.episodeOfCare<b> where </b>display.exists().not()<span style="color: navy"><b> -&gt; </b></span>te.display = <span style="color: blue">'Encounter'</span><span style="color: navy">;</span>
        se.display<span style="color: navy"><b> -&gt; </b></span>te.display<span style="color: navy">;</span>
      <span style="color: navy">}</span><span style="color: navy">;</span>
      src.status<span style="color: navy"><b> -&gt; </b></span>tgt.status<span style="color: navy">;</span>
      src<b> where </b>status = 'finished'<b> then</b><span style="color: navy"> {
    </span>    src<span style="color: navy"><b> -&gt; </b></span>tgt.status = <span style="color: blue">'completed'</span> <i>&quot;setting R5 status&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;setting R5 status in target&quot;</i><span style="color: navy">;</span>
      src<span style="color: navy"><b> -&gt; </b></span>tgt.class<b> as </b><span style="color: maroon">t_c</span><b> then</b><span style="color: navy"> {
    </span>    src.class<b> as </b><span style="color: maroon">sc</span><span style="color: navy"><b> -&gt; </b></span>t_c.coding = <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">tt</span><b> then </b>TransformEncounterClass<span style="color: navy">(</span><span style="color: maroon">sc</span><span style="color: navy">, </span><span style="color: maroon">tt</span><span style="color: navy">)</span><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;translate coding to codeableconcept&quot;</i><span style="color: navy">;</span>
      src.serviceProvider<span style="color: navy"><b> -&gt; </b></span>tgt.serviceProvider<span style="color: navy">;</span>
      src.meta<b> as </b><span style="color: maroon">s_meta</span><span style="color: navy"><b> -&gt; </b></span>tgt.meta<b> as </b><span style="color: maroon">t_meta</span><b> then</b><span style="color: navy"> {
    </span>    s_meta.lastUpdated<span style="color: navy"><b> -&gt; </b></span>t_meta.lastUpdated<span style="color: navy">;</span>
        s_meta.language<span style="color: navy"><b> -&gt; </b></span>t_meta.language<span style="color: navy">;</span>
        s_meta.tags<span style="color: navy"><b> -&gt; </b></span>t_meta.tags<span style="color: navy">;</span>
        src.meta<b> where </b>profile.exists().not()<span style="color: navy"><b> -&gt; </b></span>t_meta.profile = <span style="color: blue">'https://fhir.slade360.co.ke/fhir/StructureDefinition/encounter'</span> <i>&quot;setprofileinmeta&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;set profile in meta&quot;</i><span style="color: navy">;</span>
      src.period<span style="color: navy"><b> -&gt; </b></span>tgt.actualPeriod<span style="color: navy">;</span>
      src.subject<span style="color: navy"><b> -&gt; </b></span>tgt.subject<span style="color: navy">;</span>
      src.episodeOfcare<span style="color: navy"><b> -&gt; </b></span>tgt.episodeOfcare<span style="color: navy">;</span>
      src.subject<b> as </b><span style="color: maroon">sb</span><span style="color: navy"><b> -&gt; </b></span>tgt.participant<b> as </b><span style="color: maroon">tb</span><b> then</b><span style="color: navy"> {
    </span>    sb<span style="color: navy"><b> -&gt; </b></span>tb.actor = <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">ar</span><b> then</b><span style="color: navy"> {
    </span>      sb.reference<span style="color: navy"><b> -&gt; </b></span>ar.reference<span style="color: navy">;</span>
          sb.display<span style="color: navy"><b> -&gt; </b></span>ar.display<span style="color: navy">;</span>
        <span style="color: navy">}</span> <i>&quot;set actor from subject&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span><span style="color: navy">;</span>
    <span style="color: navy">}

    </span><b>group </b>TransformAssigner<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><b> &lt;&lt;types&gt;&gt;</b><span style="color: navy"> {
    </span>  src.reference<span style="color: navy"><b> -&gt; </b></span>tgt.reference<span style="color: navy">;</span>
      src.display<span style="color: navy"><b> -&gt; </b></span>tgt.display<span style="color: navy">;</span>
    <span style="color: navy">}

    </span><b>group </b>TransformEncounterClass<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><b> &lt;&lt;types&gt;&gt;</b><span style="color: navy"> {
    </span>  src.code<span style="color: navy"><b> -&gt; </b></span>tgt.code<span style="color: navy">;</span>
      src.display<span style="color: navy"><b> -&gt; </b></span>tgt.display<span style="color: navy">;</span>
      src.system<span style="color: navy"><b> -&gt; </b></span>tgt.system<span style="color: navy">;</span>
      src.userSelected<span style="color: navy"><b> -&gt; </b></span>tgt.userSelected<span style="color: navy">;</span>
      src.version<span style="color: navy"><b> -&gt; </b></span>tgt.version<span style="color: navy">;</span>
    <span style="color: navy">}

    </span></pre></div>
      </text>
      <url
           value="https://fhir.slade360.co.ke/fhir/StructureMap/Encounter4toSGHI5"/>
      <version value="0.1.0"/>
      <name value="Encounter4toSGHI5"/>
      <title value="Encounter Transforms: R4 → SGHI R5"/>
      <status value="active"/>
      <date value="2026-04-27T09:21:43+00:00"/>
      <publisher value="Kathurima Kimathi"/>
      <contact>
        <name value="Kathurima Kimathi"/>
        <telecom>
          <system value="url"/>
          <value value="https://www.linkedin.com/in/kathurima-kimathi/"/>
        </telecom>
        <telecom>
          <system value="email"/>
          <value value="kathurimakimathi415@gmail.com"/>
        </telecom>
      </contact>
      <contact>
        <name value="Oscar John"/>
        <telecom>
          <system value="email"/>
          <value value="oscarjohnotieno@gmail.com"/>
          <use value="work"/>
        </telecom>
      </contact>
      <contact>
        <name value="Kennedy Omondi"/>
        <telecom>
          <system value="email"/>
          <value value="kennankole@gmail.com"/>
          <use value="work"/>
        </telecom>
      </contact>
      <description value="EncounterTransformsR4SGHIR5"/>
      <structure>
        <url value="http://hl7.org/fhir/4.0/StructureDefinition/Encounter"/>
        <mode value="source"/>
        <alias value="EncounterR4"/>
      </structure>
      <structure>
        <url
             value="https://fhir.slade360.co.ke/fhir/StructureDefinition/encounter"/>
        <mode value="target"/>
        <alias value="SGHIEncounter"/>
      </structure>
      <import value="http://hl7.org/fhir/StructureMap/*4to5"/>
      <group>
        <name value="SGHIEncounter"/>
        <extends value="DomainResource"/>
        <typeMode value="type-and-types"/>
        <input>
          <name value="src"/>
          <type value="EncounterR4"/>
          <mode value="source"/>
        </input>
        <input>
          <name value="tgt"/>
          <type value="SGHIEncounter"/>
          <mode value="target"/>
        </input>
        <rule>
          <name value="id"/>
          <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>
          <dependent>
            <name value="DefaultMappingGroupAnonymousAlias"/>
            <parameter>
              <valueId value="vvv"/>
            </parameter>
            <parameter>
              <valueId value="vvv"/>
            </parameter>
          </dependent>
        </rule>
        <rule>
          <name value="active"/>
          <source>
            <context value="src"/>
            <element value="active"/>
          </source>
          <target>
            <context value="tgt"/>
            <element value="active"/>
            <transform value="copy"/>
            <parameter>
              <valueString value="true"/>
            </parameter>
          </target>
        </rule>
        <rule>
          <name value="language"/>
          <source>
            <context value="src"/>
            <element value="language"/>
            <variable value="vvv"/>
          </source>
          <target>
            <context value="tgt"/>
            <element value="language"/>
            <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="createhardcodedtext"/>
          <source>
            <context value="src"/>
          </source>
          <target>
            <context value="tgt"/>
            <element value="text"/>
            <variable value="tgt_n"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Narrative"/>
            </parameter>
          </target>
          <rule>
            <name value="settextstatus"/>
            <source>
              <context value="src"/>
            </source>
            <target>
              <context value="tgt_n"/>
              <element value="status"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="generated"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="settextdiv"/>
            <source>
              <context value="src"/>
            </source>
            <target>
              <context value="tgt_n"/>
              <element value="div"/>
              <transform value="copy"/>
              <parameter>
                <valueString
                             value="&lt;div xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;&lt;h1&gt;Generated text&lt;/h1&gt;&lt;/div&gt;"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="creating identifier"/>
          <source>
            <context value="src"/>
            <variable value="sc"/>
            <condition value="identifier.exists().not()"/>
          </source>
          <target>
            <context value="tgt"/>
            <element value="identifier"/>
            <variable value="tt_id"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Identifier"/>
            </parameter>
          </target>
          <rule>
            <name value="creating id"/>
            <source>
              <context value="src"/>
              <element value="id"/>
              <variable value="uuid"/>
            </source>
            <target>
              <context value="tt_id"/>
              <element value="value"/>
              <transform value="copy"/>
              <parameter>
                <valueId value="uuid"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="creating use"/>
            <source>
              <context value="src"/>
            </source>
            <target>
              <context value="tt_id"/>
              <element value="use"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="official"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="creating identifier type"/>
            <source>
              <context value="src"/>
            </source>
            <target>
              <context value="tt_id"/>
              <element value="type"/>
              <variable value="ty"/>
            </target>
            <rule>
              <name value="creating identifier type"/>
              <source>
                <context value="src"/>
              </source>
              <target>
                <context value="ty"/>
                <element value="coding"/>
                <variable value="ty_c"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="CodeableConcept"/>
                </parameter>
              </target>
              <rule>
                <name value="creating coding"/>
                <source>
                  <context value="src"/>
                </source>
                <target>
                  <context value="ty_c"/>
                  <element value="system"/>
                  <transform value="copy"/>
                  <parameter>
                    <valueString
                                 value="https://fhir.slade360.co.ke/fhir/CodeSystem/identifier-codesystem"/>
                  </parameter>
                </target>
              </rule>
              <rule>
                <name value="creating code"/>
                <source>
                  <context value="src"/>
                </source>
                <target>
                  <context value="ty_c"/>
                  <element value="code"/>
                  <transform value="copy"/>
                  <parameter>
                    <valueString value="fhir-id"/>
                  </parameter>
                </target>
              </rule>
              <rule>
                <name value="creating display"/>
                <source>
                  <context value="src"/>
                </source>
                <target>
                  <context value="ty_c"/>
                  <element value="display"/>
                  <transform value="copy"/>
                  <parameter>
                    <valueString value="FHIR Id"/>
                  </parameter>
                </target>
              </rule>
            </rule>
            <rule>
              <name value="creating system"/>
              <source>
                <context value="src"/>
              </source>
              <target>
                <context value="tt_id"/>
                <element value="system"/>
                <transform value="copy"/>
                <parameter>
                  <valueString
                               value="https://fhir.slade360.co.ke/fhir/CodeSystem/identifier-codesystem"/>
                </parameter>
              </target>
            </rule>
            <rule>
              <name value="serviceProvider"/>
              <source>
                <context value="src"/>
                <element value="serviceProvider"/>
                <variable value="sp"/>
              </source>
              <target>
                <context value="tt_id"/>
                <element value="assigner"/>
                <variable value="t_assigner"/>
                <transform value="create"/>
                <parameter>
                  <valueString value="Reference"/>
                </parameter>
              </target>
              <rule>
                <name value="reference"/>
                <source>
                  <context value="sp"/>
                  <element value="reference"/>
                  <variable value="vvv"/>
                </source>
                <target>
                  <context value="t_assigner"/>
                  <element value="reference"/>
                  <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="display"/>
                <source>
                  <context value="sp"/>
                  <element value="display"/>
                  <variable value="vvv"/>
                </source>
                <target>
                  <context value="t_assigner"/>
                  <element value="display"/>
                  <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>
          <documentation value="Create identifier"/>
        </rule>
        <rule>
          <name value="episodeOfCare"/>
          <source>
            <context value="src"/>
            <element value="episodeOfCare"/>
            <variable value="se"/>
          </source>
          <target>
            <context value="tgt"/>
            <element value="episodeOfCare"/>
            <variable value="te"/>
            <transform value="create"/>
            <parameter>
              <valueString value="Reference"/>
            </parameter>
          </target>
          <rule>
            <name value="reference"/>
            <source>
              <context value="se"/>
              <element value="reference"/>
              <variable value="vvv"/>
            </source>
            <target>
              <context value="te"/>
              <element value="reference"/>
              <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="id"/>
            <source>
              <context value="se"/>
              <element value="id"/>
              <variable value="vvv"/>
            </source>
            <target>
              <context value="te"/>
              <element value="id"/>
              <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="display"/>
            <source>
              <context value="se"/>
              <element value="display"/>
              <variable value="vvv"/>
              <condition value="display.exists()"/>
            </source>
            <target>
              <context value="te"/>
              <element value="display"/>
              <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="episodeOfCare"/>
            <source>
              <context value="src"/>
              <element value="episodeOfCare"/>
              <condition value="display.exists().not()"/>
            </source>
            <target>
              <context value="te"/>
              <element value="display"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="Encounter"/>
              </parameter>
            </target>
          </rule>
          <rule>
            <name value="display"/>
            <source>
              <context value="se"/>
              <element value="display"/>
              <variable value="vvv"/>
            </source>
            <target>
              <context value="te"/>
              <element value="display"/>
              <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="status"/>
          <source>
            <context value="src"/>
            <element value="status"/>
            <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>
          <name value="setting R5 status in target"/>
          <source>
            <context value="src"/>
            <condition value="status = 'finished'"/>
          </source>
          <rule>
            <name value="setting R5 status"/>
            <source>
              <context value="src"/>
            </source>
            <target>
              <context value="tgt"/>
              <element value="status"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="completed"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="translate coding to codeableconcept"/>
          <source>
            <context value="src"/>
          </source>
          <target>
            <context value="tgt"/>
            <element value="class"/>
            <variable value="t_c"/>
          </target>
          <rule>
            <name value="class"/>
            <source>
              <context value="src"/>
              <element value="class"/>
              <variable value="sc"/>
            </source>
            <target>
              <context value="t_c"/>
              <element value="coding"/>
              <variable value="tt"/>
              <transform value="create"/>
              <parameter>
                <valueString value="CodeableConcept"/>
              </parameter>
            </target>
            <dependent>
              <name value="TransformEncounterClass"/>
              <parameter>
                <valueId value="sc"/>
              </parameter>
              <parameter>
                <valueId value="tt"/>
              </parameter>
            </dependent>
          </rule>
        </rule>
        <rule>
          <name value="serviceProvider"/>
          <source>
            <context value="src"/>
            <element value="serviceProvider"/>
            <variable value="vvv"/>
          </source>
          <target>
            <context value="tgt"/>
            <element value="serviceProvider"/>
            <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="set profile in meta"/>
          <source>
            <context value="src"/>
            <element value="meta"/>
            <variable value="s_meta"/>
          </source>
          <target>
            <context value="tgt"/>
            <element value="meta"/>
            <variable value="t_meta"/>
          </target>
          <rule>
            <name value="lastUpdated"/>
            <source>
              <context value="s_meta"/>
              <element value="lastUpdated"/>
              <variable value="vvv"/>
            </source>
            <target>
              <context value="t_meta"/>
              <element value="lastUpdated"/>
              <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="language"/>
            <source>
              <context value="s_meta"/>
              <element value="language"/>
              <variable value="vvv"/>
            </source>
            <target>
              <context value="t_meta"/>
              <element value="language"/>
              <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="tags"/>
            <source>
              <context value="s_meta"/>
              <element value="tags"/>
              <variable value="vvv"/>
            </source>
            <target>
              <context value="t_meta"/>
              <element value="tags"/>
              <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="setprofileinmeta"/>
            <source>
              <context value="src"/>
              <element value="meta"/>
              <condition value="profile.exists().not()"/>
            </source>
            <target>
              <context value="t_meta"/>
              <element value="profile"/>
              <transform value="copy"/>
              <parameter>
                <valueString
                             value="https://fhir.slade360.co.ke/fhir/StructureDefinition/encounter"/>
              </parameter>
            </target>
          </rule>
        </rule>
        <rule>
          <name value="period"/>
          <source>
            <context value="src"/>
            <element value="period"/>
            <variable value="vvv"/>
          </source>
          <target>
            <context value="tgt"/>
            <element value="actualPeriod"/>
            <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="episodeOfcare"/>
          <source>
            <context value="src"/>
            <element value="episodeOfcare"/>
            <variable value="vvv"/>
          </source>
          <target>
            <context value="tgt"/>
            <element value="episodeOfcare"/>
            <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="sb"/>
          </source>
          <target>
            <context value="tgt"/>
            <element value="participant"/>
            <variable value="tb"/>
          </target>
          <rule>
            <name value="set actor from subject"/>
            <source>
              <context value="sb"/>
            </source>
            <target>
              <context value="tb"/>
              <element value="actor"/>
              <variable value="ar"/>
              <transform value="create"/>
              <parameter>
                <valueString value="Reference"/>
              </parameter>
            </target>
            <rule>
              <name value="reference"/>
              <source>
                <context value="sb"/>
                <element value="reference"/>
                <variable value="vvv"/>
              </source>
              <target>
                <context value="ar"/>
                <element value="reference"/>
                <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="display"/>
              <source>
                <context value="sb"/>
                <element value="display"/>
                <variable value="vvv"/>
              </source>
              <target>
                <context value="ar"/>
                <element value="display"/>
                <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>
      </group>
      <group>
        <name value="TransformAssigner"/>
        <typeMode value="types"/>
        <input>
          <name value="src"/>
          <mode value="source"/>
        </input>
        <input>
          <name value="tgt"/>
          <mode value="target"/>
        </input>
        <rule>
          <name value="reference"/>
          <source>
            <context value="src"/>
            <element value="reference"/>
            <variable value="vvv"/>
          </source>
          <target>
            <context value="tgt"/>
            <element value="reference"/>
            <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="display"/>
          <source>
            <context value="src"/>
            <element value="display"/>
            <variable value="vvv"/>
          </source>
          <target>
            <context value="tgt"/>
            <element value="display"/>
            <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="TransformEncounterClass"/>
        <typeMode value="types"/>
        <input>
          <name value="src"/>
          <mode value="source"/>
        </input>
        <input>
          <name value="tgt"/>
          <mode value="target"/>
        </input>
        <rule>
          <name value="code"/>
          <source>
            <context value="src"/>
            <element value="code"/>
            <variable value="vvv"/>
          </source>
          <target>
            <context value="tgt"/>
            <element value="code"/>
            <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="display"/>
          <source>
            <context value="src"/>
            <element value="display"/>
            <variable value="vvv"/>
          </source>
          <target>
            <context value="tgt"/>
            <element value="display"/>
            <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="system"/>
          <source>
            <context value="src"/>
            <element value="system"/>
            <variable value="vvv"/>
          </source>
          <target>
            <context value="tgt"/>
            <element value="system"/>
            <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="userSelected"/>
          <source>
            <context value="src"/>
            <element value="userSelected"/>
            <variable value="vvv"/>
          </source>
          <target>
            <context value="tgt"/>
            <element value="userSelected"/>
            <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="version"/>
          <source>
            <context value="src"/>
            <element value="version"/>
            <variable value="vvv"/>
          </source>
          <target>
            <context value="tgt"/>
            <element value="version"/>
            <variable value="vvv"/>
            <transform value="create"/>
          </target>
          <dependent>
            <name value="DefaultMappingGroupAnonymousAlias"/>
            <parameter>
              <valueId value="vvv"/>
            </parameter>
            <parameter>
              <valueId value="vvv"/>
            </parameter>
          </dependent>
        </rule>
      </group>
    </StructureMap>