Skip to content
Partner Developer Portal

Definition

The Dataservices Changelog model records changes to identified data items, including the log timestamp and update-mode value. It holds item, item-type and change-source identifiers, together with patient and organisation identifiers and the recorded row key for the item.

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

dataservices.changelog with dataservices.changelogsource, dbo.organisation and dbo.patient details

Section titled “dataservices.changelog with dataservices.changelogsource, dbo.organisation and dbo.patient details”

Return records alongside descriptive values from the related tables.

SELECT
m."changelogid",
m."changelogsourceid",
p1."sourcename" AS "changelogsource_sourcename",
m."organisationid",
p2."organisationdisplayname" AS "organisationdisplayname",
m."patientid",
p3."displayname" AS "patient_displayname"
FROM dataservices.changelog AS m
LEFT JOIN dataservices.changelogsource AS p1
ON p1."changelogsourceid" = m."changelogsourceid"
AND p1."organisation" = m."organisation"
LEFT JOIN dbo.organisation AS p2
ON p2."organisationid" = m."organisationid"
AND p2."organisation" = m."organisation"
LEFT JOIN dbo.patient AS p3
ON p3."patientid" = m."patientid"
AND p3."organisation" = m."organisation";

Row count by dataservices.changelogsource sourcename

Section titled “Row count by dataservices.changelogsource sourcename”

Count dataservices.changelog records for each dataservices.changelogsource value, joined on changelogsourceid.

SELECT
p."sourcename" AS "changelogsource_sourcename",
COUNT(*) AS row_count
FROM dataservices.changelog AS m
INNER JOIN dataservices.changelogsource AS p
ON p."changelogsourceid" = m."changelogsourceid"
AND p."organisation" = m."organisation"
GROUP BY p."sourcename"
ORDER BY row_count DESC;

Row count by dbo.organisation organisationdisplayname

Section titled “Row count by dbo.organisation organisationdisplayname”

Count dataservices.changelog records for each dbo.organisation value, joined on organisationid.

SELECT
p."organisationdisplayname" AS "organisationdisplayname",
COUNT(*) AS row_count
FROM dataservices.changelog AS m
INNER JOIN dbo.organisation AS p
ON p."organisationid" = m."organisationid"
AND p."organisation" = m."organisation"
GROUP BY p."organisationdisplayname"
ORDER BY row_count DESC;