Skip to main content

Lazy, privacy-aware code occurrence summaries for MEDS datasets

Project description

suMEDS

suMEDS creates a compact code catalog for defining tasks on very large Medical Event Data Standard (MEDS) datasets. It joins canonical descriptions and parent codes to event and unique-subject counts, then masks or removes rare codes before writing Parquet, CSV, or JSON.

Polars scans, aggregations, joins, and writes stay lazy. Patient-level rows are never collected into Python memory.

Install and run

uv sync
uv run suMEDS MIMICIV_DEMO/MEDS_cohort \
  --output code-summary.parquet \
  --min-subjects 20

Or use YAML:

summary:
  per_split: false
  split_columns: false
privacy:
  min_subjects: 20
  min_split_subjects: 1
  rare_code_action: bucket
  rare_code_label: __RARE__
  round_counts_to: 5
uv run suMEDS /path/to/MEDS -o summary.parquet -c examples/summary.yaml
# The suffix selects CSV or JSON instead:
uv run suMEDS /path/to/MEDS -o summary.json -c examples/summary.yaml

CLI flags override YAML. The defaults bucket codes seen in fewer than 20 unique subjects and retain exact counts.

Python API

from sumeds import SummaryConfig, summarize

path = summarize(
    "/path/to/MEDS",
    "code-summary.parquet",
    SummaryConfig(min_subjects=20, rare_code_action="bucket"),
)

The output format is inferred from .parquet, .csv, or .json (with .jsonl/.ndjson also supported). It preserves all code-metadata extension columns and adds event_count, subject_count, and is_masked. per_split=True emits one row per split. split_columns=True keeps the total row and adds columns such as event_count_train and subject_count_train from subject_splits.parquet. Set min_split_subjects above 1 to suppress rare split-level cells.

Documentation

uv run mkdocs serve
uv run mkdocs build --strict

See the documentation site for the data flow, complete CLI and YAML reference, output schema, Python API, and privacy limitations.

Development

uv run pre-commit run --all-files
uv run pytest
uv run mkdocs build --strict

The included integration test uses MIMICIV_DEMO/MEDS_cohort when present.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sumeds-0.1.0.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sumeds-0.1.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file sumeds-0.1.0.tar.gz.

File metadata

  • Download URL: sumeds-0.1.0.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for sumeds-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ff5beed0748f88b935bf30354ca7eebb863d7d933e9fe6049b3cd51ed06888e5
MD5 e4670ac7d2e030858e3befbb1429152a
BLAKE2b-256 8bbe3c8f25bdcb270eac3671252da1c9a0db55a73e8756d6c95bb5be5fd11bd6

See more details on using hashes here.

Provenance

The following attestation bundles were made for sumeds-0.1.0.tar.gz:

Publisher: python-build.yaml on rvandewater/suMEDS

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sumeds-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: sumeds-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for sumeds-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 08b1c57844b720bbc4b5a691c7633e18e870ee7600029b3d2c7adc2b3dce204b
MD5 250d495eb2d793bd8c35bfa6e8f39bb1
BLAKE2b-256 220c5e3c279d048a34cc41f738b117ccb032fbb9319ec7aef56e757ad5c574ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for sumeds-0.1.0-py3-none-any.whl:

Publisher: python-build.yaml on rvandewater/suMEDS

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page