{
  "resourceType": "StructureDefinition",
  "url": "https://lpr.mcc.mayo.edu/fhir/StructureDefinition/Condition",
  "name": "LPR_Condition",
  "status": "draft",
  "fhirVersion": "4.0.1",
  "mapping": [
    {
      "identity": "Epic-HL7v2",
      "name": "Epic HL7v2"
    },
    {
      "identity": "LPR-System",
      "name": "LPR System"
    }
  ],
  "kind": "resource",
  "abstract": false,
  "type": "Condition",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Condition",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Condition.id",
        "path": "Condition.id",
        "min": 1,
        "mapping": [
          {
            "identity": "LPR-System",
            "map": "Server assigned"
          }
        ]
      },
      {
        "id": "Condition.meta",
        "path": "Condition.meta",
        "min": 1
      },
      {
        "id": "Condition.meta.versionId",
        "path": "Condition.meta.versionId",
        "min": 1,
        "mapping": [
          {
            "identity": "LPR-System",
            "map": "Managed by the FHIR server"
          }
        ]
      },
      {
        "id": "Condition.meta.lastUpdated",
        "path": "Condition.meta.lastUpdated",
        "min": 1,
        "mapping": [
          {
            "identity": "LPR-System",
            "map": "Set by server to the timestamp of the transaction that created/updated the resource"
          }
        ]
      },
      {
        "id": "Condition.meta.source",
        "path": "Condition.meta.source",
        "min": 1,
        "fixedUri": "http://terms.mayo.edu/mccfhir/systemid/mcc/datasource/epic"
      },
      {
        "id": "Condition.meta.profile",
        "path": "Condition.meta.profile",
        "max": "0"
      },
      {
        "id": "Condition.meta.tag",
        "path": "Condition.meta.tag",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "system"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "Condition.meta.tag:MessageTimestamp",
        "path": "Condition.meta.tag",
        "sliceName": "MessageTimestamp",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Condition.meta.tag:MessageTimestamp.system",
        "path": "Condition.meta.tag.system",
        "min": 1,
        "fixedUri": "http://terms.mayo.edu/mccfhir/hl7v2-timestamp"
      },
      {
        "id": "Condition.meta.tag:MessageTimestamp.version",
        "path": "Condition.meta.tag.version",
        "max": "0"
      },
      {
        "id": "Condition.meta.tag:MessageTimestamp.code",
        "path": "Condition.meta.tag.code",
        "min": 1,
        "mapping": [
          {
            "identity": "Epic-HL7v2",
            "map": "MSH-7"
          }
        ]
      },
      {
        "id": "Condition.meta.tag:MessageTimestamp.display",
        "path": "Condition.meta.tag.display",
        "max": "0"
      },
      {
        "id": "Condition.meta.tag:MessageTimestamp.userSelected",
        "path": "Condition.meta.tag.userSelected",
        "max": "0"
      },
      {
        "id": "Condition.meta.tag:MessageControlId",
        "path": "Condition.meta.tag",
        "sliceName": "MessageControlId",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Condition.meta.tag:MessageControlId.system",
        "path": "Condition.meta.tag.system",
        "min": 1,
        "fixedUri": "http://terms.mayo.edu/mccfhir/hl7v2-control-id"
      },
      {
        "id": "Condition.meta.tag:MessageControlId.version",
        "path": "Condition.meta.tag.version",
        "max": "0"
      },
      {
        "id": "Condition.meta.tag:MessageControlId.code",
        "path": "Condition.meta.tag.code",
        "min": 1,
        "mapping": [
          {
            "identity": "Epic-HL7v2",
            "map": "MSH-9.1"
          }
        ]
      },
      {
        "id": "Condition.meta.tag:MessageControlId.display",
        "path": "Condition.meta.tag.display",
        "max": "0"
      },
      {
        "id": "Condition.meta.tag:MessageControlId.userSelected",
        "path": "Condition.meta.tag.userSelected",
        "max": "0"
      },
      {
        "id": "Condition.meta.tag:prbCoding",
        "path": "Condition.meta.tag",
        "sliceName": "prbCoding",
        "max": "1"
      },
      {
        "id": "Condition.meta.tag:prbCoding.system",
        "path": "Condition.meta.tag.system",
        "min": 1,
        "mapping": [
          {
            "identity": "Epic-HL7v2",
            "map": "PRB-3.1, PRB-3.3",
            "comment": "The PRB-3.1 and PRB-3.3 will be combined into \"http://terms.mayo.edu/mccfhir/hl7v2-prb-<PRB-3.1>-<PRB-3.3>\""
          }
        ]
      },
      {
        "id": "Condition.meta.tag:prbCoding.version",
        "path": "Condition.meta.tag.version",
        "min": 1,
        "mapping": [
          {
            "identity": "Epic-HL7v2",
            "map": "MSH-10"
          }
        ]
      },
      {
        "id": "Condition.meta.tag:prbCoding.code",
        "path": "Condition.meta.tag.code",
        "min": 1,
        "mapping": [
          {
            "identity": "Epic-HL7v2",
            "map": "PRB-1"
          }
        ]
      },
      {
        "id": "Condition.meta.tag:prbCoding.display",
        "path": "Condition.meta.tag.display",
        "max": "0"
      },
      {
        "id": "Condition.meta.tag:prbCoding.userSelected",
        "path": "Condition.meta.tag.userSelected",
        "max": "0"
      },
      {
        "id": "Condition.implicitRules",
        "path": "Condition.implicitRules",
        "max": "0"
      },
      {
        "id": "Condition.language",
        "path": "Condition.language",
        "max": "0"
      },
      {
        "id": "Condition.text",
        "path": "Condition.text",
        "max": "0"
      },
      {
        "id": "Condition.contained",
        "path": "Condition.contained",
        "max": "0"
      },
      {
        "id": "Condition.identifier",
        "path": "Condition.identifier",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Condition.identifier.use",
        "path": "Condition.identifier.use",
        "max": "0"
      },
      {
        "id": "Condition.identifier.type",
        "path": "Condition.identifier.type",
        "max": "0"
      },
      {
        "id": "Condition.identifier.system",
        "path": "Condition.identifier.system",
        "min": 1,
        "fixedUri": "http://terms.mayo.edu/mccfhir/systemid/epic/condition_id"
      },
      {
        "id": "Condition.identifier.value",
        "path": "Condition.identifier.value",
        "min": 1,
        "mapping": [
          {
            "identity": "Epic-HL7v2",
            "map": "PRB-4"
          }
        ]
      },
      {
        "id": "Condition.identifier.period",
        "path": "Condition.identifier.period",
        "max": "0"
      },
      {
        "id": "Condition.identifier.assigner",
        "path": "Condition.identifier.assigner",
        "max": "0"
      },
      {
        "id": "Condition.clinicalStatus",
        "path": "Condition.clinicalStatus",
        "min": 1
      },
      {
        "id": "Condition.clinicalStatus.coding",
        "path": "Condition.clinicalStatus.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Condition.clinicalStatus.coding.system",
        "path": "Condition.clinicalStatus.coding.system",
        "min": 1,
        "fixedUri": "http://terminology.hl7.org/CodeSystem/condition-clinical"
      },
      {
        "id": "Condition.clinicalStatus.coding.version",
        "path": "Condition.clinicalStatus.coding.version",
        "max": "0"
      },
      {
        "id": "Condition.clinicalStatus.coding.code",
        "path": "Condition.clinicalStatus.coding.code",
        "min": 1,
        "mapping": [
          {
            "identity": "Epic-HL7v2",
            "map": "PRB-13",
            "comment": "Extract code from ConditionClinical based on lowercase(PRB-13) and map, throws exception IllegalArgumentException if invalid lowercase(PRB-13); If the value of PRB-13 is Deleted (case insensitive), map it as inactive (case sensitive; lowercase) instead."
          }
        ]
      },
      {
        "id": "Condition.clinicalStatus.coding.display",
        "path": "Condition.clinicalStatus.coding.display",
        "mapping": [
          {
            "identity": "Epic-HL7v2",
            "map": "PRB-13"
          }
        ]
      },
      {
        "id": "Condition.clinicalStatus.coding.userSelected",
        "path": "Condition.clinicalStatus.coding.userSelected",
        "max": "0"
      },
      {
        "id": "Condition.verificationStatus",
        "path": "Condition.verificationStatus",
        "min": 1
      },
      {
        "id": "Condition.verificationStatus.coding",
        "path": "Condition.verificationStatus.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Condition.verificationStatus.coding.system",
        "path": "Condition.verificationStatus.coding.system",
        "min": 1,
        "fixedUri": "http://terminology.hl7.org/CodeSystem/condition-ver-status"
      },
      {
        "id": "Condition.verificationStatus.coding.version",
        "path": "Condition.verificationStatus.coding.version",
        "max": "0"
      },
      {
        "id": "Condition.verificationStatus.coding.code",
        "path": "Condition.verificationStatus.coding.code",
        "min": 1,
        "mapping": [
          {
            "identity": "Epic-HL7v2",
            "map": "PRB-1",
            "comment": "If PRB-1 is blank, throw TransformException; If PRB-1 equals \"deleted\", this will be \"entered-in-error\"; Otherwise, this will be \"confirmed\""
          }
        ]
      },
      {
        "id": "Condition.verificationStatus.coding.display",
        "path": "Condition.verificationStatus.coding.display",
        "min": 1,
        "mapping": [
          {
            "identity": "Epic-HL7v2",
            "map": "PRB-1",
            "comment": "If PRB-1 is blank, throw TransformException; If PRB-1 equals \"DE\", this will be \"Entered in Error\"; Otherwise, this will be \"Confirmed\""
          }
        ]
      },
      {
        "id": "Condition.verificationStatus.coding.userSelected",
        "path": "Condition.verificationStatus.coding.userSelected",
        "max": "0"
      },
      {
        "id": "Condition.verificationStatus.text",
        "path": "Condition.verificationStatus.text",
        "max": "0"
      },
      {
        "id": "Condition.category",
        "path": "Condition.category",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Condition.category.coding",
        "path": "Condition.category.coding",
        "max": "0"
      },
      {
        "id": "Condition.category.text",
        "path": "Condition.category.text",
        "min": 1,
        "fixedString": "problem-list-item"
      },
      {
        "id": "Condition.severity",
        "path": "Condition.severity",
        "max": "0"
      },
      {
        "id": "Condition.code.coding.system",
        "path": "Condition.code.coding.system",
        "min": 1,
        "mapping": [
          {
            "identity": "Epic-HL7v2",
            "map": "PRB-3.3",
            "comment": "If PRB-3.3 equals \"I9\" then \"http://hl7.org/fhir/sid/icd-9-cm; Else if PRB-3.3 equals \"I10\" then \"http://hl7.org/fhir/sid/icd-10-cm; Else throw TransformException"
          }
        ]
      },
      {
        "id": "Condition.code.coding.version",
        "path": "Condition.code.coding.version",
        "max": "0"
      },
      {
        "id": "Condition.code.coding.code",
        "path": "Condition.code.coding.code",
        "mapping": [
          {
            "identity": "Epic-HL7v2",
            "map": "PRB-3.1",
            "comment": "Populate with PRB-3.1; If empty, throw TransformException; If \"UNKNOWNID\", populate with null"
          }
        ]
      },
      {
        "id": "Condition.code.coding.display",
        "path": "Condition.code.coding.display",
        "max": "0"
      },
      {
        "id": "Condition.code.coding.userSelected",
        "path": "Condition.code.coding.userSelected",
        "max": "0"
      },
      {
        "id": "Condition.code.text",
        "path": "Condition.code.text",
        "min": 1,
        "mapping": [
          {
            "identity": "Epic-HL7v2",
            "map": "PRB-3.2"
          }
        ]
      },
      {
        "id": "Condition.bodySite",
        "path": "Condition.bodySite",
        "max": "0"
      },
      {
        "id": "Condition.subject.reference",
        "path": "Condition.subject.reference",
        "min": 1,
        "mapping": [
          {
            "identity": "LPR-System",
            "map": "The literal reference is constructed as Patient/<resource id> where the resource id is determined by querying the FHIR store for the subject.identifier value and subject.identifier.system value provided by the mapper."
          }
        ]
      },
      {
        "id": "Condition.subject.type",
        "path": "Condition.subject.type",
        "max": "0"
      },
      {
        "id": "Condition.subject.identifier",
        "path": "Condition.subject.identifier",
        "min": 1
      },
      {
        "id": "Condition.subject.identifier.use",
        "path": "Condition.subject.identifier.use",
        "max": "0"
      },
      {
        "id": "Condition.subject.identifier.type",
        "path": "Condition.subject.identifier.type",
        "max": "0"
      },
      {
        "id": "Condition.subject.identifier.system",
        "path": "Condition.subject.identifier.system",
        "min": 1,
        "fixedUri": "http://terms.mayo.edu/mccfhir/systemid/epic/mayo_clinic_number"
      },
      {
        "id": "Condition.subject.identifier.value",
        "path": "Condition.subject.identifier.value",
        "min": 1,
        "mapping": [
          {
            "identity": "Epic-HL7v2",
            "map": "PID-3.1",
            "comment": "Mapped from PID-3.1 during ingest, but removed and replaced by the subject literal reference."
          }
        ]
      },
      {
        "id": "Condition.subject.identifier.period",
        "path": "Condition.subject.identifier.period",
        "max": "0"
      },
      {
        "id": "Condition.subject.identifier.assigner",
        "path": "Condition.subject.identifier.assigner",
        "max": "0"
      },
      {
        "id": "Condition.encounter.reference",
        "path": "Condition.encounter.reference",
        "max": "0"
      },
      {
        "id": "Condition.encounter.type",
        "path": "Condition.encounter.type",
        "max": "0"
      },
      {
        "id": "Condition.encounter.identifier",
        "path": "Condition.encounter.identifier",
        "min": 1
      },
      {
        "id": "Condition.encounter.identifier.use",
        "path": "Condition.encounter.identifier.use",
        "max": "0"
      },
      {
        "id": "Condition.encounter.identifier.type",
        "path": "Condition.encounter.identifier.type",
        "max": "0"
      },
      {
        "id": "Condition.encounter.identifier.system",
        "path": "Condition.encounter.identifier.system",
        "min": 1,
        "fixedUri": "http://terms.mayo.edu/mccfhir/systemid/epic/csn"
      },
      {
        "id": "Condition.encounter.identifier.value",
        "path": "Condition.encounter.identifier.value",
        "min": 1,
        "mapping": [
          {
            "identity": "Epic-HL7v2",
            "map": "PV1-19"
          }
        ]
      },
      {
        "id": "Condition.encounter.identifier.period",
        "path": "Condition.encounter.identifier.period",
        "max": "0"
      },
      {
        "id": "Condition.encounter.identifier.assigner",
        "path": "Condition.encounter.identifier.assigner",
        "max": "0"
      },
      {
        "id": "Condition.encounter.display",
        "path": "Condition.encounter.display",
        "max": "0"
      },
      {
        "id": "Condition.onset[x]",
        "path": "Condition.onset[x]",
        "type": [
          {
            "code": "dateTime"
          }
        ],
        "mapping": [
          {
            "identity": "Epic-HL7v2",
            "map": "PRB-16",
            "comment": "If PRB-16 is empty, do not map\\nsadf"
          }
        ]
      },
      {
        "id": "Condition.abatement[x]",
        "path": "Condition.abatement[x]",
        "type": [
          {
            "code": "dateTime"
          }
        ],
        "mapping": [
          {
            "identity": "Epic-HL7v2",
            "map": "PRB-9"
          }
        ]
      },
      {
        "id": "Condition.recordedDate",
        "path": "Condition.recordedDate",
        "mapping": [
          {
            "identity": "Epic-HL7v2",
            "map": "PRB-7",
            "comment": "If PRB-7 is empty, do not map"
          }
        ]
      },
      {
        "id": "Condition.recorder",
        "path": "Condition.recorder",
        "max": "0"
      },
      {
        "id": "Condition.asserter",
        "path": "Condition.asserter",
        "mapping": [
          {
            "identity": "Epic-HL7v2",
            "map": "If EVN-5 is empty, this attribute will not be set"
          }
        ]
      },
      {
        "id": "Condition.asserter.reference",
        "path": "Condition.asserter.reference",
        "max": "0"
      },
      {
        "id": "Condition.asserter.type",
        "path": "Condition.asserter.type",
        "max": "0"
      },
      {
        "id": "Condition.asserter.identifier",
        "path": "Condition.asserter.identifier",
        "min": 1,
        "mapping": [
          {
            "identity": "Epic-HL7v2",
            "map": "This attribute will not be populated if EVN-5.1 is empty\nSee child elements for details.\nSee child attributes for additional mapping logic."
          }
        ]
      },
      {
        "id": "Condition.asserter.identifier.use",
        "path": "Condition.asserter.identifier.use",
        "max": "0"
      },
      {
        "id": "Condition.asserter.identifier.type",
        "path": "Condition.asserter.identifier.type",
        "max": "0"
      },
      {
        "id": "Condition.asserter.identifier.system",
        "path": "Condition.asserter.identifier.system",
        "min": 1,
        "fixedUri": "http://terms.mayo.edu/mccfhir/systemid/epic/perid"
      },
      {
        "id": "Condition.asserter.identifier.value",
        "path": "Condition.asserter.identifier.value",
        "min": 1,
        "mapping": [
          {
            "identity": "Epic-HL7v2",
            "map": "EVN-5.1"
          }
        ]
      },
      {
        "id": "Condition.asserter.identifier.period",
        "path": "Condition.asserter.identifier.period",
        "max": "0"
      },
      {
        "id": "Condition.asserter.identifier.assigner",
        "path": "Condition.asserter.identifier.assigner",
        "max": "0"
      },
      {
        "id": "Condition.asserter.display",
        "path": "Condition.asserter.display",
        "max": "0"
      },
      {
        "id": "Condition.stage",
        "path": "Condition.stage",
        "max": "0"
      },
      {
        "id": "Condition.evidence",
        "path": "Condition.evidence",
        "max": "0"
      },
      {
        "id": "Condition.note",
        "path": "Condition.note",
        "max": "1",
        "mapping": [
          {
            "identity": "Epic-HL7v2",
            "map": "NTE-3",
            "comment": "See children attributes for details\nSee child attributes for additional mapping logic."
          }
        ]
      },
      {
        "id": "Condition.note.author[x]",
        "path": "Condition.note.author[x]",
        "max": "0"
      },
      {
        "id": "Condition.note.time",
        "path": "Condition.note.time",
        "max": "0"
      },
      {
        "id": "Condition.note.text",
        "path": "Condition.note.text",
        "mapping": [
          {
            "identity": "Epic-HL7v2",
            "map": "For each NTE-3 in order following the PRB segment, concatenate the NTE-3 value plus \"\\r\\n\".\nBlank NTE-3 are included (mapped to \"\\r\\n\") in the concatenation"
          }
        ]
      }
    ]
  }
}