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