<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="profile-DwEncounter" />
  <url value="https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwEncounter" />
  <version value="2.0.0" />
  <name value="DwEncounter" />
  <status value="draft" />
  <date value="2026-05-29" />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Encounter" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Encounter" />
  <derivation value="constraint" />
  <differential>
    <element id="Encounter.id">
      <path value="Encounter.id" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.meta.lastUpdated">
      <path value="Encounter.meta.lastUpdated" />
      <min value="1" />
    </element>
    <element id="Encounter.meta.source">
      <path value="Encounter.meta.source" />
      <min value="1" />
    </element>
    <element id="Encounter.meta.security">
      <path value="Encounter.meta.security" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.text">
      <path value="Encounter.text" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.identifier">
      <path value="Encounter.identifier" />
      <min value="1" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.identifier.system">
      <path value="Encounter.identifier.system" />
      <comment value="urn:telus:emr:{emrType}:{emrInstance}:Encounter&#xD;&#xA;&#xD;&#xA;Identifier.system is always case sensitive." />
      <min value="1" />
      <mustSupport value="false" />
    </element>
    <element id="Encounter.identifier.value">
      <path value="Encounter.identifier.value" />
      <comment value="Usage note: Internal primary id for this table &#xD;&#xA;&#xD;&#xA;If the value is a full URI, then the system SHALL be urn:ietf:rfc:3986.  The value's primary purpose is computational mapping.  As a result, it may be normalized for comparison purposes (e.g. removing non-significant whitespace, dashes, etc.)  A value formatted for human display can be conveyed using the [Rendered Value extension](extension-rendered-value.html). Identifier.value is to be treated as case sensitive unless knowledge of the Identifier.system allows the processer to be confident that non-case-sensitive processing is safe." />
      <min value="1" />
    </element>
    <element id="Encounter.status">
      <path value="Encounter.status" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.statusHistory">
      <path value="Encounter.statusHistory" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.class">
      <path value="Encounter.class" />
      <comment value="Usage note: &#xD;&#xA;If you are able to find it use the mapping below. If NOT then default to AMB&#xD;&#xA;&#xD;&#xA;EMR ---&gt; FHIR &#xD;&#xA;Clinic Visit ----&gt; AMB&#xD;&#xA;Virtual Visit -----&gt; VR&#xD;&#xA;Home visit/Nursing Home---&gt; HH&#xD;&#xA;Mobile clinics---&gt;FLD&#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." />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.type">
      <path value="Encounter.type" />
      <comment value="Usage note: MA - N/A&#xD;&#xA;PSS - Note category&#xD;&#xA;&#xD;&#xA;Since there are many ways to further classify encounters, this element is 0..*." />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.type.text">
      <path value="Encounter.type.text" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.subject">
      <path value="Encounter.subject" />
      <min value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwPatient" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Encounter.participant">
      <path value="Encounter.participant" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.participant.individual">
      <path value="Encounter.participant.individual" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwPractitioner" />
        <targetProfile value="https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwPractitionerRole" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Encounter.appointment">
      <path value="Encounter.appointment" />
      <comment value="Usage note - Where applicable provide the reference to the appointment&#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." />
      <type>
        <code value="Reference" />
        <targetProfile value="https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwAppointment" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Encounter.period">
      <path value="Encounter.period" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.reasonCode">
      <path value="Encounter.reasonCode" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.reasonCode.text">
      <path value="Encounter.reasonCode.text" />
      <comment value="Usage note: &#xD;&#xA;MA - provide the reason for the visit provide by the patient i.e task concern on the left&#xD;&#xA;PSS - N/A&#xD;&#xA;&#xD;&#xA;For systems that need to know which was the primary diagnosis, these will be marked with the standard extension primaryDiagnosis (which is a sequence value rather than a flag, 1 = primary diagnosis)." />
    </element>
    <element id="Encounter.diagnosis">
      <path value="Encounter.diagnosis" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.diagnosis.condition">
      <path value="Encounter.diagnosis.condition" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwCondition" />
      </type>
    </element>
    <element id="Encounter.location">
      <path value="Encounter.location" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.location.location">
      <path value="Encounter.location.location" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwLocation" />
      </type>
    </element>
    <element id="Encounter.serviceProvider">
      <path value="Encounter.serviceProvider" />
      <comment value="Usage note: Reference to the organization resource that corresponds with the sub-organization where this service occured&#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." />
      <type>
        <code value="Reference" />
        <targetProfile value="https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwOrganization" />
      </type>
      <mustSupport value="true" />
    </element>
  </differential>
</StructureDefinition>