ACES: Automatic Cohort Extraction System for Event-Stream Datasets

Justin Xu, Jack Gallifant, Alistair Johnson, Matthew B.a. McDermott

Introduction

Reproducibility remains a significant challenge in machine learning (ML) for healthcare. Datasets, model pipelines, and even task or cohort definitions are often private, creating a massive barrier to sharing, iterating, and understanding ML results on electronic health record (EHR) datasets.

The Automatic Cohort Extraction System (ACES) is an open-source library designed to solve this "reproducibility crisis." By separating dataset-specific definitions from general task logic using a simple YAML-based configuration, ACES allows researchers to define a clinical task once and run it across diverse datasets with minimal code.

The Challenge of Cohort Definition

In healthcare ML, defining a "cohort"—the specific group of patients and timeframes used for a study—is notoriously messy. Even when researchers use the same public dataset, different groups often end up with wildly different cohort sizes, sometimes varying by over 10,000 patients. This discrepancy occurs because extraction logic is typically buried in private, complex SQL scripts or bespoke Python code.

This lack of transparency hinders reproducibility. Furthermore, most existing tools are tied to specific "Common Data Models" (like OMOP), which can be difficult to set up and often do not integrate smoothly with modern deep learning workflows that prefer flexible, event-stream data formats.

Methods and Architecture

ACES introduces a novel framework for cohort extraction based on two core components:

  1. A Domain-Specific Language (DSL): Using intuitive YAML files, researchers define Predicates (dataset-specific concepts, such as what specific billing code counts as an admission) and Windows (dataset-agnostic logic, such as looking at data 24 hours after admission). This separation allows the same clinical logic to be ported to a new hospital's data simply by updating the predicate definitions.
  2. A Recursive Extraction Algorithm: ACES represents a task as a tree of constraints. It identifies "trigger" events (like a hospital admission) and then recursively evaluates subtrees to find valid windows of data that meet all inclusion and exclusion criteria.
The ACES workflow: from raw event-stream data to a labeled task cohort ready for ML models.

The system is designed to work natively with the Medical Event Data Standard (MEDS) and Event Stream GPT (ESGPT) formats, but it can be applied to any longitudinal dataset that can be represented as a stream of events.

Key Insights: Reproducibility and ML Integration

ACES fundamentally shifts how researchers interact with EHR datasets by focusing on a few key principles:

  • Separation of Concerns: By decoupling what a clinical event is from when it happens relative to other events, ACES makes clinical tasks "conceptually reproducible." A researcher can share a task definition for "30-day readmission" without needing to share the underlying private patient data.
  • Frictionless Reproducibility: The authors advocate for "bringing the task to the data." Instead of trying to centralize highly regulated medical data, researchers can distribute small YAML configuration files that define the task precisely.
  • Deep Learning Friendly: Unlike older tools that require a full relational database setup, ACES provides a Python API and CLI that integrate directly into modern ML pipelines. It supports sharded data and parallel processing via the Hydra framework.
Comparing the manual, institution-specific 'Without ACES' workflow to the shareable, automated 'With ACES' approach.

Experimental Results

The authors validated ACES using MIMIC-IV (a widely used public EHR dataset), Synthea (a synthetic dataset of 1,000 patients), and MEDS-DEV (a benchmarking effort for decentralized validation).

In head-to-head comparisons with existing tools like DPM360 and OMOP-learn, ACES demonstrated significant advantages:

  • Efficiency: For a mortality prediction task on the MIMIC-IV Demo, ACES ran in 0.6 seconds, compared to 12.2 seconds for OMOP-learn.
  • Ease of Use: ACES required drastically fewer lines of code. Configurations were roughly 30-35 lines, while competing methods required 170 to 250+ lines.
  • Human Time Savings: Setting up a new task took roughly 1.5 to 3 hours with ACES, compared to an estimated 10 to 60+ hours for traditional methods, representing a massive reduction in researcher burden.

Limitations and Future Work

While powerful, ACES has a few areas for future growth. Currently, predicates must be pre-extracted from unstructured data like clinical notes or images; direct support for unstructured data is planned for future releases. Additionally, some highly complex study designs, such as specific case-control matching, are not yet fully supported by the DSL. Finally, the authors envision a future where Large Language Models (LLMs) can automatically generate ACES configuration files directly from natural language descriptions of clinical tasks.

ACES is open-source and available at https://github.com/justin13601/aces.

Summary updated

BibTeX
@inproceedings{xu2025aces,
  author = {Justin Xu and Jack Gallifant and ALISTAIR JOHNSON and Matthew B.A. McDermott},
  title = {{ACES: Automatic Cohort Extraction System for Event-Stream Datasets}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=P4XmKjXTrM},
}
Figure