<StructureDefinition xmlns="http://hl7.org/fhir">
  <url value="http://telus.com/fhir/patientChart/StructureDefinition/profile-detected-issue" />
  <name value="ManagedDetectedIssue" />
  <status value="draft" />
  <fhirVersion value="4.0.1" />
  <mapping>
    <identity value="workflow" />
    <uri value="http://hl7.org/fhir/workflow" />
    <name value="Workflow Pattern" />
  </mapping>
  <mapping>
    <identity value="v2" />
    <uri value="http://hl7.org/v2" />
    <name value="HL7 v2 Mapping" />
  </mapping>
  <mapping>
    <identity value="rim" />
    <uri value="http://hl7.org/v3" />
    <name value="RIM Mapping" />
  </mapping>
  <mapping>
    <identity value="w5" />
    <uri value="http://hl7.org/fhir/fivews" />
    <name value="FiveWs Pattern Mapping" />
  </mapping>
  <kind value="resource" />
  <abstract value="false" />
  <type value="DetectedIssue" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/DetectedIssue" />
  <derivation value="constraint" />
  <differential>
    <element id="DetectedIssue">
      <path value="DetectedIssue" />
      <comment value="Usage Rule:   Managed Detected issues may be recorded in the patient chart, either with or without a Prescription/Renewal/Medication Chart.  &#xD;&#xA;Usage Rule:   If the prescription does not complete (eg draft prescription that is never added to the chart)&#xD;&#xA;Usage Rule:   If there is no prescription associated with it, and it is associated to a medication record, it should be exported as part of the patient chart." />
    </element>
    <element id="DetectedIssue.meta">
      <path value="DetectedIssue.meta" />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.meta.lastUpdated">
      <path value="DetectedIssue.meta.lastUpdated" />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.meta.source">
      <path value="DetectedIssue.meta.source" />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.meta.profile">
      <path value="DetectedIssue.meta.profile" />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.status">
      <path value="DetectedIssue.status" />
      <fixedCode value="final" />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.code">
      <path value="DetectedIssue.code" />
      <comment value="Usage Rule:   There are two codes; the first being the http://hl7.org/fhir/ValueSet/detectedissue-category; the second will be the drug database code (system = FBD, code = ABC)&#xD;&#xA;&#xD;&#xA;***Anne to add slice&#xD;&#xA;&#xD;&#xA;Not all terminology uses fit this general pattern. In some cases, models should not use CodeableConcept and use Coding directly and provide their own structure for managing text, codings, translations and the relationship between elements and pre- and post-coordination." />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.code.coding">
      <path value="DetectedIssue.code.coding" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="system" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <comment value="Conformance Rule:  FDB / drug database code will be populated here as a second code; eg Drug-Drug Interaction (code 1) + FBDCode (code 2)&#xD;&#xA;&#xD;&#xA;FDB / drug database description will be here.Codes may be defined very casually in enumerations, or code lists, up to very formal definitions such as SNOMED CT - see the HL7 v3 Core Principles for more information.  Ordering of codings is undefined and SHALL NOT be used to infer meaning. Generally, at most only one of the coding values will be labeled as UserSelected = true." />
      <min value="1" />
      <max value="2" />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.code.coding.system">
      <path value="DetectedIssue.code.coding.system" />
      <comment value="Usage:   This will identify FDB, Cerner Multim, Vigillance or any other system that will identify issues.&#xD;&#xA;&#xD;&#xA;The URI may be an OID (urn:oid:...) or a UUID (urn:uuid:...).  OIDs and UUIDs SHALL be references to the HL7 OID registry. Otherwise, the URI should come from HL7's list of FHIR defined special URIs or it should reference to some definition that establishes the system clearly and unambiguously." />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.code.coding.code">
      <path value="DetectedIssue.code.coding.code" />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.code.coding:Category">
      <path value="DetectedIssue.code.coding" />
      <sliceName value="Category" />
      <min value="1" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.code.coding:Category.system">
      <path value="DetectedIssue.code.coding.system" />
      <min value="1" />
      <fixedUri value="http://hl7.org/fhir/ValueSet/detectedissue-category" />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.code.coding:Category.code">
      <path value="DetectedIssue.code.coding.code" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.code.coding:DrugDatabaseCode">
      <path value="DetectedIssue.code.coding" />
      <sliceName value="DrugDatabaseCode" />
      <comment value="Conformance Rule:   If availalable, this local code from the EMR's drug database must be supplied as it is useful for recipients using the same system&#xD;&#xA;&#xD;&#xA;Codes may be defined very casually in enumerations, or code lists, up to very formal definitions such as SNOMED CT - see the HL7 v3 Core Principles for more information.  Ordering of codings is undefined and SHALL NOT be used to infer meaning. Generally, at most only one of the coding values will be labeled as UserSelected = true." />
    </element>
    <element id="DetectedIssue.code.coding:DrugDatabaseCode.system">
      <path value="DetectedIssue.code.coding.system" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.code.coding:DrugDatabaseCode.code">
      <path value="DetectedIssue.code.coding.code" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.code.text">
      <path value="DetectedIssue.code.text" />
      <comment value="Usage Note:   This is the description associated with the issue that is returned/displayed to the user from the drug database.  &#xD;&#xA;Example:  Beta Blocker to Asthma &#xD;&#xA;&#xD;&#xA;Very often the text is the same as a displayName of one of the codings." />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.severity">
      <path value="DetectedIssue.severity" />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.identified[x]">
      <path value="DetectedIssue.identified[x]" />
      <type>
        <code value="dateTime" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.author">
      <path value="DetectedIssue.author" />
      <comment value="Usage Note:   If data is returned from the drug database (interaction checker), eg FDB, Vigilance it may be populated here.   This is useful for systems who share the same drug database.&#xD;&#xA;&#xD;&#xA;References SHALL be a reference to an actual FHIR resource, and SHALL be resolveable (allowing for access control, temporary unavailability, etc.). Resolution can be either by retrieval from the URL, or, where applicable by resource type, by treating an absolute reference as a canonical URL and looking it up in a local registry/repository." />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.author.reference">
      <path value="DetectedIssue.author.reference" />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.author.display">
      <path value="DetectedIssue.author.display" />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.implicated">
      <path value="DetectedIssue.implicated" />
      <comment value="Usage:   This will be a reference to one or more Medication Statement, Medication Order or Medication Plan, Allergy, Observation, Condition, depending on where/when the issue was managed.   In some cases, this is part of the patient chart but there is no specific reference; this could occur if the management is created and the prescription is never completed.&#xD;&#xA;&#xD;&#xA;Example Usage:   Drug interaction between asthma and a medication.  This will reference the medication order(s); which is an active or a draft or cancelled order when this exists in the chart and depending on whether the doctor chooses to prescribe.  If there is no prescription (eg a prescription was started but cancelled without a record in the EMR), there may be no reference.&#xD;&#xA;&#xD;&#xA;There's an implicit constraint on the number of implicated resources based on DetectedIssue.type; e.g. For drug-drug, there would be more than one.  For timing, there would typically only be one." />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.implicated.reference">
      <path value="DetectedIssue.implicated.reference" />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.implicated.display">
      <path value="DetectedIssue.implicated.display" />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.detail">
      <path value="DetectedIssue.detail" />
      <comment value="Usage Note:   This is the monograph (reaction, evidence, etc) and is therefore not supported for this implementation.&#xD;&#xA;&#xD;&#xA;Should focus on information not covered elsewhere as discrete data - no need to duplicate the narrative." />
    </element>
    <element id="DetectedIssue.mitigation">
      <path value="DetectedIssue.mitigation" />
      <comment value="Usage:   Mitigation can be tied to a prescription or a plan for Med A and Med B;  Can be added to an EMR record with or without a prescription." />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.mitigation.extension">
      <path value="DetectedIssue.mitigation.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <min value="0" />
    </element>
    <element id="DetectedIssue.mitigation.extension:myExtension">
      <path value="DetectedIssue.mitigation.extension" />
      <sliceName value="myExtension" />
      <comment value="Conformance Rule::   This must reflect the effective date, rather than the recorded date and must be present when known" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="http://telus.com/fhir/patientChart/StructureDefinition/ext-mitigation-effective-date" />
      </type>
      <mustSupport value="true" />
      <isModifier value="false" />
    </element>
    <element id="DetectedIssue.mitigation.action">
      <path value="DetectedIssue.mitigation.action" />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.mitigation.action.coding">
      <path value="DetectedIssue.mitigation.action.coding" />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.mitigation.action.coding.system">
      <path value="DetectedIssue.mitigation.action.coding.system" />
      <mustSupport value="true" />
      <binding>
        <strength value="extensible" />
        <valueSet value="https://fhir.infoway-inforoute.ca/ValueSet/detectedissuemitigationaction" />
      </binding>
    </element>
    <element id="DetectedIssue.mitigation.action.coding.code">
      <path value="DetectedIssue.mitigation.action.coding.code" />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.mitigation.action.text">
      <path value="DetectedIssue.mitigation.action.text" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.mitigation.date">
      <path value="DetectedIssue.mitigation.date" />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.mitigation.author">
      <path value="DetectedIssue.mitigation.author" />
      <comment value="Usage Note:   the Practitioner must be specified where known; else the role may be used.&#xD;&#xA;&#xD;&#xA;References SHALL be a reference to an actual FHIR resource, and SHALL be resolveable (allowing for access control, temporary unavailability, etc.). Resolution can be either by retrieval from the URL, or, where applicable by resource type, by treating an absolute reference as a canonical URL and looking it up in a local registry/repository." />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.mitigation.author.reference">
      <path value="DetectedIssue.mitigation.author.reference" />
      <mustSupport value="true" />
    </element>
    <element id="DetectedIssue.mitigation.author.display">
      <path value="DetectedIssue.mitigation.author.display" />
      <mustSupport value="true" />
    </element>
  </differential>
</StructureDefinition>