Монгол Улсын үндэсний цөм FHIR удирдамж (Mongolian National Core IG)
0.1.0 - draft Mongolia

Монгол Улсын үндэсний цөм FHIR удирдамж (Mongolian National Core IG) - Local Development build (v0.1.0) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions

: EMM3Extraction - XML Representation

Draft as of 2026-09-08

Raw xml | Download


<StructureMap xmlns="http://hl7.org/fhir">
  <id value="EMM3Extraction"/>
  <text>
    <status value="generated"/>
    <div xmlns="http://www.w3.org/1999/xhtml"><p class="res-header-id"><b>Generated Narrative: StructureMap EMM3Extraction</b></p><a name="EMM3Extraction"> </a><a name="hcEMM3Extraction"> </a><pre class="fml">
<b>map</b><span style="color: navy"> &quot;</span>http://fhir.mn/core/StructureMap/EMM3Extraction<span style="color: navy">&quot; = &quot;</span>EMM3Extraction<span style="color: navy">&quot;

</span><b>uses</b><span style="color: navy"> &quot;</span><a href="http://hl7.org/fhir/R4/questionnaireresponse.html" title="QuestionnaireResponse">http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse</a><span style="color: navy">&quot; </span><b>alias </b>QuestionnaireResponse <b>as </b><b>source</b>
<b>uses</b><span style="color: navy"> &quot;</span><a href="http://hl7.org/fhir/R4/bundle.html" title="Bundle">http://hl7.org/fhir/StructureDefinition/Bundle</a><span style="color: navy">&quot; </span><b>alias </b>Bundle <b>as </b><b>target</b>
<b>uses</b><span style="color: navy"> &quot;</span><a href="http://hl7.org/fhir/R4/patient.html" title="Patient">http://hl7.org/fhir/StructureDefinition/Patient</a><span style="color: navy">&quot; </span><b>alias </b>Patient <b>as </b><b>target</b>

<b>group </b>EMM3Extraction<span style="color: navy">(</span><b>source</b> <span style="color: maroon">src</span><span style="color: navy"> : </span>QuestionnaireResponse, <b>target</b> <span style="color: maroon">bnd</span><span style="color: navy"> : </span>Bundle<span style="color: navy">)</span><span style="color: navy"> {
</span>  <span style="color: navy">// </span><span style="color: green">We're taking a QuestionnaireResponse and creating a transaction Bundle</span>
  src<span style="color: navy"><b> -&gt; </b></span>bnd.id = <b>uuid</b><span style="color: navy">(</span><span style="color: navy">)</span> <i>&quot;bundleid&quot;</i><span style="color: navy">;</span>
  src<span style="color: navy"><b> -&gt; </b></span>bnd.type = <span style="color: blue">'transaction'</span> <i>&quot;bundletype&quot;</i><span style="color: navy">;</span>
  <span style="color: navy">// </span><span style="color: green">Navigate into the demographic group of the form to extract Patient</span>
  src.item<b> as </b><span style="color: maroon">item</span><b> where </b>linkId = 'demographics'<span style="color: navy"><b> -&gt; </b></span> bnd.entry<b> as </b><span style="color: maroon">entry</span><span style="color: navy">, </span> entry.resource = <b>create</b><span style="color: navy">(</span><span style="color: blue">'Patient'</span><span style="color: navy">)</span><b> as </b><span style="color: maroon">patient</span><b> then </b>ExtractPatient<span style="color: navy">(</span><span style="color: maroon">item</span><span style="color: navy">, </span><span style="color: maroon">patient</span><span style="color: navy">)</span> <i>&quot;extractpatient&quot;</i><span style="color: navy">;</span>
<span style="color: navy">}

</span><b>group </b>ExtractPatient<span style="color: navy">(</span><b>source</b> <span style="color: maroon">item</span>, <b>target</b> <span style="color: maroon">patient</span><span style="color: navy"> : </span>Patient<span style="color: navy">)</span><span style="color: navy"> {
</span>  <span style="color: navy">// </span><span style="color: green">Find the family name item and map its string answer to Patient.name.family</span>
  item.item<b> as </b><span style="color: maroon">i</span><b> where </b>linkId = 'demographics.family-name'<b> then</b><span style="color: navy"> {
</span>    i.answer<b> as </b><span style="color: maroon">ans</span><b> then</b><span style="color: navy"> {
</span>      ans.value<span style="color: navy"> : </span>string<b> as </b><span style="color: maroon">v</span><span style="color: navy"><b> -&gt; </b></span> patient.name<b> as </b><span style="color: maroon">n</span><span style="color: navy">, </span> n.family = <span style="color: maroon">v</span> <i>&quot;patientfamilyname&quot;</i><span style="color: navy">;</span>
    <span style="color: navy">}</span><span style="color: navy">;</span>
  <span style="color: navy">}</span><span style="color: navy">;</span>
  <span style="color: navy">// </span><span style="color: green">Find the given name item and map its string answer to Patient.name.given</span>
  item.item<b> as </b><span style="color: maroon">i</span><b> where </b>linkId = 'demographics.given-name'<b> then</b><span style="color: navy"> {
</span>    i.answer<b> as </b><span style="color: maroon">ans</span><b> then</b><span style="color: navy"> {
</span>      ans.value<span style="color: navy"> : </span>string<b> as </b><span style="color: maroon">v</span><span style="color: navy"><b> -&gt; </b></span> patient.name<b> as </b><span style="color: maroon">n</span><span style="color: navy">, </span> n.given = <span style="color: maroon">v</span> <i>&quot;patientgivenname&quot;</i><span style="color: navy">;</span>
    <span style="color: navy">}</span><span style="color: navy">;</span>
  <span style="color: navy">}</span><span style="color: navy">;</span>
<span style="color: navy">}

