Scalable tabularization and tabular feature usage utilities over generic MEDS datasets
Welcome!
MEDS-Tab is a library designed for automated tabularization, data preparation with aggregations and time windowing. Check out below for an overview of MEDS-Tab and how it could be useful in your workflows!
Why MEDS-Tab?
MEDS-Tab is a tool for tabularization and associated modeling of complex medical time-series data. By leveraging sparse representations during tabularization and parallelism over shards, MEDS-Tab significantly reduces the computation required to generate high-quality baseline models for diverse supervised learning tasks.
- Cost Efficiency: MEDS-Tab is dramatically more cost-effective compared to existing solutions
- Strong Performance: MEDS-Tab provides robustness and high performance across various datasets compared with other frameworks.
I. Transform to MEDS
MEDS-Tab leverages the recently developed, minimal, easy-to-use Medical Event Data Standard (MEDS) schema to standardize structured EHR data to a consistent schema from which baselines can be reliably produced across arbitrary tasks and settings. In order to use MEDS-Tab, you will first need to transform your raw EHR data to a MEDS format, which can be done using the following libraries:
- MEDS Transforms for a set of functions and scripts for extraction to and transformation/pre-processing of MEDS-formatted data.
- MEDS ETL for a collection of ETLs from common data formats to MEDS. The package library currently supports MIMIC-IV, OMOP v5, and MEDS FLAT (a flat version of MEDS).
II. Run MEDS-Tab
-
Run the MEDS-Tab Command-Line Interface tool (
MEDS-Tab-cli) to extract cohorts based on your task - check out the Usage Guide and the MIMIC-IV tutorial! -
Painless Reproducibility: Use MEDS-Tab to obtain comparable, reproducible, and well-tuned XGBoost results tailored to your dataset-specific feature space!
By following these steps, you can seamlessly transform your dataset, define necessary criteria, and leverage powerful machine learning tools within the MEDS-Tab ecosystem. This approach not only simplifies the process but also ensures high-quality, reproducible results for your machine learning tasks for health projects. It can reliably take no more than a week of full-time human effort to perform Steps I-V on new datasets in reasonable raw formulations!
Usage
This repository consists of two key pieces:
- Construction and efficient loading of tabular (flat, non-longitudinal) summary features describing patient records in MEDS over arbitrary time windows (e.g. 1 year, 6 months, etc.), which go backward in time from a given index date.
- Running a gradient-boosted-trees AutoML pipeline (by default
sparsegb, MEDS-Tab's own booster for wide, sparse matrices; XGBoost, LightGBM and others are also available) over these tabular features to predict arbitrary binary classification or regression downstream tasks defined over these datasets. The "AutoML" part of this is not particularly advanced -- what is more advanced is the efficient construction, storage, and loading of tabular features for the candidate AutoML models, enabling a far more extensive search over a much larger total number of features than prior systems.
Quick Start
To use MEDS-Tab, install the dependencies following commands below:
Pip Install
pip install meds-tab
On Linux (x86_64 and aarch64) and on Apple-silicon Macs with macOS 15 or later, for Python 3.11 to 3.13, this
installs a compiled wheel that includes sparsegb, the default and recommended model launcher, and the native
tabularization engine. Check with
python -c "from MEDS_tabular_automl import sparsegb; print(sparsegb.is_available())".
On other platforms or Python versions, pip installs a pure-Python wheel without them. To build them there,
install from source with a C++17 compiler and OpenMP (GCC on Linux; Apple clang after brew install libomp
on macOS):
pip install --no-binary meds-tab meds-tab
Windows is not supported yet for sparsegb (use WSL), so pass e.g. model_launcher=lightgbm to
meds-tab-model there.
Local Install
# clone the git repo
pip install .
Scripts and Examples
For an end-to-end example over MIMIC-IV, see the MIMIC-IV tutorial.
See /tests/test_integration.py for a local example of the end-to-end pipeline being run on synthetic data. This script is a functional test that is also run with pytest to verify the correctness of the algorithm.
The MEDS-Tab Architecture
MEDS-Tab addresses two key challenges in healthcare machine learning: efficiently tabularizing large-scale electronic health record (EHR) data and training competitive baseline models on this tabularized data. This document outlines the architecture and implementation details of MEDS-Tab's pipeline.
MEDS-Tab is designed to scale to hundreds of millions of events and tens of thousands of unique medical codes. Performance optimization is achieved through:
- Efficient parallel processing when appropriate
- Strategic use of sparse data structures
- Memory-aware data loading and processing
- Configurable processing parameters for different hardware capabilities
Overview
The MEDS-Tab pipeline consists of five main stages, with the first being optional. The pipeline begins with an optional (1) data resharding stage that optimizes processing by restructuring input data into manageable chunks. This is followed by (2) data description, which computes some summary statistics over the features in the dataset. The core processing happens in the (3) static and (4) time-series tabularization stages, which compute task-specific features: one row per label of a prediction task, with every window ending at the label's prediction time. Finally, the (5) model training stage provides efficient training capabilities with support for multiple model types and hyperparameter optimization.
Versions up to 0.2.0 could also tabularize every event time once and then cache each task's rows (meds-tab-cache-task); that workflow has been removed (see the usage guide).
Memory Management Via Sparse Data Structures
Memory management is a central consideration in MEDS-Tab's design. The system employs several key strategies to handle large-scale medical datasets efficiently:
Sparse matrix operations form the foundation of our memory management approach. We utilize scipy.sparse for memory-efficient storage of sparse non-zero elements, which is particularly effective for medical data where most potential features are not present for any given patient at any given time.
Data sharding complements our sparse matrix approach by breaking data into manageable chunks. This enables both memory-efficient processing and parallelization. Shards are processed independently, allowing us to handle datasets that would be impossible to process as a single unit.
The system implements efficient aggregation using Polars for fast rolling window computations. This optimizes same-day event aggregation and maintains memory efficiency during temporal calculations.
Improved Computational Speed Via Parallel Processing
Our processing strategy differentiates between sequential and parallel operations based on computational needs and data dependencies. The data description and static tabularization stages operate sequentially, as they have manageable computational requirements. In contrast, time-series tabularization and model training leverage parallel processing over independent workers (which may be spawned on different cores on a local machine or over a slurm cluster) to handle their more intensive computational demands.
Data flow through the pipeline is optimized through caching and sharding. Each stage's output is structured to minimize memory requirements while maintaining accessibility for subsequent stages. The system preserves sparsity wherever possible and uses efficient shard management to increase processing speed and reduce total memory consumption.
Native Backend
Static and time-series tabularization can also run on an optional C++ engine, included in the compiled
wheels on Linux and Apple-silicon macOS and compiled when MEDS-Tab is installed from source. Select it with backend=native (the default is backend=python). It
writes the same files as the Python implementation, so TabularDataset and the model launchers are
unchanged. See the native backend guide.
Feature Engineering Via Rolling Windows and Aggregation Functions
MEDS-Tab implements a comprehensive feature engineering approach that handles both static and temporal data. For static features, we capture both presence and, for codes with static numeric values, the mean of the subject's values (static/mean). Time-series features are processed through various aggregation methods including counts, sums, minimums, and maximums. These aggregations can be computed over multiple time windows (1 day, 30 days, 365 days, or the full patient history), providing temporal context at different scales.
Our feature engineering framework maintains flexibility while enforcing consistency. All aggregations preserve sparsity where possible, and the system includes configurable thresholds for feature inclusion based on frequency and relevance to the target task.
Model Support and Normalization/Imputation Options
The architecture includes robust support for multiple model types. The default and recommended one is sparsegb, MEDS-Tab's own gradient-boosted trees for wide, sparse tabularized data: on the MIMIC-IV MG tasks it trains about 10x faster than LightGBM at the same held-out AUROC, which makes large hyperparameter sweeps practical. During a sweep, each split's matrix is cached on its first load, so later trials skip re-reading the tabularized files. XGBoost and LightGBM are also supported, as are KNN Classifier, Logistic Regression, Random Forest Classifier, and SGD Classifier. An experimental AutoGluon integration provides automated model selection and tuning capabilities.
Data processing options are designed to maintain efficiency while providing necessary transformations. Normalization options (standard scaler, max abs scaler) preserve sparsity, while imputation methods (mean, median, mode) are available when dense representations are required or beneficial.
Additional Design Considerations
Extensibility and maintainability: The pipeline's modular design allows for the addition of new feature types, aggregation methods, and model support. Contributions are welcome!
Highly Configurable: This pipeline is highly configurable via parameters that allow users to adjust processing based on their specific needs and hardware constraints. See the usage guide for more details.
Roadmap
MEDS-Tab has several key limitations which we plan to address in future changes. These include, and are tracked by, the following GitHub issues.
Improvements to the core tabularization
- Further memory and runtime improvements are possible: #16
- We should support additional window sizes and types: #31
- We should support additional aggregation functions: #32
Improvements to the modeling pipeline
- We should likely decorrelate the default aggregations and/or window sizes we use prior to passing them into the models as features: #27
- We need to do a detailed parameter study over the hyperparameter sweep options to find good defaults for these kinds of problems and models: #33
- We should support a more extensive set of pipeline operations and model architectures: #37
Technical debt / code improvements
- The computation and use of the code metadata dataframe, containing frequencies of codes, should be offloaded to core MEDS functionality, with the remaining code in this repository cleaned up.
- We should add more doctests and push test coverage up to 100%
What do you mean "tabular pipelines"? Isn't all structured EHR data already tabular?
This is a common misconception. Tabular data refers to data that can be organized in a consistent, logical set of rows/columns such that the entirety of a "sample" or "instance" for modeling or analysis is contained in a single row, and the set of columns possibly observed (there can be missingness) is consistent across all rows. Structured EHR data does not satisfy this definition, as we will have different numbers of observations of medical codes and values at different timestamps for different patients, so it cannot simultaneously satisfy the (1) "single row single instance", (2) "consistent set of columns", and (3) "logical" requirements. Thus, in this pipeline, when we say we will produce a "tabular" view of MEDS data, we mean a dataset that can realize these constraints, which will explicitly involve summarizing the patient data over various historical or future windows in time to produce a single row per patient with a consistent, logical set of columns (though there may still be missingness).
Metadata
Release files for meds-tab 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| meds_tab-0.4.0.tar.gz | 1.6 MB | With provenance | Details for meds_tab-0.4.0.tar.gz |
Built distributions (wheels)
Total release size: 13.7 MB
Release files / meds_tab-0.4.0.tar.gz
| Download URL | meds_tab-0.4.0.tar.gz |
|---|---|
| Size | 1.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8ca55e7837bd0f0dd84527ba7449d3343537cf4aa0e75f2abfb737b42f994f84
|
|
BLAKE2b-256 checksum How to use checksums |
593ef8c17fa6b81a9787f9ed4de14cc833ec2dd407b0686278cb322111752c38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logRelease files / meds_tab-0.4.0-py3-none-any.whl
| Download URL | meds_tab-0.4.0-py3-none-any.whl |
|---|---|
| Size | 101.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
504a994a8d390a88cdb8c9ee610dc07827e5aa166b016ecdb8fd19b6bd9665c1
|
|
BLAKE2b-256 checksum How to use checksums |
c843884c03b2526df5a97fff0e942f170af4fed6051fe04667cb28f6ed0a6248
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logRelease files / meds_tab-0.4.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | meds_tab-0.4.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.13 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
640ab5d8bb94f63f3668f2887591d5d61f7be6d5a0bfd8f2d69d8a2583df031c
|
|
BLAKE2b-256 checksum How to use checksums |
b2ec55aa86f47b607936c5925db8e519386fa362da071d51c14b2157b600dc93
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logRelease files / meds_tab-0.4.0-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
| Download URL | meds_tab-0.4.0-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.13 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
fcbf1922dab569a571cff11bf2117012bbb58c65a41c8c1da54e10607863a131
|
|
BLAKE2b-256 checksum How to use checksums |
4e52f4247e288c85198e7c78ae409503b10555d0bb111b7301fff3fd169820d7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logRelease files / meds_tab-0.4.0-cp313-cp313-macosx_15_0_arm64.whl
| Download URL | meds_tab-0.4.0-cp313-cp313-macosx_15_0_arm64.whl |
|---|---|
| Size | 462.2 kB |
| Tags | CPython 3.13 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
5c8ab6b00b91f1f679e24fbac5b981fda3f3648f385e642a973488d73a846738
|
|
BLAKE2b-256 checksum How to use checksums |
3a7ed744be7078a4eda15dff6c015e52456a795f28c0afe1751e2a434fe9f937
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logRelease files / meds_tab-0.4.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | meds_tab-0.4.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.12 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
e06442b62f037766a79c296518f47a229e2a30045cf97e1a93cc2c64feb84828
|
|
BLAKE2b-256 checksum How to use checksums |
24e9a167592fff088e937680f604a1639c77668d00d6a1c40165e21cb7e6d8ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logRelease files / meds_tab-0.4.0-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
| Download URL | meds_tab-0.4.0-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.12 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
00515f4f20e6eac57ee1fbab74e17679692d04d44ddb3280adfb442b54e478a5
|
|
BLAKE2b-256 checksum How to use checksums |
f48c088380ea0d55dcf57d17b7ad977648e5a41c9781fd8a11e183b14128f096
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logRelease files / meds_tab-0.4.0-cp312-cp312-macosx_15_0_arm64.whl
| Download URL | meds_tab-0.4.0-cp312-cp312-macosx_15_0_arm64.whl |
|---|---|
| Size | 462.2 kB |
| Tags | CPython 3.12 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
4a216f684f0df4b3db1232836911d443a014a4d90ba375318d1b3c9bc53737b7
|
|
BLAKE2b-256 checksum How to use checksums |
4e16a54effb8fa48878005a15ca7e60ced496f97a75352473f5ee483d2028774
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logRelease files / meds_tab-0.4.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
| Download URL | meds_tab-0.4.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.11 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
9904536e3a12ce55de215c6cb92f45245a0583b96949f4539579cbb44c2ff8db
|
|
BLAKE2b-256 checksum How to use checksums |
f355b6546d700636245fb5d442ba75265d48c96a49b064e0018eb5d14a97631d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logRelease files / meds_tab-0.4.0-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
| Download URL | meds_tab-0.4.0-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 1.7 MB |
| Tags | CPython 3.11 Linux glibc 2.24+ ARM64 Linux glibc 2.28+ ARM64 |
|
SHA-256 checksum How to use checksums |
bb318b836bba5e2dacd5e990ebfe58cef93a59aa40b17d251912bfa307b2879f
|
|
BLAKE2b-256 checksum How to use checksums |
5eb9d8465aba1eb80deffb5fb7f4eb73f2a2e5f379e6b63a952906ff7856108d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logRelease files / meds_tab-0.4.0-cp311-cp311-macosx_15_0_arm64.whl
| Download URL | meds_tab-0.4.0-cp311-cp311-macosx_15_0_arm64.whl |
|---|---|
| Size | 462.2 kB |
| Tags | CPython 3.11 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
aa8197e73ddefd6d8909d4097fd1b16a8c4b7cf9c7719ea5ed5acf793032ccbb
|
|
BLAKE2b-256 checksum How to use checksums |
15f5bb78b7ba176c9b7cfdc9346713dd14e216f55578f49d180ff6ccf381d732
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logSecurity for meds-tab 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 11 files in this release have been uploaded with provenance metadata.
Attestation for meds_tab-0.4.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.