{
  "resourceType": "StructureDefinition",
  "id": "test-digidot-Procedure-no",
  "url": "http://novari.no/fhir/digidot/StructureDefinition/test-digidot-Procedure-no",
  "version": "0.1.0-test",
  "name": "TestDigidotProcedureNo",
  "title": "TEST DigiDot Procedure (NO)",
  "status": "draft",
  "date": "2026-05-19",
  "publisher": "Novari AS - DigiDOT",
  "purpose": "Use this profile for performed, attempted, stopped or clinically relevant not-done dental work. Clinical SNOMED CT procedure coding must remain separate from tariff, fee and settlement coding.",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "Procedure",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Procedure",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Procedure",
        "path": "Procedure",
        "constraint": [
          {
            "key": "proc-category-recommended",
            "severity": "warning",
            "human": "DigiDOT clinical dental procedures should include Procedure.category coding dental-procedure from the DigiDOT procedure category code system.",
            "expression": "category.coding.where(system = 'http://novari.no/fhir/digidot/CodeSystem/test-digidot-procedure-category' and code = 'dental-procedure').exists()"
          },
          {
            "key": "proc-partof-encounter-recommended",
            "severity": "warning",
            "human": "DigiDOT sub-procedures that use Procedure.partOf should normally also reference the Encounter where the sub-procedure was performed.",
            "expression": "partOf.empty() or encounter.exists()"
          },
          {
            "key": "proc-status-reason-recommended",
            "severity": "warning",
            "human": "Procedures with status stopped, not-done or on-hold should normally include statusReason.",
            "expression": "(status != 'stopped' and status != 'not-done' and status != 'on-hold') or statusReason.exists()"
          }
        ]
      },
      {
        "id": "Procedure.basedOn",
        "path": "Procedure.basedOn",
        "short": "Planned/requested procedure that this performed procedure is based on.",
        "definition": "Use Procedure.basedOn to connect a performed procedure to a planned, proposed or ordered dental service. This supports procedures that are planned before they are performed and enables traceability from ServiceRequest to Procedure.",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://novari.no/fhir/digidot/StructureDefinition/test-digidot-ServiceRequest-no",
              "http://hl7.org/fhir/StructureDefinition/ServiceRequest"
            ]
          }
        ]
      },
      {
        "id": "Procedure.partOf",
        "path": "Procedure.partOf",
        "short": "Larger performed procedure that this procedure is part of.",
        "definition": "Use Procedure.partOf for performed sub-procedures that are components or stages of a larger performed Procedure. For treatment spanning multiple visits, the default model can be several visit-level Procedures basedOn the same ServiceRequest and connected through Encounter/EpisodeOfCare. Add a parent Procedure only when a summarized overall performed procedure is clinically useful. Do not use Procedure.partOf for the plan/request relation; use Procedure.basedOn for ServiceRequest.",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://novari.no/fhir/digidot/StructureDefinition/test-digidot-Procedure-no",
              "http://hl7.no/fhir/StructureDefinition/no-basis-Procedure",
              "http://hl7.org/fhir/StructureDefinition/Procedure"
            ]
          }
        ]
      },
      {
        "id": "Procedure.status",
        "path": "Procedure.status",
        "short": "Lifecycle status for this concrete procedure occurrence.",
        "definition": "Use Procedure.status for the lifecycle of this specific Procedure resource. For staged dental treatment, visit-level Procedures usually become completed, stopped or not-done. If an optional parent Procedure is used to summarize a larger performed procedure across contacts, it should normally be in-progress while active, on-hold only when genuinely paused, stopped if abandoned, and completed when the overall performed procedure is complete. Do not use Procedure.status as a general treatment plan status; use ServiceRequest.status for the plan/request lifecycle.",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Procedure.statusReason",
        "path": "Procedure.statusReason",
        "short": "Why the procedure was stopped, not done or put on hold.",
        "definition": "Use Procedure.statusReason when status is not-done, stopped or on-hold. Prefer SNOMED CT or another agreed code system when a suitable code exists; otherwise use CodeableConcept.text until a DigiDOT reason value set has been agreed.",
        "min": 0,
        "max": "1"
      },
      {
        "id": "Procedure.category",
        "path": "Procedure.category",
        "short": "Coarse category for the DigiDOT procedure.",
        "definition": "Use Procedure.category as a coarse category marker for the Procedure resource. For DigiDOT clinical dental procedures this should be dental-procedure, but the profile only recommends this marker to avoid blocking migrated or vendor data where category is missing. The precise clinical meaning must be represented in Procedure.code using SNOMED CT; category must not be used as a replacement for the clinical procedure code.",
        "min": 0,
        "max": "1",
        "binding": {
          "strength": "preferred",
          "description": "DigiDOT procedure category. Clinical dental procedures should use dental-procedure when category is included.",
          "valueSet": "http://novari.no/fhir/digidot/ValueSet/test-digidot-procedure-category"
        }
      },
      {
        "id": "Procedure.code",
        "path": "Procedure.code",
        "min": 1,
        "binding": {
          "strength": "extensible",
          "description": "Use a code from the DigiDOT dental procedure value set when it covers the intended clinical procedure. The value set represents the reportable/refset procedure values, including values relevant for KPR reporting. For clinical storage, procedures may also be coded with SNOMED CT concepts outside the refset when the refset does not cover the meaning. A postcoordinated SNOMED CT expression may be included as an additional coding for semantic precision.",
          "valueSet": "http://novari.no/fhir/digidot/ValueSet/dental-procedures"
        },
        "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/test-digidot-Coding-SCTpre-no"
            ]
          }
        ],
        "binding": {
          "strength": "extensible",
          "description": "For EHR implementations using this profile for storage of clinical data, the precoordinated SNOMED CT coding can contain relevant SNOMED CT concepts beyond the DigiDOT dental procedure refset when no refset code covers the meaning. For national reporting, KPR reporting or other constrained information exchange, the reportable code should be selected from the DigiDOT dental procedure value set/refset. A stricter KPR/reporting profile can later use required binding if validation must enforce only reportable refset values.",
          "valueSet": "http://novari.no/fhir/digidot/ValueSet/dental-procedures"
        }
      },
      {
        "id": "Procedure.code.coding:SCTpost",
        "path": "Procedure.code.coding",
        "sliceName": "SCTpost",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Coding",
            "profile": [
              "http://novari.no/fhir/digidot/StructureDefinition/test-digidot-Coding-SCTpost-no"
            ]
          }
        ]
      },
      {
        "id": "Procedure.subject",
        "path": "Procedure.subject",
        "min": 1,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.no/fhir/StructureDefinition/no-basis-Patient",
              "http://hl7.org/fhir/StructureDefinition/Patient"
            ]
          }
        ]
      },
      {
        "id": "Procedure.encounter",
        "path": "Procedure.encounter",
        "short": "Encounter where the procedure was performed, when the procedure belongs to one concrete encounter.",
        "definition": "Use Procedure.encounter for visit-level procedures. Parent Procedures that summarize staged treatment across several encounters may omit encounter because FHIR Procedure can only point to one Encounter. The child Procedures should carry the concrete Encounter references.",
        "min": 0,
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://novari.no/fhir/digidot/StructureDefinition/test-digidot-Encounter-no",
              "http://hl7.org/fhir/StructureDefinition/Encounter"
            ]
          }
        ]
      },
      {
        "id": "Procedure.performed[x]",
        "path": "Procedure.performed[x]",
        "short": "Time or period of the procedure.",
        "definition": "Use performedDateTime for simple visit-level procedures. Use performedPeriod for staged or long-running procedures; the parent Procedure can have a period from first clinical activity to final completion. Aligns with the HL7 Europe Procedure core pattern where performed[x] is required for exchange.",
        "min": 1
      },
      {
        "id": "Procedure.performer",
        "path": "Procedure.performer"
      },
      {
        "id": "Procedure.performer.actor",
        "path": "Procedure.performer.actor",
        "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"
            ]
          }
        ]
      },
      {
        "id": "Procedure.location",
        "path": "Procedure.location",
        "max": "1",
        "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/test-digidot-Condition-no",
              "http://hl7.org/fhir/StructureDefinition/Condition"
            ]
          }
        ]
      },
      {
        "id": "Procedure.bodySite",
        "path": "Procedure.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": "Procedure.bodySite.coding",
        "path": "Procedure.bodySite.coding",
        "slicing": {
          "discriminator": [
            {
              "type": "profile",
              "path": "$this"
            }
          ],
          "rules": "open"
        },
        "min": 0,
        "max": "*"
      },
      {
        "id": "Procedure.bodySite.coding:tooth",
        "path": "Procedure.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": "Procedure.bodySite.coding:surface",
        "path": "Procedure.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": "Procedure.bodySite.coding.system",
        "path": "Procedure.bodySite.coding.system",
        "min": 1,
        "fixedUri": "http://snomed.info/sct"
      },
      {
        "id": "Procedure.outcome",
        "path": "Procedure.outcome",
        "short": "Procedure outcome when relevant.",
        "definition": "Use Procedure.outcome for clinically meaningful outcome of a completed, stopped or not-done procedure when this can be coded or described. Do not use outcome as a replacement for status; status remains the lifecycle state."
      },
      {
        "id": "Procedure.focalDevice.manipulated",
        "path": "Procedure.focalDevice.manipulated",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://novari.no/fhir/digidot/StructureDefinition/test-digidot-Device-no",
              "http://hl7.org/fhir/StructureDefinition/Device"
            ]
          }
        ]
      },
      {
        "id": "Procedure.usedReference",
        "path": "Procedure.usedReference",
        "short": "Reference to material, substance, medication product or device used in the procedure.",
        "definition": "Use Procedure.usedReference when the material, substance, medication product or device needs its own resource representation. For medication products, prefer SFM medication profiles when the source is SFM.",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "http://hl7.no/fhir/StructureDefinition/no-basis-Substance",
              "http://hl7.org/fhir/StructureDefinition/Substance",
              "http://ehelse.no/fhir/StructureDefinition/sfm-Medication",
              "http://ehelse.no/fhir/StructureDefinition/sfm-Magistrell-Medication",
              "http://hl7.no/fhir/StructureDefinition/no-basis-Medication",
              "http://hl7.org/fhir/StructureDefinition/Medication",
              "http://novari.no/fhir/digidot/StructureDefinition/test-digidot-Device-no",
              "http://hl7.org/fhir/StructureDefinition/Device"
            ]
          }
        ]
      },
      {
        "id": "Procedure.usedCode",
        "path": "Procedure.usedCode",
        "short": "Material, substance or equipment used in the procedure.",
        "definition": "Use Procedure.usedCode for simple coding of dental materials, substances or devices used during the procedure when a separate resource is not needed.",
        "min": 0,
        "max": "*"
      }
    ]
  },
  "description": "TEST comparison draft. Not for production use."
}