🤖 AI Summary
Manual SQL authoring for patient cohort definition in electronic health records (EHRs) is labor-intensive, error-prone, and lacks scalability. Method: We propose the first two-step retrieval-augmented text-to-SQL framework for EHR cohort construction. It integrates medical concept standardization—via UMLS/SNOMED CT ontology mapping—with funnel-style patient logic modeling, explicitly encoding temporal constraints and nested Boolean conditions. A dual-level retrieval-augmented generation (RAG) mechanism and a structured SQL synthesizer jointly enhance generation robustness and fidelity. Contribution/Results: Evaluated on real-world EHR data, our framework achieves an F1-score of 0.75—significantly outperforming single-step RAG baselines—and enables automated, high-precision construction of complex epidemiological cohorts.
📝 Abstract
Clinical cohort definition is crucial for patient recruitment and observational studies, yet translating inclusion/exclusion criteria into SQL queries remains challenging and manual. We present an automated system utilizing large language models that combines criteria parsing, two-level retrieval augmented generation with specialized knowledge bases, medical concept standardization, and SQL generation to retrieve patient cohorts with patient funnels. The system achieves 0.75 F1-score in cohort identification on EHR data, effectively capturing complex temporal and logical relationships. These results demonstrate the feasibility of automated cohort generation for epidemiological research.