<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="pr-appointment" />
  <meta>
    <source value="https://www.icanbwell.com/fhir_profile_definitions" />
    <security>
      <system value="https://www.icanbwell.com/owner" />
      <code value="bwell" />
    </security>
    <security>
      <system value="https://www.icanbwell.com/access" />
      <code value="bwell" />
    </security>
  </meta>
  <text>
    <status value="additional" />
    <div xmlns="http://www.w3.org/1999/xhtml">to do</div>
  </text>
  <url value="https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-appointment" />
  <version value="1.02" />
  <name value="Appointment" />
  <title value="Profile: Appointment" />
  <status value="active" />
  <experimental value="false" />
  <date value="2022-06-02" />
  <publisher value="b.Well Connected Health" />
  <description value="An appointment for a given provider" />
  <jurisdiction>
    <coding>
      <system value="urn:iso:std:iso:3166" />
      <code value="US" />
      <display value="United States of America" />
    </coding>
    <text value="United States of America" />
  </jurisdiction>
  <fhirVersion value="4.0.0" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Appointment" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Appointment" />
  <derivation value="constraint" />
  <differential>
    <element id="Appointment">
      <path value="Appointment" />
    </element>
    <element id="Appointment.id">
      <path value="Appointment.id" />
    </element>
    <element id="Appointment.meta">
      <path value="Appointment.meta" />
      <label value="meta" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Meta" />
      </type>
    </element>
    <element id="Appointment.meta.source">
      <path value="Appointment.meta.source" />
      <sliceName value="meta-source" />
      <label value="meta" />
      <short value="uri of the data source" />
      <definition value="Typically the data owner's URL followed by a source/file description" />
      <requirements value="mandatory for all resources in bWell's FHIR Server" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="uri" />
      </type>
      <example>
        <label value="example of meta.source" />
        <valueUri value="https://www.icanbwell.com/provider-directory" />
      </example>
    </element>
    <element id="Appointment.meta.security">
      <path value="Appointment.meta.security" />
      <sliceName value="meta-security" />
      <label value="meta" />
      <short value="security tags representing the data's owner, vendor, and accessibility" />
      <definition value="data owner: &#xA; &#xA; data vendor: &#xA; &#xA; data access:" />
      <requirements value="/owner &amp; /access are mandatory for all resources in bWell's FHIR Server" />
      <min value="1" />
      <max value="*" />
      <type>
        <code value="Coding" />
      </type>
      <example>
        <label value="example of data owner security tag" />
        <valueCoding>
          <system value="https://www.icanbwell.com/owner" />
          <code value="bwell" />
        </valueCoding>
      </example>
      <example>
        <label value="example of data access security tag" />
        <valueCoding>
          <system value="https://www.icanbwell.com/access" />
          <code value="bwell" />
        </valueCoding>
      </example>
      <example>
        <label value="example of data vendor security tag" />
        <valueCoding>
          <system value="https://www.icanbwell.com/vendor" />
          <code value="bwell" />
        </valueCoding>
      </example>
    </element>
    <element id="de-identifier">
      <path value="Appointment.identifier" />
      <label value="identifier" />
      <slicing>
        <description value="slice by types" />
        <rules value="open" />
      </slicing>
      <short value="a value to identify the resource by" />
      <type>
        <code value="Identifier" />
      </type>
    </element>
    <element id="identifier.id">
      <path value="Appointment.identifier.id" />
      <label value="identifier" />
      <short value="set case-by-case" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="string" />
      </type>
    </element>
    <element id="identifier.use">
      <path value="Appointment.identifier.use" />
      <label value="identifier" />
      <short value="usual | official | temp | secondary | old (If known)" />
      <definition value="The purpose of this identifier." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="code" />
      </type>
    </element>
    <element id="identifier.type">
      <path value="Appointment.identifier.type" />
      <label value="identifier" />
      <short value="Description of identifier" />
      <definition value="A coded type for the identifier that can be used to determine which identifier to use for a specific purpose." />
      <requirements value="Needs binding valueset" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="CodeableConcept" />
      </type>
    </element>
    <element id="identifier.system">
      <path value="Appointment.identifier.system" />
      <label value="identifier" />
      <short value="The system which created the identifier" />
      <definition value="Values may be an oid, uri, url, or canonical" />
      <comment value="for mapped data, this is frequently a canonical url" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="uri" />
      </type>
      <example>
        <label value="a client's unknown system" />
        <valueUri value="https://www.health.org/person-identifier" />
      </example>
    </element>
    <element id="identifier.value">
      <path value="Appointment.identifier.value" />
      <label value="identifier" />
      <short value="The unique value" />
      <definition value="The raw identifier value that represents a resource" />
      <requirements value="This should be the raw value, as it exists in the source data (ie without prefix)" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="string" />
      </type>
    </element>
    <element id="de-visit-number">
      <path value="Appointment.identifier" />
      <sliceName value="visit-number" />
      <label value="visit-number" />
      <short value="Appointment identifier value with type as VN|http://terminology.hl7.org/CodeSystem/v2-0203" />
      <patternIdentifier>
        <type>
          <coding>
            <system value="http://terminology.hl7.org/CodeSystem/v2-0203" />
            <code value="VN" />
          </coding>
        </type>
      </patternIdentifier>
    </element>
    <element id="Appointment.status">
      <path value="Appointment.status" />
      <label value="appointment-status" />
      <code>
        <system value="https://www.icanbwell.com/product-feature-code" />
        <code value="integrated-scheduling" />
      </code>
      <short value="Appointment status code" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="code" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Appointment.serviceType">
      <path value="Appointment.serviceType" />
      <label value="service-type" />
      <code>
        <system value="https://www.icanbwell.com/product-feature-code" />
        <code value="integrated-scheduling" />
      </code>
      <short value="Appointment service type" />
      <comment value="some resources in the fhir server (that don't have a source value) have a custom serviceType code w/ system incorrectly set to http://terminology.hl7.org/CodeSystem/service-type" />
      <type>
        <code value="CodeableConcept" />
      </type>
      <example>
        <label value="service type with incorrect system" />
        <valueCodeableConcept>
          <coding>
            <system value="http://terminology.hl7.org/CodeSystem/service-type" />
            <code value="p3ooKp" />
          </coding>
        </valueCodeableConcept>
      </example>
      <mustSupport value="true" />
    </element>
    <element id="Appointment.start">
      <path value="Appointment.start" />
      <label value="start-time" />
      <code>
        <system value="https://www.icanbwell.com/product-feature-code" />
        <code value="integrated-scheduling" />
      </code>
      <short value="appointment start time; likely the same value as the corresponding Slot.start" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="instant" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Appointment.slot">
      <path value="Appointment.slot" />
      <label value="appointment-slot" />
      <code>
        <system value="https://www.icanbwell.com/product-feature-code" />
        <code value="integrated-scheduling" />
      </code>
      <short value="corresponding Slot resource for the appointment" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-slot" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Appointment.created">
      <path value="Appointment.created" />
      <label value="appointment-created-date" />
      <code>
        <system value="https://www.icanbwell.com/product-feature-code" />
        <code value="integrated-scheduling" />
      </code>
      <short value="when the appointment resource was created" />
      <type>
        <code value="dateTime" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="de-participant">
      <path value="Appointment.participant" />
      <label value="participant" />
      <code>
        <system value="https://www.icanbwell.com/product-feature-code" />
        <code value="integrated-scheduling" />
      </code>
      <slicing>
        <description value="slice by type" />
        <rules value="open" />
      </slicing>
      <min value="1" />
      <type>
        <code value="BackboneElement" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="de-participant.id">
      <path value="Appointment.participant.id" />
      <label value="participant" />
      <short value="set to type code" />
      <min value="1" />
      <mustSupport value="true" />
    </element>
    <element id="de-participant.type">
      <path value="Appointment.participant.type" />
      <label value="participant" />
      <mustSupport value="true" />
    </element>
    <element id="de-participant.actor">
      <path value="Appointment.participant.actor" />
      <label value="participant" />
      <short value="reference to participant's defining resource" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-patient" />
        <targetProfile value="https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-healthcare-location" />
        <targetProfile value="https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-healthcare-service" />
        <targetProfile value="https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-practitioner" />
        <targetProfile value="https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-practitioner-role" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="de-participant.status">
      <path value="Appointment.participant.status" />
      <label value="participant" />
      <short value="accepted" />
      <mustSupport value="true" />
    </element>
    <element id="de-participating-patient">
      <path value="Appointment.participant" />
      <sliceName value="participating-patient" />
      <label value="participating-patient" />
      <code>
        <system value="https://www.icanbwell.com/product-feature-code" />
        <code value="integrated-scheduling" />
      </code>
      <short value="the patient / subject of the appointment" />
      <type>
        <code value="BackboneElement" />
      </type>
    </element>
    <element id="de-participating-patient.type">
      <path value="Appointment.participant.type" />
      <label value="participating-patient" />
      <short value="Fixed: patient|https//hl7.org/fhir/ValueSet/encounter-participant-type" />
      <patternCodeableConcept>
        <coding>
          <system value="https://hl7.org/fhir/ValueSet/encounter-participant-type" />
          <code value="patient" />
        </coding>
      </patternCodeableConcept>
    </element>
    <element id="de-participating-patient.actor">
      <path value="Appointment.participant.actor" />
      <label value="participating-patient" />
      <short value="reference to the individual's Patient resource" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-patient" />
      </type>
    </element>
    <element id="de-booker">
      <path value="Appointment.participant" />
      <sliceName value="booker" />
      <label value="booker" />
      <code>
        <system value="https://www.icanbwell.com/product-feature-code" />
        <code value="integrated-scheduling" />
      </code>
      <short value="the individual who scheduled the appointment on behalf of the patient" />
      <type>
        <code value="BackboneElement" />
      </type>
    </element>
    <element id="de-booker.type">
      <path value="Appointment.participant.type" />
      <label value="booker" />
      <short value="Fixed: booker|https//hl7.org/fhir/ValueSet/encounter-participant-type" />
      <patternCodeableConcept>
        <coding>
          <system value="https://hl7.org/fhir/ValueSet/encounter-participant-type" />
          <code value="booker" />
        </coding>
      </patternCodeableConcept>
    </element>
    <element id="de-booker.actor">
      <path value="Appointment.participant.actor" />
      <label value="booker" />
      <short value="reference to the individual's Patient or Person resource" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-patient" />
        <targetProfile value="https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-person" />
      </type>
    </element>
    <element id="de-participating-location">
      <path value="Appointment.participant" />
      <sliceName value="participating-location" />
      <label value="participating-location" />
      <code>
        <system value="https://www.icanbwell.com/product-feature-code" />
        <code value="integrated-scheduling" />
      </code>
      <short value="reference the location of the appointment" />
      <type>
        <code value="BackboneElement" />
      </type>
    </element>
    <element id="de-participating-location.type">
      <path value="Appointment.participant.type" />
      <label value="participating-location" />
      <short value="Fixed: facility|https//hl7.org/fhir/ValueSet/encounter-participant-type" />
      <patternCodeableConcept>
        <coding>
          <system value="https://hl7.org/fhir/ValueSet/encounter-participant-type" />
          <code value="facility" />
        </coding>
      </patternCodeableConcept>
    </element>
    <element id="de-participating-location.actor">
      <path value="Appointment.participant.actor" />
      <label value="participating-location" />
      <short value="reference to the provider's Location resource" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://fhir.icanbwell.com/4_0_0/StructureDefinition/pr-healthcare-location" />
      </type>
    </element>
  </differential>
</StructureDefinition>