Beyond billing codes: a proof-of-concept study of large language models for pregnancy episode reconstruction from clinical notes
Year: 2026
Type: preprint
Abstract: Background: Accurate identification of pregnancy episodes from electronic health records (EHRs) is essential for maternal and fetal health research. Existing approaches rely primarily on diagnosis and procedure codes, which may miss pregnancies documented outside the health system and are susceptible to coding errors. Clinical notes contain richer information but remain largely unexplored for this task. Objectives: To evaluate whether a large language model (LLM) can reconstruct complete pregnancy episodes directly from clinical notes. Methods: Chronologically concatenated notes and messages were provided to GPT-5, which identified episodes and extracted variables including assisted reproductive treatment, gestational age, outcome, and complications. Performance was benchmarked against manual chart review (gold standard) and a hierarchical ICD-code algorithm in 30 patients comprising 74 pregnancies (20 patients in a held-out test set). Results: The LLM identified 53 of 54 test-set pregnancies versus 40/54 for a hierarchical ICD-code algorithm, with fewer spurious episodes (3 vs 24), corresponding to an F1 score for pregnancy detection against chart review of 0.96 vs 0.68. Among pregnancies identified by both methods, median absolute error was 0 vs 25.5 days for start dates (p<0.001) and 0 vs 1 day for end dates (p=0.044), and outcome accuracy was numerically but not significantly higher (0.84 vs 0.74 for exact outcome types; 0.92 vs 0.84 with abortion subtypes grouped). It additionally recovered information unavailable in structured data, including reproductive-treatment type and fetus-level outcomes. Conclusions: An LLM applied to clinical narratives identified pregnancy episodes more completely and with more accurate dates than an ICD-code algorithm while capturing richer clinical detail. Because the two approaches used different input data, these gains reflect both the information in clinical notes and the LLM itself. LLM-based extraction from clinical notes is a promising complement to code-based pregnancy phenotyping that warrants evaluation in larger, multi-institutional cohorts.
Source: medRxiv
Language: English
Subfield: Artificial Intelligence
Field: Computer Science
Domain: Physical Sciences
Open Access status: green
OpenAlex ID: W7238826510
Cites:
Cited by:
Related to:
