Skip to content
Partner Developer Portal

Definition

The Audit Registrationaudit model records patient registration audit events with their date stamps and event details. It holds patient XML, message identifiers and activity-context and mode-type identifiers, together with the patient identifier, user-role display information, impersonated-user name and organisation information.

_deleted indicates whether the record has been deleted in the source system.

audit.registrationaudit with audit.activitycontext, audit.modetype and dbo.patient details

Section titled “audit.registrationaudit with audit.activitycontext, audit.modetype and dbo.patient details”

Return records alongside descriptive values from the related tables.

SELECT
m."registrationauditid",
m."activitycontextid",
p1."activitycontextdescription" AS "activitycontextdescription",
m."modetypeid",
p2."description" AS "modetype_description",
m."patientid",
p3."displayname" AS "patient_displayname"
FROM audit.registrationaudit AS m
LEFT JOIN audit.activitycontext AS p1
ON p1."activitycontextid" = m."activitycontextid"
AND p1."organisation" = m."organisation"
LEFT JOIN audit.modetype AS p2
ON p2."modetypeid" = m."modetypeid"
AND p2."organisation" = m."organisation"
LEFT JOIN dbo.patient AS p3
ON p3."patientid" = m."patientid"
AND p3."organisation" = m."organisation";

Row count by audit.activitycontext activitycontextdescription

Section titled “Row count by audit.activitycontext activitycontextdescription”

Count audit.registrationaudit records for each audit.activitycontext value, joined on activitycontextid.

SELECT
p."activitycontextdescription" AS "activitycontextdescription",
COUNT(*) AS row_count
FROM audit.registrationaudit AS m
INNER JOIN audit.activitycontext AS p
ON p."activitycontextid" = m."activitycontextid"
AND p."organisation" = m."organisation"
GROUP BY p."activitycontextdescription"
ORDER BY row_count DESC;

Count audit.registrationaudit records for each audit.modetype value, joined on modetypeid.

SELECT
p."description" AS "modetype_description",
COUNT(*) AS row_count
FROM audit.registrationaudit AS m
INNER JOIN audit.modetype AS p
ON p."modetypeid" = m."modetypeid"
AND p."organisation" = m."organisation"
GROUP BY p."description"
ORDER BY row_count DESC;