About the RDD Project (Registry-Driven Development)
RDD is a specialized clinical web registry for longitudinal tracking of patients with recurrent depressive disorder, and simultaneously a full-stack architectural portfolio at Senior / Staff Engineer level. The system solves the primary challenge of clinical research: collecting deeply structured, longitudinal medical data with absolute guarantees against data loss and codebase desynchronization.
1. Clinical Context and Domain Expertise
The registry data model is grounded in a 6-year study of recurrent depressive disorder in late-life patients conducted by the author at the V.M. Bekhterev National Medical Research Center for Psychiatry and Neurology (St. Petersburg, 2015, PhD in Psychiatry).
What Clinical Problem Does It Solve?
In psychiatric research, traditional tooling (Excel spreadsheets, generic Google Forms surveys, systems like RedCap) rapidly hits a wall: it cannot validate the temporal sequence of affective phases, fails to tie pharmacotherapy switches to symptom dynamics, and allows conflicting entries. RDD moves clinical reasoning directly into the system architecture: a normalized patient passport and a dynamic phase matrix (1..N, admission, discharge) covering the clinical picture of phases and intermissions, treatment effectiveness, and psychometric rating scales.
2. Architecture: Registry-Driven Core (SSOT)
The central problem of medical systems with dozens of clinical signs is the difficulty of adapting the application to changes in the study design. Whenever a change is introduced, there is a constant risk of desynchronization between the database schema, backend validation, UI form components, and the data dictionary. RDD implements the Single Source of Truth approach:
A single declarative TypeScript object (src/shared/config/registry/) defines each field: SQLite data type, UI component, min/max bounds, clinical options, and calculation formulas.
From this registry, gen:d1 generates D1 SQL migrations, Zod schemas are derived at runtime (to-zod.ts), UI form cards render declaratively, and the Data Dictionary updates with zero manual effort.
The “Field = Column” invariant: binary clinical signs are flat INTEGER 0/1 columns. This eliminates opaque JSON blobs and heavy EAV patterns, enabling direct high-throughput SQL aggregations.
3. High-Performance Phase Grid (Matrix)
Applications like this often suffer from poor usability when filling in clinical signs, and the interface can lag because of the sheer volume of data. We built the “phase matrix” — the clinician’s central tool that displays hundreds of cells of disease signs at once:
Hybrid scroll, no JS
Hybrid scrolling without JS synchronization: rows render via CSS Grid, where the left column with the sign name uses the native “position: sticky” rule. This ruled out desynchronization of independent scroll layers.
TanStack virtualization
TanStack Virtual row windowing: only rows within the visible viewport are kept in the DOM, guaranteeing high performance even on massive patient charts.
Atomic Zustand store
Fine-grained Zustand store: editing a cell re-renders only that specific DOM node via subscription selectors, leaving the rest of the table untouched.
CAS version control (409)
Data-loss protection (Compare-And-Swap): concurrent edits by several clinicians are verified against the record version. On a conflict (HTTP 409 Conflict) the doctor sees the difference between their own value and the colleague’s version — silent overwrites are impossible by design.
4. Edge Infrastructure, Audit, and Security
The application runs entirely on Cloudflare serverless edge infrastructure (Workers + Pages + D1 Database) with Next.js 16 App Router and zero cold start:
Web Crypto API
Web Crypto API: in the absence of node:crypto on Edge, password hashing is built on PBKDF2-SHA256 (100,000 iterations) with cryptographic salts. Session tokens exist strictly in HttpOnly; Secure; SameSite=Lax cookies, with SHA-256 digests stored in D1.
Row-level access
Row-level access: each user is given a visibility width (data_scope) — “all”, “own center” (site) or “assigned patients” (assigned). The repository adds the filter to every query, so a direct link cannot open someone else’s chart (IDOR).
Tamper-evident audit log
An audit log that cannot be rewritten: every change is written to audit_log in the same transaction as the data, and entries are chained by hashes (prev_hash/entry_hash) — history cannot be tampered with unnoticed.
5. Demo Boundaries and Production Readiness
This project demonstrates system architecture and domain depth. The technical specifications explicitly delineate current implementation from production deployment requirements:
Current demo scope
Demo scope: fully functional registry business logic running on synthetic clinical profiles on Cloudflare global edge.
Production requirements
Production requirements: HIPAA/GDPR compliance, Cloudflare WAF against L7 floods, automated D1 Point-in-Time Recovery, and integration with hospital EHRs via HL7 FHIR.