Skip to content
Partner Developer Portal

Definition

The Carerecord Reportobservation model links patient reports with clinical observations through their recorded identifiers. Each association holds report, observation and patient identifiers together with source organisation information, describing the observation association recorded against the report within the patient’s care record.

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

carerecord.reportobservation with carerecord.observation, dbo.patient and carerecord.report details

Section titled “carerecord.reportobservation with carerecord.observation, dbo.patient and carerecord.report details”

Return records alongside descriptive values from the related tables.

SELECT
m."_primary_key",
m."observationid",
p1."associatedtext" AS "observation_associatedtext",
m."patientid",
p2."displayname" AS "patient_displayname",
m."reportid",
p3."associatedtext" AS "report_associatedtext"
FROM carerecord.reportobservation AS m
LEFT JOIN carerecord.observation AS p1
ON p1."observationid" = m."observationid"
AND p1."organisation" = m."organisation"
LEFT JOIN dbo.patient AS p2
ON p2."patientid" = m."patientid"
AND p2."organisation" = m."organisation"
LEFT JOIN carerecord.report AS p3
ON p3."reportid" = m."reportid"
AND p3."organisation" = m."organisation";

Row count by carerecord.observation associatedtext

Section titled “Row count by carerecord.observation associatedtext”

Count carerecord.reportobservation records for each carerecord.observation value, joined on observationid.

SELECT
p."associatedtext" AS "observation_associatedtext",
COUNT(*) AS row_count
FROM carerecord.reportobservation AS m
INNER JOIN carerecord.observation AS p
ON p."observationid" = m."observationid"
AND p."organisation" = m."organisation"
GROUP BY p."associatedtext"
ORDER BY row_count DESC;

Count carerecord.reportobservation records for each dbo.patient value, joined on patientid.

SELECT
p."displayname" AS "patient_displayname",
COUNT(*) AS row_count
FROM carerecord.reportobservation AS m
INNER JOIN dbo.patient AS p
ON p."patientid" = m."patientid"
AND p."organisation" = m."organisation"
GROUP BY p."displayname"
ORDER BY row_count DESC;