← Knowledge library

Clinical care

Care team

Technical reference for the encounter care team in MANSOQ EMR. See the care team concept for the plain-language view. Source: - Model: care/emr/models/encounter.py - Specs: care/emr/resources/encounter/spec.py · valueset.py - Viewset:…

3.1 · versioned documentation · 3 min read

Technical reference for the encounter care team in MANSOQ EMR. See the care team concept for the plain-language view.

Source:

The care team has no model of its own. It is stored on the Encounter model as an opaque JSONField, and the real shape lives in the Pydantic specs. The write path is a dedicated action on the encounter viewset, not the encounter create or update schema.

Models

Model Purpose
Encounter Owns the care team through the care_team and care_team_users fields

Encounter extends EMRBaseModel.

Encounter care team fields

Field Type Notes
care_team JSONField Default {}. Stored as a list of { "user_id": int, "role": Coding } entries. Excluded from EncounterCreateSpec and EncounterUpdateSpec
care_team_users ArrayField[int] Denormalized cache of the internal user IDs in care_team. Platform-maintained

The stored user_id is the internal integer primary key of User. The API accepts and returns the external_id (UUID) instead.

Stored shape

care_team: [
  {
    "user_id": int,             # internal User pk
    "role": Coding { system, code, display }
  }
]

Resource specs (API schema)

Spec Role
EncounterCareTeamMemberSpec write · one member: user_id: UUID4, role: ValueSetBoundCoding[system-practitioner-role-code]
EncounterCareTeamMemberWriteSpec write · the full replacement list: members: list[EncounterCareTeamMemberSpec]
EncounterListSpec read · list. Serializes care_team as [{ "member": UserSpec, "role": Coding }]
EncounterRetrieveSpec read · detail. Same care_team serialization as the list spec

On read, each member is expanded from the cached UserSpec for the stored user_id. The list order of care_team is preserved, so the first entry is the primary member.

PRACTITIONER_ROLE_VALUESET

role is bound to the system value set with slug system-practitioner-role-code. It composes two SNOMED CT is-a filters:

Concept Meaning
223366009 Healthcare professional
224930009 Healthcare related organization

API integration notes

Methods & save behaviour

Related

Source evidence

References are pinned to the private MANSOQ source repository. Repository access is required to open these links.