Related Experiment Video
Updated: Jul 17, 2026

04:54
IntelliSleepScorer, a Software Package with a Graphic User Interface for Mice Automated Sleep Stage Scoring
Published on: November 8, 2024
Large language model derived regular expressions for sleep phenotyping from electronic health record: a feasibility
Nathanael Hwang1,2, M Brandon Westover2, Diego R Mazzotti3
1Department of Sleep Medicine, Kaiser Permanente Southern California, Fontana, CA, United States.
Sleep Advances : a Journal of the Sleep Research Society
|July 16, 2026
Summary
PromptNLP efficiently extracts clinical data using large language models and regular expressions, outperforming manual methods for electronic health record phenotyping. This approach shows accuracy and generalizability across institutions.
Area of Science:
- Natural Language Processing
- Artificial Intelligence in Healthcare
- Clinical Informatics
Background:
- Electronic health records (EHRs) contain valuable clinical information.
- Extracting specific phenotypes from unstructured EHR notes is challenging.
- Regular expression (regex)-based natural language processing (NLP) is a common method for EHR phenotyping.
Purpose of the Study:
- To assess the feasibility of using large language models (LLMs) to develop regex-based NLP for EHR phenotyping.
- To introduce PromptNLP, a novel method for generating regexes using LLMs.
- To evaluate PromptNLP's performance and generalizability across multiple institutions.
Main Methods:
- Sleep-related clinical notes from three institutions were used.
- PromptNLP involves creating a phrase library and using LLMs with prompts to generate regexes.
- The study compared PromptNLP-generated regexes against manually created ones and validated performance across institutions.
Main Results:
- PromptNLP's targeted regexes significantly outperformed manual regexes in recall for apnea-hypopnea index and Epworth Sleepiness Scale.
- General regexes also surpassed manual methods but with lower recall.
- Adapting the phrase library improved performance in external validation settings, achieving high precision (100%) and recall (up to 96%/89%).
Conclusions:
- PromptNLP is a feasible, efficient, accurate, and generalizable method for EHR phenotyping.
- It outperforms traditional manual regex approaches.
- Further systematic comparisons with direct LLM approaches are warranted.
