<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="profile-DwAppointment" />
  <meta>
    <lastUpdated value="2024-05-03T19:48:37.9773167+00:00" />
  </meta>
  <url value="https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwAppointment" />
  <version value="2.0.0" />
  <name value="DwAppointment" />
  <status value="active" />
  <date value="2026-05-29" />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Appointment" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Appointment" />
  <derivation value="constraint" />
  <differential>
    <element id="Appointment.id">
      <path value="Appointment.id" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Appointment.meta.security">
      <path value="Appointment.meta.security" />
      <comment value="Populated when the patient record is restricted." />
    </element>
    <element id="Appointment.extension">
      <path value="Appointment.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <ordered value="false" />
        <rules value="open" />
      </slicing>
    </element>
    <element id="Appointment.extension:appointmentEMRCustomStatus">
      <path value="Appointment.extension" />
      <sliceName value="appointmentEMRCustomStatus" />
      <comment value="Provides the EMR-specific appointment status value as a string." />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Extension" />
        <profile value="https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/ext-AppointmentEMRCustomStatus" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Appointment.extension:virtualVisit">
      <path value="Appointment.extension" />
      <sliceName value="virtualVisit" />
      <comment value="Boolean indicating whether the appointment is a virtual visit." />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Extension" />
        <profile value="https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/ext-VirtualVisit" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Appointment.extension:virtualVisitType">
      <path value="Appointment.extension" />
      <sliceName value="virtualVisitType" />
      <comment value="Provides the type of virtual appointment." />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Extension" />
        <profile value="https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/ext-VirtualVisitType" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Appointment.identifier.system">
      <path value="Appointment.identifier.system" />
      <comment value="Pattern: urn:telus:emr:{emrtype}:{emrinstance}:appointment" />
    </element>
    <element id="Appointment.status">
      <path value="Appointment.status" />
      <comment value="This element is labeled as a modifier because the status contains the code entered-in-error that marks the Appointment as not currently valid." />
      <mustSupport value="true" />
    </element>
    <element id="Appointment.cancelationReason">
      <path value="Appointment.cancelationReason" />
      <comment value="Provide cancellation reason where available." />
      <mustSupport value="true" />
    </element>
    <element id="Appointment.appointmentType">
      <path value="Appointment.appointmentType" />
      <mustSupport value="true" />
    </element>
    <element id="Appointment.description">
      <path value="Appointment.description" />
      <mustSupport value="true" />
    </element>
    <element id="Appointment.start">
      <path value="Appointment.start" />
      <comment value="Format: YYYY-MM-DDThh:mm:ss.sss+zz:zz. If FHIR status is not proposed or cancelled, start must be present; provide data-absent-reason of unknown if missing." />
      <mustSupport value="true" />
    </element>
    <element id="Appointment.end">
      <path value="Appointment.end" />
      <comment value="Format: YYYY-MM-DDThh:mm:ss.sss+zz:zz. If FHIR status is not proposed or cancelled, end must be present; provide data-absent-reason of unknown if missing." />
      <mustSupport value="true" />
    </element>
    <element id="Appointment.minutesDuration">
      <path value="Appointment.minutesDuration" />
      <mustSupport value="true" />
    </element>
    <element id="Appointment.created">
      <path value="Appointment.created" />
      <comment value="Date and time the appointment booking was created." />
      <mustSupport value="true" />
    </element>
    <element id="Appointment.basedOn">
      <path value="Appointment.basedOn" />
      <comment value="When the appointment is the result of an internal or external referral, provide the reference to the ServiceRequest." />
      <type>
        <code value="Reference" />
        <targetProfile value="https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwServiceRequest" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Appointment.participant">
      <path value="Appointment.participant" />
      <comment value="This is 1 to many. Includes patient and provider participants. participant.status is hard-coded to 'accepted' as participation status is not tracked by the EMR." />
      <mustSupport value="true" />
    </element>
    <element id="Appointment.participant.actor">
      <path value="Appointment.participant.actor" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwPatient" />
        <targetProfile value="https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwPractitioner" />
        <targetProfile value="https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwPractitionerRole" />
        <targetProfile value="https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwHealthcareService" />
        <targetProfile value="https://www.telus.com/health/fhir/dwemrextract/StructureDefinition/DwLocation" />
      </type>
    </element>
  </differential>
</StructureDefinition>