Klinička okosnica
Svaki modul spaja se na istu okosnicu: jedan susret po posjetu, upravljani životni ciklus za sve što AI proizvede, sloj činjenica u koji ulaze samo podaci koje je kliničar potvrdio te revizijski i provenijencijski trag iza svega. Zato je Faurenis jedna aplikacija, a ne skup AI funkcija: pregled, zaključivanje i ispravci rade jednako u svakom modulu. Okosnica ne sadrži AI; ona je deterministička struktura unutar koje AI radi.
Tehnička specifikacija vodi se na engleskom jeziku; naslovi i sažeci poglavlja prevedeni su na hrvatski.
Spine overview
- Encounter entryone transaction, advisory lock
- Capability sessionsScribe · Perio · Imaging · Copilot
- Close · abandon · recover72-hour sweep
- Workflow publisheratomic clinical write
- Artifact lifecycledraft → review → accepted → locked
- Review & finalizationblocking rules, no score
- Clinical factsproposed → confirmed
- Fact event busprojection worker
- Projectionstimeline · tooth state · memory
- AI decision logper call
- Provenance linksoutbox + reconciliation
- Audit chainper clinic, hash-linked
Connections (10)
- Encounter entry → Capability sessions
- Capability sessions → Close · abandon · recover
- Workflow publisher → Artifact lifecycle
- Artifact lifecycle → Review & finalization
- Artifact lifecycle → Clinical facts · on accept
- Clinical facts ⇢ Fact event bus
- Fact event bus ⇢ Projections
- Workflow publisher ⇢ AI decision log
- Artifact lifecycle ⇢ Provenance links
- Artifact lifecycle ⇢ Audit chain
The encounter (ADR 0003)
A clinical encounter is the parent of everything that happens in one visit for one patient. It is deliberately thin: it owns identity, binding and lifecycle, while each capability keeps its own session table. Entry runs in a single transaction under an advisory lock keyed on clinic, clinician and patient, so two devices opening the same visit converge on one encounter instead of creating two.
- Enter
- Behaviour
- Find or create the encounter atomically; capability sessions bind to it as they start
- Work
- Behaviour
- Device presence and capture leases decide which device owns the microphone; hand-offs between devices are recorded
- Close
- Behaviour
- Explicit close, or abandonment by a bounded server sweep after 72 hours, with audit evidence — never deletion of canonical records
- Recover
- Behaviour
- A dropped device re-enters the same encounter; ambiguous patient binding stops with a blocking screen (REC-03)
- Bill
- Behaviour
- A documented encounter is the billing unit (ADR 0020), recorded in its own usage ledger
| Stage | Behaviour |
|---|---|
| Enter | Find or create the encounter atomically; capability sessions bind to it as they start |
| Work | Device presence and capture leases decide which device owns the microphone; hand-offs between devices are recorded |
| Close | Explicit close, or abandonment by a bounded server sweep after 72 hours, with audit evidence — never deletion of canonical records |
| Recover | A dropped device re-enters the same encounter; ambiguous patient binding stops with a blocking screen (REC-03) |
| Bill | A documented encounter is the billing unit (ADR 0020), recorded in its own usage ledger |
Governed artifact lifecycle
Every clinically meaningful AI output is stored as a clinical artifact with a kind and a state. Kinds include SOAP notes, Scribe dossiers, perio staging and reports, document extracts and interpretations, Copilot reports, chairside suggestions, imaging findings, memory summaries, completion outputs and clinical documents. Only backend lifecycle services change state; clients request transitions.
ai_draft → needs_clinician_review | clinician_accepted | clinician_modified | clinician_rejected | superseded
needs_clinician_review → clinician_accepted | clinician_modified | clinician_rejected | superseded
clinician_modified → clinician_accepted | clinician_modified | clinician_rejected | locked | superseded
clinician_accepted → locked | clinician_modified | superseded
clinician_rejected → superseded
locked → amended (correction creates a successor draft)
amended → superseded
superseded → (terminal)server/services/clinicalArtifactLifecycle.ts). Official reads accept only accepted, locked and amended.- Acceptance, rejection, modification, locking and amendment require an authenticated, authorised actor, and a reason where the lifecycle demands one (ART-03).
- Locked content is immutable. Correction creates a successor and keeps the prior row and its transition history (ART-05).
- An overwrite that changes source content supersedes the previous artifact in the same transaction, so a stale acceptance can never vouch for new content (ART-06).
- Every transition is idempotent or explicitly version-producing, and audit publication never reports success for a write that rolled back (ART-12).
Clinical facts and projections
Facts are the structured, longitudinal record: medications, conditions, allergies, tooth states, periodontal findings. Writers in Scribe, Perio and Document Intelligence emit them; every machine-derived fact is born proposed, and only an audited clinician confirmation makes it part of the confirmed record (ART-07). Corrections use supersession or entered_in_error, never mutation.
Confirmed facts are published on an in-process event bus to a projection worker that maintains the patient timeline, per-tooth state and the patient memory used as Copilot context. A contradiction engine with medication, pregnancy and periodontal rules surfaces conflicts between facts; resolving one changes the owning fact through its audited path, and dismissing it in the UI erases nothing.
- ProductionScribe and Perio fact writersEnabled in the production configuration
- ShadowContradiction engineEvaluates on real data and records results; does not yet block
- ShadowTimeline dual-readNew projection read alongside the legacy timeline and compared
Review and finalization
Review composes the artifacts of an encounter into one place where the clinician accepts, edits or rejects them, individually or in a batch, with a cross-encounter queue for anything left open. Finalization is blocked by rules, not by a score: an unresolved required-review artifact, an unconfirmed critical fact, a high-risk contradiction, an ambiguous patient binding or an active persistence failure each prevents it (ART-10).
Provenance and audit
- AI decision log
- What it proves
- Which model, prompt version and consent produced an output, at what cost and latency
- Integrity mechanism
- One row per call; prompt and response stored as hashes, never raw PHI; on-disk outbox drained at boot
- Provenance links
- What it proves
- Which AI decisions an artifact descends from
- Integrity mechanism
- Transactional outbox, dead-letter table and a scheduled reconciliation job
- Evidence snapshot
- What it proves
- Exactly what sources and passages a response was grounded on
- Integrity mechanism
- Immutable snapshot per response; refresh creates a new one (EVID-09)
- Audit trail
- What it proves
- Who did what, to which object, when
- Integrity mechanism
- Append-only by database trigger; hash-chained per clinic plus a system chain; verified on a schedule, and each verification joins the chain
| Record | What it proves | Integrity mechanism |
|---|---|---|
| AI decision log | Which model, prompt version and consent produced an output, at what cost and latency | One row per call; prompt and response stored as hashes, never raw PHI; on-disk outbox drained at boot |
| Provenance links | Which AI decisions an artifact descends from | Transactional outbox, dead-letter table and a scheduled reconciliation job |
| Evidence snapshot | Exactly what sources and passages a response was grounded on | Immutable snapshot per response; refresh creates a new one (EVID-09) |
| Audit trail | Who did what, to which object, when | Append-only by database trigger; hash-chained per clinic plus a system chain; verified on a schedule, and each verification joins the chain |
hash_n = SHA-256( canonical(entry_n) ‖ hash_(n−1) )docs/adr/0003-clinical-encounter-spine.mddocs/clinical-invariants/artifacts.mdserver/services/clinical/server/services/clinicalArtifactLifecycle.tsserver/services/clinicalFacts/server/services/auditTrail.ts