Dental Platform · Internal Docs
Architecture

Implementation Plan

Owner: Platform EngineeringLast reviewed:

Status: Living document — updated at the end of every phase.

Goal

A production-grade Canadian dental clinical documentation, treatment-planning, patient-communication, and clinic-management assistance platform. AI output is always a draft; an authorized dental professional must review and explicitly approve everything before it can be charted, exported, sent, or signed.

Delivery phases

PhaseScopeDefinition of workingStatus (2026-07-24)
0Discovery, plan, ADRs, threat model, structureDocs merged, repo builds emptyDone
1Monorepo, tooling, tokens, UI foundation, auth, tenancy, RLS, audit chain, local envmake bootstrap && make dev yields a signed-in shellDone (backend committed; design system + clinic-web BFF auth + Keycloak dev realm)
2Organizations, clinics, locations, rooms, staff, roles, patients, medical data, appointments, timeline, searchClinic staff can manage patients and appointments end-to-endDone server-side; clinic-web covers dashboard/patients/schedule/staff/settings/reports
3Recording consent, recorder, waveform, chunked resumable upload, context island, realtime gateway, transcription, transcript editorAudio recorded in a treatment room survives network loss and produces an editable speaker-aware transcriptDone (recorder + transcript editor + realtime ticket/WS client; interim text via BFF refetch on PHI-free events)
4AI gateway (privacy modes, prompt registry, structured outputs, routing), clinical note generation, patient summary, diagnosis/code suggestions, evidence mapping, evaluationsDrafts generate from a transcript with evidence links and land in review as unapprovedBackend done; clinic-web generate + review workspace UI landed
5Procedure catalog + fee guides, treatment plans/options/comparison, consents, instructions, referrals, prescriptions, clearance, lab prescriptions, review + approval workspaceA dentist can approve section-by-section with hash-chained approval eventsBackend done; clinic-web plans/consents/rx/referrals/review workspaces landed
6Document rendering, exports, secure delivery, secure messaging, patient portal, signatures, treatment acceptancePatient reviews, signs, accepts/declines through the portalBackend done; patient-portal app landed
7Integration framework, ABELDent adapter boundary, email/SMS/signature abstraction, insurance estimates, reportingReports and reconciliations run tenant-scopedBackend done; admin/reporting surfaces partial
8RKE2/K8s manifests, Helm, Argo CD, Terraform, Ansible, observability, backups, DRStaging manifests validate; GitOps tree completeReference K8s manifests for all Go services + Argo CD root; Terraform/Ansible scaffolded, blocked on procurement
9Hardening, security scans, performance, accessibility, full E2E, restore tests, docs, completion reportCompletion report issued with honest statusCI + scans + boundary checks + first E2E suites in place; full pass pending

The build must remain green after every phase.

Non-negotiable platform rules

  1. Drafts never auto-finalize. Approval is an explicit, audited, hash-chained event.
  2. The browser never talks to PostgreSQL, MinIO admin, OpenBao, Keycloak admin, or OpenAI.
  3. Only ai-gateway may call OpenAI. AI_PHI_MODE gates PHI processing and defaults to disabled.
  4. Every tenant-owned row carries clinic_id (and organization_id where relevant) and is protected by PostgreSQL row-level security.
  5. Audit events are append-only and tamper-evident (hash chain).
  6. No PHI in logs, traces, metrics, queue payloads, URLs, object keys, or error reports.
  7. Transcript text is untrusted data — never instructions.
  8. Synthetic fixtures only; they are marked synthetic: true everywhere.

Repository layout

See docs/architecture/system-overview.md and the top-level README.md for the authoritative directory map and ownership table.

Sequencing rationale

Database schema and tenancy land first because every feature depends on RLS and audit. The AI gateway lands after transcription because its inputs are versioned transcripts. Infrastructure manifests are written alongside services but validated in Phase 8 once all workloads exist.

Out-of-repo dependencies (tracked, not fabricated)

DependencyNeeded forStatus
OpenAI org with DPA + Canadian residency + ZDRAI_PHI_MODE=approved_phiBlocked on client contract
Licensed provincial fee guide dataFee guide importClinic supplies licensed file
ABELDent vendor API accessPractice-management syncBlocked on vendor agreement
SMTP/SMS production credentialsDeliveriesClient accounts
Qualified signature provider agreement (if provider-backed signing)E-signatureOptional; built-in signing implemented
Canadian data-centre hardware + networkProduction topologyClient procurement

On this page