Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: tests

on:
pull_request:
branches: [main]
push:
branches: [main]

jobs:
pytest:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11"]
steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip

- name: Install package + test extras
run: |
python -m pip install --upgrade pip
pip install -e ".[tests,meds,aws,genomics]"

- name: Show meds_etl info
run: |
python -c "import meds_etl; print('meds_etl', meds_etl.__version__)"
which meds_etl_omop || true

- name: Run pytest
run: pytest tests/ -v --tb=short
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,25 @@ SynthLab provides Python interfaces for working with major synthetic healthcare
- **Access Information**: Clear documentation of open vs. registration-required datasets
- **Download Utilities**: Helpers for downloading select open-access datasets

### MEDS (Medical Event Data Standard) conversion (NEW)
Plug synthetic EHR into ML-native foundation models. Provides a thin,
well-tested wrapper over the community [`meds_etl`](https://github.com/Medical-Event-Data-Standard/meds_etl)
package so OMOP CSVs (produced by `synthlab.synthea.convert_synthea_to_omop`)
become MEDS parquet shards ready for models like
[SMB-v1](https://huggingface.co/standardmodelbio) or MOTOR:

```python
from synthlab.meds import MedsConvertConfig, convert_omop_to_meds, load_meds_events

convert_omop_to_meds(MedsConvertConfig(
omop_dir="~/.cache/synthlab/synthea/omop_100",
meds_dir="~/.cache/synthlab/meds/synthea_100",
))
df = load_meds_events("~/.cache/synthlab/meds/synthea_100")
```

Install the optional extra: `pip install synthlab[meds]`.

## Installation

```bash
Expand Down
12 changes: 12 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@ visualization = [
"pyvis>=0.3.0",
"networkx>=2.8.0",
]
meds = [
# Medical Event Data Standard ETL (OMOP / MIMIC-IV → MEDS parquet).
# https://github.com/Medical-Event-Data-Standard/meds_etl
"meds_etl>=0.3",
"meds>=0.4",
]
tests = [
"pytest>=8.0",
"pytest-cov>=5.0",
]
all = [
"boto3>=1.26.0",
"numpy>=1.20.0",
Expand All @@ -78,6 +88,8 @@ all = [
"faiss-gpu>=1.7.0",
"pyvis>=0.3.0",
"networkx>=2.8.0",
"meds_etl>=0.3",
"meds>=0.4",
]

[project.urls]
Expand Down
17 changes: 17 additions & 0 deletions synthlab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,16 @@
get_snomed_data_dir,
)

# MEDS (Medical Event Data Standard) conversion for ML-native EHR inputs
from synthlab.meds import (
MedsConvertConfig,
convert_omop_to_meds,
load_meds_events,
get_meds_cache_dir,
get_meds_info,
print_meds_info,
)

from synthlab.coherent import (
list_coherent_components,
list_coherent_files,
Expand Down Expand Up @@ -340,4 +350,11 @@ def _print_banner():
"SAPBERT_MODEL_ID",
"SAPBERT_MODELS",
"EMBEDDING_MODELS",
# MEDS conversion
"MedsConvertConfig",
"convert_omop_to_meds",
"load_meds_events",
"get_meds_cache_dir",
"get_meds_info",
"print_meds_info",
]
Loading
Loading