{
  "resourceType": "StructureDefinition",
  "id": "allergyintolerance-substanceExposureRisk",
  "extension": [
    {
      "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg",
      "valueCode": "pc"
    },
    {
      "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm",
      "valueInteger": 1
    }
  ],
  "url": "http://hl7.org/fhir/StructureDefinition/allergyintolerance-substanceExposureRisk",
  "name": "substanceExposureRisk",
  "title": "substanceExposureRisk",
  "status": "draft",
  "date": "2015-02-21",
  "publisher": "Health Level Seven, Inc. - FHIR WG",
  "contact": [
    {
      "telecom": [
        {
          "system": "url",
          "value": "HL7"
        }
      ]
    }
  ],
  "description": "A complex extension allowing structured capture of the exposure risk of the patient for an adverse reaction (allergy or intolerance) to the specified substance/product.",
  "fhirVersion": "3.0.1",
  "mapping": [
    {
      "identity": "v2",
      "uri": "http://hl7.org/v2",
      "name": "HL7 v2 Mapping"
    },
    {
      "identity": "rim",
      "uri": "http://hl7.org/v3",
      "name": "RIM Mapping"
    }
  ],
  "kind": "complex-type",
  "abstract": false,
  "contextType": "resource",
  "context": [
    "AllergyIntolerance"
  ],
  "type": "Extension",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Extension",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Extension",
        "path": "Extension",
        "short": "Exposure risk of adverse reaction (allergy or intolerance) to the specified substance/product",
        "definition": "A complex extension allowing structured capture of the exposure risk of the patient for an adverse reaction (allergy or intolerance) to the specified substance/product.",
        "comment": "This extension is available and is intended to be used as a more completely structured and flexible alternative to the 'code' element for representing positive and negative allergy and intolerance statements.  If this extension element is present, the AllergyIntolerance.code element SHALL be omitted (see invariant \"code or substanceExposureRisk\").",
        "min": 0,
        "max": "1",
        "constraint": [
          {
            "key": "inv-1",
            "severity": "error",
            "human": "If the substanceExposureRisk extension element is present, the AllergyIntolerance.code element must be omitted.",
            "expression": "substanceExposureRisk.exists() and code.empty()",
            "xpath": "exists(f:substanceExposureRisk) and not(exists(f:code))"
          }
        ]
      },
      {
        "id": "Extension.extension:substance",
        "path": "Extension.extension",
        "sliceName": "substance",
        "short": "Substance (or pharmaceutical product)",
        "definition": "Code for a substance or pharmaceutical product that is considered to be responsible for the adverse reaction risk or is known not to have an associated risk of an adverse reaction upon exposure.",
        "comment": "It is strongly recommended that this element be populated using a terminology, where possible. For example, some terminologies used include RxNorm, SNOMED CT, DM+D, NDFRT, UNII, and ATC. Plain text should only be used if there is no appropriate terminology available. Additional details can be specified in the text.",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Extension"
          }
        ],
        "mapping": [
          {
            "identity": "v2",
            "map": "AL1-3 / IAM-3"
          },
          {
            "identity": "rim",
            "map": ".participation[typeCode=CAGNT].role[classCode=ADMM].player[classCode=MAT, determinerCode=KIND, code <= ExposureAgentEntityType]"
          }
        ]
      },
      {
        "id": "Extension.extension:substance.extension",
        "path": "Extension.extension.extension",
        "max": "0"
      },
      {
        "id": "Extension.extension:substance.url",
        "path": "Extension.extension.url",
        "type": [
          {
            "code": "uri"
          }
        ],
        "fixedUri": "substance"
      },
      {
        "id": "Extension.extension:substance.valueCodeableConcept",
        "path": "Extension.extension.valueCodeableConcept",
        "type": [
          {
            "code": "CodeableConcept"
          }
        ],
        "binding": {
          "extension": [
            {
              "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName",
              "valueString": "SubstanceCode"
            }
          ],
          "strength": "example",
          "description": "Codes defining the type of the substance (including pharmaceutical products).",
          "valueSetReference": {
            "reference": "http://hl7.org/fhir/ValueSet/substance-code"
          }
        }
      },
      {
        "id": "Extension.extension:exposurerisk",
        "path": "Extension.extension",
        "sliceName": "exposureRisk",
        "short": "known-reaction-risk | no-known-reaction-risk",
        "definition": "The presence or absence of a known exposure risk of the patient for an adverse reaction (allergy or intolerance) to the specified substance/product.",
        "comment": "exposureRisk is a modifier of the substance.",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Extension"
          }
        ]
      },
      {
        "id": "Extension.extension:exposurerisk.extension",
        "path": "Extension.extension.extension",
        "max": "0"
      },
      {
        "id": "Extension.extension:exposurerisk.url",
        "path": "Extension.extension.url",
        "type": [
          {
            "code": "uri"
          }
        ],
        "fixedUri": "exposureRisk"
      },
      {
        "id": "Extension.extension:exposurerisk.valueCodeableConcept",
        "path": "Extension.extension.valueCodeableConcept",
        "type": [
          {
            "code": "CodeableConcept"
          }
        ],
        "binding": {
          "extension": [
            {
              "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName",
              "valueString": "AllergyIntoleranceSubstanceExposureRisk"
            }
          ],
          "strength": "required",
          "description": "The risk of an adverse reaction (allergy or intolerance) for this patient upon exposure to the substance (including pharmaceutical products).",
          "valueSetReference": {
            "reference": "http://hl7.org/fhir/ValueSet/allerg-intol-substance-exp-risk"
          }
        }
      },
      {
        "id": "Extension.url",
        "path": "Extension.url",
        "type": [
          {
            "code": "uri"
          }
        ],
        "fixedUri": "http://hl7.org/fhir/StructureDefinition/allergyintolerance-substanceExposureRisk"
      },
      {
        "id": "Extension.value[x]",
        "path": "Extension.value[x]",
        "min": 0,
        "max": "0"
      }
    ]
  }
}