<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="profile-allergyintolerance" />
  <meta>
    <lastUpdated value="2021-10-27T01:52:46.665+00:00" />
  </meta>
  <url value="https://simplifier.net/omd-cdss/allergyintoleranceprofile" />
  <version value="0.0.3" />
  <name value="AllergyIntoleranceProfile" />
  <title value="Allergy Intolerance Profile" />
  <status value="draft" />
  <date value="2021-10-24T23:10:10.7705133+00:00" />
  <publisher value="OMD" />
  <description value="Proposed constraints and extensions on the AllergyIntolerance Resource" />
  <jurisdiction>
    <coding>
      <system value="urn:iso:std:iso:3166" />
      <code value="CA" />
      <display value="Canada" />
    </coding>
  </jurisdiction>
  <fhirVersion value="4.0.1" />
  <mapping>
    <identity value="CDSS5.1" />
    <uri value="www.ontariomd.com" />
    <name value="CDS-S 5.1" />
  </mapping>
  <kind value="resource" />
  <abstract value="false" />
  <type value="AllergyIntolerance" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/AllergyIntolerance" />
  <derivation value="constraint" />
  <differential>
    <element id="AllergyIntolerance">
      <path value="AllergyIntolerance" />
      <short value="AllergyIntolerance Profile" />
      <definition value="The AllergyIntolerance Profile is based upon the core FHIR AllergyIntolerance Resource" />
    </element>
    <element id="AllergyIntolerance.identifier">
      <path value="AllergyIntolerance.identifier" />
      <mustSupport value="true" />
    </element>
    <element id="AllergyIntolerance.clinicalStatus">
      <path value="AllergyIntolerance.clinicalStatus" />
      <mustSupport value="true" />
      <isModifierReason value="This element is labeled as a modifier because the status contains the codes refuted and entered-in-error that mark the AllergyIntolerance as not currently valid." />
    </element>
    <element id="AllergyIntolerance.verificationStatus">
      <path value="AllergyIntolerance.verificationStatus" />
      <mustSupport value="true" />
    </element>
    <element id="AllergyIntolerance.verificationStatus.coding">
      <path value="AllergyIntolerance.verificationStatus.coding" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="system" />
        </discriminator>
        <rules value="closed" />
      </slicing>
      <mustSupport value="true" />
    </element>
    <element id="AllergyIntolerance.verificationStatus.coding:StatusCode">
      <path value="AllergyIntolerance.verificationStatus.coding" />
      <sliceName value="StatusCode" />
      <short value="Code for allergy or intolerance status" />
      <definition value="Code for an allergy or intolerance statement. Represents whether an allergy/intolerance is active or resolved (indicating no longer active)." />
      <comment value="The binding strength of this element is [Preferred](https://www.hl7.org/fhir/terminologies.html#strength), meaning that codes are encouraged to draw from the AllergyIntoleranceStatusCode value set for interoperability purposes but are not required to do so to be considered conformant." />
      <max value="1" />
      <binding>
        <strength value="preferred" />
        <description value="Assertion about certainty associated with a propensity, or potential risk, of a reaction to the identified substance." />
        <valueSet value="https://fhir.infoway-inforoute.ca/ValueSet/allergyintolerancestatuscode" />
      </binding>
    </element>
    <element id="AllergyIntolerance.verificationStatus.coding:StatusCode.system">
      <path value="AllergyIntolerance.verificationStatus.coding.system" />
      <min value="1" />
    </element>
    <element id="AllergyIntolerance.verificationStatus.coding:StatusCode.code">
      <path value="AllergyIntolerance.verificationStatus.coding.code" />
      <min value="1" />
    </element>
    <element id="AllergyIntolerance.verificationStatus.coding:@default">
      <path value="AllergyIntolerance.verificationStatus.coding" />
      <sliceName value="@default" />
      <definition value="Code for an allergy or intolerance statement. This may be a code for a substance or pharmaceutical product that is considered to be responsible for the adverse reaction risk, an allergy or intolerance condition." />
      <comment value="The binding strength of this element is [Required](https://hl7.org/fhir/R4/terminologies.html#required), meaning that codes SHALL be taken from the specified value set to be conformant" />
      <min value="1" />
      <max value="1" />
      <binding>
        <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName">
          <valueString value="AllergyIntoleranceVerificationStatus" />
        </extension>
        <strength value="required" />
        <description value="Assertion about certainty associated with a propensity, or potential risk, of a reaction to the identified substance." />
        <valueSet value="http://hl7.org/fhir/ValueSet/allergyintolerance-verification|4.0.1" />
      </binding>
    </element>
    <element id="AllergyIntolerance.verificationStatus.coding:@default.system">
      <path value="AllergyIntolerance.verificationStatus.coding.system" />
      <min value="1" />
      <fixedUri value="http://terminology.hl7.org/CodeSystem/allergyintolerance-verification" />
    </element>
    <element id="AllergyIntolerance.verificationStatus.coding:@default.code">
      <path value="AllergyIntolerance.verificationStatus.coding.code" />
      <min value="1" />
    </element>
    <element id="AllergyIntolerance.type">
      <path value="AllergyIntolerance.type" />
      <definition value="BASE RESOURCE DEFINITION:&#xD;&#xA;Identification of the underlying physiological mechanism for the reaction risk.&#xD;&#xA;&#xD;&#xA;CDS-S PROFILE DEFINITION:&#xD;&#xA;Identifies whether the reaction is an allergy or an adverse reaction (including intolerance and side effects)." />
      <mapping>
        <identity value="CDSS5.1" />
        <map value="DE11.003" />
        <comment value="Reaction Type" />
      </mapping>
    </element>
    <element id="AllergyIntolerance.category">
      <path value="AllergyIntolerance.category" />
      <mustSupport value="true" />
    </element>
    <element id="AllergyIntolerance.criticality">
      <path value="AllergyIntolerance.criticality" />
      <mustSupport value="true" />
    </element>
    <element id="AllergyIntolerance.code">
      <path value="AllergyIntolerance.code" />
      <constraint>
        <key value="ca-baseline-allergy" />
        <severity value="error" />
        <human value="AllergyIntolerance.verificationStatus SHALL be present if AllergyIntolerance.code represents NullFlavor concept" />
        <expression value="AllergyIntolerance.code.coding.where(system = 'https://fhir.infoway-inforoute.ca/ValueSet/NullFlavor').exists() or AllergyIntolerance.verificationStatus.exists()" />
        <xpath value="f:code/f:coding/f:system/@value='https://fhir.infoway-inforoute.ca/ValueSet/NullFlavor' or exists(f:verificationStatus)" />
        <source value="http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-allergyintolerance" />
      </constraint>
      <mustSupport value="true" />
    </element>
    <element id="AllergyIntolerance.code.coding">
      <path value="AllergyIntolerance.code.coding" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="system" />
        </discriminator>
        <rules value="closed" />
      </slicing>
      <mustSupport value="true" />
    </element>
    <element id="AllergyIntolerance.code.coding:NotAsked">
      <path value="AllergyIntolerance.code.coding" />
      <sliceName value="NotAsked" />
      <short value="Code for NOT asked or NOT possible to obtain information about allergy or intolerance" />
      <definition value="Code for the case when a patient has NOT been asked or it is NOT possible to obtain information about any history of allergy or intolerance." />
      <comment value="The binding strength of this element is [Preferred](https://www.hl7.org/fhir/terminologies.html#strength), meaning that codes are encouraged to draw from the NullFlavor value set for interoperability purposes but are not required to do so to be considered conformant." />
      <max value="1" />
      <constraint>
        <key value="ca-baseline-allergy-notasked" />
        <severity value="error" />
        <human value="if AllergyIntolerance.code is a NullFlavor value, then AllergyIntolerance.clinicalStatus, AllergyIntolerance.verificationStatus, AllergyIntolerance.type, AllergyIntolerance.category, AllergyIntolerance.criticality SHALL NOT be present" />
        <expression value="AllergyIntolerance.code.coding.where(system = 'https://fhir.infoway-inforoute.ca/ValueSet/NullFlavor').exists() implies (AllergyIntolerance.verificationStatus.exists().not() and AllergyIntolerance.type.exists().not() and AllergyIntolerance.category.exists().not() and AllergyIntolerance.criticality.exists().not())" />
        <xpath value="f:code/f:coding/f:system/@value='https://fhir.infoway-inforoute.ca/ValueSet/NullFlavor' and exists(f:verificationStatus).not() and exists(f:type).not() and exists(f:category).not() and exists(f:criticality).not()" />
        <source value="http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-allergyintolerance" />
      </constraint>
      <binding>
        <strength value="preferred" />
        <description value="Negation/exclusion codes for reporting no known allergies or not available data." />
        <valueSet value="https://fhir.infoway-inforoute.ca/ValueSet/NullFlavor" />
      </binding>
    </element>
    <element id="AllergyIntolerance.code.coding:NotAsked.system">
      <path value="AllergyIntolerance.code.coding.system" />
      <min value="1" />
      <fixedUri value="http://hl7.org/fhir/v3/NullFlavor" />
    </element>
    <element id="AllergyIntolerance.code.coding:NotAsked.code">
      <path value="AllergyIntolerance.code.coding.code" />
      <min value="1" />
    </element>
    <element id="AllergyIntolerance.code.coding:NoAllergy">
      <path value="AllergyIntolerance.code.coding" />
      <sliceName value="NoAllergy" />
      <short value="Code when a patient has been asked and has indicated no history of allergies or intolerance" />
      <definition value="Code for the case when a patient has been asked and has indicated no history of allergies or intolerance." />
      <max value="1" />
      <constraint>
        <key value="ca-baseline-allergy-noallergy" />
        <severity value="error" />
        <human value="if AllergyIntolerance.code is '716186003' No known allergy, then AllergyIntolerance.verificationStatus SHALL be one of the following: confirmed | refuted | entered-in-error" />
        <expression value="AllergyIntolerance.code.coding.where(system = 'http://snomed.info/sct' and code = '716186003').exists() and AllergyIntolerance.verificationStatus.coding.where(code = 'unconfirmed').empty()" />
        <xpath value="f:code/f:coding/f:system/@value='http://snomed.info/sct' and exists(f:verificationStatus/f:coding/f:code/@value='unconfirmed').not()" />
        <source value="http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-allergyintolerance" />
      </constraint>
      <binding>
        <strength value="required" />
        <description value="Negation/exclusion codes for reporting no known allergies" />
        <valueSet value="http://snomed.info/sct" />
      </binding>
    </element>
    <element id="AllergyIntolerance.code.coding:NoAllergy.system">
      <path value="AllergyIntolerance.code.coding.system" />
      <min value="1" />
      <fixedUri value="http://snomed.info/sct" />
    </element>
    <element id="AllergyIntolerance.code.coding:NoAllergy.code">
      <path value="AllergyIntolerance.code.coding.code" />
      <min value="1" />
      <fixedCode value="716186003" />
    </element>
    <element id="AllergyIntolerance.code.coding:@default">
      <path value="AllergyIntolerance.code.coding" />
      <sliceName value="@default" />
      <definition value="Code for an allergy or intolerance statement. This may be a code for a substance or pharmaceutical product that is considered to be responsible for the adverse reaction risk, an allergy or intolerance condition." />
      <comment value="The binding strength of this element is [Example](https://hl7.org/fhir/R4/terminologies.html#example), meaning that codes are not expected or even encouraged to draw from the specified value set to be conformant" />
      <max value="1" />
      <binding>
        <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName">
          <valueString value="AllergyIntoleranceCode" />
        </extension>
        <strength value="example" />
        <description value="Type of the substance/product, allergy or intolerance condition." />
        <valueSet value="http://hl7.org/fhir/ValueSet/allergyintolerance-code" />
      </binding>
    </element>
    <element id="AllergyIntolerance.patient">
      <path value="AllergyIntolerance.patient" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-patient" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="AllergyIntolerance.encounter">
      <path value="AllergyIntolerance.encounter" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-encounter" />
      </type>
    </element>
    <element id="AllergyIntolerance.onset[x]">
      <path value="AllergyIntolerance.onset[x]" />
      <slicing>
        <discriminator>
          <type value="type" />
          <path value="$this" />
        </discriminator>
      </slicing>
      <definition value="BASE RESOURCE DEFINITION:&#xD;&#xA;Estimated or actual date,  date-time, or age when allergy or intolerance was identified.&#xD;&#xA;&#xD;&#xA;CDS-S PROFILE DEFINITION:&#xD;&#xA;(AllergyIntolerance.onset.onsetString) - The life stage of the patient when he/she has been identified as being allergic or having an adverse reaction to a drug or a non-drug." />
      <type>
        <code value="dateTime" />
      </type>
      <type>
        <code value="Age" />
        <profile value="https://simplifier.net/omd-cdss/onsetage" />
      </type>
      <type>
        <code value="Period" />
      </type>
      <type>
        <code value="Range" />
      </type>
      <type>
        <code value="string" />
      </type>
      <mustSupport value="true" />
      <mapping>
        <identity value="CDSS5.1" />
        <map value="DE11.005" />
        <comment value="Life Stage" />
      </mapping>
    </element>
    <element id="AllergyIntolerance.onset[x]:onsetDateTime">
      <path value="AllergyIntolerance.onset[x]" />
      <sliceName value="onsetDateTime" />
      <definition value="BASE RESOURCE DEFINITION:&#xD;&#xA;Estimated or actual date,  date-time, or age when allergy or intolerance was identified.&#xD;&#xA;&#xD;&#xA;CDS-S PROFILE DEFINITION:&#xD;&#xA;The date that the patient reported or has been identified as being allergic or having an adverse reaction to a drug or non-drug." />
      <comment value="CODE SET TABLE: &#xD;&#xA;CT-016: Life Stage" />
      <type>
        <code value="dateTime" />
      </type>
      <mustSupport value="true" />
      <mapping>
        <identity value="CDSS5.1" />
        <map value="DE11.004" />
        <comment value="Start Date" />
      </mapping>
    </element>
    <element id="AllergyIntolerance.recordedDate">
      <path value="AllergyIntolerance.recordedDate" />
      <definition value="BASE RESOURCE DEFINITION:&#xD;&#xA;The recordedDate represents when this particular AllergyIntolerance record was created in the system, which is often a system-generated date.&#xD;&#xA;&#xD;&#xA;CDS-S PROFILE DEFINITION:&#xD;&#xA;The date that the allergy or adverse reaction was recorded in the EMR." />
      <mapping>
        <identity value="CDSS5.1" />
        <map value="DE11.008" />
        <comment value="Recorded Date" />
      </mapping>
    </element>
    <element id="AllergyIntolerance.recorder">
      <path value="AllergyIntolerance.recorder" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-practitioner" />
        <targetProfile value="http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-practitionerrole" />
        <targetProfile value="http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-patient" />
      </type>
    </element>
    <element id="AllergyIntolerance.asserter">
      <path value="AllergyIntolerance.asserter" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-patient" />
        <targetProfile value="http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-practitioner" />
        <targetProfile value="http://hl7.org/fhir/ca/baseline/StructureDefinition/profile-practitionerrole" />
      </type>
    </element>
    <element id="AllergyIntolerance.note">
      <path value="AllergyIntolerance.note" />
      <definition value="BASE RESOURCE DEFINITION:&#xD;&#xA;Additional narrative about the propensity for the Adverse Reaction, not captured in other fields.&#xD;&#xA;&#xD;&#xA;CDS-S PROFILE DEFINITION:&#xD;&#xA;Additional notes about an allergy or adverse reaction." />
      <mapping>
        <identity value="CDSS5.1" />
        <map value="DE11.009" />
        <comment value="Notes" />
      </mapping>
    </element>
    <element id="AllergyIntolerance.reaction">
      <path value="AllergyIntolerance.reaction" />
      <mustSupport value="true" />
    </element>
    <element id="AllergyIntolerance.reaction.substance">
      <path value="AllergyIntolerance.reaction.substance" />
      <mustSupport value="true" />
    </element>
    <element id="AllergyIntolerance.reaction.substance.coding">
      <path value="AllergyIntolerance.reaction.substance.coding" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="system" />
        </discriminator>
        <rules value="closed" />
      </slicing>
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="AllergyIntolerance.reaction.substance.coding:NonDrugAllergen">
      <path value="AllergyIntolerance.reaction.substance.coding" />
      <sliceName value="NonDrugAllergen" />
      <short value="Code for the specific non-drug allergen" />
      <definition value="Code for the specific non-drug allergen or other agent/substance to which the Client has an allergic reaction." />
      <comment value="The binding strength of this element is [Preferred](https://www.hl7.org/fhir/terminologies.html#strength), meaning that codes are encouraged to draw from the NonDrugAllergenCode value set for interoperability purposes but are not required to do so to be considered conformant." />
      <binding>
        <strength value="preferred" />
        <description value="Represents the specific non-drug allergen or other agent/substance to which the Client has an allergic reaction." />
        <valueSet value="https://fhir.infoway-inforoute.ca/ValueSet/NonDrugAllergenCode" />
      </binding>
    </element>
    <element id="AllergyIntolerance.reaction.substance.coding:NonDrugAllergen.system">
      <path value="AllergyIntolerance.reaction.substance.coding.system" />
      <min value="1" />
    </element>
    <element id="AllergyIntolerance.reaction.substance.coding:NonDrugAllergen.code">
      <path value="AllergyIntolerance.reaction.substance.coding.code" />
      <min value="1" />
    </element>
    <element id="AllergyIntolerance.reaction.substance.coding:CCDD">
      <path value="AllergyIntolerance.reaction.substance.coding" />
      <sliceName value="CCDD" />
      <short value="Medicinal products for prescribing" />
      <definition value="The subset of codes with commonly used medicinal products that are available for prescribing and dispensing in Canada." />
      <comment value="The binding strength of this element is [Preferred](https://www.hl7.org/fhir/terminologies.html#strength), meaning that codes are encouraged to draw from the PrescriptionMedicinalProduct value set for interoperability purposes but are not required to do so to be considered conformant." />
      <binding>
        <strength value="preferred" />
        <description value="Represents subset of codes with commonly used medicinal products that are available for prescribing and dispensing in Canada." />
        <valueSet value="https://fhir.infoway-inforoute.ca/ValueSet/prescriptionmedicinalproduct" />
      </binding>
    </element>
    <element id="AllergyIntolerance.reaction.substance.coding:CCDD.system">
      <path value="AllergyIntolerance.reaction.substance.coding.system" />
      <min value="1" />
      <fixedUri value="https://fhir.infoway-inforoute.ca/CodeSystem/canadianclinicaldrugdataset" />
    </element>
    <element id="AllergyIntolerance.reaction.substance.coding:CCDD.code">
      <path value="AllergyIntolerance.reaction.substance.coding.code" />
      <min value="1" />
    </element>
    <element id="AllergyIntolerance.reaction.substance.coding:@default">
      <path value="AllergyIntolerance.reaction.substance.coding" />
      <sliceName value="@default" />
      <short value="Specific substance or pharmaceutical product considered to be responsible for event" />
      <definition value="Identification of the specific substance (or pharmaceutical product) considered to be responsible for the Adverse Reaction event." />
      <comment value="The binding strength of this element is [Example](https://hl7.org/fhir/R4/terminologies.html#example), meaning that codes are not expected or even encouraged to draw from the specified value set to be conformant" />
      <binding>
        <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName">
          <valueString value="SubstanceCode" />
        </extension>
        <strength value="example" />
        <description value="Codes defining the type of the substance (including pharmaceutical products)." />
        <valueSet value="http://hl7.org/fhir/ValueSet/substance-code" />
      </binding>
    </element>
    <element id="AllergyIntolerance.reaction.substance.text">
      <path value="AllergyIntolerance.reaction.substance.text" />
      <definition value="BASE RESOURCE DEFINITION:&#xD;&#xA;A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user.&#xD;&#xA;&#xD;&#xA;CDS-S PROFILE DEFINITION:&#xD;&#xA;The name of the offending agent, whether drug or non-drug." />
      <mustSupport value="true" />
      <mapping>
        <identity value="CDSS5.1" />
        <map value="DE11.001" />
        <comment value="Offending Agent" />
      </mapping>
    </element>
    <element id="AllergyIntolerance.reaction.manifestation">
      <path value="AllergyIntolerance.reaction.manifestation" />
      <mustSupport value="true" />
    </element>
    <element id="AllergyIntolerance.reaction.severity">
      <path value="AllergyIntolerance.reaction.severity" />
      <definition value="BASE RESOURCE DEFINITION:&#xD;&#xA;Clinical assessment of the severity of the reaction event as a whole, potentially considering multiple different manifestations.&#xD;&#xA;&#xD;&#xA;CDS-S PROFILE DEFINITION:&#xD;&#xA;The severity of the allery or adverse reaction as identified by the provider." />
      <mustSupport value="true" />
      <mapping>
        <identity value="CDSS5.1" />
        <map value="DE11.006" />
        <comment value="Severity" />
      </mapping>
    </element>
    <element id="AllergyIntolerance.reaction.exposureRoute">
      <path value="AllergyIntolerance.reaction.exposureRoute" />
      <comment value="The binding strength of this element is [Preferred](https://www.hl7.org/fhir/terminologies.html#strength), meaning that codes are encouraged to draw from the RouteOfAdministration value set for interoperability purposes but are not required to do so to be considered conformant." />
      <binding>
        <strength value="preferred" />
        <valueSet value="https://fhir.infoway-inforoute.ca/ValueSet/RouteOfAdministration" />
      </binding>
    </element>
    <element id="AllergyIntolerance.reaction.note">
      <path value="AllergyIntolerance.reaction.note" />
      <definition value="BASE RESOURCE DEFINITION:&#xD;&#xA;Additional text about the adverse reaction event not captured in other fields.&#xD;&#xA;&#xD;&#xA;CDS-S PROFILE DEFINITION:&#xD;&#xA;The description of the patient's reaction to a drug or a non-drug (e.g., rash, lip, swelling)." />
      <mustSupport value="true" />
      <mapping>
        <identity value="CDSS5.1" />
        <map value="DE11.007" />
        <comment value="Reaction Description" />
      </mapping>
    </element>
  </differential>
</StructureDefinition>