Skip to main content

MEDS Testing Helpers

MEDS v0.4 PyPI - Version python Documentation Status tests codecov code-quality license PRs contributors

Provides various utilities for testing and benchmarking MEDS packages and tools, including pytest helpers, fixtures, sample datasets, and capabilities to build larger sample datasets for benchmarking purposes.

Installation

pip install meds_testing_helpers

Testing Helpers

After installing this package via pip, you can use the provided pytest fixtures and helpers to test your MEDS pipelines and tools. These include fixtures for static datasets shipped with this package and fixtures that generate larger datasets on the fly for benchmarking purposes.

Simple Static Dataset

You can use the fixture simple_static_MEDS to access a simple, static dataset that is sharded by split (e.g., shard names are of the form train/0.parquet. To use this fixture, simply add it as an argument to your test function in pytest:

# test_my_pipeline.py


def test_my_pipeline(simple_static_MEDS):
    # The simple static dataset will be stored on disk in a temporary directory in a path given by
    # the `simple_static_MEDS` input variable.
    pass

Note that you can also import this static dataset directly in yaml form then convert it to a MEDS dataset in a simple object-oriented format that can be written to disk via:

from meds_testing_helpers.static_sample_data import SIMPLE_STATIC_SHARDED_BY_SPLIT
from meds_testing_helpers.dataset import MEDSDataset

data = MEDSDataset.from_yaml(SIMPLE_STATIC_SHARDED_BY_SPLIT)
data.write(...)

Simple Static Dataset with Tasks

You can use the fixture simple_static_MEDS_with_task to access a dataset that is identical to the simple_static_MEDS dataset, but augmented with a prediction task named boolean_value_task that has a boolean label. Note that this formulation of including tasks relies on file storage conventions that are not mandated within MEDS; namely that tasks are stored in a task_labels subdirectory of the raw dataset directory.

Generated Datasets (useful for benchmarking)

You can use the fixture generated_sample_MEDS to generate a sample dataset that is similar to the static dataset discussed above dynamically with a controllable number of patients (controlled via the pytest argument --generated-dataset-N). This dataset is generated on the fly and is not stored on disk, so will take some time to generate depending on the number of patients. The dataset is generated according to the relevant configuration file. Over time, more configs and data generation specifications will be added. Like the static datasets, as a pytest fixture this can be accessed via a temporary path:

# test_my_pipeline.py


def test_my_pipeline(generated_sample_MEDS):
    # The generated dataset will be stored on disk in a temporary directory in a path given by
    # the `generated_sample_MEDS` input variable.
    pass

You can also control the seed of the generation process via the pytest argument --generated-dataset-seed.

Building Sample Datasets

This package also contains an executable to generate sample MEDS datasets and store them to disk. It is this command that backs the generated_sample_MEDS pytest fixtures. This CLI tool uses hydra to manage configuration options and generate datasets according to the configuration. You can run the command as follows:

build_sample_MEDS_dataset dataset_spec=sample N_subjects=500

Add do_overwrite=True to overwrite an existing dataset. You can see the full configuration options by running sample_MEDS --help.

Inferring Dataset Generation Configs

To generate a dataset similar to a local dataset on disk, you can also use the infer_MEDS_sample_gen_config CLI command to infer the dataset generation configuration from a local dataset. This command will output a yaml file to a specified path on disk that can be used as input to the build_sample_MEDS_dataset command to generate a dataset similar to the local dataset along some limited axes. There is not a clean way currently to use the yaml file on disk other than making a new dataset_spec configuration file and referencing that directly via Hydra.

infer_MEDS_sample_gen_config dataset_dir=/path/to/local/dataset output_fp=/path/to/output.yaml

Metadata

Release files for meds-testing-helpers 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for meds-testing-helpers 0.3.1
File Size Uploaded Provenance
meds_testing_helpers-0.3.1.tar.gz 41.6 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for meds-testing-helpers 0.3.1
File Interpreter ABI Platform
meds_testing_helpers-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 78.4 kB

Release files / meds_testing_helpers-0.3.1.tar.gz

Download URL meds_testing_helpers-0.3.1.tar.gz
Size 41.6 kB
Tags Source
SHA-256 checksum
How to use checksums
aacd91102f3481667933ef85dc1c8f1f6f111a8f715d111e1809474b54628237
BLAKE2b-256 checksum
How to use checksums
8dd232e2c1766ba96da4a9ad87e3d826600c8fc115d695e3426411af9b864d87
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 5, 2025.

Transparency log

Release files / meds_testing_helpers-0.3.1-py3-none-any.whl

Download URL meds_testing_helpers-0.3.1-py3-none-any.whl
Size 36.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e69761632c7941cfa2839d0222dd3ce44e87f4e8ec0df805d2446d58645a19b9
BLAKE2b-256 checksum
How to use checksums
ff8b8b25f6e674a84091868b72a5c32946ecd61ef7b56915b110b3f69dd4f98d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 5, 2025.

Transparency log

Security for meds-testing-helpers 0.3.1

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 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for meds_testing_helpers-0.3.1.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 5, 2025.

Transparency log

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page