Electronic health records hold enormous potential for training and validating clinical AI models, but in practice that data is often a mess: inconsistent formatting, mismatched coding systems, duplicate entries, noise, and missing values. Most existing tools for cleaning this kind of data are built for a single project, hard-coded, and difficult to reuse or verify elsewhere, which slows and complicates AI research built on EHR data. To address this gap, researchers built THReD, an agent-driven, modular system that automatically converts complex, multi-site EHR data into clean, standardized datasets ready for AI use.
THReD runs as a web application (built with Next.js and Python FastAPI) that logs every preprocessing step in order, so the full process can be replayed and reproduced on new data. Users assemble pipelines from reusable modules covering data description, quality assurance, standardization, feature engineering, geographic mapping, and cohort construction. An AI agent reviews the uploaded data, recommends an appropriate pipeline, and can carry out the workflow automatically, while a built-in pipeline manager lets teams save, reuse, and share configurations across studies and institutions. The platform also includes tools for statistical analysis, interactive visualization, and dataset export.
The team tested THReD on more than 200 million clinical encounters and vital records from over 200 healthcare facilities, using two patient cohorts: type 2 diabetes and hypertension. In the hypertension cohort, automated quality checks trimmed the encounter dataset by 15.6%, context-based inference filled in missing patient-class information for 20.4% of records, and vital-sign label completeness rose from roughly 42% to 100% (with value and unit completeness reaching 97.8% and 99.6%). Standardization also cut the number of categories used for demographic variables like sex, race, and ethnicity by more than half, and consolidated 39 different unit variants for vital signs into just 12 standardized units.