<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="test-digidot-Observation-no" />
  <url value="http://novari.no/fhir/digidot/StructureDefinition/test-digidot-Observation-no" />
  <version value="0.1.0-test" />
  <name value="TestDigidotObservationNo" />
  <title value="TEST DigiDot Observation (NO)" />
  <status value="draft" />
  <date value="2026-05-19" />
  <publisher value="Novari AS - DigiDOT" />
  <description value="TEST comparison draft. Not for production use." />
  <purpose value="Use this profile for dental measurements, indicators, methods and observed values. It is deliberately more flexible than Procedure because some dental observations may use local or calculated codes during terminology maturation." />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Observation" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Observation" />
  <derivation value="constraint" />
  <differential>
    <element id="Observation">
      <path value="Observation" />
    </element>
    <element id="Observation.status">
      <path value="Observation.status" />
      <short value="Observation status." />
      <definition value="Use final for stable clinical findings and calculated indicators. Other FHIR Observation statuses are allowed for migrated, preliminary, corrected or entered-in-error data when the lifecycle is relevant." />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Observation.category">
      <path value="Observation.category" />
      <min value="0" />
      <max value="*" />
      <binding>
        <strength value="preferred" />
        <valueSet value="http://terminology.hl7.org/ValueSet/observation-category" />
      </binding>
    </element>
    <element id="Observation.code">
      <path value="Observation.code" />
      <short value="Observable entity" />
      <definition value="The SNOMED CT concept describing what is being observed (observable entity)." />
      <min value="1" />
      <constraint>
        <key value="obs-sct-min1" />
        <severity value="warning" />
        <human value="At least one SNOMED CT code (pre- or postcoordinated) should be present." />
        <expression value="coding.where(system = 'http://snomed.info/sct').exists()" />
      </constraint>
      <binding>
        <strength value="extensible" />
        <description value="Use SNOMED CT observable entity when it covers the intended observation. Other codings may be used for calculated indicators or local observations when no suitable SNOMED CT observable concept exists." />
        <valueSet value="http://snomed.info/sct?fhir_vs=isa/363787002" />
      </binding>
    </element>
    <element id="Observation.code.coding">
      <path value="Observation.code.coding" />
      <slicing>
        <discriminator>
          <type value="profile" />
          <path value="$this" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <min value="1" />
      <max value="2" />
    </element>
    <element id="Observation.code.coding:SCTpre">
      <path value="Observation.code.coding" />
      <sliceName value="SCTpre" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Coding" />
        <profile value="http://novari.no/fhir/digidot/StructureDefinition/test-digidot-Coding-SCTpre-no" />
      </type>
      <binding>
        <strength value="extensible" />
        <description value="Use a SNOMED CT observable entity when it covers the intended observation. Local or calculated indicator codes may be used when no suitable SNOMED CT observable exists; these should be handled explicitly in the implementation guide and reporting rules." />
        <valueSet value="http://snomed.info/sct?fhir_vs=isa/363787002" />
      </binding>
    </element>
    <element id="Observation.code.coding:SCTpost">
      <path value="Observation.code.coding" />
      <sliceName value="SCTpost" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Coding" />
        <profile value="http://novari.no/fhir/digidot/StructureDefinition/test-digidot-Coding-SCTpost-no" />
      </type>
    </element>
    <element id="Observation.subject">
      <path value="Observation.subject" />
      <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="Observation.encounter">
      <path value="Observation.encounter" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://novari.no/fhir/digidot/StructureDefinition/test-digidot-Encounter-no" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Encounter" />
      </type>
    </element>
    <element id="Observation.effective[x]">
      <path value="Observation.effective[x]" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="dateTime" />
      </type>
    </element>
    <element id="Observation.performer">
      <path value="Observation.performer" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Reference" />
        <targetProfile value="http://hl7.no/fhir/StructureDefinition/no-basis-Practitioner" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Practitioner" />
        <targetProfile value="http://hl7.no/fhir/StructureDefinition/no-basis-PractitionerRole" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/PractitionerRole" />
        <targetProfile value="http://hl7.no/fhir/StructureDefinition/no-basis-Organization" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Organization" />
        <targetProfile value="http://hl7.no/fhir/StructureDefinition/no-basis-Patient" />
        <targetProfile value="http://hl7.no/fhir/StructureDefinition/no-basis-RelatedPerson" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/Patient" />
        <targetProfile value="http://hl7.org/fhir/StructureDefinition/RelatedPerson" />
      </type>
    </element>
    <element id="Observation.value[x]">
      <path value="Observation.value[x]" />
      <short value="Result value" />
      <definition value="The result of the observation." />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Quantity" />
      </type>
      <type>
        <code value="CodeableConcept" />
      </type>
      <type>
        <code value="string" />
      </type>
      <type>
        <code value="integer" />
      </type>
      <type>
        <code value="boolean" />
      </type>
    </element>
    <element id="Observation.interpretation">
      <path value="Observation.interpretation" />
      <min value="0" />
      <max value="*" />
    </element>
    <element id="Observation.note">
      <path value="Observation.note" />
      <min value="0" />
      <max value="*" />
    </element>
    <element id="Observation.bodySite">
      <path value="Observation.bodySite" />
      <min value="0" />
      <max value="1" />
      <constraint>
        <key value="tooth-required-if-surface" />
        <severity value="error" />
        <human value="If tooth surfaces are provided, a tooth must also be provided." />
        <expression value="coding.where(memberOf('http://novari.no/fhir/digidot/ValueSet/tooth-surfaces')).empty() or coding.where(memberOf('http://novari.no/fhir/digidot/ValueSet/teeth')).exists()" />
      </constraint>
    </element>
    <element id="Observation.bodySite.coding">
      <path value="Observation.bodySite.coding" />
      <slicing>
        <discriminator>
          <type value="profile" />
          <path value="$this" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <min value="0" />
      <max value="*" />
    </element>
    <element id="Observation.bodySite.coding:tooth">
      <path value="Observation.bodySite.coding" />
      <sliceName value="tooth" />
      <min value="0" />
      <max value="1" />
      <type>
        <code value="Coding" />
        <profile value="http://novari.no/fhir/digidot/StructureDefinition/test-digidot-Coding-tooth-no" />
      </type>
      <binding>
        <strength value="required" />
        <valueSet value="http://novari.no/fhir/digidot/ValueSet/teeth" />
      </binding>
    </element>
    <element id="Observation.bodySite.coding:surface">
      <path value="Observation.bodySite.coding" />
      <sliceName value="surface" />
      <min value="0" />
      <max value="*" />
      <type>
        <code value="Coding" />
        <profile value="http://novari.no/fhir/digidot/StructureDefinition/test-digidot-Coding-tooth-surface-no" />
      </type>
      <binding>
        <strength value="required" />
        <valueSet value="http://novari.no/fhir/digidot/ValueSet/tooth-surfaces" />
      </binding>
    </element>
    <element id="Observation.bodySite.coding.system">
      <path value="Observation.bodySite.coding.system" />
      <min value="1" />
      <fixedUri value="http://snomed.info/sct" />
    </element>
    <element id="Observation.method">
      <path value="Observation.method" />
      <min value="0" />
      <max value="1" />
      <binding>
        <strength value="preferred" />
        <description value="Use DigiDOT observation method codes when a suitable method exists; otherwise use SNOMED CT or another agreed code system." />
        <valueSet value="http://novari.no/fhir/digidot/ValueSet/test-digidot-observation-method" />
      </binding>
    </element>
    <element id="Observation.component">
      <path value="Observation.component" />
      <min value="0" />
      <max value="*" />
    </element>
    <element id="Observation.component.code">
      <path value="Observation.component.code" />
      <min value="1" />
    </element>
    <element id="Observation.component.value[x]">
      <path value="Observation.component.value[x]" />
      <min value="0" />
      <type>
        <code value="Quantity" />
      </type>
      <type>
        <code value="CodeableConcept" />
      </type>
      <type>
        <code value="string" />
      </type>
      <type>
        <code value="integer" />
      </type>
      <type>
        <code value="boolean" />
      </type>
    </element>
  </differential>
</StructureDefinition>