Clinica23
Complete Radiology Information System
~76K-line full-stack RIS for imaging diagnostic centers. 41 Astro pages, 60+ API endpoints, custom DICOM viewer (2,628 lines), MedGemma 1.5 AI diagnosis, voice dictation with Chirp 2 (18 medical commands), CASS billing with PDF invoices, HL7 v2.x HCCA integration, 14 consent types with digital signature, critical finding alerts, and patient portal — trilingual (ES/EN/CA).
Year
2024 — Present
Role
Sole Architect & Developer
Tech Stack
11 technologies
The Challenge
Imaging diagnostic centers need a complete RIS covering the full workflow — from patient appointment to digitally signed report delivery — with DICOM integration, AI-assisted diagnosis, digital consent, national billing compliance and shared health records.
- Paper-based workflows — consent forms, study requests and reports still rely on physical signatures and manual distribution
- No AI assistance — radiologists interpret studies without automated finding detection, longitudinal comparison or differential diagnosis support
- Billing complexity — Andorra's CASS social security has modality-specific coverage rates (90% RX, 60% MRI, 100% screening mammography) requiring precise calculation
- Interoperability gap — HCCA (Andorra's shared health records) demands HL7 v2.x message exchange over MLLP for orders and results
The Approach
Build a full-stack RIS on Astro 4 (hybrid mode) + React 18 with Cloudflare infrastructure (~76K lines across 217 source files), a custom DICOM viewer, and dual AI integration (MedGemma for imaging + Gemini Pro for general assistance).
- Astro hybrid — 41 pages across 3 portals (public website, admin panel, patient portal) with React islands for interactive components
- Custom DICOM viewer — 2,628 lines, no cornerstone.js — window/level, zoom, pan, measurements, annotations, AI finding overlay with severity-colored bounding boxes
- Dual AI — MedGemma 1.5 4B (Vertex AI) for image analysis and finding detection + Gemini Pro (384-line service) for chat, summarization and text generation
- Voice dictation — Google Cloud Speech-to-Text (Chirp 2) with 18 voice commands (navigation, punctuation, section jumping) and medical vocabulary (BI-RADS, PI-RADS, TI-RADS, Lung-RADS)
The Solution
Clinica23 delivers 41 pages, 60+ API endpoints, 51 React components and 10+ D1 tables across 3 portals — with 33 test files (11,738 test lines):
- Appointment calendar — multi-room scheduling, 10 appointment statuses, 3 priority levels, 9 imaging modalities (CT, MR, US, XR, MG, DX, NM, PT, DXA)
- Worklist — technician workflow for study acquisition, radiologist workflow for interpretation, 9 study statuses tracking the full lifecycle
- Report editor — 1,327 lines: structured sections (Técnica, Hallazgos, Impresión), templates by modality + body part, classification scoring (BI-RADS, PI-RADS, TI-RADS), ICD-10 coding, digital signature, voice dictation + AI assistant integrated
- AI diagnostic — MedGemma 1.5 via Vertex AI: automatic finding detection with bounding boxes, longitudinal comparison with prior studies (659-line component), differential diagnosis, contextual imaging chat (857-line AIAssistant)
- Critical alerts — 560-line real-time alert system with audio for urgent findings requiring immediate clinical action
- CASS billing — Andorra social security coverage validation (RX 90%, ECO 75%, TAC 70%, RM 60%, MAM 100%), 8 invoice statuses, 6 payment methods, professional PDF invoices (612-line @react-pdf/renderer generator), Andorra VAT (0%/4.5%/9.5%)
- HCCA integration — HL7 v2.x over MLLP (TCP port 2575): bidirectional orders (ORM) + results (ORU), patient demographics (ADT), acknowledgments (ACK)
- 14 consent types — rx, ct, mri, ultrasound, mammography, nuclear, intervention, biopsy, sedation, data protection + contrast variants — digital signature on canvas, guardian/witness support, SHA-256 document hash
- Patient portal — 1,173 lines, mobile-first (touch targets ≥44px): study viewer, PDF download, appointment booking, access code auth
- Notifications — WhatsApp (Twilio) + Email (Resend) + AI voice calls (ElevenLabs) for appointment reminders and result delivery
- Lab extraction — 662-line component extracting lab results from PDF/images via MedGemma/Document AI
- Trilingual — full i18n in ES, EN and CA (Catalan)
Key Results
- ~76K lines across 217 source files (41 pages, 51 React components, 33 test files)
- Custom DICOM viewer: 2,628 lines with AI finding overlay and longitudinal comparison
- MedGemma 1.5 4B: automatic finding detection, differential diagnosis, imaging chat
- Voice dictation: Chirp 2 STT with 18 medical commands and radiology vocabulary
- CASS billing: modality-specific coverage, PDF invoices, Andorra VAT
- HL7 v2.x HCCA: bidirectional orders/results over MLLP
- 14 consent types with digital signature, guardian support, SHA-256 hash
- Critical alert system: real-time audio alerts for urgent findings
- 60+ API endpoints across 3 layers (Astro, Pages Functions, shared backend)
- Patient portal: mobile-first with study viewer, booking, PDF download