🤖 AI Summary
Existing EHR query tools struggle to balance expressiveness and usability, and most are constrained to a single data standard (e.g., OMOP), limiting flexible, portable time-series querying required for modern machine learning modeling. This paper introduces MedQL—a unified temporal query language for EHRs—natively supporting major standards including OMOP and MEDS. Leveraging domain-specific language design augmented by LLM-assisted query generation and semantic validation, MedQL significantly improves query readability, authoring efficiency, and semantic correctness. Implemented in Python, it features an interactive Jupyter Notebook interface. Experiments across multiple real-world EHR datasets demonstrate that MedQL reduces cohort construction time by 62% on average. It enables reproducible, multi-center, cross-standard clinical analyses, thereby bridging the data gap between clinical research and AI-driven modeling.
📝 Abstract
Electronic health record (EHR) data is an essential data source for machine learning for health, but researchers and clinicians face steep barriers in extracting and validating EHR data for modeling. Existing tools incur trade-offs between expressivity and usability and are typically specialized to a single data standard, making it difficult to write temporal queries that are ready for modern model-building pipelines and adaptable to new datasets. This paper introduces TempoQL, a Python-based toolkit designed to lower these barriers. TempoQL provides a simple, human-readable language for temporal queries; support for multiple EHR data standards, including OMOP, MEDS, and others; and an interactive notebook-based query interface with optional large language model (LLM) authoring assistance. Through a performance evaluation and two use cases on different datasets, we demonstrate that TempoQL simplifies the creation of cohorts for machine learning while maintaining precision, speed, and reproducibility.