</span></pre></div>
  </text>
  <url value="http://fhir.mn/core/StructureMap/EMM3Extraction"/>
  <version value="0.1.0"/>
  <name value="EMM3Extraction"/>
  <status value="draft"/>
  <date value="2026-09-08T10:09:36+08:00"/>
  <publisher
             value="Эрүүл мэндийн хөгжлийн төв (Health Development Center, Mongolia)"/>
  <contact>
    <name
          value="Эрүүл мэндийн хөгжлийн төв (Health Development Center, Mongolia)"/>
    <telecom>
      <system value="url"/>
      <value value="https://hdc.gov.mn"/>
    </telecom>
  </contact>
  <contact>
    <name value="Эрүүл мэндийн хөгжлийн төв (Health Development Center)"/>
    <telecom>
      <system value="url"/>
      <value value="https://hdc.gov.mn"/>
    </telecom>
  </contact>
  <jurisdiction>
    <coding>
      <system value="urn:iso:std:iso:3166"/>
      <code value="MN"/>
    </coding>
  </jurisdiction>
  <structure>
    <url
         value="http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse"/>
    <mode value="source"/>
    <alias value="QuestionnaireResponse"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/Bundle"/>
    <mode value="target"/>
    <alias value="Bundle"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/Patient"/>
    <mode value="target"/>
    <alias value="Patient"/>
  </structure>
  <group>
    <name value="EMM3Extraction"/>
    <typeMode value="none"/>
    <input>
      <name value="src"/>
      <type value="QuestionnaireResponse"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="bnd"/>
      <type value="Bundle"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="bundleid"/>
      <source>
        <context value="src"/>
      </source>
      <target>
        <context value="bnd"/>
        <contextType value="variable"/>
        <element value="id"/>
        <transform value="uuid"/>
      </target>
    </rule>
    <rule>
      <name value="bundletype"/>
      <source>
        <context value="src"/>
      </source>
      <target>
        <context value="bnd"/>
        <contextType value="variable"/>
        <element value="type"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="transaction"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="extractpatient"/>
      <source>
        <context value="src"/>
        <element value="item"/>
        <variable value="item"/>
        <condition value="linkId = 'demographics'"/>
      </source>
      <target>
        <context value="bnd"/>
        <contextType value="variable"/>
        <element value="entry"/>
        <variable value="entry"/>
      </target>
      <target>
        <context value="entry"/>
        <contextType value="variable"/>
        <element value="resource"/>
        <variable value="patient"/>
        <transform value="create"/>
        <parameter>
          <valueString value="Patient"/>
        </parameter>
      </target>
      <dependent>
        <name value="ExtractPatient"/>
        <variable value="item"/>
        <variable value="patient"/>
      </dependent>
    </rule>
  </group>
  <group>
    <name value="ExtractPatient"/>
    <typeMode value="none"/>
    <input>
      <name value="item"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="patient"/>
      <type value="Patient"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="item"/>
      <source>
        <context value="item"/>
        <element value="item"/>
        <variable value="i"/>
        <condition value="linkId = 'demographics.family-name'"/>
      </source>
      <rule>
        <name value="answer"/>
        <source>
          <context value="i"/>
          <element value="answer"/>
          <variable value="ans"/>
        </source>
        <rule>
          <name value="patientfamilyname"/>
          <source>
            <context value="ans"/>
            <type value="string"/>
            <element value="value"/>
            <variable value="v"/>
          </source>
          <target>
            <context value="patient"/>
            <contextType value="variable"/>
            <element value="name"/>
            <variable value="n"/>
          </target>
          <target>
            <context value="n"/>
            <contextType value="variable"/>
            <element value="family"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="v"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="item"/>
      <source>
        <context value="item"/>
        <element value="item"/>
        <variable value="i"/>
        <condition value="linkId = 'demographics.given-name'"/>
      </source>
      <rule>
        <name value="answer"/>
        <source>
          <context value="i"/>
          <element value="answer"/>
          <variable value="ans"/>
        </source>
        <rule>
          <name value="patientgivenname"/>
          <source>
            <context value="ans"/>
            <type value="string"/>
            <element value="value"/>
            <variable value="v"/>
          </source>
          <target>
            <context value="patient"/>
            <contextType value="variable"/>
            <element value="name"/>
            <variable value="n"/>
          </target>
          <target>
            <context value="n"/>
            <contextType value="variable"/>
            <element value="given"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="v"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
  </group>
</StructureMap>