<StructureDefinition xmlns="http://hl7.org/fhir">
  <meta>
    <lastUpdated value="2017-11-08T08:15:57.39+01:00" />
  </meta>
  <url value="http://ehelse.no/fhir/StructureDefinition/NationalDialogue-Appointment" />
  <name value="NationalDialogue-Appointment" />
  <status value="draft" />
  <experimental value="true" />
  <date value="2017-09-13T08:35:27.127+02:00" />
  <description value="This profile defines the Appointment object used in the national project that shall enable the citizen to have his appointments in a calendar at the national health care protal. " />
  <fhirVersion value="3.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" />
      <requirements value="The appointment communicated with the national health care portal are always created in advance by the health care service." />
      <min value="1" />
    </element>
    <element id="Appointment.meta.versionId">
      <path value="Appointment.meta.versionId" />
      <requirements value="An appointment shall always contain a version ID to distinguish appointments that change after creation." />
      <min value="1" />
    </element>
    <element id="Appointment.meta.security">
      <path value="Appointment.meta.security" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="system" />
        </discriminator>
        <rules value="open" />
      </slicing>
    </element>
    <element id="Appointment.meta.security.system">
      <path value="Appointment.meta.security.system" />
      <min value="1" />
      <binding>
        <strength value="required" />
        <valueSetUri value="http://hl7.org/fhir/ValueSet/v3-ConfidentialityClassification" />
      </binding>
    </element>
    <element id="Appointment.meta.security.code">
      <path value="Appointment.meta.security.code" />
      <min value="1" />
    </element>
    <element id="Appointment.meta.security:defaultSecurity">
      <path value="Appointment.meta.security" />
      <sliceName value="defaultSecurity" />
    </element>
    <element id="Appointment.meta.security:confClassSecurity">
      <path value="Appointment.meta.security" />
      <sliceName value="confClassSecurity" />
      <binding>
        <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName">
          <valueString value="SecurityLabels" />
        </extension>
        <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-isCommonBinding">
          <valueBoolean value="true" />
        </extension>
        <strength value="required" />
        <valueSetUri value="http://hl7.org/fhir/ValueSet/v3-ConfidentialityClassification" />
      </binding>
    </element>
    <element id="security:confClassSecurity.system">
      <path value="Appointment.meta.security.system" />
      <min value="1" />
    </element>
    <element id="security:confClassSecurity.code">
      <path value="Appointment.meta.security.code" />
      <min value="1" />
    </element>
    <element id="Appointment.extension">
      <path value="Appointment.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <rules value="open" />
      </slicing>
    </element>
    <element id="Appointment.extension:CommunicationOptions">
      <path value="Appointment.extension" />
      <sliceName value="CommunicationOptions" />
      <type>
        <code value="Extension" />
        <profile value="http://ehelse.no/fhir/StructureDefinition/NationalDialogue-Extension.CommunicationOptions" />
      </type>
    </element>
    <element id="Appointment.identifier">
      <path value="Appointment.identifier" />
      <max value="0" />
    </element>
    <element id="Appointment.status">
      <path value="Appointment.status" />
      <requirements value="The status is mandatory" />
    </element>
    <element id="Appointment.serviceCategory">
      <path value="Appointment.serviceCategory" />
      <max value="0" />
    </element>
    <element id="Appointment.serviceType">
      <path value="Appointment.serviceType" />
      <max value="0" />
    </element>
    <element id="Appointment.specialty">
      <path value="Appointment.specialty" />
      <max value="0" />
    </element>
    <element id="Appointment.appointmentType">
      <path value="Appointment.appointmentType" />
      <definition value="The code set selected is the one that has most relevanse for the patient. The aim of this profile is to populate the patient calendar." />
      <requirements value="The current code set is found to limited. The code set for Encounter.class is more suitable for our purpose." />
      <min value="1" />
      <binding>
        <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName">
          <valueString value="appointment-type" />
        </extension>
        <strength value="required" />
        <valueSetUri value="http://hl7.org/fhir/ValueSet/v3-ActEncounterCode" />
      </binding>
    </element>
    <element id="Appointment.reason">
      <path value="Appointment.reason" />
      <max value="0" />
    </element>
    <element id="Appointment.indication">
      <path value="Appointment.indication" />
      <max value="0" />
    </element>
    <element id="Appointment.priority">
      <path value="Appointment.priority" />
      <max value="0" />
    </element>
    <element id="Appointment.description">
      <path value="Appointment.description" />
      <min value="1" />
    </element>
    <element id="Appointment.supportingInformation">
      <path value="Appointment.supportingInformation" />
      <definition value="In this profile there shall be at least one supportingInformation element that holds a refernce to the organization that manage the helath service that is provided at the described Location. The Location is mandatory partcipant in the appointment. Other supporting information elements may hold XDS document references that are provided in a specific eHelse profile for DocumentReference" />
      <requirements value="In our profile the organization responsible for providing the health care sercvice must be given. As the partcipants are refferd and referrals can not be nested, we propose that the managing organization is given in the supportingInformation (rather being another participant)." />
      <min value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://ehelse.no/fhir/StructureDefinition/NationalDialogue-DocumentReference" />
        <aggregation value="contained" />
      </type>
      <type>
        <code value="Reference" />
        <targetProfile value="http://ehelse.no/fhir/StructureDefinition/NationalDialogue-Contained.Location" />
        <aggregation value="contained" />
      </type>
      <type>
        <code value="Reference" />
        <targetProfile value="http://ehelse.no/fhir/StructureDefinition/NationalDialogue-Contained.Organization" />
        <aggregation value="contained" />
      </type>
    </element>
    <element id="Appointment.supportingInformation.reference">
      <path value="Appointment.supportingInformation.reference" />
      <min value="1" />
    </element>
    <element id="Appointment.supportingInformation.identifier">
      <path value="Appointment.supportingInformation.identifier" />
      <max value="0" />
    </element>
    <element id="Appointment.start">
      <path value="Appointment.start" />
      <min value="1" />
    </element>
    <element id="Appointment.comment">
      <path value="Appointment.comment" />
      <max value="0" />
    </element>
    <element id="Appointment.incomingReferral">
      <path value="Appointment.incomingReferral" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://ehelse.no/fhir/StructureDefinition/NationalDialogue-ReferralRequest" />
      </type>
    </element>
    <element id="Appointment.participant">
      <path value="Appointment.participant" />
      <requirements value="In our profile there must be at least two participants: The Paitient, and the Location where the healthcare service is to be provided. Both are refernced contained resources." />
      <min value="2" />
    </element>
    <element id="Appointment.participant.actor">
      <path value="Appointment.participant.actor" />
      <min value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://ehelse.no/fhir/StructureDefinition/NationalDialogue-Contained.Location" />
        <aggregation value="contained" />
      </type>
      <type>
        <code value="Reference" />
        <targetProfile value="http://ehelse.no/fhir/StructureDefinition/NationalDialogue-Contained.Patient" />
        <aggregation value="contained" />
      </type>
      <type>
        <code value="Reference" />
        <targetProfile value="http://ehelse.no/fhir/StructureDefinition/NationalDialogue-Contained.Practitioner" />
        <aggregation value="contained" />
      </type>
    </element>
    <element id="Appointment.participant.actor.reference">
      <path value="Appointment.participant.actor.reference" />
      <min value="1" />
    </element>
    <element id="Appointment.participant.actor.identifier">
      <path value="Appointment.participant.actor.identifier" />
      <max value="0" />
    </element>
    <element id="Appointment.participant.required">
      <path value="Appointment.participant.required" />
      <min value="1" />
    </element>
    <element id="Appointment.requestedPeriod">
      <path value="Appointment.requestedPeriod" />
      <max value="1" />
    </element>
  </differential>
</StructureDefinition>