<StructureDefinition xmlns="http://hl7.org/fhir">
  <id value="test-digidot-Condition-no" />
  <url value="http://novari.no/fhir/digidot/StructureDefinition/test-digidot-Condition-no" />
  <version value="0.1.0-test" />
  <name value="TestDigidotConditionNo" />
  <title value="TEST DigiDot Condition (NO)" />
  <status value="draft" />
  <date value="2026-05-20" />
  <publisher value="Novari AS - DigiDOT" />
  <description value="TEST comparison draft. Not for production use. DigiDOT profile for dental findings, diagnoses, problems and conditions." />
  <purpose value="Use this profile when a dental finding, diagnosis, problem or clinical concern should be exchanged as a Condition with dental coding and tooth or tooth-surface context." />
  <fhirVersion value="4.0.1" />
  <kind value="resource" />
  <abstract value="false" />
  <type value="Condition" />
  <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Condition" />
  <derivation value="constraint" />
  <differential>
    <element id="Condition">
      <path value="Condition" />
      <constraint>
        <key value="cond-category-recommended" />
        <severity value="warning" />
        <human value="DigiDOT dental findings should include Condition.category coding dental-finding from the DigiDOT condition category code system." />
        <expression value="category.coding.where(system = 'http://novari.no/fhir/digidot/CodeSystem/test-digidot-condition-category' and code = 'dental-finding').exists()" />
      </constraint>
    </element>
    <element id="Condition.clinicalStatus">
      <path value="Condition.clinicalStatus" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Condition.verificationStatus">
      <path value="Condition.verificationStatus" />
      <short value="Bekreftelsesstatus for funnet/diagnosen." />
      <definition value="Use verificationStatus to distinguish confirmed dental findings from provisional, differential or refuted findings. This is strongly recommended for vendor exchange, but not made mandatory in the test profile to avoid blocking migration of older data." />
    </element>
    <element id="Condition.category">
      <path value="Condition.category" />
      <slicing>
        <discriminator>
          <type value="value" />
          <path value="coding.system" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <short value="Coarse category for DigiDOT dental findings." />
      <definition value="Use Condition.category as a coarse category marker for dental findings. The precise clinical meaning must be represented in Condition.code using SNOMED CT; category must not be used as a replacement for the clinical finding or diagnosis code. The DigiDOT dental-finding category is recommended, but not hard-required, and other category codings such as problem-list-item or encounter-diagnosis may also be included when relevant." />
      <min value="0" />
      <max value="*" />
    </element>
    <element id="Condition.category:dentalFinding">
      <path value="Condition.category" />
      <sliceName value="dentalFinding" />
      <min value="0" />
      <max value="1" />
      <binding>
        <strength value="preferred" />
        <description value="DigiDOT condition category. Dental findings should use dental-finding when category is included." />
        <valueSet value="http://novari.no/fhir/digidot/ValueSet/test-digidot-condition-category" />
      </binding>
    </element>
    <element id="Condition.category:dentalFinding.coding">
      <path value="Condition.category.coding" />
      <min value="1" />
      <max value="1" />
    </element>
    <element id="Condition.category:dentalFinding.coding.system">
      <path value="Condition.category.coding.system" />
      <min value="1" />
      <fixedUri value="http://novari.no/fhir/digidot/CodeSystem/test-digidot-condition-category" />
    </element>
    <element id="Condition.category:dentalFinding.coding.code">
      <path value="Condition.category.coding.code" />
      <min value="1" />
      <fixedCode value="dental-finding" />
    </element>
    <element id="Condition.category:dentalFinding.coding.display">
      <path value="Condition.category.coding.display" />
      <min value="0" />
      <max value="1" />
    </element>
    <element id="Condition.code">
      <path value="Condition.code" />
      <min value="1" />
      <constraint>
        <key value="cond-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 a code from the DigiDOT dental condition value set when it covers the intended clinical finding or diagnosis. The value set represents controlled/refset values, but clinical storage can use broader SNOMED CT when the refset does not cover the meaning. A postcoordinated SNOMED CT expression may be included as additional semantic precision." />
        <valueSet value="http://novari.no/fhir/digidot/ValueSet/dental-conditions" />
      </binding>
    </element>
    <element id="Condition.code.coding">
      <path value="Condition.code.coding" />
      <slicing>
        <discriminator>
          <type value="profile" />
          <path value="$this" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <min value="1" />
      <max value="2" />
    </element>
    <element id="Condition.code.coding:SCTpre">
      <path value="Condition.code.coding" />
      <sliceName value="SCTpre" />
      <min value="1" />
      <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 precoordinated SNOMED CT concept from the DigiDOT dental condition value set when it covers the finding or diagnosis. Broader SNOMED CT concepts are allowed for clinical storage when the refset does not cover the meaning." />
        <valueSet value="http://novari.no/fhir/digidot/ValueSet/dental-conditions" />
      </binding>
    </element>
    <element id="Condition.code.coding:SCTpost">
      <path value="Condition.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="Condition.bodySite">
      <path value="Condition.bodySite" />
      <min value="0" />
      <max value="*" />
      <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="Condition.bodySite.coding">
      <path value="Condition.bodySite.coding" />
      <slicing>
        <discriminator>
          <type value="profile" />
          <path value="$this" />
        </discriminator>
        <rules value="open" />
      </slicing>
      <min value="0" />
      <max value="*" />
    </element>
    <element id="Condition.bodySite.coding:tooth">
      <path value="Condition.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="Condition.bodySite.coding:surface">
      <path value="Condition.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="Condition.bodySite.coding.system">
      <path value="Condition.bodySite.coding.system" />
      <min value="1" />
      <fixedUri value="http://snomed.info/sct" />
    </element>
    <element id="Condition.subject">
      <path value="Condition.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="Condition.encounter">
      <path value="Condition.encounter" />
      <short value="Encounter where the finding was recorded, when known." />
      <definition value="Use Condition.encounter when the dental finding was asserted or recorded as part of a known encounter. Keep this optional to support imported historical findings and problem-list style findings where the originating encounter is unknown." />
      <min value="0" />
      <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="Condition.asserter">
      <path value="Condition.asserter" />
      <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-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="Condition.note">
      <path value="Condition.note" />
      <min value="0" />
      <max value="1" />
    </element>
  </differential>
</StructureDefinition>