Definition
Information
Section titled “Information”The Audit Activitycontext model holds descriptions of audit activity contexts. Each entry records a context identifier and description, an item-type identifier and organisation information.
Deferred Visits Audit Contexts
Section titled “Deferred Visits Audit Contexts”The Deferred Visits Enhancements guide defines these activity contexts:
| activitycontextid | activitycontextdescription | Meaning |
|---|---|---|
| 436 | Deferral Reasons Manage | Configuration activity for adding, editing or deleting deferral reasons. |
| 437 | Slot Deferred | Operational activity when a scheduled slot is deferred. |
Reason configuration activity uses Appointments Configuration item type 383. Join itemtypeid to audit.itemtype with organisation to resolve the classification recorded for each context.
This model is reference data, not one row per action. Counting context rows does not count deferrals or configuration changes. Event reporting requires the relevant audit records linked by activitycontextid and organisation. Assignment deferral counts should instead use the cancellation and target-link criteria in appointment.assignmentlistpatientschedule. Do not assume every deferred assignment has a slot audit event.
Soft-Deleted Records
Section titled “Soft-Deleted Records”_deleted indicates whether the record has been deleted in the source system.
Examples
Section titled “Examples”Deferred visits context definitions and their item types
Section titled “Deferred visits context definitions and their item types”Inspect the configured classifications without assuming that both contexts share the same itemtypeid. This returns reference rows, not audit events.
SELECT c."organisation", c."activitycontextid", c."activitycontextdescription", c."itemtypeid", t."itemtypedescription"FROM audit.activitycontext AS cLEFT JOIN audit.itemtype AS t ON t."itemtypeid" = c."itemtypeid" AND t."organisation" = c."organisation"WHERE c."activitycontextid" IN (436, 437)ORDER BY c."organisation", c."activitycontextid";audit.activitycontext with audit.itemtype details
Section titled “audit.activitycontext with audit.itemtype details”Return records alongside descriptive values from the related audit.itemtype record.
SELECT m."activitycontextid", m."itemtypeid", p1."itemtypedescription" AS "itemtypedescription"FROM audit.activitycontext AS mLEFT JOIN audit.itemtype AS p1 ON p1."itemtypeid" = m."itemtypeid" AND p1."organisation" = m."organisation";audit.careraudit count per audit.activitycontext
Section titled “audit.careraudit count per audit.activitycontext”Count related audit.careraudit records for each audit.activitycontext record, joined on activitycontextid.
SELECT m."activitycontextid", m."activitycontextdescription", COUNT(c."activitycontextid") AS careraudit_countFROM audit.activitycontext AS mLEFT JOIN audit.careraudit AS c ON m."activitycontextid" = c."activitycontextid" AND m."organisation" = c."organisation"GROUP BY m."activitycontextid", m."activitycontextdescription"ORDER BY careraudit_count DESC;Row count by audit.itemtype itemtypedescription
Section titled “Row count by audit.itemtype itemtypedescription”Count audit.activitycontext records for each audit.itemtype value, joined on itemtypeid.
SELECT p."itemtypedescription" AS "itemtypedescription", COUNT(*) AS row_countFROM audit.activitycontext AS mINNER JOIN audit.itemtype AS p ON p."itemtypeid" = m."itemtypeid" AND p."organisation" = m."organisation"GROUP BY p."itemtypedescription"ORDER BY row_count DESC;