<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="test-digidot-EpisodeOfCare-no" />
  <url value="http://novari.no/fhir/digidot/StructureDefinition/test-digidot-EpisodeOfCare-no" />
  <version value="0.1.0-test" />
  <name value="TestDigidotEpisodeOfCareNo" />
  <title value="TEST DigiDOT EpisodeOfCare (NO)" />
  <status value="draft" />
  <date value="2026-05-22" />
  <publisher value="Novari AS - DigiDOT" />
  <description value="TEST comparison draft. Not for production use. DigiDOT profile for a dental episode or case that groups related encounters, requests and performed procedures over time." />
  <purpose value="Use this profile as a lightweight episode or case frame that groups related contacts over time. Episode context should normally be reached through Encounter.episodeOfCare rather than a custom Procedure extension." />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="EpisodeOfCare" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/EpisodeOfCare" />
  <derivation value="constraint" />
  <differential>
    <element id="EpisodeOfCare">
      <path value="EpisodeOfCare" />
      <short value="Dental episode or case frame" />
    </element>
    <element id="EpisodeOfCare.identifier">
      <path value="EpisodeOfCare.identifier" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="system" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <short value="Business identifier for the dental episode" />
      <definition value="A stable identifier for the episode or case. This is expected to be assigned by the source system or DigiDOT integration layer." />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="EpisodeOfCare.identifier:episode">
      <path value="EpisodeOfCare.identifier" />
      <sliceName value="episode" />
      <short value="DigiDOT dental episode identifier" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="EpisodeOfCare.identifier:episode.system">
      <path value="EpisodeOfCare.identifier.system" />
      <min value="1" />
      <patternUri value="urn:novari:episode" />
    </element>
    <element id="EpisodeOfCare.status">
      <path value="EpisodeOfCare.status" />
      <short value="Episode lifecycle status" />
      <definition value="Use EpisodeOfCare.status for the lifecycle of the episode or case. Do not use this status to describe whether an individual procedure has been completed; use Procedure.status for performed procedure occurrences." />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="EpisodeOfCare.type">
      <path value="EpisodeOfCare.type" />
      <short value="Type of dental episode" />
      <definition value="The type of episode or case, for example examination, treatment episode, orthodontic episode or follow-up. The exact value set should be clarified with counties and EHR suppliers before production use." />
      <min value="0" />
      <max value="1" />
    </element>
    <element id="EpisodeOfCare.patient">
      <path value="EpisodeOfCare.patient" />
      <short value="Patient who is the subject of the episode" />
      <min value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.no/fhir/StructureDefinition/no-basis-Patient" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Patient" />
      </type>
    </element>
    <element id="EpisodeOfCare.managingOrganization">
      <path value="EpisodeOfCare.managingOrganization" />
      <short value="Organization responsible for managing the episode" />
      <max value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.no/fhir/StructureDefinition/no-basis-Organization" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Organization" />
      </type>
    </element>
    <element id="EpisodeOfCare.period">
      <path value="EpisodeOfCare.period" />
      <short value="Episode start and end period" />
      <definition value="Recommended when the episode has a known start or end date. Use Encounter.period for contact timing and Procedure.performed[x] for performed procedure timing." />
    </element>
    <element id="EpisodeOfCare.careManager">
      <path value="EpisodeOfCare.careManager" />
      <short value="Responsible clinician or role" />
      <max value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.no/fhir/StructureDefinition/no-basis-PractitionerRole" />
        <targetProfile value="http://hl7.no/fhir/StructureDefinition/no-basis-Practitioner" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/PractitionerRole" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Practitioner" />
      </type>
    </element>
  </differential>
</StructureDefinition>