{
  "resourceType": "StructureDefinition",
  "id": "digidot-Encounter-no",
  "url": "https://novari.no/fhir/digidot/StructureDefinition/digidot-Encounter-no",
  "version": "0.6.11",
  "name": "DigidotEncounterNo",
  "title": "DigiDOT Encounter (NO)",
  "status": "draft",
  "date": "2026-11-27",
  "publisher": "Novari AS - DigiDOT",
  "description": "Readiness: [In review](https://simplifier.net/guide/Visual-overview/Home/Review-status-and-releases.page.md?version=current#readiness-encounter).\n\nProfile base: FHIR R4 Encounter (http://hl7.org/fhir/StructureDefinition/Encounter).\n\nDraft 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": "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": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Encounter",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Encounter",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Encounter",
        "path": "Encounter",
        "short": "One dental contact and its lifecycle",
        "constraint": [
          {
            "key": "enc-period-end-finished",
            "severity": "error",
            "human": "A finished Encounter must have an end time.",
            "expression": "status != 'finished' or period.end.exists()"
          },
          {
            "key": "digidot-encounter-status-allowed",
            "severity": "error",
            "human": "Use only the six agreed DigiDOT contact lifecycle states.",
            "expression": "status = 'arrived' or status = 'triaged' or status = 'in-progress' or status = 'finished' or status = 'cancelled' or status = 'entered-in-error'"
          },
          {
            "key": "enc-participant-pprf-care",
            "severity": "error",
            "human": "An in-progress or finished clinical contact needs an identified primary performer (PPRF); do not invent one for arrival, triage or cancellation.",
            "expression": "(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()"
          },
          {
            "key": "enc-period-start-active",
            "severity": "error",
            "human": "Arrival, triage, care and finished contacts need an actual start time.",
            "expression": "(status != 'arrived' and status != 'triaged' and status != 'in-progress' and status != 'finished') or period.start.exists()"
          },
          {
            "key": "enc-physical-location",
            "severity": "error",
            "human": "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": "(class.code != 'AMB' and class.code != 'EMER') or (status != 'arrived' and status != 'triaged' and status != 'in-progress' and status != 'finished') or location.exists()"
          },
          {
            "key": "encounter-health-group-date",
            "severity": "error",
            "human": "An Encounter carrying a health group must have a start with a complete calendar date, with or without a time.",
            "expression": "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": "https://novari.no/fhir/digidot/StructureDefinition/digidot-Encounter-no"
          }
        ]
      },
      {
        "id": "Encounter.implicitRules",
        "path": "Encounter.implicitRules",
        "max": "0"
      },
      {
        "id": "Encounter.contained",
        "path": "Encounter.contained",
        "max": "0"
      },
      {
        "id": "Encounter.extension",
        "path": "Encounter.extension",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "url"
            }
          ],
          "rules": "closed"
        },
        "short": "Optional health group applied for this contact",
        "definition": "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": 0,
        "max": "1"
      },
      {
        "id": "Encounter.extension:helsegruppe",
        "path": "Encounter.extension",
        "sliceName": "helsegruppe",
        "short": "Health group applied for this contact",
        "definition": "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": "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": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://novari.no/fhir/digidot/StructureDefinition/digidot-Helsegruppe-no"
            ]
          }
        ]
      },
      {
        "id": "Encounter.extension:helsegruppe.url",
        "path": "Encounter.extension.url",
        "fixedUri": "https://novari.no/fhir/digidot/StructureDefinition/digidot-Helsegruppe-no"
      },
      {
        "id": "Encounter.modifierExtension",
        "path": "Encounter.modifierExtension",
        "max": "0"
      },
      {
        "id": "Encounter.identifier",
        "path": "Encounter.identifier",
        "short": "Stable source business identifiers when available",
        "definition": "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.",
        "min": 0,
        "max": "*",
        "mustSupport": true,
        "comment": "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."
      },
      {
        "id": "Encounter.identifier.system",
        "path": "Encounter.identifier.system",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Encounter.identifier.value",
        "path": "Encounter.identifier.value",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Encounter.status",
        "path": "Encounter.status",
        "short": "Contact lifecycle status",
        "definition": "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": true,
        "binding": {
          "strength": "required",
          "valueSet": "https://novari.no/fhir/digidot/ValueSet/digidot-encounter-status"
        }
      },
      {
        "id": "Encounter.statusHistory",
        "path": "Encounter.statusHistory",
        "short": "Not exchanged",
        "definition": "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": "0"
      },
      {
        "id": "Encounter.class",
        "path": "Encounter.class",
        "short": "Physical or virtual dental contact",
        "definition": "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": true,
        "binding": {
          "strength": "required",
          "description": "Standard HL7 classes selected for ambulatory, emergency, home-based or synchronous virtual dental contacts.",
          "valueSet": "https://novari.no/fhir/digidot/ValueSet/digidot-encounter-class"
        }
      },
      {
        "id": "Encounter.classHistory",
        "path": "Encounter.classHistory",
        "max": "0"
      },
      {
        "id": "Encounter.type",
        "path": "Encounter.type",
        "short": "Specific contact type",
        "definition": "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.",
        "max": "1",
        "binding": {
          "strength": "preferred",
          "description": "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": "https://novari.no/fhir/digidot/ValueSet/digidot-encounter-type"
        },
        "comment": "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": 0
      },
      {
        "id": "Encounter.serviceType",
        "path": "Encounter.serviceType",
        "max": "0"
      },
      {
        "id": "Encounter.priority",
        "path": "Encounter.priority",
        "short": "Source-recorded urgency of the contact",
        "definition": "Populate only when the source explicitly records the urgency of the actual contact. Do not infer it from appointment availability or clinical severity.",
        "max": "0"
      },
      {
        "id": "Encounter.subject",
        "path": "Encounter.subject",
        "short": "Patient receiving care in the contact",
        "definition": "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.",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://novari.no/fhir/digidot/StructureDefinition/digidot-Patient-no"
            ]
          }
        ],
        "mustSupport": true,
        "comment": "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.",
        "constraint": [
          {
            "key": "encounter-subject-literal",
            "severity": "error",
            "human": "A shared-resource reference must contain a literal reference value; identifiers and contained references are not permitted.",
            "expression": "($this is Reference) implies (reference.hasValue() and identifier.empty() and reference.startsWith('#').not())",
            "source": "https://novari.no/fhir/digidot/StructureDefinition/digidot-Encounter-no"
          }
        ]
      },
      {
        "id": "Encounter.subject.reference",
        "path": "Encounter.subject.reference",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Encounter.subject.identifier",
        "path": "Encounter.subject.identifier",
        "max": "0",
        "min": 0
      },
      {
        "id": "Encounter.episodeOfCare",
        "path": "Encounter.episodeOfCare",
        "short": "Care episodes actually addressed by this contact",
        "definition": "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.",
        "max": "*",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://novari.no/fhir/digidot/StructureDefinition/digidot-EpisodeOfCare-no"
            ]
          }
        ],
        "mustSupport": true,
        "min": 0,
        "comment": "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.",
        "constraint": [
          {
            "key": "encounter-episodeofcare-literal",
            "severity": "error",
            "human": "A shared-resource reference must contain a literal reference value; identifiers and contained references are not permitted.",
            "expression": "($this is Reference) implies (reference.hasValue() and identifier.empty() and reference.startsWith('#').not())",
            "source": "https://novari.no/fhir/digidot/StructureDefinition/digidot-Encounter-no"
          }
        ]
      },
      {
        "id": "Encounter.episodeOfCare.reference",
        "path": "Encounter.episodeOfCare.reference",
        "min": 1
      },
      {
        "id": "Encounter.episodeOfCare.identifier",
        "path": "Encounter.episodeOfCare.identifier",
        "max": "0"
      },
      {
        "id": "Encounter.basedOn",
        "path": "Encounter.basedOn",
        "short": "Planned services that led to the contact",
        "definition": "Reference the DigiDOT ServiceRequest or requests that initiated this contact. The reference is optional for unplanned and emergency contacts.",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://novari.no/fhir/digidot/StructureDefinition/digidot-ServiceRequest-no"
            ]
          }
        ],
        "mustSupport": true,
        "comment": "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.",
        "constraint": [
          {
            "key": "encounter-basedon-literal",
            "severity": "error",
            "human": "A shared-resource reference must contain a literal reference value; identifiers and contained references are not permitted.",
            "expression": "($this is Reference) implies (reference.hasValue() and identifier.empty() and reference.startsWith('#').not())",
            "source": "https://novari.no/fhir/digidot/StructureDefinition/digidot-Encounter-no"
          }
        ]
      },
      {
        "id": "Encounter.basedOn.reference",
        "path": "Encounter.basedOn.reference",
        "min": 1
      },
      {
        "id": "Encounter.basedOn.identifier",
        "path": "Encounter.basedOn.identifier",
        "max": "0"
      },
      {
        "id": "Encounter.participant",
        "path": "Encounter.participant",
        "short": "People who participated in the contact",
        "definition": "Record people who actually participated. An in-progress or finished contact requires a primary performer; arrival, triage or cancellation may have none yet.",
        "min": 0,
        "mustSupport": true
      },
      {
        "id": "Encounter.participant.extension",
        "path": "Encounter.participant.extension",
        "max": "0"
      },
      {
        "id": "Encounter.participant.modifierExtension",
        "path": "Encounter.participant.modifierExtension",
        "max": "0"
      },
      {
        "id": "Encounter.participant.type",
        "path": "Encounter.participant.type",
        "short": "Participant role in this contact",
        "min": 1,
        "max": "*",
        "mustSupport": true,
        "definition": "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."
      },
      {
        "id": "Encounter.participant.individual",
        "path": "Encounter.participant.individual",
        "short": "Identified contact participant",
        "definition": "Persons involved in the encounter other than the patient.",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.no/fhir/StructureDefinition/no-basis-Practitioner",
              "http://hl7.no/fhir/StructureDefinition/no-basis-PractitionerRole",
              "http://hl7.no/fhir/StructureDefinition/no-basis-RelatedPerson"
            ]
          }
        ],
        "mustSupport": true,
        "comment": "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.",
        "constraint": [
          {
            "key": "encounter-participant-individual-literal",
            "severity": "error",
            "human": "A shared-resource reference must contain a literal reference value; identifiers and contained references are not permitted.",
            "expression": "($this is Reference) implies (reference.hasValue() and identifier.empty() and reference.startsWith('#').not())",
            "source": "https://novari.no/fhir/digidot/StructureDefinition/digidot-Encounter-no"
          }
        ]
      },
      {
        "id": "Encounter.participant.individual.reference",
        "path": "Encounter.participant.individual.reference",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Encounter.participant.individual.identifier",
        "path": "Encounter.participant.individual.identifier",
        "min": 0,
        "max": "0"
      },
      {
        "id": "Encounter.appointment",
        "path": "Encounter.appointment",
        "short": "Appointment that scheduled this contact",
        "definition": "Reference the DigiDOT Appointment, derived from no-basis Appointment, when this actual contact resulted from a booked appointment.",
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://novari.no/fhir/digidot/StructureDefinition/digidot-Appointment-no"
            ]
          }
        ],
        "mustSupport": true,
        "comment": "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.",
        "constraint": [
          {
            "key": "encounter-appointment-literal",
            "severity": "error",
            "human": "A shared-resource reference must contain a literal reference value; identifiers and contained references are not permitted.",
            "expression": "($this is Reference) implies (reference.hasValue() and identifier.empty() and reference.startsWith('#').not())",
            "source": "https://novari.no/fhir/digidot/StructureDefinition/digidot-Encounter-no"
          }
        ]
      },
      {
        "id": "Encounter.appointment.reference",
        "path": "Encounter.appointment.reference",
        "min": 1
      },
      {
        "id": "Encounter.appointment.identifier",
        "path": "Encounter.appointment.identifier",
        "max": "0"
      },
      {
        "id": "Encounter.period",
        "path": "Encounter.period",
        "short": "Actual contact period",
        "definition": "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": 0,
        "mustSupport": true
      },
      {
        "id": "Encounter.period.start",
        "path": "Encounter.period.start",
        "min": 1
      },
      {
        "id": "Encounter.length",
        "path": "Encounter.length",
        "max": "1",
        "short": "Actual duration, if recorded",
        "definition": "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."
      },
      {
        "id": "Encounter.reasonCode",
        "path": "Encounter.reasonCode",
        "max": "0"
      },
      {
        "id": "Encounter.reasonReference",
        "path": "Encounter.reasonReference",
        "short": "Clinical reason for the contact",
        "definition": "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.",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://novari.no/fhir/digidot/StructureDefinition/digidot-Condition-no",
              "https://novari.no/fhir/digidot/StructureDefinition/digidot-Observation-no",
              "https://novari.no/fhir/digidot/StructureDefinition/digidot-Procedure-no"
            ]
          }
        ],
        "mustSupport": true,
        "comment": "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.",
        "constraint": [
          {
            "key": "encounter-reasonreference-literal",
            "severity": "error",
            "human": "A shared-resource reference must contain a literal reference value; identifiers and contained references are not permitted.",
            "expression": "($this is Reference) implies (reference.hasValue() and identifier.empty() and reference.startsWith('#').not())",
            "source": "https://novari.no/fhir/digidot/StructureDefinition/digidot-Encounter-no"
          }
        ]
      },
      {
        "id": "Encounter.reasonReference.reference",
        "path": "Encounter.reasonReference.reference",
        "min": 1
      },
      {
        "id": "Encounter.reasonReference.identifier",
        "path": "Encounter.reasonReference.identifier",
        "max": "0"
      },
      {
        "id": "Encounter.diagnosis",
        "path": "Encounter.diagnosis",
        "max": "0",
        "min": 0,
        "mustSupport": false,
        "short": "Not exchanged in this profile",
        "definition": "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."
      },
      {
        "id": "Encounter.account",
        "path": "Encounter.account",
        "max": "0"
      },
      {
        "id": "Encounter.hospitalization",
        "path": "Encounter.hospitalization",
        "max": "0"
      },
      {
        "id": "Encounter.location",
        "path": "Encounter.location",
        "short": "Location of the dental contact",
        "definition": "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": 0,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "Encounter.location.extension",
        "path": "Encounter.location.extension",
        "max": "0"
      },
      {
        "id": "Encounter.location.modifierExtension",
        "path": "Encounter.location.modifierExtension",
        "max": "0"
      },
      {
        "id": "Encounter.location.location",
        "path": "Encounter.location.location",
        "short": "Physical or virtual service location",
        "definition": "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.",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.no/fhir/StructureDefinition/no-basis-Location"
            ]
          }
        ],
        "mustSupport": true,
        "comment": "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.",
        "constraint": [
          {
            "key": "encounter-location-location-literal",
            "severity": "error",
            "human": "A shared-resource reference must contain a literal reference value; identifiers and contained references are not permitted.",
            "expression": "($this is Reference) implies (reference.hasValue() and identifier.empty() and reference.startsWith('#').not())",
            "source": "https://novari.no/fhir/digidot/StructureDefinition/digidot-Encounter-no"
          }
        ]
      },
      {
        "id": "Encounter.location.location.reference",
        "path": "Encounter.location.location.reference",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Encounter.location.location.identifier",
        "path": "Encounter.location.location.identifier",
        "max": "0",
        "min": 0
      },
      {
        "id": "Encounter.serviceProvider",
        "path": "Encounter.serviceProvider",
        "short": "Organisation responsible for this contact",
        "definition": "The no-basis Organisation responsible for the actual contact. This can differ from the organisation managing the wider EpisodeOfCare.",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.no/fhir/StructureDefinition/no-basis-Organization"
            ]
          }
        ],
        "mustSupport": true,
        "comment": "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.",
        "constraint": [
          {
            "key": "encounter-serviceprovider-literal",
            "severity": "error",
            "human": "A shared-resource reference must contain a literal reference value; identifiers and contained references are not permitted.",
            "expression": "($this is Reference) implies (reference.hasValue() and identifier.empty() and reference.startsWith('#').not())",
            "source": "https://novari.no/fhir/digidot/StructureDefinition/digidot-Encounter-no"
          }
        ]
      },
      {
        "id": "Encounter.serviceProvider.reference",
        "path": "Encounter.serviceProvider.reference",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Encounter.serviceProvider.identifier",
        "path": "Encounter.serviceProvider.identifier",
        "max": "0",
        "min": 0
      },
      {
        "id": "Encounter.partOf",
        "path": "Encounter.partOf",
        "max": "0"
      }
    ]
  }
}