CareBridge models a cross-specialty clinic: patients, their charts, the care teams around them, and the clinical flags the AI oversight layer raises. The canonical TypeScript shapes live in @carebridge/shared-types; the persisted schema lives in @carebridge/db-schema (Drizzle ORM).
Key entities
The single source of truth for types is @carebridge/shared-types. Notable exports include Patient, Vital, Medication, LabPanel, LabResult, ClinicalFlag, ClinicalEvent, User, UserRole, FlagSeverity, and FlagStatus.
Database schema
Authentication
users id, email, password_hash, name, role, specialty, department
sessions id, user_id, token, expires_at
Patients
patients id, name, dob, mrn, insurance, primary_provider_id
diagnoses id, patient_id, icd10_code, description, status, onset_date
allergies id, patient_id, allergen, reaction, severity
care_team_members id, patient_id, provider_id, role, specialty
Clinical Data
vitals id, patient_id, type, value, unit, recorded_at
lab_panels id, patient_id, panel_name, ordered_by, collected_at
lab_results id, panel_id, test_name, value, unit, flag, reference_range
medications id, patient_id, name, dose, unit, route, frequency, status
med_logs id, medication_id, administered_at, administered_by, dose
procedures id, patient_id, name, cpt_code, status, performed_at
Documentation
clinical_notes id, patient_id, type, content, signed_by, signed_at, version
note_versions id, note_id, version_num, content, created_at
AI Oversight
clinical_flags id, patient_id, source, severity, category, summary,
rationale, suggested_action, status, rule_id,
acknowledged_by, resolved_by, dismiss_reason
review_jobs id, patient_id, status, rules_fired, flags_generated,
prompt_tokens, completion_tokens, elapsed_ms
Notifications
notifications id, recipient_id, recipient_type, type, content, status
FHIR
fhir_resources id, patient_id, resource_type, resource_id, content, imported_at
The audit_log table (referenced throughout Compliance and Safety) is append-only and tamper-evident at the database level.
Clinical documentation
clinical-notes provides structured documentation with template support: SOAP (Subjective / Objective / Assessment / Plan) and Progress Note. Notes are versioned and become immutable after signing. Saving or signing a note emits note.saved / note.signed events to the clinical-events queue, feeding the oversight layer.
Clinical validation: @carebridge/medical-logic
Validation utilities that the rules engine and forms share:
VITAL_DANGER_ZONES— per-type min / max / critical ranges (e.g. O2 sat critical below 85%)validateVital(type, value)— returns warnings + errorsisCriticalVital(type, value)— boolean for the rules enginevalidateLabResult(testName, value)— flags out-of-range values- Trend analysis (rising / falling / stable direction detection)
Interoperability: FHIR R4
CareBridge converts between its own types and standard FHIR R4 resources (Patient, Observation, Medication, DiagnosticReport) via @carebridge/fhir-utils and the fhir-gateway service. CareBridge-minted identifiers use the canonical namespace https://carebridge.dev/fhir/sid, chosen because major EHRs recognise URL-form Identifier.system values. The full namespace convention and a documented legacy MRN namespace are in the FHIR interop doc.
Roles and dev accounts
The clinic spans specialties by design. Development accounts (all password password123):
| Role | Specialty | |
|---|---|---|
dr.smith@carebridge.dev | Physician | Hematology/Oncology |
dr.jones@carebridge.dev | Specialist | Interventional Radiology |
nurse.rachel@carebridge.dev | Nurse | Oncology |
patient@carebridge.dev | Patient | — |
See also: Architecture Overview, AI Oversight Layer, Developer Guide.