Group

Introduction #

The Group model gives you the stable external identifier Canvas uses to expose a Team or a PatientGroup as a single FHIR resource, so you can move between an SDK record and its FHIR representation without tracking a separate identifier yourself.

A Group is a stable external identifier that Canvas attaches through a generic relation — the content_type and object_id fields, the same pattern OrganizationalEntity uses — to either a Team or a PatientGroup, the record this reference calls the Group’s content object. This identifier is exactly what the FHIR Group endpoint exposes as its id. A Team surfaces as a FHIR Group of type practitioner, and a PatientGroup surfaces as a FHIR Group of type person.

Reach for Group when you hold a FHIR Group id — the stable external identifier — and need to resolve which SDK record it names, a Team or a PatientGroup. When you already have a Team in hand, its group_id is the shorter path, because it exposes the FHIR Group id directly.

Group exposes the linked record through typed property accessors. Create the underlying FHIR Group through the FHIR API. To add or deactivate members of an existing patient group, use the patient group effects.

Basic usage #

To follow a Group to the record it points at, retrieve the Group by id and read whichever typed property is set:

from canvas_sdk.v1.data import Group

group = Group.objects.get(id="d2194110-5c9a-4842-8733-ef09ea5ead11")

if group.team is not None:
    linked = group.team
elif group.patient_group is not None:
    linked = group.patient_group
else:
    linked = None

For a Group whose content object is a Team, team returns the linked Team and patient_group is None. For a Group whose content object is a PatientGroup, patient_group returns the linked PatientGroup and team is None. When a Group is not backed by either type, both properties return None, so read whichever property is set rather than assuming one always resolves.

Attributes #

Group #

Field NameTypeDescription
idUUID 
dbidInteger 
createdDateTime 
modifiedDateTime 
content_typeContentType 
object_idInteger 
teamTeam | None (computed)The Team this group points at, or None when its content object is not a Team.
patient_groupPatientGroup | None (computed)The PatientGroup this group points at, or None when its content object is not a PatientGroup.

The object_id field holds the target record’s dbid — its internal integer identifier — rather than its id UUID.

Only two kinds of record get a Group, so content_type.model is always one of these two values. Read it to tell which one a Group points at, or read team or patient_group in the table below, which do the same check for you.

content_type.modelContent object
teamTeam
patientgroupPatientGroup