Domain relationships
A patient represents the person. A case holds one oncology episode and its workspace. Sources, confirmed chart state, AI drafts, and clinician decisions remain separate records so a new document or generated answer cannot silently change what the chart says.
The clinical record
Read each arrow as a relationship: one parent can have zero or many children. Explore the record.
| Record | What it means |
|---|---|
| Patient | The person, owned by one organization, which may have several case workspaces. |
| Case | The oncology episode. It groups the chart, source material, drafts, and review decisions. |
| Encounter | An actual visit or contact recorded by a clinician. A case can have at most one encounter in progress. |
| Patient source | An uploaded, pasted, or explicitly imported document. Its original source version stays available to historical runs and citations. |
| Patient-state version | An immutable snapshot of clinician-confirmed fact revisions. A new confirmation creates a new version. |
| Case Copilot thread | One conversation within the case. A case can have many independent threads. |
The chart is not the document inventory. Extraction proposes findings; a clinician's review or direct edit determines which facts enter a confirmed snapshot. Removing a source from active use does not erase the version behind an earlier result.
Runs and saved versions
A saved version keeps its history even after the case changes. Explore the version links.
A workflow run records one AI request. Its progress changes as work proceeds, while its captured inputs stay fixed. It may pin a confirmed patient-state version or explicitly run without one, according to the workflow. Exact source selections also belong to that captured basis.
An artifact groups one output type in a case, such as a workup assessment or treatment draft. Its artifact versions preserve generated drafts and clinician revisions. Every version retains its producing run; a clinician edit can retain the original run while recording a new author and content version.
A plan version records a clinician's treatment selection or revision. It belongs to a care-plan history and points to the exact treatment artifact used. Only one version in that history is active at a time. Selecting a plan does not order or administer treatment.
An evidence record connects a run's citation alias to an exact source version and passage. An export receipt connects a reviewed artifact version to the exact bytes exported, their hash, format, and exporting clinician. These records answer different questions: what supports the result, and what left the application.
Shared documents and general conversations
Some work belongs to the organization or clinician without belonging to a case:
| Record | Scope and relationship |
|---|---|
| Pathway, protocol, or internal trial | Organization-managed Library content with preserved versions that a run can pin. |
| Personal reference or preference | Belongs to the clinician within the organization. A reference is not a patient source or chart fact. |
| General Copilot thread | Belongs to the organization and creating clinician; it has no case. Its replies retain their producing runs. |
| External identifier | Associates an external system and value with a patient, encounter, source document, or export receipt in the same organization. |
Library is a view across these permitted sources. It does not move patient documents out of their case or make personal references available to everyone.
Where the records live
The relational record lives in OrganizationCell("primary") through Drizzle. Files SDK stores large immutable bytes in a separate S3-compatible object store. Local prepared files are disposable copies.
The schema is under apps/oncobrain/src/lib/db/schema/: cases.ts, patient-state.ts, workflows.ts, artifacts.ts, copilot.ts, and exports.ts define the relationships above. clinical-guidance.ts, internal-trials.ts, and personal-references.ts hold the corresponding Library records.
User journeys shows when these records are created. From evidence to output follows their source and citation links through an AI request.