Skip to content
Partner Developer Portal

Definition

The Carerecord Problemobservation model links patient problems with clinical observations and records a link-type value for the association. It holds problem-observation, observation and patient identifiers together with source organisation information, describing the observation association recorded against the patient’s problem.

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

carerecord.problemobservation with carerecord.observation and dbo.patient details

Section titled “carerecord.problemobservation with carerecord.observation and dbo.patient details”

Return records alongside descriptive values from the related tables.

SELECT
m."problemobservationid",
m."observationid",
p1."associatedtext" AS "observation_associatedtext",
m."patientid",
p2."displayname" AS "patient_displayname"
FROM carerecord.problemobservation 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";

carerecord.problemdiary count per carerecord.problemobservation

Section titled “carerecord.problemdiary count per carerecord.problemobservation”

Count related carerecord.problemdiary records for each carerecord.problemobservation record, joined on problemobservationid.

SELECT
m."problemobservationid",
m."linktype",
COUNT(c."problemobservationid") AS problemdiary_count
FROM carerecord.problemobservation AS m
LEFT JOIN carerecord.problemdiary AS c
ON m."problemobservationid" = c."problemobservationid"
AND m."organisation" = c."organisation"
GROUP BY m."problemobservationid", m."linktype"
ORDER BY problemdiary_count DESC;

Row count by carerecord.observation associatedtext

Section titled “Row count by carerecord.observation associatedtext”

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

SELECT
p."associatedtext" AS "observation_associatedtext",
COUNT(*) AS row_count
FROM carerecord.problemobservation 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;