{
  "resourceType": "StructureDefinition",
  "id": "epa-auditevent",
  "url": "https://gematik.de/fhir/epa/StructureDefinition/epa-auditevent",
  "version": "1.1.0",
  "name": "EPAAuditEvent",
  "title": "AuditEvent for the ePA",
  "status": "active",
  "experimental": false,
  "date": "2024-08-14",
  "publisher": "gematik GmbH",
  "description": "Defines the data structure for audit events in the ePA system.",
  "fhirVersion": "4.0.1",
  "kind": "resource",
  "abstract": false,
  "type": "AuditEvent",
  "baseDefinition": "http://hl7.org/fhir/StructureDefinition/AuditEvent",
  "derivation": "constraint",
  "differential": {
    "element": [
      {
        "id": "AuditEvent.type",
        "path": "AuditEvent.type",
        "binding": {
          "strength": "required",
          "valueSet": "https://gematik.de/fhir/epa/ValueSet/epa-auditevent-type-vs"
        }
      },
      {
        "id": "AuditEvent.subtype",
        "path": "AuditEvent.subtype",
        "max": "0"
      },
      {
        "id": "AuditEvent.action",
        "path": "AuditEvent.action",
        "short": "Type of action performed during the event. CREATE: C | READ: R | UPDATE: U | DELETE: D | EXECUTE: E",
        "definition": "Type of action performed during the event. CREATE: C | READ: R | UPDATE: U | DELETE: D | EXECUTE: E",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "AuditEvent.period",
        "path": "AuditEvent.period",
        "max": "0"
      },
      {
        "id": "AuditEvent.recorded",
        "path": "AuditEvent.recorded",
        "mustSupport": true
      },
      {
        "id": "AuditEvent.outcome",
        "path": "AuditEvent.outcome",
        "short": "success: 0; failure: 4; major failure: 12",
        "definition": "success: 0; failure: 4; major failure: 12",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "AuditEvent.outcomeDesc",
        "path": "AuditEvent.outcomeDesc",
        "max": "0"
      },
      {
        "id": "AuditEvent.purposeOfEvent",
        "path": "AuditEvent.purposeOfEvent",
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "valueSet": "https://gematik.de/fhir/epa/ValueSet/epa-auditevent-purpose-of-event-vs"
        }
      },
      {
        "id": "AuditEvent.agent",
        "path": "AuditEvent.agent",
        "slicing": {
          "discriminator": [
            {
              "type": "pattern",
              "path": "type"
            }
          ],
          "rules": "open"
        },
        "mustSupport": true
      },
      {
        "id": "AuditEvent.agent:user",
        "path": "AuditEvent.agent",
        "sliceName": "user",
        "short": "The agent user refers to the service provider (LE) or the service provider institution (LEI)",
        "definition": "The agent user refers to the service provider (LE) or the service provider institution (LEI)",
        "min": 0,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "AuditEvent.agent:user.extension:healthcareFacilityType",
        "path": "AuditEvent.agent.extension",
        "sliceName": "healthcareFacilityType",
        "min": 0,
        "max": "1",
        "type": [
          {
            "code": "Extension",
            "profile": [
              "https://gematik.de/fhir/epa/StructureDefinition/epa-healthcare-facility-type-extension"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "AuditEvent.agent:user.type",
        "path": "AuditEvent.agent.type",
        "min": 1,
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "valueSet": "https://gematik.de/fhir/epa/ValueSet/epa-audit-event-agent-type-user-vs"
        }
      },
      {
        "id": "AuditEvent.agent:user.role",
        "path": "AuditEvent.agent.role",
        "short": "Professional role of the service provider",
        "definition": "Professional role of the service provider",
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "valueSet": "https://gematik.de/fhir/terminology/ValueSet/epa-ehealth-dsi-healthcare-facility-type-vs"
        }
      },
      {
        "id": "AuditEvent.agent:user.role.coding",
        "path": "AuditEvent.agent.role.coding",
        "mustSupport": true
      },
      {
        "id": "AuditEvent.agent:user.role.coding.system",
        "path": "AuditEvent.agent.role.coding.system",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "AuditEvent.agent:user.role.coding.code",
        "path": "AuditEvent.agent.role.coding.code",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "AuditEvent.agent:user.role.coding.display",
        "path": "AuditEvent.agent.role.coding.display",
        "mustSupport": true
      },
      {
        "id": "AuditEvent.agent:user.who",
        "path": "AuditEvent.agent.who",
        "short": "The subject Id of the IDToken",
        "definition": "The subject Id of the IDToken",
        "mustSupport": true
      },
      {
        "id": "AuditEvent.agent:user.who.identifier",
        "path": "AuditEvent.agent.who.identifier",
        "min": 1,
        "type": [
          {
            "code": "Identifier",
            "profile": [
              "http://fhir.de/StructureDefinition/identifier-telematik-id",
              "http://fhir.de/StructureDefinition/identifier-kvid-10"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "AuditEvent.agent:user.altId",
        "path": "AuditEvent.agent.altId",
        "short": "Alternative User identity (e.g. Telematik-ID or the KVNR)",
        "definition": "Alternative User identity (e.g. Telematik-ID or the KVNR)",
        "mustSupport": true
      },
      {
        "id": "AuditEvent.agent:user.name",
        "path": "AuditEvent.agent.name",
        "short": "Name of HCP or Insurant",
        "definition": "Name of HCP or Insurant, in case of EU-access provide the name of the practitioner and the organization separated by a '/' ",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "AuditEvent.agent:user.requestor",
        "path": "AuditEvent.agent.requestor",
        "fixedBoolean": true
      },
      {
        "id": "AuditEvent.agent:user.location",
        "path": "AuditEvent.agent.location",
        "max": "0"
      },
      {
        "id": "AuditEvent.agent:user.policy",
        "path": "AuditEvent.agent.policy",
        "max": "0"
      },
      {
        "id": "AuditEvent.agent:user.media",
        "path": "AuditEvent.agent.media",
        "max": "0"
      },
      {
        "id": "AuditEvent.agent:user.network",
        "path": "AuditEvent.agent.network",
        "max": "0"
      },
      {
        "id": "AuditEvent.agent:client",
        "path": "AuditEvent.agent",
        "sliceName": "client",
        "short": "The agent client refers to a software system that has executed the action, for example, E-Rezept Fachdienst",
        "definition": "The agent client refers to a software system that has executed the action, for example, E-Rezept Fachdienst",
        "min": 0,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "AuditEvent.agent:client.type",
        "path": "AuditEvent.agent.type",
        "min": 1,
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "valueSet": "https://gematik.de/fhir/epa/ValueSet/epa-audit-event-agent-type-client-vs"
        }
      },
      {
        "id": "AuditEvent.agent:client.role",
        "path": "AuditEvent.agent.role",
        "mustSupport": true
      },
      {
        "id": "AuditEvent.agent:client.who",
        "path": "AuditEvent.agent.who",
        "short": "The subject Id of the IDToken",
        "definition": "The subject Id of the IDToken",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "AuditEvent.agent:client.who.identifier",
        "path": "AuditEvent.agent.who.identifier",
        "min": 1,
        "type": [
          {
            "code": "Identifier",
            "profile": [
              "http://fhir.de/StructureDefinition/identifier-telematik-id"
            ]
          }
        ],
        "mustSupport": true
      },
      {
        "id": "AuditEvent.agent:client.altId",
        "path": "AuditEvent.agent.altId",
        "short": "Alternative client identity (e.g. Telematik-ID))",
        "definition": "Alternative client identity (e.g. Telematik-ID)",
        "mustSupport": true
      },
      {
        "id": "AuditEvent.agent:client.name",
        "path": "AuditEvent.agent.name",
        "short": "Name e.g. eRezept, EU access/country name or DiGA",
        "definition": "Name of a service e.g. eRezept, EU access/country name or DiGA",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "AuditEvent.agent:client.requestor",
        "path": "AuditEvent.agent.requestor",
        "fixedBoolean": true
      },
      {
        "id": "AuditEvent.agent:client.location",
        "path": "AuditEvent.agent.location",
        "max": "0"
      },
      {
        "id": "AuditEvent.agent:client.policy",
        "path": "AuditEvent.agent.policy",
        "max": "0"
      },
      {
        "id": "AuditEvent.agent:client.media",
        "path": "AuditEvent.agent.media",
        "max": "0"
      },
      {
        "id": "AuditEvent.agent:client.network",
        "path": "AuditEvent.agent.network",
        "max": "0"
      },
      {
        "id": "AuditEvent.agent:internal",
        "path": "AuditEvent.agent",
        "sliceName": "internal",
        "short": "The agent internal refers to internal actions of the Elektronische Patientenakte Fachdienst (ePA) service, such as data export submissions",
        "definition": "The agent internal refers to internal actions of the Elektronische Patientenakte Fachdienst (ePA) service, such as data export submissions",
        "min": 0,
        "max": "1",
        "mustSupport": true
      },
      {
        "id": "AuditEvent.agent:internal.type",
        "path": "AuditEvent.agent.type",
        "min": 1,
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "valueSet": "https://gematik.de/fhir/epa/ValueSet/epa-auditevent-sourcetype-vs"
        }
      },
      {
        "id": "AuditEvent.agent:internal.role",
        "path": "AuditEvent.agent.role",
        "max": "0"
      },
      {
        "id": "AuditEvent.agent:internal.altId",
        "path": "AuditEvent.agent.altId",
        "short": "altId MUST be epa",
        "definition": "altId MUST be epa",
        "fixedString": "epa",
        "mustSupport": true
      },
      {
        "id": "AuditEvent.agent:internal.name",
        "path": "AuditEvent.agent.name",
        "short": "Name MUST be ePA",
        "definition": "Name MUST be ePA",
        "min": 1,
        "fixedString": "ePA",
        "mustSupport": true
      },
      {
        "id": "AuditEvent.agent:internal.requestor",
        "path": "AuditEvent.agent.requestor",
        "fixedBoolean": true
      },
      {
        "id": "AuditEvent.agent:internal.location",
        "path": "AuditEvent.agent.location",
        "max": "0"
      },
      {
        "id": "AuditEvent.agent:internal.policy",
        "path": "AuditEvent.agent.policy",
        "max": "0"
      },
      {
        "id": "AuditEvent.agent:internal.media",
        "path": "AuditEvent.agent.media",
        "max": "0"
      },
      {
        "id": "AuditEvent.agent:internal.network",
        "path": "AuditEvent.agent.network",
        "max": "0"
      },
      {
        "id": "AuditEvent.source",
        "path": "AuditEvent.source",
        "mustSupport": true
      },
      {
        "id": "AuditEvent.source.observer.display",
        "path": "AuditEvent.source.observer.display",
        "fixedString": "Elektronische Patientenakte Fachdienst"
      },
      {
        "id": "AuditEvent.source.type",
        "path": "AuditEvent.source.type",
        "min": 1,
        "max": "1",
        "mustSupport": true,
        "binding": {
          "strength": "required",
          "valueSet": "https://gematik.de/fhir/epa/ValueSet/epa-auditevent-sourcetype-vs"
        }
      },
      {
        "id": "AuditEvent.entity",
        "path": "AuditEvent.entity",
        "min": 1,
        "mustSupport": true
      },
      {
        "id": "AuditEvent.entity.what",
        "path": "AuditEvent.entity.what",
        "max": "0"
      },
      {
        "id": "AuditEvent.entity.type",
        "path": "AuditEvent.entity.type",
        "max": "0"
      },
      {
        "id": "AuditEvent.entity.role",
        "path": "AuditEvent.entity.role",
        "max": "0"
      },
      {
        "id": "AuditEvent.entity.lifecycle",
        "path": "AuditEvent.entity.lifecycle",
        "max": "0"
      },
      {
        "id": "AuditEvent.entity.securityLabel",
        "path": "AuditEvent.entity.securityLabel",
        "max": "0"
      },
      {
        "id": "AuditEvent.entity.name",
        "path": "AuditEvent.entity.name",
        "short": "The title of the XDS document, FHIR resource or object name of a service (e.g. Entitlement Service, Device Management, ...).",
        "definition": "The title of the XDS document, FHIR resource or object name of a service (e.g. Entitlement Service, Device Management, ...).",
        "mustSupport": true
      },
      {
        "id": "AuditEvent.entity.description",
        "path": "AuditEvent.entity.description",
        "short": "The OperationId",
        "definition": "The OperationId",
        "mustSupport": true
      },
      {
        "id": "AuditEvent.entity.query",
        "path": "AuditEvent.entity.query",
        "max": "0"
      },
      {
        "id": "AuditEvent.entity.detail",
        "path": "AuditEvent.entity.detail",
        "mustSupport": true
      },
      {
        "id": "AuditEvent.entity.detail.type",
        "path": "AuditEvent.entity.detail.type",
        "short": "The Name of the property (e.g. Document Format, DocumentID, ...).",
        "definition": "The Name of the property (e.g. Document Format, DocumentID, ...).",
        "mustSupport": true
      },
      {
        "id": "AuditEvent.entity.detail.value[x]",
        "path": "AuditEvent.entity.detail.value[x]",
        "slicing": {
          "discriminator": [
            {
              "type": "type",
              "path": "$this"
            }
          ],
          "ordered": false,
          "rules": "open"
        }
      },
      {
        "id": "AuditEvent.entity.detail.value[x]:valueString",
        "path": "AuditEvent.entity.detail.value[x]",
        "sliceName": "valueString",
        "short": "Property value (e.g. urn:gematik:ig:Zahnbonusheft:v1.1.0)",
        "definition": "Property value (e.g. urn:gematik:ig:Zahnbonusheft:v1.1.0)",
        "min": 1,
        "max": "1",
        "type": [
          {
            "code": "string"
          }
        ],
        "mustSupport": true
      }
    ]
  }
}