<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="digidot-Appointment-no" />
  <url value="https://novari.no/fhir/digidot/StructureDefinition/digidot-Appointment-no" />
  <version value="0.7.0" />
  <name value="DigidotAppointmentNo" />
  <title value="DigiDOT Appointment (NO)" />
  <status value="draft" />
  <date value="2026-11-02" />
  <publisher value="Novari AS - DigiDOT" />
  <description value="Readiness: [In review](https://simplifier.net/guide/Visual-overview/Home/Review-status-and-releases.page.md?version=current#readiness-appointment).&#xA;&#xA;Profile base: no-basis-Appointment (hl7.fhir.no.basis 2.2.2) (http://hl7.no/fhir/StructureDefinition/no-basis-Appointment).&#xA;&#xA;One dental appointment for exactly one patient. Uses the fixed Dental service category, optional dental specialty and clinical reason, scheduling status, planned time or requested window, participants and optional links to planned care and the care episodes intentionally addressed by the booking." />
  <purpose value="Use for proposed, booked, fulfilled, cancelled and missed appointments. It schedules care; it does not document that care occurred. One Appointment may lead to more than one actual Encounter; each Encounter references the appointment. Clinical narrative belongs in Dental Contact Note. This is a shared appointment record, not a replacement for the source scheduling engine." />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Appointment" />
  <baseDefinition value="http://hl7.no/fhir/StructureDefinition/no-basis-Appointment" />
  <derivation value="constraint" />
  <differential>
    <element id="Appointment">
      <path value="Appointment" />
      <constraint>
        <key value="appt-positive-time" />
        <severity value="error" />
        <human value="A scheduled appointment ends after it starts." />
        <expression value="start.empty() or end &gt; start" />
      </constraint>
      <constraint>
        <key value="appt-one-patient" />
        <severity value="error" />
        <human value="Exactly one participant must be identifiable as the Patient." />
        <expression value="participant.where(actor.type = 'Patient' or actor.type = 'http://hl7.org/fhir/StructureDefinition/Patient' or actor.reference.matches('(^|/)Patient/[^/]+(/_history/[^/]+)?$') or actor.resolve().ofType(Patient).exists()).count() = 1" />
      </constraint>
    </element>
    <element id="Appointment.implicitRules">
      <path value="Appointment.implicitRules" />
      <max value="0" />
    </element>
    <element id="Appointment.contained">
      <path value="Appointment.contained" />
      <max value="0" />
    </element>
    <element id="Appointment.extension">
      <path value="Appointment.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <rules value="closed" />
      </slicing>
    </element>
    <element id="Appointment.extension:virtualService">
      <path value="Appointment.extension" />
      <sliceName value="virtualService" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Extension" />
        <profile value="http://hl7.no/fhir/StructureDefinition/no-basis-virtual-service" />
      </type>
    </element>
    <element id="Appointment.extension:group">
      <path value="Appointment.extension" />
      <sliceName value="group" />
      <max value="0" />
    </element>
    <element id="Appointment.extension:partOf">
      <path value="Appointment.extension" />
      <sliceName value="partOf" />
      <max value="0" />
    </element>
    <element id="Appointment.modifierExtension">
      <path value="Appointment.modifierExtension" />
      <max value="0" />
    </element>
    <element id="Appointment.identifier">
      <path value="Appointment.identifier" />
      <short value="Stable source business identifiers when available" />
      <definition value="Stable business identifiers for this record. If the source EHR or external system has a stable business identifier, it SHALL be included and preserved with its assigning system and value. The element is optional when no such identifier is available. Each supplied identifier SHALL contain system and value. Do not copy the local FHIR resource id merely to populate this element." />
      <comment value="MustSupport requires producers to support conveying available source identifiers and receivers to support preserving them; it does not require inventing an identifier when none is available. Any additional identifier-assignment and matching requirements belong in the exchange contract. An integration-assigned identifier requires governed assignment and a persistent mapping across retries; never generate a fresh identifier on each submission. Different records retain their own identities, even when they share the same patient or care episode. Resource references and FHIR server id rules are unchanged." />
      <min value="0" />
      <max value="*" />
      <mustSupport value="true" />
    </element>
    <element id="Appointment.identifier.system">
      <path value="Appointment.identifier.system" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Appointment.identifier.value">
      <path value="Appointment.identifier.value" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Appointment.status">
      <path value="Appointment.status" />
      <definition value="Scheduling lifecycle using the native R4 codes. Map source states through an agreed supplier mapping. A source value such as Active must not be assumed to mean booked or fulfilled. Historical scheduled dates do not prove attendance or care delivery." />
      <mustSupport value="true" />
    </element>
    <element id="Appointment.serviceCategory">
      <path value="Appointment.serviceCategory" />
      <short value="Dental service category" />
      <definition value="All appointments in this dental profile use service category 10 |Dental| from the FHIR R4 ServiceCategory code system. The coding is fixed; a human-readable display or text may be supplied." />
      <min value="1" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Appointment.serviceCategory.coding">
      <path value="Appointment.serviceCategory.coding" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Appointment.serviceCategory.coding.system">
      <path value="Appointment.serviceCategory.coding.system" />
      <min value="1" />
      <max value="1" />
      <fixedUri value="http://terminology.hl7.org/CodeSystem/service-category" />
    </element>
    <element id="Appointment.serviceCategory.coding.code">
      <path value="Appointment.serviceCategory.coding.code" />
      <min value="1" />
      <max value="1" />
      <fixedCode value="10" />
    </element>
    <element id="Appointment.serviceType">
      <path value="Appointment.serviceType" />
      <max value="0" />
    </element>
    <element id="Appointment.specialty">
      <path value="Appointment.specialty" />
      <short value="Dental specialty required for this booking, when relevant" />
      <definition value="Use only when the appointment requires a particular dental specialty. Choose from the dental subset of the FHIR R4 practice-setting codes; do not populate a specialty merely because the appointment is dental." />
      <min value="0" />
      <max value="1" />
      <binding>
        <strength value="required" />
        <valueSet value="https://novari.no/fhir/digidot/ValueSet/digidot-appointment-dental-specialties" />
      </binding>
    </element>
    <element id="Appointment.specialty.coding">
      <path value="Appointment.specialty.coding" />
      <short value="One precoordinated SNOMED CT dental specialty" />
      <definition value="One Coding conforming to the DigiDOT SCTpre profile, including the SNOMED CT edition release URI. Choose a concept from the bound dental specialty ValueSet." />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Coding" />
        <profile value="https://novari.no/fhir/digidot/StructureDefinition/digidot-Coding-SCTpre-no" />
      </type>
    </element>
    <element id="Appointment.appointmentType">
      <path value="Appointment.appointmentType" />
      <short value="Administrative appointment type" />
      <definition value="Administrative style of booking using the inherited no-basis type slices where applicable. Preserve a source appointment type through a documented terminology mapping. Clinical service codes belong on the planned ServiceRequest; do not duplicate the same source field in appointmentType and serviceType without distinct meanings." />
      <min value="0" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Appointment.reasonCode">
      <path value="Appointment.reasonCode" />
      <short value="Precoordinated clinical reason for this appointment" />
      <definition value="Optional coded reason for booking the appointment. Use one precoordinated SNOMED CT Clinical finding or Finding with explicit context concept per reason; its context must accurately describe the indication. Use reasonReference when the relevant Condition or Observation is separately stored. A routine recall booking need not invent a clinical reason; basedOn can identify the planned ServiceRequest." />
      <mustSupport value="true" />
      <binding>
        <strength value="required" />
        <valueSet value="https://novari.no/fhir/digidot/ValueSet/digidot-service-request-reasons" />
      </binding>
    </element>
    <element id="Appointment.reasonCode.coding">
      <path value="Appointment.reasonCode.coding" />
      <short value="One precoordinated SNOMED CT reason code" />
      <min value="1" />
      <max value="1" />
      <type>
        <code value="Coding" />
        <profile value="https://novari.no/fhir/digidot/StructureDefinition/digidot-Coding-SCTpre-no" />
      </type>
      <mustSupport value="true" />
    </element>
    <element id="Appointment.reasonReference">
      <path value="Appointment.reasonReference" />
      <short value="Existing clinical finding or observation behind the booking" />
      <definition value="Reference an existing DigiDOT Condition or Observation that explains why the appointment is scheduled. Use a literal reference to the stored record. This is independent of basedOn, which links the appointment to a planned ServiceRequest." />
      <comment value="Use a literal reference to a separately stored resource conforming to the permitted target profile. Identifier-only and contained references are not permitted. The receiving service must check target existence and profile conformance." />
      <type>
        <code value="Reference" />
        <targetProfile value="https://novari.no/fhir/digidot/StructureDefinition/digidot-Condition-no" />
        <targetProfile value="https://novari.no/fhir/digidot/StructureDefinition/digidot-Observation-no" />
      </type>
      <constraint>
        <key value="appointment-reasonreference-literal" />
        <severity value="error" />
        <human value="A shared-resource reference must contain a literal reference value; identifiers and contained references are not permitted." />
        <expression value="($this is Reference) implies (reference.hasValue() and identifier.empty() and reference.startsWith('#').not())" />
        <source value="https://novari.no/fhir/digidot/StructureDefinition/digidot-Appointment-no" />
      </constraint>
      <mustSupport value="true" />
    </element>
    <element id="Appointment.reasonReference.reference">
      <path value="Appointment.reasonReference.reference" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Appointment.reasonReference.identifier">
      <path value="Appointment.reasonReference.identifier" />
      <max value="0" />
    </element>
    <element id="Appointment.priority">
      <path value="Appointment.priority" />
      <constraint>
        <key value="appt-priority-range" />
        <severity value="error" />
        <human value="Scheduling priority must be between 0 (undefined) and 9." />
        <expression value="$this &lt;= 9" />
      </constraint>
    </element>
    <element id="Appointment.description">
      <path value="Appointment.description" />
      <short value="Brief booking label" />
      <definition value="Short human-readable purpose for the appointment list, for example examination or restoration visit. Do not store clinical findings, completed treatment or the journal narrative here." />
      <mustSupport value="true" />
    </element>
    <element id="Appointment.supportingInformation">
      <path value="Appointment.supportingInformation" />
      <short value="Care episodes intentionally addressed by this booking" />
      <definition value="Optional literal references to defined care-responsibility episodes addressed by this booking. Use them when such responsibility is represented; reuse the appropriate shared identity. A booking does not require an artificial episode, and links to ServiceRequest remain independently useful. Do not attach all open episodes by default." />
      <comment value="Use a literal reference to a separately stored resource conforming to the permitted target profile. Identifier-only and contained references are not permitted. The receiving service must check target existence and profile conformance." />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://novari.no/fhir/digidot/StructureDefinition/digidot-EpisodeOfCare-no" />
      </type>
      <constraint>
        <key value="appointment-supportinginformation-literal" />
        <severity value="error" />
        <human value="A shared-resource reference must contain a literal reference value; identifiers and contained references are not permitted." />
        <expression value="($this is Reference) implies (reference.hasValue() and identifier.empty() and reference.startsWith('#').not())" />
        <source value="https://novari.no/fhir/digidot/StructureDefinition/digidot-Appointment-no" />
      </constraint>
      <mustSupport value="true" />
    </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.minutesDuration">
      <path value="Appointment.minutesDuration" />
      <short value="Requested care duration when known" />
      <definition value="May express requested duration before a time is booked, or care time excluding planned breaks. It need not equal end minus start." />
    </element>
    <element id="Appointment.slot">
      <path value="Appointment.slot" />
      <max value="0" />
    </element>
    <element id="Appointment.comment">
      <path value="Appointment.comment" />
      <short value="Practical internal booking comments" />
      <definition value="Practical internal scheduling information that cannot be represented in another scheduling element. Do not use this field for clinical findings, treatment results or the clinical journal note. Patient-facing attendance information belongs in patientInstruction." />
      <min value="0" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Appointment.patientInstruction">
      <path value="Appointment.patientInstruction" />
      <short value="Practical instructions for attending the appointment" />
    </element>
    <element id="Appointment.basedOn">
      <path value="Appointment.basedOn" />
      <comment value="Use a literal reference to a separately stored resource conforming to the permitted target profile. Identifier-only and contained references are not permitted. The receiving service must check target existence and profile conformance." />
      <type>
        <code value="Reference" />
        <targetProfile value="https://novari.no/fhir/digidot/StructureDefinition/digidot-ServiceRequest-no" />
      </type>
      <constraint>
        <key value="appointment-basedon-literal" />
        <severity value="error" />
        <human value="A shared-resource reference must contain a literal reference value; identifiers and contained references are not permitted." />
        <expression value="($this is Reference) implies (reference.hasValue() and identifier.empty() and reference.startsWith('#').not())" />
        <source value="https://novari.no/fhir/digidot/StructureDefinition/digidot-Appointment-no" />
      </constraint>
      <mustSupport value="true" />
    </element>
    <element id="Appointment.basedOn.reference">
      <path value="Appointment.basedOn.reference" />
      <min value="1" />
    </element>
    <element id="Appointment.basedOn.identifier">
      <path value="Appointment.basedOn.identifier" />
      <max value="0" />
    </element>
    <element id="Appointment.participant">
      <path value="Appointment.participant" />
      <comment value="Exactly one Patient participant is required. Every participant must reference a separately stored permitted actor. Reference.type is optional; the resource-level invariant identifies the patient from its declared type, literal reference or resolved resource. Other permitted participant types remain optional and repeatable." />
    </element>
    <element id="Appointment.participant.extension">
      <path value="Appointment.participant.extension" />
      <max value="0" />
    </element>
    <element id="Appointment.participant.modifierExtension">
      <path value="Appointment.participant.modifierExtension" />
      <max value="0" />
    </element>
    <element id="Appointment.participant.type">
      <path value="Appointment.participant.type" />
      <max value="0" />
    </element>
    <element id="Appointment.participant.actor">
      <path value="Appointment.participant.actor" />
      <definition value="A separately stored Patient, Practitioner, PractitionerRole, RelatedPerson or Location participating in the appointment, conforming to the permitted no-basis target profile. Include the one Patient and the other known participants; do not invent an actor for an unassigned booking." />
      <comment value="Use a literal Reference.reference to a separately stored resource conforming to the permitted national target profile. Identifier-only and contained references are not permitted. Official identifiers belong on the target resource. Reuse a confirmed resource in central storage; if no matching resource exists, register it before persisting the clinical reference. The receiving service must check target existence and profile conformance; the profile alone does not perform identity matching or prove that a resource exists in central storage." />
      <min value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.no/fhir/StructureDefinition/no-basis-Patient" />
        <targetProfile value="http://hl7.no/fhir/StructureDefinition/no-basis-Practitioner" />
        <targetProfile value="http://hl7.no/fhir/StructureDefinition/no-basis-PractitionerRole" />
        <targetProfile value="http://hl7.no/fhir/StructureDefinition/no-basis-Location" />
        <targetProfile value="http://hl7.no/fhir/StructureDefinition/no-basis-RelatedPerson" />
      </type>
      <constraint>
        <key value="appointment-participant-actor-literal" />
        <severity value="error" />
        <human value="A shared-resource reference must contain a literal reference value; identifiers and contained references are not permitted." />
        <expression value="($this is Reference) implies (reference.hasValue() and identifier.empty() and reference.startsWith('#').not())" />
        <source value="https://novari.no/fhir/digidot/StructureDefinition/digidot-Appointment-no" />
      </constraint>
    </element>
    <element id="Appointment.participant.actor.reference">
      <path value="Appointment.participant.actor.reference" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Appointment.participant.actor.identifier">
      <path value="Appointment.participant.actor.identifier" />
      <min value="0" />
      <max value="0" />
    </element>
    <element id="Appointment.participant.status">
      <path value="Appointment.participant.status" />
      <definition value="The participant's recorded acceptance state. An actor being listed is not evidence of acceptance. Document the source event or agreed booking workflow supporting the value; needs-action means a response is needed, not an arbitrary unknown fallback." />
      <mustSupport value="true" />
    </element>
  </differential>
</StructureDefinition>