{
  "resourceType": "StructureDefinition",
  "id": "pilot-digidot-Procedure-no",
  "url": "https://novari.no/fhir/digidot/StructureDefinition/pilot-digidot-Procedure-no",
  "version": "0.1.5",
  "name": "PilotDigidotProcedureNo",
  "title": "Pilot 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": [
              "https://novari.no/fhir/digidot/StructureDefinition/pilot-digidot-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": "https://novari.no/fhir/digidot/ValueSet/pilot-digidot-ValueSet-procedures"
        }
      },
      {
        "id": "Procedure.code.coding:SCTpost",
        "path": "Procedure.code.coding",
        "sliceName": "SCTpost",
        "max": "1",
        "type": [
          {
            "code": "Coding",
            "profile": [
              "https://novari.no/fhir/digidot/StructureDefinition/pilot-digidot-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": [
              "https://novari.no/fhir/digidot/StructureDefinition/pilot-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": [
              "https://novari.no/fhir/digidot/StructureDefinition/pilot-digidot-Condition-no",
              "http://hl7.org/fhir/StructureDefinition/Condition"
            ]
          }
        ]
      },
      {
        "id": "Procedure.bodySite",
        "path": "Procedure.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/pilot-digidot-ValueSet-tooth-surfaces')).empty() or coding.where(memberOf('https://novari.no/fhir/digidot/ValueSet/pilot-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."
      },
      {
        "id": "Procedure.bodySite.coding",
        "path": "Procedure.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": "Procedure.bodySite.coding:tooth",
        "path": "Procedure.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/pilot-digidot-ValueSet-teeth"
        }
      },
      {
        "id": "Procedure.bodySite.coding:tooth.system",
        "path": "Procedure.bodySite.coding.system",
        "min": 1,
        "fixedUri": "http://snomed.info/sct"
      },
      {
        "id": "Procedure.bodySite.coding:tooth.code",
        "path": "Procedure.bodySite.coding.code",
        "min": 1
      },
      {
        "id": "Procedure.bodySite.coding:surface",
        "path": "Procedure.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/pilot-digidot-ValueSet-tooth-surfaces"
        }
      },
      {
        "id": "Procedure.bodySite.coding:surface.system",
        "path": "Procedure.bodySite.coding.system",
        "min": 1,
        "fixedUri": "http://snomed.info/sct"
      },
      {
        "id": "Procedure.bodySite.coding:surface.code",
        "path": "Procedure.bodySite.coding.code",
        "min": 1
      }
    ]
  }
}