<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="digidot-Encounter-no" />
  <url value="https://novari.no/fhir/digidot/StructureDefinition/digidot-Encounter-no" />
  <version value="0.6.10" />
  <name value="DigidotEncounterNo" />
  <title value="DigiDOT Encounter (NO)" />
  <status value="draft" />
  <date value="2026-10-19" />
  <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-encounter).&#xA;&#xA;Profile base: FHIR R4 Encounter (http://hl7.org/fhir/StructureDefinition/Encounter).&#xA;&#xA;Draft DigiDOT profile for one ambulatory, emergency, home-based or synchronous virtual dental contact, from arrival or triage through care, completion or cancellation. A booking alone remains an Appointment. Stores the patient, provider, known timing and participants actually involved." />
  <purpose value="Use this profile as the context for one actual dental contact. Appointment represents scheduling, ServiceRequest represents planned care, and EpisodeOfCare may group related contacts over time. Condition, Observation and Procedure reference the Encounter in which clinical information was recorded or an action occurred. Use DigiDOT Dental Contact Note (Composition) for the clinician-authored journal note. A contact can have multiple independently authored notes; the Encounter lifecycle and each note's document status remain distinct. The selected health group applied at the start of this Encounter. Select the Patient health-group period covering the calendar date of Encounter.period.start in the Europe/Oslo time zone. Use the contact date even for late entry; do not copy today's classification into a past contact. If a contact crosses a group boundary, retain its start-date classification. Later Patient changes do not automatically rewrite this value. Correct an erroneous classification only through the agreed traceable correction workflow. The receiving service must check the Patient period and code; standalone profile validation cannot perform this cross-resource workflow check. The extension remains optional (0..1) for now; a future mandatory requirement is a separate decision. Absence means that no contact classification is recorded, not that the patient has no entitlement." />
  <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">
      <path value="Encounter" />
      <short value="One dental contact and its lifecycle" />
      <constraint>
        <key value="enc-period-end-finished" />
        <severity value="error" />
        <human value="A finished Encounter must have an end time." />
        <expression value="status != 'finished' or period.end.exists()" />
      </constraint>
      <constraint>
        <key value="digidot-encounter-status-allowed" />
        <severity value="error" />
        <human value="Use only the six agreed DigiDOT contact lifecycle states." />
        <expression value="status = 'arrived' or status = 'triaged' or status = 'in-progress' or status = 'finished' or status = 'cancelled' or status = 'entered-in-error'" />
      </constraint>
      <constraint>
        <key value="enc-participant-pprf-care" />
        <severity value="error" />
        <human value="An in-progress or finished clinical contact needs an identified primary performer (PPRF); do not invent one for arrival, triage or cancellation." />
        <expression value="(status != 'in-progress' and status != 'finished') or participant.where(type.coding.where(system = 'http://terminology.hl7.org/CodeSystem/v3-ParticipationType' and code = 'PPRF').exists() and (individual.type = 'Practitioner' or individual.type = 'PractitionerRole' or individual.type = 'http://hl7.org/fhir/StructureDefinition/Practitioner' or individual.type = 'http://hl7.org/fhir/StructureDefinition/PractitionerRole' or individual.reference.matches('(^|/)(Practitioner|PractitionerRole)/[^/]+(/_history/[^/]+)?$') or individual.resolve().ofType(Practitioner).exists() or individual.resolve().ofType(PractitionerRole).exists())).exists()" />
      </constraint>
      <constraint>
        <key value="enc-period-start-active" />
        <severity value="error" />
        <human value="Arrival, triage, care and finished contacts need an actual start time." />
        <expression value="(status != 'arrived' and status != 'triaged' and status != 'in-progress' and status != 'finished') or period.start.exists()" />
      </constraint>
      <constraint>
        <key value="enc-physical-location" />
        <severity value="error" />
        <human value="An ambulatory or emergency contact needs its actual care Location once the patient has arrived, been triaged or received care. Location is optional for home-based and virtual contacts." />
        <expression value="(class.code != 'AMB' and class.code != 'EMER') or (status != 'arrived' and status != 'triaged' and status != 'in-progress' and status != 'finished') or location.exists()" />
      </constraint>
      <constraint>
        <key value="encounter-health-group-date" />
        <severity value="error" />
        <human value="An Encounter carrying a health group must have a start with a complete calendar date, with or without a time." />
        <expression value="extension.where(url = 'https://novari.no/fhir/digidot/StructureDefinition/digidot-Helsegruppe-no').exists() implies (period.start.hasValue() and period.start.toString().matches('^[0-9]{4}-[0-9]{2}-[0-9]{2}'))" />
        <source value="https://novari.no/fhir/digidot/StructureDefinition/digidot-Encounter-no" />
      </constraint>
    </element>
    <element id="Encounter.implicitRules">
      <path value="Encounter.implicitRules" />
      <max value="0" />
    </element>
    <element id="Encounter.contained">
      <path value="Encounter.contained" />
      <max value="0" />
    </element>
    <element id="Encounter.extension">
      <path value="Encounter.extension" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="url" />
        </discriminator>
        <rules value="closed" />
      </slicing>
      <short value="Optional health group applied for this contact" />
      <definition value="At most one root-level extension is permitted in this draft: the defined helsegruppe slice. Other root-level extensions are not part of the current closed slice set. Nested extensions on other elements retain their own constraints." />
      <min value="0" />
      <max value="1" />
    </element>
    <element id="Encounter.extension:helsegruppe">
      <path value="Encounter.extension" />
      <sliceName value="helsegruppe" />
      <short value="Health group applied for this contact" />
      <definition value="Optional health-group classification applied at the start of this contact, selected from the patient's recorded validity periods. It remains independent of later patient reclassification." />
      <comment value="The selected health group applied at the start of this Encounter. Select the Patient health-group period covering the calendar date of Encounter.period.start in the Europe/Oslo time zone. Use the contact date even for late entry; do not copy today's classification into a past contact. If a contact crosses a group boundary, retain its start-date classification. Later Patient changes do not automatically rewrite this value. Correct an erroneous classification only through the agreed traceable correction workflow. The receiving service must check the Patient period and code; standalone profile validation cannot perform this cross-resource workflow check. The extension remains optional (0..1) for now; a future mandatory requirement is a separate decision. Absence means that no contact classification is recorded, not that the patient has no entitlement." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Extension" />
        <profile value="https://novari.no/fhir/digidot/StructureDefinition/digidot-Helsegruppe-no" />
      </type>
    </element>
    <element id="Encounter.extension:helsegruppe.url">
      <path value="Encounter.extension.url" />
      <fixedUri value="https://novari.no/fhir/digidot/StructureDefinition/digidot-Helsegruppe-no" />
    </element>
    <element id="Encounter.modifierExtension">
      <path value="Encounter.modifierExtension" />
      <max value="0" />
    </element>
    <element id="Encounter.identifier">
      <path value="Encounter.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="Encounter.identifier.system">
      <path value="Encounter.identifier.system" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Encounter.identifier.value">
      <path value="Encounter.identifier.value" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Encounter.status">
      <path value="Encounter.status" />
      <short value="Contact lifecycle status" />
      <definition value="Contact lifecycle using arrived, triaged, in-progress, finished, cancelled or entered-in-error. Do not use unknown, planned or onleave. A cancelled appointment with no Encounter remains an Appointment; cancelled here is for a contact record that was initiated but ended before care." />
      <mustSupport value="true" />
      <binding>
        <strength value="required" />
        <valueSet value="https://novari.no/fhir/digidot/ValueSet/digidot-encounter-status" />
      </binding>
    </element>
    <element id="Encounter.statusHistory">
      <path value="Encounter.statusHistory" />
      <short value="Not exchanged" />
      <definition value="Status transitions are not repeated inline. The receiving storage must retain resource history or equivalent audit events if previous states need to be reconstructed; meta.versionId alone is not a status timeline." />
      <max value="0" />
    </element>
    <element id="Encounter.class">
      <path value="Encounter.class" />
      <short value="Physical or virtual dental contact" />
      <definition value="Care setting, distinct from the specific type of contact. Use AMB for ambulatory care, EMER for care in a dedicated emergency service, HH for home-based care or VR for synchronous virtual care. An urgent appointment at an ordinary clinic does not by itself establish EMER." />
      <mustSupport value="true" />
      <binding>
        <strength value="required" />
        <description value="Standard HL7 classes selected for ambulatory, emergency, home-based or synchronous virtual dental contacts." />
        <valueSet value="https://novari.no/fhir/digidot/ValueSet/digidot-encounter-class" />
      </binding>
    </element>
    <element id="Encounter.classHistory">
      <path value="Encounter.classHistory" />
      <max value="0" />
    </element>
    <element id="Encounter.type">
      <path value="Encounter.type" />
      <short value="Specific contact type" />
      <definition value="Optional primary type of the actual contact, such as a check-up, follow-up, problem-focused contact, consultation for treatment or new-patient consultation. Record the care setting in Encounter.class and actual procedures in Procedure." />
      <comment value="Select at most one source-recorded primary contact type. Omit type rather than infer a classification from booking text or treatment codes alone. Use basedOn to identify the recall ServiceRequest; a check-up code alone does not establish recall enrolment. Other appropriate codes remain permitted by the preferred binding." />
      <min value="0" />
      <max value="1" />
      <binding>
        <strength value="preferred" />
        <description value="Prefer the selected existing SNOMED CT contact concepts when they represent the actual contact. This is a recommended selection, not an exhaustive or mutually exclusive classification." />
        <valueSet value="https://novari.no/fhir/digidot/ValueSet/digidot-encounter-type" />
      </binding>
    </element>
    <element id="Encounter.serviceType">
      <path value="Encounter.serviceType" />
      <max value="0" />
    </element>
    <element id="Encounter.priority">
      <path value="Encounter.priority" />
      <short value="Source-recorded urgency of the contact" />
      <definition value="Populate only when the source explicitly records the urgency of the actual contact. Do not infer it from appointment availability or clinical severity." />
      <max value="0" />
    </element>
    <element id="Encounter.subject">
      <path value="Encounter.subject" />
      <short value="Patient receiving care in the contact" />
      <definition value="The patient receiving care in this contact. The health-group extension, when present, applies to this same patient for this contact. The patient's longitudinal health-group classification is represented separately." />
      <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" />
      <max value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.no/fhir/StructureDefinition/no-basis-Patient" />
      </type>
      <constraint>
        <key value="encounter-subject-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-Encounter-no" />
      </constraint>
      <mustSupport value="true" />
    </element>
    <element id="Encounter.subject.reference">
      <path value="Encounter.subject.reference" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Encounter.subject.identifier">
      <path value="Encounter.subject.identifier" />
      <min value="0" />
      <max value="0" />
    </element>
    <element id="Encounter.episodeOfCare">
      <path value="Encounter.episodeOfCare" />
      <short value="Care episodes actually addressed by this contact" />
      <definition value="Optional references to defined care-responsibility episodes actually addressed by this contact. Use and reuse them when longitudinal organisational responsibility is represented. Planned or unplanned care can be recorded without an artificial episode. Do not attach all open patient episodes by default." />
      <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="0" />
      <max value="*" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://novari.no/fhir/digidot/StructureDefinition/digidot-EpisodeOfCare-no" />
      </type>
      <constraint>
        <key value="encounter-episodeofcare-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-Encounter-no" />
      </constraint>
      <mustSupport value="true" />
    </element>
    <element id="Encounter.episodeOfCare.reference">
      <path value="Encounter.episodeOfCare.reference" />
      <min value="1" />
    </element>
    <element id="Encounter.episodeOfCare.identifier">
      <path value="Encounter.episodeOfCare.identifier" />
      <max value="0" />
    </element>
    <element id="Encounter.basedOn">
      <path value="Encounter.basedOn" />
      <short value="Planned services that led to the contact" />
      <definition value="Reference the DigiDOT ServiceRequest or requests that initiated this contact. The reference is optional for unplanned and emergency contacts." />
      <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." />
      <type>
        <code value="Reference" />
        <targetProfile value="https://novari.no/fhir/digidot/StructureDefinition/digidot-ServiceRequest-no" />
      </type>
      <constraint>
        <key value="encounter-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-Encounter-no" />
      </constraint>
      <mustSupport value="true" />
    </element>
    <element id="Encounter.basedOn.reference">
      <path value="Encounter.basedOn.reference" />
      <min value="1" />
    </element>
    <element id="Encounter.basedOn.identifier">
      <path value="Encounter.basedOn.identifier" />
      <max value="0" />
    </element>
    <element id="Encounter.participant">
      <path value="Encounter.participant" />
      <short value="People who participated in the contact" />
      <definition value="Record people who actually participated. An in-progress or finished contact requires a primary performer; arrival, triage or cancellation may have none yet." />
      <min value="0" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.participant.extension">
      <path value="Encounter.participant.extension" />
      <max value="0" />
    </element>
    <element id="Encounter.participant.modifierExtension">
      <path value="Encounter.participant.modifierExtension" />
      <max value="0" />
    </element>
    <element id="Encounter.participant.type">
      <path value="Encounter.participant.type" />
      <short value="Participant role in this contact" />
      <definition value="How this person participated in this contact (for example PPRF primary performer), not their professional qualification. Uses the inherited FHIR R4 Encounter participant-type extensible binding." />
      <min value="1" />
      <max value="*" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.participant.individual">
      <path value="Encounter.participant.individual" />
      <short value="Identified contact participant" />
      <definition value="Persons involved in the encounter other than the patient." />
      <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-Practitioner" />
        <targetProfile value="http://hl7.no/fhir/StructureDefinition/no-basis-PractitionerRole" />
        <targetProfile value="http://hl7.no/fhir/StructureDefinition/no-basis-RelatedPerson" />
      </type>
      <constraint>
        <key value="encounter-participant-individual-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-Encounter-no" />
      </constraint>
      <mustSupport value="true" />
    </element>
    <element id="Encounter.participant.individual.reference">
      <path value="Encounter.participant.individual.reference" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Encounter.participant.individual.identifier">
      <path value="Encounter.participant.individual.identifier" />
      <min value="0" />
      <max value="0" />
    </element>
    <element id="Encounter.appointment">
      <path value="Encounter.appointment" />
      <short value="Appointment that scheduled this contact" />
      <definition value="Reference the DigiDOT Appointment, derived from no-basis Appointment, when this actual contact resulted from a booked appointment." />
      <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." />
      <max value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="https://novari.no/fhir/digidot/StructureDefinition/digidot-Appointment-no" />
      </type>
      <constraint>
        <key value="encounter-appointment-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-Encounter-no" />
      </constraint>
      <mustSupport value="true" />
    </element>
    <element id="Encounter.appointment.reference">
      <path value="Encounter.appointment.reference" />
      <min value="1" />
    </element>
    <element id="Encounter.appointment.identifier">
      <path value="Encounter.appointment.identifier" />
      <max value="0" />
    </element>
    <element id="Encounter.period">
      <path value="Encounter.period" />
      <short value="Actual contact period" />
      <definition value="Actual contact times when known. Start is required for arrived, triaged, in-progress and finished; end is required for finished. Do not copy a planned appointment period into a cancelled pre-care Encounter." />
      <min value="0" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.period.start">
      <path value="Encounter.period.start" />
      <min value="1" />
    </element>
    <element id="Encounter.length">
      <path value="Encounter.length" />
      <short value="Actual duration, if recorded" />
      <definition value="Optional actual contact duration, excluding absence where relevant. Do not infer it from booking length or force it to equal period.end minus period.start." />
      <max value="1" />
    </element>
    <element id="Encounter.reasonCode">
      <path value="Encounter.reasonCode" />
      <max value="0" />
    </element>
    <element id="Encounter.reasonReference">
      <path value="Encounter.reasonReference" />
      <short value="Clinical reason for the contact" />
      <definition value="Reference a DigiDOT Condition, Observation or Procedure when it is the structured reason for this contact. Use basedOn for the planned service that initiated the contact." />
      <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." />
      <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" />
        <targetProfile value="https://novari.no/fhir/digidot/StructureDefinition/digidot-Procedure-no" />
      </type>
      <constraint>
        <key value="encounter-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-Encounter-no" />
      </constraint>
      <mustSupport value="true" />
    </element>
    <element id="Encounter.reasonReference.reference">
      <path value="Encounter.reasonReference.reference" />
      <min value="1" />
    </element>
    <element id="Encounter.reasonReference.identifier">
      <path value="Encounter.reasonReference.identifier" />
      <max value="0" />
    </element>
    <element id="Encounter.diagnosis">
      <path value="Encounter.diagnosis" />
      <short value="Not exchanged in this profile" />
      <definition value="Clinical findings and diagnoses are recorded as Conditions. Condition.encounter identifies the contact where a Condition was recorded; it does not automatically link every later contact where it was considered." />
      <min value="0" />
      <max value="0" />
      <mustSupport value="false" />
    </element>
    <element id="Encounter.account">
      <path value="Encounter.account" />
      <max value="0" />
    </element>
    <element id="Encounter.hospitalization">
      <path value="Encounter.hospitalization" />
      <max value="0" />
    </element>
    <element id="Encounter.location">
      <path value="Encounter.location" />
      <short value="Location of the dental contact" />
      <definition value="At most one actual care location. For an ambulatory (AMB) or emergency (EMER) contact, reference the care facility from arrival or triage through care and completion. Location is optional for home-based (HH) and synchronous virtual (VR) contacts. A home visit does not require registration of the patient home as a Location. Do not substitute the responsible organisation or invent a virtual Location when no actual care location is recorded." />
      <min value="0" />
      <max value="1" />
      <mustSupport value="true" />
    </element>
    <element id="Encounter.location.extension">
      <path value="Encounter.location.extension" />
      <max value="0" />
    </element>
    <element id="Encounter.location.modifierExtension">
      <path value="Encounter.location.modifierExtension" />
      <max value="0" />
    </element>
    <element id="Encounter.location.location">
      <path value="Encounter.location.location" />
      <short value="Physical or virtual service location" />
      <definition value="When supplied, reference a separately stored no-basis Location that actually represents the place of care. The responsible organisation belongs in serviceProvider. For a virtual contact, a supplied location must have an explicit source meaning, such as the clinician service location." />
      <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-Location" />
      </type>
      <constraint>
        <key value="encounter-location-location-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-Encounter-no" />
      </constraint>
      <mustSupport value="true" />
    </element>
    <element id="Encounter.location.location.reference">
      <path value="Encounter.location.location.reference" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Encounter.location.location.identifier">
      <path value="Encounter.location.location.identifier" />
      <min value="0" />
      <max value="0" />
    </element>
    <element id="Encounter.serviceProvider">
      <path value="Encounter.serviceProvider" />
      <short value="Organisation responsible for this contact" />
      <definition value="The no-basis Organisation responsible for the actual contact. This can differ from the organisation managing the wider EpisodeOfCare." />
      <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-Organization" />
      </type>
      <constraint>
        <key value="encounter-serviceprovider-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-Encounter-no" />
      </constraint>
      <mustSupport value="true" />
    </element>
    <element id="Encounter.serviceProvider.reference">
      <path value="Encounter.serviceProvider.reference" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Encounter.serviceProvider.identifier">
      <path value="Encounter.serviceProvider.identifier" />
      <min value="0" />
      <max value="0" />
    </element>
    <element id="Encounter.partOf">
      <path value="Encounter.partOf" />
      <max value="0" />
    </element>
  </differential>
</StructureDefinition>