{
  "resourceType": "StructureDefinition",
  "id": "digidot-Procedure-no",
  "url": "http://novari.no/fhir/digidot/StructureDefinition/digidot-Procedure-no",
  "version": "0.1.5",
  "name": "digidot_Procedure_no",
  "title": "DigiDot Procedure (NO)",
  "status": "draft",
  "date": "2025-09-17",
  "publisher": "Novari AS – DigiDot",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Procedure",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Procedure",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Procedure.code",
        "path": "Procedure.code",
        "min": 1,
        "constraint": [
          {
            "key": "proc-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": "Procedure.code.coding",
        "path": "Procedure.code.coding",
        "slicing": {
          "discriminator": [
            {
              "type": "profile",
              "path": "$this"
            }
          ],
          "rules": "open"
        },
        "min": 1,
        "max": "2"
      },
      {
        "id": "Procedure.code.coding:SCTpre",
        "path": "Procedure.code.coding",
        "sliceName": "SCTpre",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "Coding",
            "profile": [
              "http://novari.no/fhir/digidot/StructureDefinition/Coding-SCTpre-no"
            ]
          }
        ],
        "binding": {
          "strength": "extensible",
          "description": "For EHR implementations using this profile for storage of clinical data the code-element can contain relevant concepts from SNOMED CT beyond those of the reference set. For national reporting or information exchange to other systems codes are restricted to those included by the reference set.",
          "valueSet": "http://novari.no/fhir/digidot/ValueSet/dental-procedures"
        }
      },
      {
        "id": "Procedure.code.coding:SCTpost",
        "path": "Procedure.code.coding",
        "sliceName": "SCTpost",
        "max": "1",
        "type": [
          {
            "code": "Coding",
            "profile": [
              "http://novari.no/fhir/digidot/StructureDefinition/Coding-SCTpost-no"
            ]
          }
        ]
      },
      {
        "id": "Procedure.subject",
        "path": "Procedure.subject",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.no/fhir/StructureDefinition/no-basis-Patient",
              "http://hl7.org/fhir/StructureDefinition/Patient"
            ]
          }
        ]
      },
      {
        "id": "Procedure.encounter",
        "path": "Procedure.encounter",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://novari.no/fhir/digidot/StructureDefinition/digidot-Encounter-no",
              "http://hl7.org/fhir/StructureDefinition/Encounter"
            ]
          }
        ]
      },
      {
        "id": "Procedure.performer.actor",
        "path": "Procedure.performer.actor",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.no/fhir/StructureDefinition/no-basis-Practitioner"
            ]
          }
        ]
      },
      {
        "id": "Procedure.location",
        "path": "Procedure.location",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.no/fhir/StructureDefinition/no-basis-Location",
              "http://hl7.org/fhir/StructureDefinition/Location"
            ]
          }
        ]
      },
      {
        "id": "Procedure.reasonReference",
        "path": "Procedure.reasonReference",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://novari.no/fhir/digidot/StructureDefinition/digidot-Condition-no",
              "http://hl7.org/fhir/StructureDefinition/Condition"
            ]
          }
        ]
      },
      {
        "id": "Procedure.bodySite",
        "path": "Procedure.bodySite",
        "constraint": [
          {
            "key": "tooth-required-if-surface",
            "severity": "error",
            "human": "If tooth surfaces are provided, a tooth must also be provided.",
            "expression": "coding.where($this.sliceName='surface').empty() or coding.where($this.sliceName='tooth').exists()"
          }
        ]
      },
      {
        "id": "Procedure.bodySite.coding",
        "path": "Procedure.bodySite.coding",
        "slicing": {
          "discriminator": [
            {
              "type": "value",
              "path": "system"
            }
          ],
          "rules": "open"
        }
      },
      {
        "id": "Procedure.bodySite.coding.system",
        "path": "Procedure.bodySite.coding.system",
        "min": 1,
        "fixedUri": "http://snomed.info/sct"
      },
      {
        "id": "Procedure.bodySite.coding:tooth",
        "path": "Procedure.bodySite.coding",
        "sliceName": "tooth",
        "max": "1",
        "binding": {
          "strength": "required",
          "valueSet": "http://novari.no/fhir/digidot/ValueSet/teeth"
        }
      },
      {
        "id": "Procedure.bodySite.coding:surface",
        "path": "Procedure.bodySite.coding",
        "sliceName": "surface",
        "binding": {
          "strength": "required",
          "valueSet": "http://novari.no/fhir/digidot/ValueSet/tooth-surfaces"
        }
      },
      {
        "id": "Procedure.bodySite.coding:surface.code",
        "path": "Procedure.bodySite.coding.code",
        "min": 1
      }
    ]
  }
}