SDK

DocumentStream

One independent line of versions inside a document (`docs/PROTOCOL.md §8`). Exams and templates have a single stream, `data`. Patients have two: `data` (the structured record this SDK reads and writes) and `file` (the web editor's rich document, not exposed by the SDK yet).

On this page

class

Signature #

class DocumentStream(*, latest_version_id: str | None = None, versions: list[DocumentVersion] = [], pending_version_id: str | None = None, draft: DocumentDraft | None = None)

Bases: BaseModel

One independent line of versions inside a document (docs/PROTOCOL.md §8).

Exams and templates have a single stream, data. Patients have two: data (the structured record this SDK reads and writes) and file (the web editor's rich document, not exposed by the SDK yet).

Members #

latest_version_id: str | None = None #

attribute

versions: list[DocumentVersion] = [] #

attribute

pending_version_id: str | None = None #

attribute

draft: DocumentDraft | None = None #

attribute

latest_version: DocumentVersion | None #

property

The entry of `versions` that `latest_version_id` points at.

draft_is_newer: bool #

property

The web app's precedence rule: the draft wins when it exists and is newer than the latest version. A commit does not erase the draft, it only supersedes it, so "newer" is decided by timestamps: `draft.updated_at` against the latest version's `created_at`. An unreadable timestamp never makes the draft win — the committed version is the safe answer.