<StructureDefinition xmlns="http://hl7.org/fhir">
  <url value="https://lpr.mcc.mayo.edu/fhir/StructureDefinition/AllergyIntolerance" />
  <name value="AllergyIntolerance" />
  <status value="draft" />
  <fhirVersion value="4.0.1" />
  <mapping>
    <identity value="Epic-HL7v2" />
    <name value="Epic HL7v2" />
  </mapping>
  <mapping>
    <identity value="LPR-System" />
    <name value="LPR System" />
  </mapping>
  <kind value="resource" />
  <abstract value="false" />
  <type value="AllergyIntolerance" />
  <baseDefinition value="http://hl7.org/fhir/us/core/StructureDefinition/us-core-allergyintolerance" />
  <derivation value="constraint" />
  <snapshot />
  <differential>
    <element id="AllergyIntolerance.id">
      <path value="AllergyIntolerance.id" />
      <mapping>
        <identity value="LPR-System" />
        <map value="Server assigned" />
      </mapping>
    </element>
    <element id="AllergyIntolerance.meta">
      <path value="AllergyIntolerance.meta" />
    </element>
    <element id="AllergyIntolerance.meta.versionId">
      <path value="AllergyIntolerance.meta.versionId" />
      <min value="1" />
      <mapping>
        <identity value="LPR-System" />
        <map value="Managed by the FHIR server" />
      </mapping>
    </element>
    <element id="AllergyIntolerance.meta.lastUpdated">
      <path value="AllergyIntolerance.meta.lastUpdated" />
      <min value="1" />
      <mapping>
        <identity value="LPR-System" />
        <map value="Set by server to the timestamp of the transaction that created/updated the resource" />
      </mapping>
    </element>
    <element id="AllergyIntolerance.meta.source">
      <path value="AllergyIntolerance.meta.source" />
      <min value="1" />
      <fixedUri value="http://terms.mayo.edu/mccfhir/systemid/mcc/datasource/epic" />
      <mapping>
        <identity value="LPR-System" />
        <map value="Fixed value" />
      </mapping>
    </element>
    <element id="AllergyIntolerance.meta.profile">
      <path value="AllergyIntolerance.meta.profile" />
      <max value="0" />
    </element>
    <element id="AllergyIntolerance.meta.tag">
      <path value="AllergyIntolerance.meta.tag" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="system" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <min value="2" />
    </element>
    <element id="AllergyIntolerance.meta.tag:MessageTimestamp">
      <path value="AllergyIntolerance.meta.tag" />
      <sliceName value="MessageTimestamp" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="AllergyIntolerance.meta.tag:MessageTimestamp.system">
      <path value="AllergyIntolerance.meta.tag.system" />
      <min value="1" />
      <fixedUri value="http://terms.mayo.edu/mccfhir/hl7v2-timestamp" />
    </element>
    <element id="AllergyIntolerance.meta.tag:MessageTimestamp.code">
      <path value="AllergyIntolerance.meta.tag.code" />
      <min value="1" />
      <mapping>
        <identity value="LPR-System" />
        <map value="MSH-7" />
      </mapping>
    </element>
    <element id="AllergyIntolerance.meta.tag:MessageControlId">
      <path value="AllergyIntolerance.meta.tag" />
      <sliceName value="MessageControlId" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="AllergyIntolerance.meta.tag:MessageControlId.system">
      <path value="AllergyIntolerance.meta.tag.system" />
      <min value="1" />
      <fixedUri value="http://terms.mayo.edu/mccfhir/hl7v2-control-id" />
    </element>
    <element id="AllergyIntolerance.meta.tag:MessageControlId.code">
      <path value="AllergyIntolerance.meta.tag.code" />
      <min value="1" />
      <mapping>
        <identity value="LPR-System" />
        <map value="MSH-9.1" />
      </mapping>
    </element>
    <element id="AllergyIntolerance.implicitRules">
      <path value="AllergyIntolerance.implicitRules" />
      <max value="0" />
    </element>
    <element id="AllergyIntolerance.language">
      <path value="AllergyIntolerance.language" />
      <max value="0" />
    </element>
    <element id="AllergyIntolerance.text">
      <path value="AllergyIntolerance.text" />
      <max value="0" />
    </element>
    <element id="AllergyIntolerance.contained">
      <path value="AllergyIntolerance.contained" />
      <max value="0" />
    </element>
    <element id="AllergyIntolerance.identifier.id">
      <path value="AllergyIntolerance.identifier.id" />
      <max value="0" />
    </element>
    <element id="AllergyIntolerance.identifier.use">
      <path value="AllergyIntolerance.identifier.use" />
      <min value="1" />
      <fixedCode value="usual" />
    </element>
    <element id="AllergyIntolerance.identifier.type">
      <path value="AllergyIntolerance.identifier.type" />
      <min value="1" />
    </element>
    <element id="AllergyIntolerance.identifier.type.coding">
      <path value="AllergyIntolerance.identifier.type.coding" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="AllergyIntolerance.identifier.type.coding.system">
      <path value="AllergyIntolerance.identifier.type.coding.system" />
      <min value="1" />
      <fixedUri value="http://terms.mayo.edu/mccfhir/systemid/mcc/assigned_identifier" />
    </element>
    <element id="AllergyIntolerance.identifier.type.coding.version">
      <path value="AllergyIntolerance.identifier.type.coding.version" />
      <max value="0" />
    </element>
    <element id="AllergyIntolerance.identifier.type.coding.code">
      <path value="AllergyIntolerance.identifier.type.coding.code" />
      <min value="1" />
      <fixedCode value="allergy" />
    </element>
    <element id="AllergyIntolerance.identifier.type.coding.display">
      <path value="AllergyIntolerance.identifier.type.coding.display" />
      <min value="1" />
      <fixedString value="Allergy Identifie" />
    </element>
    <element id="AllergyIntolerance.identifier.type.coding.userSelected">
      <path value="AllergyIntolerance.identifier.type.coding.userSelected" />
      <max value="0" />
    </element>
    <element id="AllergyIntolerance.identifier.type.text">
      <path value="AllergyIntolerance.identifier.type.text" />
      <min value="1" />
      <fixedString value="Allergy Identifier" />
    </element>
    <element id="AllergyIntolerance.identifier.system">
      <path value="AllergyIntolerance.identifier.system" />
      <min value="1" />
      <fixedUri value="http://terms.mayo.edu/mccfhir/systemid/epic/allergy_id" />
    </element>
    <element id="AllergyIntolerance.identifier.value">
      <path value="AllergyIntolerance.identifier.value" />
      <min value="1" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="PID-3.1, AL1-3.6, AL1-3.4, AL1-3.3, AL1-3.1, ZAL-3.3, ZAL-3.1" />
        <comment value="Check the following fields in order to identify the Epic internal code: AL1-3.6 is not empty -&gt; Use AL1-3.4 for code; AL1-3.3 is not empty -&gt; Use AL1-3.1 for code; ZAL-3.3 is not empty -&gt; Use ZAL-3.1 for code (Repeat for all ZAL-3 repetitions); Store the Epic code as the code for the AllergyIntolerance -- If no internal Epic identifier is discovered throw an error; Attempt to translate the code into a standard code detail; Build identifier value by concatenating with this pattern: &lt;PID-3.1&gt;_EPIC_&lt;CODE&gt;" />
      </mapping>
    </element>
    <element id="AllergyIntolerance.identifier.period">
      <path value="AllergyIntolerance.identifier.period" />
      <max value="0" />
    </element>
    <element id="AllergyIntolerance.identifier.assigner">
      <path value="AllergyIntolerance.identifier.assigner" />
      <max value="0" />
    </element>
    <element id="AllergyIntolerance.clinicalStatus">
      <path value="AllergyIntolerance.clinicalStatus" />
      <comment value="During reconciliation, clinicalStatus is cleared if verificationStatus is set to &quot;entered-in-error&quot;." />
    </element>
    <element id="AllergyIntolerance.clinicalStatus.coding.system">
      <path value="AllergyIntolerance.clinicalStatus.coding.system" />
      <comment value="During reconciliation, clinicalStatus is cleared if verificationStatus is set to &quot;entered-in-error&quot;." />
      <fixedUri value="http://terminology.hl7.org/CodeSystem/allergyintolerance-clinical" />
    </element>
    <element id="AllergyIntolerance.clinicalStatus.coding.version">
      <path value="AllergyIntolerance.clinicalStatus.coding.version" />
      <max value="0" />
    </element>
    <element id="AllergyIntolerance.clinicalStatus.coding.code">
      <path value="AllergyIntolerance.clinicalStatus.coding.code" />
      <comment value="During reconciliation, clinicalStatus is cleared if verificationStatus is set to &quot;entered-in-error&quot;." />
      <fixedCode value="active" />
    </element>
    <element id="AllergyIntolerance.clinicalStatus.coding.display">
      <path value="AllergyIntolerance.clinicalStatus.coding.display" />
      <comment value="During reconciliation, clinicalStatus is cleared if verificationStatus is set to &quot;entered-in-error&quot;." />
      <fixedString value="Active" />
    </element>
    <element id="AllergyIntolerance.clinicalStatus.coding.userSelected">
      <path value="AllergyIntolerance.clinicalStatus.coding.userSelected" />
      <max value="0" />
    </element>
    <element id="AllergyIntolerance.clinicalStatus.text">
      <path value="AllergyIntolerance.clinicalStatus.text" />
      <comment value="During reconciliation, clinicalStatus is cleared if verificationStatus is set to &quot;entered-in-error&quot;." />
      <fixedString value="Active" />
    </element>
    <element id="AllergyIntolerance.verificationStatus">
      <path value="AllergyIntolerance.verificationStatus" />
      <comment value="Set during reconcilation if the AllergyIntolerance resource is to be marked deleted (entered-in-error)." />
    </element>
    <element id="AllergyIntolerance.verificationStatus.coding">
      <path value="AllergyIntolerance.verificationStatus.coding" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="AllergyIntolerance.verificationStatus.coding.system">
      <path value="AllergyIntolerance.verificationStatus.coding.system" />
      <comment value="Set during reconcilation if the AllergyIntolerance resource is to be marked deleted (entered-in-error)." />
      <min value="1" />
      <fixedUri value="http://terminology.hl7.org/CodeSystem/allergyintolerance-verification" />
    </element>
    <element id="AllergyIntolerance.verificationStatus.coding.code">
      <path value="AllergyIntolerance.verificationStatus.coding.code" />
      <comment value="Set during reconcilation if the AllergyIntolerance resource is to be marked deleted (entered-in-error)." />
      <min value="1" />
      <fixedCode value="entered-in-error" />
    </element>
    <element id="AllergyIntolerance.verificationStatus.coding.display">
      <path value="AllergyIntolerance.verificationStatus.coding.display" />
      <comment value="Set during reconcilation if the AllergyIntolerance resource is to be marked deleted (entered-in-error)." />
      <min value="1" />
      <fixedString value="Entered in Error" />
    </element>
    <element id="AllergyIntolerance.verificationStatus.coding.userSelected">
      <path value="AllergyIntolerance.verificationStatus.coding.userSelected" />
      <max value="0" />
    </element>
    <element id="AllergyIntolerance.verificationStatus.text">
      <path value="AllergyIntolerance.verificationStatus.text" />
      <definition value="Set during reconcilation if the AllergyIntolerance resource is to be marked deleted (entered-in-error)." />
      <fixedString value="Entered in Error" />
    </element>
    <element id="AllergyIntolerance.type">
      <path value="AllergyIntolerance.type" />
      <max value="0" />
    </element>
    <element id="AllergyIntolerance.category">
      <path value="AllergyIntolerance.category" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="AL1-2" />
        <comment value="Loop on each AL1-2 repetition&#xA;If the AL1-2 repetition value exists attempt to translate the code&#xA;If the code cannot be translated then ignore this repetition&#xA;If the input does not have an entry in the Concept Map, execute the following action: Log and throw exception" />
      </mapping>
    </element>
    <element id="AllergyIntolerance.criticality">
      <path value="AllergyIntolerance.criticality" />
      <max value="0" />
    </element>
    <element id="AllergyIntolerance.code">
      <path value="AllergyIntolerance.code" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="If the input does not have an entry in the Concept Map, execute the following action: Use incoming values as-is&#xA;See child attributes for additional mapping logic." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.code.coding">
      <path value="AllergyIntolerance.code.coding" />
      <min value="1" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="See child attributes for additional mapping logic." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.code.coding.code">
      <path value="AllergyIntolerance.code.coding.code" />
      <min value="1" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="AL1-3.6, AL1-3.4, AL1-3.3, AL1-3.1, ZAL-3.3, ZAL-3.1" />
        <comment value="Check the following fields in order to identify the Epic internal code:&#xA;-- AL1-3.6 is not empty -&gt; Use AL1-3.4 for EPIC_CODE&#xA;-- AL1-3.3 is not empty -&gt; Use AL1-3.1 for EPIC_CODE&#xA;-- ZAL-3.3 is not empty -&gt; Use ZAL-3.1 for EPIC_CODE (Repeat for all ZAL-3 repetitions)&#xA;If no EPIC_CODE is discovered throw an error&#xA;Store the EPIC_CODE as a code for the AllergyIntolerance&#xA;Attempt to translate the code into a standard code detail for the Epic code -- If no translation is found then use the EPIC_CODE as-is and log this for tracking&#xA;Assign the other non-Epic codes to the AllergyIntolerance as well&#xA;If the input does not have an entry in the Concept Map, execute the following action: Use incoming values as-is" />
      </mapping>
    </element>
    <element id="AllergyIntolerance.code.coding.display">
      <path value="AllergyIntolerance.code.coding.display" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="AL1-3.5, AL1-3.2, ZAL-3.2" />
        <comment value="See code.coding[].code for logic on identifying EPIC_CODE and translation&#xA;For EPIC_CODE use either the translated display value if it exists or the as-is display&#xA;For non EPIC_CODE items do not set display&#xA;If the input does not have an entry in the Concept Map, execute the following action: Use incoming values as-is" />
      </mapping>
    </element>
    <element id="AllergyIntolerance.code.coding.system">
      <path value="AllergyIntolerance.code.coding.system" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="uri" />
      </type>
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="For Epic coded items use &quot;http://terms.mayo.edu/mccfhir/codesystem/EPIC_ALLERGEN&quot;&#xA;For RxNorm coded items use &quot;http://www.nlm.nih.gov/research/umls/rxnorm&quot;&#xA;For SNOMED coded items use &quot;http://snomed.info/sct&quot;" />
      </mapping>
    </element>
    <element id="AllergyIntolerance.code.text">
      <path value="AllergyIntolerance.code.text" />
      <min value="1" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="Use the code.coding[].display for the code.text" />
      </mapping>
    </element>
    <element id="AllergyIntolerance.patient.reference">
      <path value="AllergyIntolerance.patient.reference" />
      <min value="1" />
    </element>
    <element id="AllergyIntolerance.patient.type">
      <path value="AllergyIntolerance.patient.type" />
      <max value="0" />
    </element>
    <element id="AllergyIntolerance.patient.identifier">
      <path value="AllergyIntolerance.patient.identifier" />
      <max value="0" />
    </element>
    <element id="AllergyIntolerance.patient.display">
      <path value="AllergyIntolerance.patient.display" />
      <max value="0" />
    </element>
    <element id="AllergyIntolerance.encounter">
      <path value="AllergyIntolerance.encounter" />
      <max value="0" />
    </element>
    <element id="AllergyIntolerance.onset[x]">
      <path value="AllergyIntolerance.onset[x]" />
      <type>
        <code value="dateTime" />
      </type>
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="AL1-6" />
        <comment value="If the current AL1-6 date is before the existing onset date for an AllergyIntolerance then assign the current value." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.recordedDate">
      <path value="AllergyIntolerance.recordedDate" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="ZAL-13" />
        <comment value="If the current ZAL-13 date is before the existing recorded date for an AllergyIntolerance then assign the current value." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.lastOccurrence">
      <path value="AllergyIntolerance.lastOccurrence" />
      <max value="0" />
    </element>
    <element id="AllergyIntolerance.note">
      <path value="AllergyIntolerance.note" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="Multiple NTE segments on a record will result in multiple note elements with a single text&#xA;See child attributes for additional mapping logic." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.note.text">
      <path value="AllergyIntolerance.note.text" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="NTE-3" />
      </mapping>
    </element>
    <element id="AllergyIntolerance.reaction">
      <path value="AllergyIntolerance.reaction" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="See child attributes for additional mapping logic." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.reaction.substance">
      <path value="AllergyIntolerance.reaction.substance" />
      <max value="0" />
    </element>
    <element id="AllergyIntolerance.reaction.manifestation">
      <path value="AllergyIntolerance.reaction.manifestation" />
      <max value="1" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="See child attributes for additional mapping logic." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.reaction.manifestation.coding">
      <extension url="https://lpr.mcc.mayo.edu/fhir/StructureDefinition/Extension-ConceptMap">
        <valueUri value="http://terms.mayo.edu/mccfhir/translate/epic.reaction.name.to.code" />
      </extension>
      <path value="AllergyIntolerance.reaction.manifestation.coding" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="AllergyIntolerance.reaction.manifestation.coding.system">
      <path value="AllergyIntolerance.reaction.manifestation.coding.system" />
      <min value="1" />
      <fixedUri value="http://terms.mayo.edu/mccfhir/codesystem/EPIC_REACTION" />
    </element>
    <element id="AllergyIntolerance.reaction.manifestation.coding.version">
      <path value="AllergyIntolerance.reaction.manifestation.coding.version" />
      <max value="0" />
    </element>
    <element id="AllergyIntolerance.reaction.manifestation.coding.code">
      <path value="AllergyIntolerance.reaction.manifestation.coding.code" />
      <min value="1" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="AL1-5" />
        <comment value="If the input does not have an entry in the Concept Map, execute the following action: Log warning and skip reaction" />
      </mapping>
    </element>
    <element id="AllergyIntolerance.reaction.manifestation.coding.display">
      <path value="AllergyIntolerance.reaction.manifestation.coding.display" />
      <min value="1" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="AL1-5" />
        <comment value="If the input does not have an entry in the Concept Map, execute the following action: Log warning and skip reaction" />
      </mapping>
    </element>
    <element id="AllergyIntolerance.reaction.manifestation.coding.userSelected">
      <path value="AllergyIntolerance.reaction.manifestation.coding.userSelected" />
      <max value="0" />
    </element>
    <element id="AllergyIntolerance.reaction.description">
      <path value="AllergyIntolerance.reaction.description" />
      <max value="0" />
    </element>
    <element id="AllergyIntolerance.reaction.onset">
      <path value="AllergyIntolerance.reaction.onset" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="AL1-6" />
        <comment value="If there is no onset in AL1-6 then skip this element for this specific reaction." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.reaction.severity">
      <path value="AllergyIntolerance.reaction.severity" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="AL1-4" />
        <comment value="If there is no severity in AL1-4 then skip this element for this specific reaction.&#xA;If the mapped severity cannot be converted into a value from the &quot;http://hl7.org/fhir/ValueSet/reaction-event-severity&quot; value set then log an error&#xA;If the input does not have an entry in the Concept Map, execute the following action: Log error for issue tracking but continue with mapping" />
      </mapping>
    </element>
    <element id="AllergyIntolerance.reaction.exposureRoute">
      <path value="AllergyIntolerance.reaction.exposureRoute" />
      <max value="0" />
    </element>
    <element id="AllergyIntolerance.reaction.note">
      <path value="AllergyIntolerance.reaction.note" />
      <max value="0" />
    </element>
    <element id="AllergyIntolerance.clinicalStatus">
      <path value="AllergyIntolerance.clinicalStatus" />
      <comment value="During reconciliation, clinicalStatus is cleared if verificationStatus is set to &quot;entered-in-error&quot;." />
      <max value="1" />
      <type>
        <code value="CodeableConcept" />
      </type>
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="See child attributes for additional mapping logic." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.clinicalStatus.coding">
      <path value="AllergyIntolerance.clinicalStatus.coding" />
      <comment value="During reconciliation, clinicalStatus is cleared if verificationStatus is set to &quot;entered-in-error&quot;." />
      <min value="1" />
      <max value="1" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="See child attributes for additional mapping logic." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.clinicalStatus.coding.code">
      <path value="AllergyIntolerance.clinicalStatus.coding.code" />
      <comment value="During reconciliation, clinicalStatus is cleared if verificationStatus is set to &quot;entered-in-error&quot;." />
      <min value="1" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="Hard coded to constant value." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.clinicalStatus.coding.display">
      <path value="AllergyIntolerance.clinicalStatus.coding.display" />
      <comment value="During reconciliation, clinicalStatus is cleared if verificationStatus is set to &quot;entered-in-error&quot;." />
      <min value="1" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="Hard coded to constant value." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.clinicalStatus.coding.system">
      <path value="AllergyIntolerance.clinicalStatus.coding.system" />
      <comment value="During reconciliation, clinicalStatus is cleared if verificationStatus is set to &quot;entered-in-error&quot;." />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="uri" />
      </type>
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="Hard coded to constant value." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.clinicalStatus.text">
      <path value="AllergyIntolerance.clinicalStatus.text" />
      <comment value="During reconciliation, clinicalStatus is cleared if verificationStatus is set to &quot;entered-in-error&quot;." />
      <min value="1" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="Hard coded to constant value." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.id">
      <path value="AllergyIntolerance.id" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="string" />
      </type>
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="Server assigned" />
      </mapping>
    </element>
    <element id="AllergyIntolerance.identifier">
      <path value="AllergyIntolerance.identifier" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Identifier" />
      </type>
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="See identifier.value for specifics of identifying the single identifier instance&#xA;See child attributes for additional mapping logic." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.identifier.system">
      <path value="AllergyIntolerance.identifier.system" />
      <min value="1" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="Hard coded to constant value." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.identifier.value">
      <path value="AllergyIntolerance.identifier.value" />
      <min value="1" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="PID-3.1, AL1-3.6, AL1-3.4, AL1-3.3, AL1-3.1, ZAL-3.3, ZAL-3.1" />
        <comment value="Check the following fields in order to identify the Epic internal code&#xA;-- AL1-3.6 is not empty -&gt; Use AL1-3.4 for code&#xA;-- AL1-3.3 is not empty -&gt; Use AL1-3.1 for code&#xA;-- ZAL-3.3 is not empty -&gt; Use ZAL-3.1 for code (Repeat for all ZAL-3 repetitions)&#xA;Store the Epic code as the code for the AllergyIntolerance -- If no internal Epic identifier is discovered throw an error&#xA;Attempt to translate the code into a standard code detail&#xA;Build identifier value by concatenating with this pattern: `&lt;PID-3.1&gt;_EPIC_&lt;CODE&gt;`" />
      </mapping>
    </element>
    <element id="AllergyIntolerance.identifier.type">
      <path value="AllergyIntolerance.identifier.type" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="CodeableConcept" />
      </type>
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="See child attributes for additional mapping logic." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.identifier.type.coding">
      <path value="AllergyIntolerance.identifier.type.coding" />
      <min value="1" />
      <max value="1" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="See child attributes for additional mapping logic." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.identifier.type.coding.code">
      <path value="AllergyIntolerance.identifier.type.coding.code" />
      <min value="1" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="Hard coded to constant value." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.identifier.type.coding.display">
      <path value="AllergyIntolerance.identifier.type.coding.display" />
      <min value="1" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="Hard coded to constant value." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.identifier.type.coding.system">
      <path value="AllergyIntolerance.identifier.type.coding.system" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="uri" />
      </type>
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="Hard coded to constant value." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.identifier.type.text">
      <path value="AllergyIntolerance.identifier.type.text" />
      <min value="1" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="Hard coded to constant value." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.identifier.use">
      <path value="AllergyIntolerance.identifier.use" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="code" />
      </type>
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="Hard coded to constant value." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.meta">
      <path value="AllergyIntolerance.meta" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Meta" />
      </type>
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="See child attributes for additional mapping logic." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.meta.lastUpdated">
      <path value="AllergyIntolerance.meta.lastUpdated" />
      <min value="1" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="Set by server to the timestamp of the transaction that created/updated the resource" />
      </mapping>
    </element>
    <element id="AllergyIntolerance.meta.source">
      <path value="AllergyIntolerance.meta.source" />
      <min value="1" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="Hard coded to constant value." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.meta.versionId">
      <path value="AllergyIntolerance.meta.versionId" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="id" />
      </type>
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="Managed by the FHIR server" />
      </mapping>
    </element>
    <element id="AllergyIntolerance.onsetDateTime">
      <path value="AllergyIntolerance.onsetDateTime" />
      <max value="1" />
      <type>
        <code value="dateTime" />
      </type>
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="AL1-6" />
        <comment value="If the current AL1-6 date is before the existing onset date for an AllergyIntolerance then assign the current value." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.patient">
      <path value="AllergyIntolerance.patient" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Reference" />
      </type>
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="See child attributes for additional mapping logic." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.patient.identifier">
      <path value="AllergyIntolerance.patient.identifier" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="See child attributes for additional mapping logic." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.patient.identifier.system">
      <path value="AllergyIntolerance.patient.identifier.system" />
      <min value="1" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="Hard coded to constant value." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.patient.identifier.value">
      <path value="AllergyIntolerance.patient.identifier.value" />
      <min value="1" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="PID-3.1" />
      </mapping>
    </element>
    <element id="AllergyIntolerance.patient.reference">
      <path value="AllergyIntolerance.patient.reference" />
      <comment value="Translate this identifier into a direct reference to the Patient resource." />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="string" />
      </type>
    </element>
    <element id="AllergyIntolerance.patient.type">
      <path value="AllergyIntolerance.patient.type" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="uri" />
      </type>
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="Hard coded to constant value." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.recordedDate">
      <path value="AllergyIntolerance.recordedDate" />
      <max value="1" />
      <type>
        <code value="dateTime" />
      </type>
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="ZAL-13" />
        <comment value="If the current ZAL-13 date is before the existing recorded date for an AllergyIntolerance then assign the current value." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.verificationStatus">
      <path value="AllergyIntolerance.verificationStatus" />
      <comment value="Set during reconcilation if the AllergyIntolerance resource is to be marked deleted (entered-in-error)." />
      <max value="1" />
      <type>
        <code value="CodeableConcept" />
      </type>
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="See child attributes for additional mapping logic." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.verificationStatus.coding">
      <path value="AllergyIntolerance.verificationStatus.coding" />
      <comment value="Set during reconcilation if the AllergyIntolerance resource is to be marked deleted (entered-in-error)." />
      <min value="1" />
      <max value="1" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="See child attributes for additional mapping logic." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.verificationStatus.coding.code">
      <path value="AllergyIntolerance.verificationStatus.coding.code" />
      <comment value="Set during reconcilation if the AllergyIntolerance resource is to be marked deleted (entered-in-error)." />
      <min value="1" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="Hard coded to constant value." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.verificationStatus.coding.display">
      <path value="AllergyIntolerance.verificationStatus.coding.display" />
      <comment value="Set during reconcilation if the AllergyIntolerance resource is to be marked deleted (entered-in-error)." />
      <min value="1" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="Hard coded to constant value." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.verificationStatus.coding.system">
      <path value="AllergyIntolerance.verificationStatus.coding.system" />
      <comment value="Set during reconcilation if the AllergyIntolerance resource is to be marked deleted (entered-in-error)." />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="uri" />
      </type>
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="Hard coded to constant value." />
      </mapping>
    </element>
    <element id="AllergyIntolerance.verificationStatus.text">
      <path value="AllergyIntolerance.verificationStatus.text" />
      <comment value="Set during reconcilation if the AllergyIntolerance resource is to be marked deleted (entered-in-error)." />
      <min value="1" />
      <mapping>
        <identity value="Epic-HL7v2" />
        <map value="Hard coded to constant value." />
      </mapping>
    </element>
  </differential>
</StructureDefinition>