Lazy‑Loading Reasoning Chunks in Documedic CDSS
Documedic is a clinical decision support system (CDSS) that delivers AI‑generated recommendations to clinicians through a web interface built with NestJS, React, PostgreSQL, and the OpenRouter API. One of the most visible performance bottlenecks in a CDSS is the size of the reasoning data that accompanies each recommendation. The reasoning is a multi‑paragraph explanation of how the AI arrived at a decision, and it is often several kilobytes long. When every recommendation is loaded eagerly, the initial bundle size grows, the page takes longer to render, and the user experience suffers, especially on mobile devices. This is where cdss pays off in practice.
The Problem
Large payloads – A typical reasoning chunk can be 5–10 KB of plain text. When a clinician opens a patient case, dozens of recommendations may be displayed, each with its own reasoning.
Slow initial render – React must download and parse all of the reasoning text before it can paint the UI.…