<?xml version="1.0" encoding="UTF-8"?>

<StructureMap xmlns="http://hl7.org/fhir">
  <id value="NormalizeEditeurPatientToCorePatientIpp"/>
  <text>
    <status value="generated"/><div xmlns="http://www.w3.org/1999/xhtml"><p class="res-header-id"><b>Narratif généré : StructureMap NormalizeEditeurPatientToCorePatientIpp</b></p><a name="NormalizeEditeurPatientToCorePatientIpp"> </a><a name="hcNormalizeEditeurPatientToCorePatientIpp"> </a><pre class="fml">
<b>map</b><span style="color: navy"> &quot;</span>https://interop.aphp.fr/ig/fhir/core/StructureMap/NormalizeEditeurPatientToCorePatientIpp<span style="color: navy">&quot; = &quot;</span>NormalizeEditeurPatientToCorePatientIpp<span style="color: navy">&quot;

</span><span style="color: navy">// </span><span style="color: green">Exemple de simulation Design First (page design-first.html) : transformation d'un Patient source brut (IPP sans system ni use) vers le profil AP-HP Core Patient (IPP), en ajoutant le system, le use et en recopiant le nom, le prénom, le sexe, la date de naissance et l'adresse.</span>

<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|4.0.1</a><span style="color: navy">&quot; </span><b>alias </b>EditeurPatient <b>as </b><b>source</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|4.0.1</a><span style="color: navy">&quot; </span><b>alias </b>CorePatientIpp <b>as </b><b>target</b>

<b>group </b>NormalizeEditeurPatientToCorePatientIpp<span style="color: navy">(</span><b>source</b> <span style="color: maroon">src</span><span style="color: navy"> : </span>EditeurPatient, <b>target</b> <span style="color: maroon">tgt</span><span style="color: navy"> : </span>CorePatientIpp<span style="color: navy">)</span><span style="color: navy"> {
</span>  src<span style="color: navy"><b> -&gt; </b></span> tgt.meta<b> as </b><span style="color: maroon">m</span><span style="color: navy">, </span> m.profile = <span style="color: blue">'https://interop.aphp.fr/ig/fhir/core/StructureDefinition/core-patient-ipp'</span> <i>&quot;setProfile&quot;</i><span style="color: navy">;</span>
  src.identifier<b> as </b><span style="color: maroon">srcId</span><b> then</b><span style="color: navy"> {
</span>    srcId.value<b> as </b><span style="color: maroon">v</span><span style="color: navy"><b> -&gt; </b></span> tgt.identifier<b> as </b><span style="color: maroon">newId</span><span style="color: navy">, </span> newId.use = <span style="color: blue">'usual'</span><span style="color: navy">, </span> newId.system = <span style="color: blue">'https://interop.aphp.fr/info/Patient/ipp'</span><span style="color: navy">, </span> newId.value = <span style="color: maroon">v</span><b> then</b><span style="color: navy"> {
</span>      v<span style="color: navy"><b> -&gt; </b></span>newId.type<b> as </b><span style="color: maroon">t</span><b> then</b><span style="color: navy"> {
</span>        v<span style="color: navy"><b> -&gt; </b></span> t.coding<b> as </b><span style="color: maroon">c</span><span style="color: navy">, </span> c.system = <span style="color: blue">'http://terminology.hl7.org/CodeSystem/v2-0203'</span><span style="color: navy">, </span> c.code = <span style="color: blue">'PI'</span><span style="color: navy">, </span> c.display = <span style="color: blue">'Patient internal identifier'</span> <i>&quot;setIdentifierCoding&quot;</i><span style="color: navy">;</span>
      <span style="color: navy">}</span> <i>&quot;setIdentifierType&quot;</i><span style="color: navy">;</span>
    <span style="color: navy">}</span> <i>&quot;mapIdentifierValue&quot;</i><span style="color: navy">;</span>
  <span style="color: navy">}</span> <i>&quot;mapIdentifierGroup&quot;</i><span style="color: navy">;</span>
  src.name<b> as </b><span style="color: maroon">srcName</span><b> then</b><span style="color: navy"> {
</span>    srcName.family<b> as </b><span style="color: maroon">f</span><span style="color: navy"><b> -&gt; </b></span> tgt.name<b> as </b><span style="color: maroon">newName</span><span style="color: navy">, </span> newName.use = <span style="color: blue">'official'</span><span style="color: navy">, </span> newName.family = <span style="color: maroon">f</span><b> then</b><span style="color: navy"> {
</span>      srcName.given<b> as </b><span style="color: maroon">giv</span><span style="color: navy"><b> -&gt; </b></span>newName.given = <span style="color: maroon">giv</span> <i>&quot;mapGiven&quot;</i><span style="color: navy">;</span>
    <span style="color: navy">}</span> <i>&quot;mapFamily&quot;</i><span style="color: navy">;</span>
  <span style="color: navy">}</span> <i>&quot;mapNameGroup&quot;</i><span style="color: navy">;</span>
  src.gender<b> as </b><span style="color: maroon">g</span><span style="color: navy"><b> -&gt; </b></span>tgt.gender = <span style="color: maroon">g</span> <i>&quot;mapGender&quot;</i><span style="color: navy">;</span>
  src.birthDate<b> as </b><span style="color: maroon">bd</span><span style="color: navy"><b> -&gt; </b></span>tgt.birthDate = <span style="color: maroon">bd</span> <i>&quot;mapBirthDate&quot;</i><span style="color: navy">;</span>
  src.address<b> as </b><span style="color: maroon">a</span><span style="color: navy"><b> -&gt; </b></span>tgt.address = <span style="color: maroon">a</span> <i>&quot;mapAddress&quot;</i><span style="color: navy">;</span>
<span style="color: navy">}

