SDK
Patients
`vault.patients` — list, read, create, update, archive/unarchive, delete/restore.
class
Signature #
class Patients(documents: VersionedDocuments[PatientRecord, PatientSummary], *, time_precision: TimePrecision | None = None) vault.patients — list, read, create, update, archive/unarchive, delete/restore.
Members #
list(*, security_group: str | None = None, include_deleted: bool = False, limit: int = 50, cursor: str | None = None) -> Page[PatientListItem] #
method
One page of patients, each with its decrypted summary (names, tags) — no version downloaded.
iter_all(*, security_group: str | None = None, include_deleted: bool = False, limit: int = 50) -> Iterator[PatientListItem] #
method
Every patient, across all pages.
get(patient_id: str, *, version_id: str | None = None, include_draft: bool = True) -> Patient #
method
Fetches and decrypts one patient: the newest content, or the version `version_id` names. The newest content is the web app's: its draft head when that is newer than the latest version (`Patient.from_draft`), else the latest version. Pass `include_draft=False` to read only committed versions.
create(record: PatientRecord | Mapping[str, Any], *, security_group: str, tags: Sequence[str] = (), specialist_ids: Sequence[str] | None = None) -> Patient #
method
Seals `record` under `security_group` and creates the patient with its first version. `tags` are list/search labels ("diabetes"); they are sealed inside the summary, never sent in clear. `specialist_ids` go to clear `meta` — the only patient metadata the vault itself reads.
update(patient_id: str, record: PatientRecord | Mapping[str, Any], *, tags: Sequence[str] | None = None, specialist_ids: Sequence[str] | None = None, expected_latest_version_id: str | None = None) -> Patient #
method
Seals a new complete version of `record`; `tags=None` keeps the current tags. Pass `expected_latest_version_id=patient.index.latest_version_id` from your earlier read to have the vault refuse the write (`ConflictError`, `DocumentVersionMismatch`) if someone else saved in between.
archive(patient_id: str) -> DocumentIndex #
method
Marks the patient archived (no new version).
unarchive(patient_id: str) -> DocumentIndex #
method
Clears the archived flag (no new version).
delete(patient_id: str) -> DocumentIndex #
method
Moves the patient to the trash — a flag, never a hard delete; `restore` undoes it.
restore(patient_id: str) -> DocumentIndex #
method
Takes the patient out of the trash.