{
  "resourceType": "StructureDefinition",
  "id": "test-digidot-Condition-no",
  "url": "http://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 = 'http://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": "http://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": "http://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": "http://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": [
              "http://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": "http://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": [
              "http://novari.no/fhir/digidot/StructureDefinition/test-digidot-Coding-SCTpost-no"
            ]
          }
        ]
      },
      {
        "id": "Condition.bodySite",
        "path": "Condition.bodySite",
        "min": 0,
        "max": "*",
        "constraint": [
          {
            "key": "tooth-required-if-surface",
            "severity": "error",
            "human": "If tooth surfaces are provided, a tooth must also be provided.",
            "expression": "coding.where(memberOf('http://novari.no/fhir/digidot/ValueSet/tooth-surfaces')).empty() or coding.where(memberOf('http://novari.no/fhir/digidot/ValueSet/teeth')).exists()"
          }
        ]
      },
      {
        "id": "Condition.bodySite.coding",
        "path": "Condition.bodySite.coding",
        "slicing": {
          "discriminator": [
            {
              "type": "profile",
              "path": "$this"
            }
          ],
          "rules": "open"
        },
        "min": 0,
        "max": "*"
      },
      {
        "id": "Condition.bodySite.coding:tooth",
        "path": "Condition.bodySite.coding",
        "sliceName": "tooth",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Coding",
            "profile": [
              "http://novari.no/fhir/digidot/StructureDefinition/test-digidot-Coding-tooth-no"
            ]
          }
        ],
        "binding": {
          "strength": "required",
          "valueSet": "http://novari.no/fhir/digidot/ValueSet/teeth"
        }
      },
      {
        "id": "Condition.bodySite.coding:surface",
        "path": "Condition.bodySite.coding",
        "sliceName": "surface",
        "min": 0,
        "max": "*",
        "type": [
          {
            "code": "Coding",
            "profile": [
              "http://novari.no/fhir/digidot/StructureDefinition/test-digidot-Coding-tooth-surface-no"
            ]
          }
        ],
        "binding": {
          "strength": "required",
          "valueSet": "http://novari.no/fhir/digidot/ValueSet/tooth-surfaces"
        }
      },
      {
        "id": "Condition.bodySite.coding.system",
        "path": "Condition.bodySite.coding.system",
        "min": 1,
        "fixedUri": "http://snomed.info/sct"
      },
      {
        "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": [
              "http://novari.no/fhir/digidot/StructureDefinition/test-digidot-Encounter-no",
              "http://hl7.org/fhir/StructureDefinition/Encounter"
            ]
          }
        ]
      },
      {
        "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"
      }
    ]
  }
}