</span></pre></div>
  </text>
  <url value="https://interop.aphp.fr/ig/fhir/core/StructureMap/NormalizeEditeurPatientToCorePatientIpp"/>
  <version value="0.13.5"/>
  <name value="NormalizeEditeurPatientToCorePatientIpp"/>
  <title value="Normalisation Patient source vers Patient (IPP)"/>
  <status value="active"/>
  <date value="2026-11-24T09:23:46+00:00"/>
  <publisher value="AP-HP"/>
  <contact>
    <name value="AP-HP"/>
    <telecom>
      <system value="url"/>
      <value value="https://aphp.fr"/>
    </telecom>
  </contact>
  <description value="Exemple de simulation Design First (page design-first.html) : transformation d'un Patient source brut (IPP sans system ni use) vers le profil AP-HP Core Patient (IPP), en ajoutant le system, le use et en recopiant le nom, le prénom, le sexe, la date de naissance et l'adresse."/>
  <jurisdiction>
    <coding>
      <system value="urn:iso:std:iso:3166"/>
      <code value="FR"/>
    </coding>
  </jurisdiction>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/Patient|4.0.1"/>
    <mode value="source"/>
    <alias value="EditeurPatient"/>
  </structure>
  <structure>
    <url value="http://hl7.org/fhir/StructureDefinition/Patient|4.0.1"/>
    <mode value="target"/>
    <alias value="CorePatientIpp"/>
  </structure>
  <group>
    <name value="NormalizeEditeurPatientToCorePatientIpp"/>
    <typeMode value="none"/>
    <input>
      <name value="src"/>
      <type value="EditeurPatient"/>
      <mode value="source"/>
    </input>
    <input>
      <name value="tgt"/>
      <type value="CorePatientIpp"/>
      <mode value="target"/>
    </input>
    <rule>
      <name value="setProfile"/>
      <source>
        <context value="src"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="meta"/>
        <variable value="m"/>
      </target>
      <target>
        <context value="m"/>
        <contextType value="variable"/>
        <element value="profile"/>
        <transform value="copy"/>
        <parameter>
          <valueString value="https://interop.aphp.fr/ig/fhir/core/StructureDefinition/core-patient-ipp"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="mapIdentifierGroup"/>
      <source>
        <context value="src"/>
        <element value="identifier"/>
        <variable value="srcId"/>
      </source>
      <rule>
        <name value="mapIdentifierValue"/>
        <source>
          <context value="srcId"/>
          <element value="value"/>
          <variable value="v"/>
        </source>
        <target>
          <context value="tgt"/>
          <contextType value="variable"/>
          <element value="identifier"/>
          <variable value="newId"/>
        </target>
        <target>
          <context value="newId"/>
          <contextType value="variable"/>
          <element value="use"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="usual"/>
          </parameter>
        </target>
        <target>
          <context value="newId"/>
          <contextType value="variable"/>
          <element value="system"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="https://interop.aphp.fr/info/Patient/ipp"/>
          </parameter>
        </target>
        <target>
          <context value="newId"/>
          <contextType value="variable"/>
          <element value="value"/>
          <transform value="copy"/>
          <parameter>
            <valueId value="v"/>
          </parameter>
        </target>
        <rule>
          <name value="setIdentifierType"/>
          <source>
            <context value="v"/>
          </source>
          <target>
            <context value="newId"/>
            <contextType value="variable"/>
            <element value="type"/>
            <variable value="t"/>
          </target>
          <rule>
            <name value="setIdentifierCoding"/>
            <source>
              <context value="v"/>
            </source>
            <target>
              <context value="t"/>
              <contextType value="variable"/>
              <element value="coding"/>
              <variable value="c"/>
            </target>
            <target>
              <context value="c"/>
              <contextType value="variable"/>
              <element value="system"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="http://terminology.hl7.org/CodeSystem/v2-0203"/>
              </parameter>
            </target>
            <target>
              <context value="c"/>
              <contextType value="variable"/>
              <element value="code"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="PI"/>
              </parameter>
            </target>
            <target>
              <context value="c"/>
              <contextType value="variable"/>
              <element value="display"/>
              <transform value="copy"/>
              <parameter>
                <valueString value="Patient internal identifier"/>
              </parameter>
            </target>
          </rule>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="mapNameGroup"/>
      <source>
        <context value="src"/>
        <element value="name"/>
        <variable value="srcName"/>
      </source>
      <rule>
        <name value="mapFamily"/>
        <source>
          <context value="srcName"/>
          <element value="family"/>
          <variable value="f"/>
        </source>
        <target>
          <context value="tgt"/>
          <contextType value="variable"/>
          <element value="name"/>
          <variable value="newName"/>
        </target>
        <target>
          <context value="newName"/>
          <contextType value="variable"/>
          <element value="use"/>
          <transform value="copy"/>
          <parameter>
            <valueString value="official"/>
          </parameter>
        </target>
        <target>
          <context value="newName"/>
          <contextType value="variable"/>
          <element value="family"/>
          <transform value="copy"/>
          <parameter>
            <valueId value="f"/>
          </parameter>
        </target>
        <rule>
          <name value="mapGiven"/>
          <source>
            <context value="srcName"/>
            <element value="given"/>
            <variable value="giv"/>
          </source>
          <target>
            <context value="newName"/>
            <contextType value="variable"/>
            <element value="given"/>
            <transform value="copy"/>
            <parameter>
              <valueId value="giv"/>
            </parameter>
          </target>
        </rule>
      </rule>
    </rule>
    <rule>
      <name value="mapGender"/>
      <source>
        <context value="src"/>
        <element value="gender"/>
        <variable value="g"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="gender"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="g"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="mapBirthDate"/>
      <source>
        <context value="src"/>
        <element value="birthDate"/>
        <variable value="bd"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="birthDate"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="bd"/>
        </parameter>
      </target>
    </rule>
    <rule>
      <name value="mapAddress"/>
      <source>
        <context value="src"/>
        <element value="address"/>
        <variable value="a"/>
      </source>
      <target>
        <context value="tgt"/>
        <contextType value="variable"/>
        <element value="address"/>
        <transform value="copy"/>
        <parameter>
          <valueId value="a"/>
        </parameter>
      </target>
    </rule>
  </group>
</StructureMap>