{
  "resourceType": "StructureDefinition",
  "id": "test-digidot-Observation-no",
  "url": "https://novari.no/fhir/digidot/StructureDefinition/test-digidot-Observation-no",
  "version": "0.1.0-test",
  "name": "TestDigidotObservationNo",
  "title": "TEST DigiDot Observation (NO)",
  "status": "draft",
  "date": "2026-05-19",
  "publisher": "Novari AS - DigiDOT",
  "purpose": "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": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Observation",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Observation",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Observation",
        "path": "Observation"
      },
      {
        "id": "Observation.status",
        "path": "Observation.status",
        "min": 1,
        "max": "1",
        "short": "Observation status.",
        "definition": "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."
      },
      {
        "id": "Observation.category",
        "path": "Observation.category",
        "min": 0,
        "max": "*",
        "binding": {
          "strength": "preferred",
          "valueSet": "http://terminology.hl7.org/ValueSet/observation-category"
        }
      },
      {
        "id": "Observation.code",
        "path": "Observation.code",
        "short": "Observable entity",
        "definition": "The SNOMED CT concept describing what is being observed (observable entity).",
        "min": 1,
        "constraint": [
          {
            "key": "obs-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()"
          }
        ],
        "binding": {
          "strength": "extensible",
          "description": "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": "http://snomed.info/sct?fhir_vs=isa/363787002"
        }
      },
      {
        "id": "Observation.code.coding",
        "path": "Observation.code.coding",
        "slicing": {
          "discriminator": [
            {
              "type": "profile",
              "path": "$this"
            }
          ],
          "rules": "open"
        },
        "min": 1,
        "max": "2"
      },
      {
        "id": "Observation.code.coding:SCTpre",
        "path": "Observation.code.coding",
        "sliceName": "SCTpre",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Coding",
            "profile": [
              "https://novari.no/fhir/digidot/StructureDefinition/test-digidot-Coding-SCTpre-no"
            ]
          }
        ],
        "binding": {
          "strength": "extensible",
          "description": "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": "http://snomed.info/sct?fhir_vs=isa/363787002"
        }
      },
      {
        "id": "Observation.code.coding:SCTpost",
        "path": "Observation.code.coding",
        "sliceName": "SCTpost",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Coding",
            "profile": [
              "https://novari.no/fhir/digidot/StructureDefinition/test-digidot-Coding-SCTpost-no"
            ]
          }
        ]
      },
      {
        "id": "Observation.subject",
        "path": "Observation.subject",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.no/fhir/StructureDefinition/no-basis-Patient",
              "http://hl7.org/fhir/StructureDefinition/Patient"
            ]
          }
        ]
      },
      {
        "id": "Observation.encounter",
        "path": "Observation.encounter",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://novari.no/fhir/digidot/StructureDefinition/test-digidot-Encounter-no",
              "http://hl7.org/fhir/StructureDefinition/Encounter"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Observation.effective[x]",
        "path": "Observation.effective[x]",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "dateTime"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Observation.performer",
        "path": "Observation.performer",
        "min": 0,
        "max": "*",
        "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-Organization",
              "http://hl7.org/fhir/StructureDefinition/Organization",
              "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": "Observation.value[x]",
        "path": "Observation.value[x]",
        "short": "Result value",
        "definition": "The result of the observation.",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Quantity"
          },
          {
            "code": "CodeableConcept"
          },
          {
            "code": "string"
          },
          {
            "code": "integer"
          },
          {
            "code": "boolean"
          }
        ],
        "mustSupport": true
      },
      {
        "id": "Observation.interpretation",
        "path": "Observation.interpretation",
        "min": 0,
        "max": "*"
      },
      {
        "id": "Observation.note",
        "path": "Observation.note",
        "min": 0,
        "max": "*"
      },
      {
        "id": "Observation.bodySite",
        "path": "Observation.bodySite",
        "min": 0,
        "max": "1",
        "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": "Observation.bodySite.coding",
        "path": "Observation.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": "Observation.bodySite.coding:tooth",
        "path": "Observation.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": "Observation.bodySite.coding:tooth.system",
        "path": "Observation.bodySite.coding.system",
        "min": 1,
        "fixedUri": "http://snomed.info/sct"
      },
      {
        "id": "Observation.bodySite.coding:tooth.code",
        "path": "Observation.bodySite.coding.code",
        "min": 1
      },
      {
        "id": "Observation.bodySite.coding:surface",
        "path": "Observation.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": "Observation.bodySite.coding:surface.system",
        "path": "Observation.bodySite.coding.system",
        "min": 1,
        "fixedUri": "http://snomed.info/sct"
      },
      {
        "id": "Observation.bodySite.coding:surface.code",
        "path": "Observation.bodySite.coding.code",
        "min": 1
      },
      {
        "id": "Observation.method",
        "path": "Observation.method",
        "min": 0,
        "max": "1",
        "binding": {
          "strength": "preferred",
          "description": "Use DigiDOT observation method codes when a suitable method exists; otherwise use SNOMED CT or another agreed code system.",
          "valueSet": "https://novari.no/fhir/digidot/ValueSet/test-digidot-observation-method"
        }
      },
      {
        "id": "Observation.component",
        "path": "Observation.component",
        "min": 0,
        "max": "*",
        "mustSupport": true
      },
      {
        "id": "Observation.component.code",
        "path": "Observation.component.code",
        "min": 1
      },
      {
        "id": "Observation.component.value[x]",
        "path": "Observation.component.value[x]",
        "min": 0,
        "type": [
          {
            "code": "Quantity"
          },
          {
            "code": "CodeableConcept"
          },
          {
            "code": "string"
          },
          {
            "code": "integer"
          },
          {
            "code": "boolean"
          }
        ]
      }
    ]
  },
  "description": "TEST comparison draft. Not for production use."
}