{
  "resourceType": "StructureDefinition",
  "id": "test-digidot-Condition-no",
  "url": "https://novari.no/fhir/digidot/StructureDefinition/test-digidot-Condition-no",
  "version": "0.1.0-test",
  "name": "TestDigidotConditionNo",
  "title": "TEST DigiDot Condition (NO)",
  "status": "draft",
  "date": "2026-05-20",
  "publisher": "Novari AS - DigiDOT",
  "description": "TEST comparison draft. Not for production use. DigiDOT profile for dental findings, diagnoses, problems and conditions.",
  "purpose": "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": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Condition",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Condition",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Condition",
        "path": "Condition",
        "constraint": [
          {
            "key": "cond-category-recommended",
            "severity": "warning",
            "human": "DigiDOT dental findings should include Condition.category coding dental-finding from the DigiDOT condition category code system.",
            "expression": "category.coding.where(system = 'https://novari.no/fhir/digidot/CodeSystem/test-digidot-condition-category' and code = 'dental-finding').exists()"
          }
        ]
      },
      {
        "id": "Condition.clinicalStatus",
        "path": "Condition.clinicalStatus",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Condition.verificationStatus",
        "path": "Condition.verificationStatus",
        "short": "Bekreftelsesstatus for funnet/diagnosen.",
        "definition": "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."
      },
      {
        "id": "Condition.category",
        "path": "Condition.category",
        "short": "Coarse category for DigiDOT dental findings.",
        "definition": "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": 0,
        "max": "*",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "coding.system"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "Condition.category:dentalFinding",
        "path": "Condition.category",
        "sliceName": "dentalFinding",
        "min": 0,
        "max": "1",
        "binding": {
          "strength": "preferred",
          "description": "DigiDOT condition category. Dental findings should use dental-finding when category is included.",
          "valueSet": "https://novari.no/fhir/digidot/ValueSet/test-digidot-condition-category"
        }
      },
      {
        "id": "Condition.category:dentalFinding.coding",
        "path": "Condition.category.coding",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Condition.category:dentalFinding.coding.system",
        "path": "Condition.category.coding.system",
        "min": 1,
        "fixedUri": "https://novari.no/fhir/digidot/CodeSystem/test-digidot-condition-category"
      },
      {
        "id": "Condition.category:dentalFinding.coding.code",
        "path": "Condition.category.coding.code",
        "min": 1,
        "fixedCode": "dental-finding"
      },
      {
        "id": "Condition.category:dentalFinding.coding.display",
        "path": "Condition.category.coding.display",
        "min": 0,
        "max": "1"
      },
      {
        "id": "Condition.code",
        "path": "Condition.code",
        "min": 1,
        "binding": {
          "strength": "extensible",
          "description": "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": "https://novari.no/fhir/digidot/ValueSet/dental-conditions"
        },
        "constraint": [
          {
            "key": "cond-sct-min1",
            "severity": "warning",
            "human": "At least one SNOMED CT code (pre- or postcoordinated) should be present.",
            "expression": "coding.where(system = 'http://snomed.info/sct').exists()"
          }
        ]
      },
      {
        "id": "Condition.code.coding",
        "path": "Condition.code.coding",
        "slicing": {
          "discriminator": [
            {
              "type": "profile",
              "path": "$this"
            }
          ],
          "rules": "open"
        },
        "min": 1,
        "max": "2"
      },
      {
        "id": "Condition.code.coding:SCTpre",
        "path": "Condition.code.coding",
        "sliceName": "SCTpre",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Coding",
            "profile": [
              "https://novari.no/fhir/digidot/StructureDefinition/test-digidot-Coding-SCTpre-no"
            ]
          }
        ],
        "binding": {
          "strength": "extensible",
          "description": "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": "https://novari.no/fhir/digidot/ValueSet/dental-conditions"
        }
      },
      {
        "id": "Condition.code.coding:SCTpost",
        "path": "Condition.code.coding",
        "sliceName": "SCTpost",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Coding",
            "profile": [
              "https://novari.no/fhir/digidot/StructureDefinition/test-digidot-Coding-SCTpost-no"
            ]
          }
        ]
      },
      {
        "id": "Condition.bodySite",
        "path": "Condition.bodySite",
        "min": 0,
        "max": "*",
        "constraint": [
          {
            "key": "single-tooth-required-if-surface",
            "severity": "error",
            "human": "If tooth surfaces are provided, exactly one tooth must also be provided in the same bodySite.",
            "expression": "coding.where(memberOf('https://novari.no/fhir/digidot/ValueSet/tooth-surfaces')).empty() or coding.where(memberOf('https://novari.no/fhir/digidot/ValueSet/teeth')).count() = 1"
          }
        ],
        "short": "Tooth, surface or other dental body site",
        "definition": "Use bodySite to identify the relevant tooth or teeth and, when needed, tooth surface. Tooth and surface are represented as named slices on bodySite.coding, with required bindings to the DigiDOT teeth and tooth-surfaces ValueSets. If a surface coding is present, exactly one tooth coding must also be present in the same bodySite.",
        "mustSupport": true
      },
      {
        "id": "Condition.bodySite.coding",
        "path": "Condition.bodySite.coding",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "$this"
            }
          ],
          "rules": "open"
        },
        "min": 0,
        "max": "*",
        "short": "Tooth and surface codings",
        "definition": "Open slicing of bodySite.coding. The named tooth and surface slices are identified by required ValueSet bindings, not by separate Coding profiles."
      },
      {
        "id": "Condition.bodySite.coding:tooth",
        "path": "Condition.bodySite.coding",
        "sliceName": "tooth",
        "min": 0,
        "max": "*",
        "short": "Tooth",
        "definition": "One or more relevant teeth, coded with SNOMED CT and constrained by the DigiDOT teeth ValueSet.",
        "binding": {
          "strength": "required",
          "valueSet": "https://novari.no/fhir/digidot/ValueSet/teeth"
        }
      },
      {
        "id": "Condition.bodySite.coding:tooth.system",
        "path": "Condition.bodySite.coding.system",
        "min": 1,
        "fixedUri": "http://snomed.info/sct"
      },
      {
        "id": "Condition.bodySite.coding:tooth.code",
        "path": "Condition.bodySite.coding.code",
        "min": 1
      },
      {
        "id": "Condition.bodySite.coding:surface",
        "path": "Condition.bodySite.coding",
        "sliceName": "surface",
        "min": 0,
        "max": "*",
        "short": "Tooth surface",
        "definition": "One or more relevant tooth surfaces, coded with SNOMED CT and constrained by the DigiDOT tooth-surfaces ValueSet. A surface coding requires exactly one tooth coding on the same bodySite.",
        "binding": {
          "strength": "required",
          "valueSet": "https://novari.no/fhir/digidot/ValueSet/tooth-surfaces"
        }
      },
      {
        "id": "Condition.bodySite.coding:surface.system",
        "path": "Condition.bodySite.coding.system",
        "min": 1,
        "fixedUri": "http://snomed.info/sct"
      },
      {
        "id": "Condition.bodySite.coding:surface.code",
        "path": "Condition.bodySite.coding.code",
        "min": 1
      },
      {
        "id": "Condition.subject",
        "path": "Condition.subject",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.no/fhir/StructureDefinition/no-basis-Patient",
              "http://hl7.org/fhir/StructureDefinition/Patient"
            ]
          }
        ]
      },
      {
        "id": "Condition.encounter",
        "path": "Condition.encounter",
        "short": "Encounter where the finding was recorded, when known.",
        "definition": "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": 0,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://novari.no/fhir/digidot/StructureDefinition/test-digidot-Encounter-no",
              "http://hl7.org/fhir/StructureDefinition/Encounter"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Condition.asserter",
        "path": "Condition.asserter",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.no/fhir/StructureDefinition/no-basis-Practitioner",
              "http://hl7.org/fhir/StructureDefinition/Practitioner",
              "http://hl7.no/fhir/StructureDefinition/no-basis-PractitionerRole",
              "http://hl7.org/fhir/StructureDefinition/PractitionerRole",
              "http://hl7.no/fhir/StructureDefinition/no-basis-Patient",
              "http://hl7.no/fhir/StructureDefinition/no-basis-RelatedPerson",
              "http://hl7.org/fhir/StructureDefinition/Patient",
              "http://hl7.org/fhir/StructureDefinition/RelatedPerson"
            ]
          }
        ]
      },
      {
        "id": "Condition.note",
        "path": "Condition.note",
        "min": 0,
        "max": "1"
      },
      {
        "id": "Condition.onset[x]",
        "path": "Condition.onset[x]",
        "short": "Onset or finding time"
      },
      {
        "id": "Condition.recordedDate",
        "path": "Condition.recordedDate",
        "short": "Recorded date"
      },
      {
        "id": "Condition.recorder",
        "path": "Condition.recorder",
        "short": "Recorder"
      }
    ]
  }
}