{
  "resourceType": "StructureDefinition",
  "id": "Extension-DataStandardsWales-DocumentErrorAction",
  "url": "https://fhir.nhs.wales/StructureDefinition/Extension-DataStandardsWales-DocumentErrorAction",
  "version": "0.0.1",
  "name": "ExtensionDataStandardsWalesDocumentErrorAction",
  "title": "Extension Data Standards Wales Document Error Action",
  "status": "draft",
  "experimental": true,
  "date": "2025-09-24",
  "publisher": "NHS Wales",
  "contact": [
    {
      "name": "FHIR Standards",
      "telecom": [
        {
          "system": "email",
          "value": "fhir.standards@wales.nhs.uk",
          "use": "work",
          "rank": 1
        }
      ]
    }
  ],
  "description": "This extension provides a history of error actions performed e.g. document misfile proposed then accepted.",
  "purpose": "To support the document error workflow in NHS Wales, including the specific action performed, when, bu whom and any reason provided.",
  "copyright": "2025 NHS Wales",
  "fhirVersion": "4.0.1",
  "kind": "complex-type",
  "abstract": false,
  "context": [
    {
      "type": "element",
      "expression": "DocumentReference"
    }
  ],
  "type": "Extension",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/Extension",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "Extension",
        "path": "Extension",
        "short": "Document error action metadata.",
        "definition": "This extension provides outline data for an action performed as part of a document error workflow e.g. document misfile proposed."
      },
      {
        "id": "Extension.extension",
        "path": "Extension.extension",
        "min": 2
      },
      {
        "id": "Extension.extension:actionType",
        "path": "Extension.extension",
        "sliceName": "actionType",
        "short": "misfile-proposed | misfile-accepted | misfile-rejected | revoked",
        "definition": "A descriptive code for action performed as part of a document error workflow in NHS Wales e.g. document misfile proposed.",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Extension.extension:actionType.extension",
        "path": "Extension.extension.extension",
        "max": "0"
      },
      {
        "id": "Extension.extension:actionType.url",
        "path": "Extension.extension.url",
        "fixedUri": "actionType"
      },
      {
        "id": "Extension.extension:actionType.value[x]",
        "path": "Extension.extension.value[x]",
        "short": "misfile-proposed | misfile-accepted | misfile-rejected | revoked",
        "definition": "A descriptive code for an action performed as part of a document error workflow in NHS Wales e.g. document misfile proposed.",
        "type": [
          {
            "code": "code"
          }
        ],
        "binding": {
          "strength": "required",
          "valueSet": "https://fhir.nhs.wales/ValueSet/FHIRStandardsWales-DocumentErrorAction"
        }
      },
      {
        "id": "Extension.extension:actionDateTime",
        "path": "Extension.extension",
        "sliceName": "actionDateTime",
        "short": "The date and time of the document error action.",
        "definition": "A timestamp for the error workflow action performed by the user e.g. proposing that a document is misfiled.",
        "min": 1,
        "max": "1"
      },
      {
        "id": "Extension.extension:actionDateTime.extension",
        "path": "Extension.extension.extension",
        "max": "0"
      },
      {
        "id": "Extension.extension:actionDateTime.url",
        "path": "Extension.extension.url",
        "fixedUri": "actionDateTime"
      },
      {
        "id": "Extension.extension:actionDateTime.value[x]",
        "path": "Extension.extension.value[x]",
        "type": [
          {
            "code": "instant"
          }
        ]
      },
      {
        "id": "Extension.extension:actionedBy",
        "path": "Extension.extension",
        "sliceName": "actionedBy",
        "short": "The user that performed the document error action.",
        "definition": "A reference to the user that performed the error workflow action e.g. proposing that a document is misfiled.",
        "max": "1"
      },
      {
        "id": "Extension.extension:actionedBy.extension",
        "path": "Extension.extension.extension",
        "max": "0"
      },
      {
        "id": "Extension.extension:actionedBy.url",
        "path": "Extension.extension.url",
        "fixedUri": "actionedBy"
      },
      {
        "id": "Extension.extension:actionedBy.value[x]",
        "path": "Extension.extension.value[x]",
        "short": "The user that performed the document error action.",
        "definition": "A reference to the user that performed the error workflow action e.g. proposing that a document is misfiled.",
        "type": [
          {
            "code": "Reference",
            "targetProfile": [
              "https://fhir.nhs.wales/StructureDefinition/DataStandardsWales-Practitioner",
              "https://fhir.nhs.wales/StructureDefinition/DataStandardsWales-PractitionerRole",
              "https://fhir.nhs.wales/StructureDefinition/DataStandardsWales-Patient",
              "https://fhir.nhs.wales/StructureDefinition/DataStandardsWales-RelatedPerson"
            ]
          }
        ]
      },
      {
        "id": "Extension.extension:actionReason",
        "path": "Extension.extension",
        "sliceName": "actionReason",
        "short": "The reason provided for the error action.",
        "definition": "Any coded or free text justification or explanation provided for the error action performed.",
        "max": "1"
      },
      {
        "id": "Extension.extension:actionReason.extension",
        "path": "Extension.extension.extension",
        "max": "0"
      },
      {
        "id": "Extension.extension:actionReason.url",
        "path": "Extension.extension.url",
        "fixedUri": "actionReason"
      },
      {
        "id": "Extension.extension:actionReason.value[x]",
        "path": "Extension.extension.value[x]",
        "short": "The reason provided for the error action.",
        "definition": "Any coded or free text justification or explanation provided for the error action performed.",
        "type": [
          {
            "code": "CodeableConcept"
          }
        ]
      },
      {
        "id": "Extension.url",
        "path": "Extension.url",
        "fixedUri": "https://fhir.nhs.wales/StructureDefinition/Extension-DataStandardsWales-DocumentErrorAction"
      },
      {
        "id": "Extension.value[x]",
        "path": "Extension.value[x]",
        "max": "0"
      }
    ]
  }
}