PyHealth icon indicating copy to clipboard operation
PyHealth copied to clipboard

Add MIMIC-III readmission Transformer example and tests

Open RishabhRanganathan2004 opened this issue 1 month ago • 0 comments

Add MIMIC-III Readmission Prediction Example Using Transformer + Tests

Summary

This PR adds a new example demonstrating 30-day readmission prediction on MIMIC-III using the Transformer model. While PyHealth includes Transformer examples and readmission examples, this is the first to combine Transformer + readmission + MIMIC-III, filling a clear gap in the existing examples.

What's Included

New Example

examples/mimic3_readmission_transformer.py

  • Full 5-stage PyHealth pipeline
  • Supports Synthetic MIMIC-III and local MIMIC-III
  • Well-documented module-level docstring
  • CLI arguments for reproducible runs

New Tests

tests/test_mimic3_readmission_transformer.py

  • Lightweight integration tests
  • Validates the example pipeline end-to-end
  • Skips automatically unless local or approved remote data is available

Why This Is Useful

  • Introduces a missing model–task combination to the example library
  • Demonstrates how to run Transformer on clinical prediction tasks
  • Improves reproducibility of PyHealth examples
  • Adds test coverage to ensure long-term stability

Testing

Synthetic MIMIC-III (online):

export PYHEALTH_RUN_ONLINE_EXAMPLES=1
pytest -q

RishabhRanganathan2004 avatar Dec 07 '25 18:12 RishabhRanganathan2004