Skip to content

Conversation

@EricSchrock
Copy link
Collaborator

Overview

This PR updates the readmission_prediction_mimic3_fn for PyHealth 2.0. I'll complete the readmission prediction tasks for the other datasets once this PR merges. This early PR should make that next PR go more smoothly.

In addition to supporting PyHealth 2.0, the new ReadmissionPredictionMIMIC3 task has the following improvements. First, it takes a datetime.timedelta instead of an int for the readmission window, making the input parameter clearer and more flexible. Second, it can optionally exclude visits where the patient was under 18 years old (a previously unimplemented #todo).

Besides the items listed above, ReadmissionPredictionMIMIC3 should be logically equivalent to readmission_prediction_mimic3_fn.

Testing

I added unit tests for ReadmissionPredictionMIMIC3 and updated and ran examples/readmission_mimic3_rnn.py.

I also updated examples/readmission_mimic3_fairness.py, but it doesn't run as fairness_metrics_fn was disabled in #320.

Additional Notes

Apologies for all the whitespace changes in README.rst. My editor automatically removes trailing whitespace and I had to update a code snippet in that file. Let me know if you'd rather not merge the whitespace changes and I can undo them.

I'm curious what you think of the new MockMICIC3Dataset class I created for the unit tests. Would that be helpful elsewhere to keep the unit test run times short (instead of using the demo datasets)?

I considered keeping readmission_prediction_mimic3_fn as a wrapper around ReadmissionPredictionMIMIC3 for backwards compatibility (I saw #735 does this for the LoS tasks). However, I'm not sure the changes to the LoS tasks are actually backwards compatible. The new tasks return lists for conditions, procedures, and drugs. The old tasks used to return lists of lists for these items but now as pass throughs they just return lists. I'm not sure if that change in behavior would impact users of the old tasks.

@EricSchrock EricSchrock requested a review from jhnwu3 December 24, 2025 04:53
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, it might be easier to use the mimic3demo dataset, itself in test-resources/ . You may need to expand these test.csv files in this directory though with more patients/specific attributes, as they're a subset of the actual mimic3demo for speed purposes:
https://github.com/sunlabuiuc/PyHealth/tree/master/test-resources/core/mimic3demo

MIMIC3demo download:https://physionet.org/content/mimiciii-demo/1.4/

@LogicFan LogicFan added bounty Please see the bounty list in PyHealth Discord Server task Contribute a new task to PyHealth labels Dec 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bounty Please see the bounty list in PyHealth Discord Server task Contribute a new task to PyHealth

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants