Skip to content
Partner Developer Portal

Definition

The Careplanresource Resource model records care-plan resources and their creation details. Each record holds a resource identifier and GUID, a resource-type identifier and an owning-organisation identifier, together with the recorded creation date and time and organisation information.

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

careplanresource.resource with careplanresource.type and dbo.organisation details

Section titled “careplanresource.resource with careplanresource.type and dbo.organisation details”

Return records alongside descriptive values from the related tables.

:::caution[Unverified join] This join is inferred from matching column names and is not part of the documented relationships. Check the results before relying on it. :::

SELECT
m."resourceid",
m."resourcetypeid",
p1."description" AS "type_description",
m."ownerorganisationid",
p2."organisationdisplayname" AS "organisationdisplayname"
FROM careplanresource.resource AS m
LEFT JOIN careplanresource.type AS p1
ON p1."resourcetypeid" = m."resourcetypeid"
AND p1."organisation" = m."organisation"
LEFT JOIN dbo.organisation AS p2
ON p2."organisationid" = m."ownerorganisationid"
AND p2."organisation" = m."organisation";

Row count by careplanresource.type description

Section titled “Row count by careplanresource.type description”

Count careplanresource.resource records for each careplanresource.type value, joined on resourcetypeid.

:::caution[Unverified join] This join is inferred from matching column names and is not part of the documented relationships. Check the results before relying on it. :::

SELECT
p."description" AS "type_description",
COUNT(*) AS row_count
FROM careplanresource.resource AS m
INNER JOIN careplanresource.type AS p
ON p."resourcetypeid" = m."resourcetypeid"
AND p."organisation" = m."organisation"
GROUP BY p."description"
ORDER BY row_count DESC;

Row count by dbo.organisation organisationdisplayname

Section titled “Row count by dbo.organisation organisationdisplayname”

Count careplanresource.resource records for each dbo.organisation value, joined on ownerorganisationid.

:::caution[Unverified join] This join is inferred from matching column names and is not part of the documented relationships. Check the results before relying on it. :::

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