Skip to content
Partner Developer Portal

Definition

The Carerecord Observation model records patient clinical observations, including coded terms, associated text and numeric or text values. It also holds units, comparison operators, range information and abnormality details, together with effective dates, entering and authorising user identifiers, and recorded provisional and access-restriction flags.

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

carerecord.observation with carerecord.consultationsection, dbo.organisation and dbo.patient details

Section titled “carerecord.observation with carerecord.consultationsection, dbo.organisation and dbo.patient details”

Return records alongside descriptive values from the related tables.

SELECT
m."observationid",
m."consultationsectionid",
p1."originalheading" AS "consultationsection_originalheading",
m."organisationid",
p2."organisationdisplayname" AS "organisationdisplayname",
m."patientid",
p3."displayname" AS "patient_displayname"
FROM carerecord.observation AS m
LEFT JOIN carerecord.consultationsection AS p1
ON p1."consultationsectionid" = m."consultationsectionid"
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";

carerecord.careplandetail count per carerecord.observation

Section titled “carerecord.careplandetail count per carerecord.observation”

Count related carerecord.careplandetail records for each carerecord.observation record, joined on observationid.

SELECT
m."observationid",
m."associatedtext",
COUNT(c."observationid") AS careplandetail_count
FROM carerecord.observation AS m
LEFT JOIN carerecord.careplandetail AS c
ON m."observationid" = c."observationid"
AND m."organisation" = c."organisation"
GROUP BY m."observationid", m."associatedtext"
ORDER BY careplandetail_count DESC;

Row count by carerecord.consultationsection originalheading

Section titled “Row count by carerecord.consultationsection originalheading”

Count carerecord.observation records for each carerecord.consultationsection value, joined on consultationsectionid.

SELECT
p."originalheading" AS "consultationsection_originalheading",
COUNT(*) AS row_count
FROM carerecord.observation AS m
INNER JOIN carerecord.consultationsection AS p
ON p."consultationsectionid" = m."consultationsectionid"
AND p."organisation" = m."organisation"
GROUP BY p."originalheading"
ORDER BY row_count DESC;