Skip to content

Add configurable minimum gap for MIMIC4 readmission - #1275

Open
thebean27 wants to merge 3 commits into
sunlabuiuc:masterfrom
thebean27:fix-readmission-min-gap
Open

thebean27 wants to merge 3 commits into
sunlabuiuc:masterfrom
thebean27:fix-readmission-min-gap

Conversation

@thebean27

Copy link
Copy Markdown

Summary

This PR adds an optional min_gap parameter to ReadmissionPredictionMIMIC4.

Very short intervals between discharge and the next admission may represent internal transfers rather than true readmissions. With min_gap, users can define a minimum interval that must pass before a subsequent admission is labeled as a readmission.

  • min_gap=None preserves the existing behavior.
  • Existing positional arguments remain backward compatible.
  • Added tests for the new behavior and backward compatibility.
  • Updated the documentation and MIMIC-IV readmission example.

Testing

python -m unittest discover -s tests/core -p 'test_mimic4_readmission_prediction.py' -v

All 10 tests pass.

Also checked:

git diff --check

with no errors.

Fixes #1269

@thebean27

Copy link
Copy Markdown
Author

@JosephSBoyle Thanks again, the PR is up. I’d appreciate your thoughts on the proposed min_gap logic.

@JosephSBoyle JosephSBoyle left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@thebean27 Thank you for this PR I had some suggestions for the prose but other than that it looks good.

One other thing I might suggest would be standardising the docs and examples to use a fixed period, either 3hrs or 1 day seem like reasonable candidates to my mind. If people default to the same thing this could help reproducibility. :)

Cheers,
Joe

Comment thread docs/api/tasks/pyhealth.tasks.readmission_prediction.rst Outdated
Comment thread pyhealth/tasks/readmission_prediction.py Outdated
thebean27 and others added 2 commits October 9, 2026 14:02
Co-authored-by: JosephSBoyle <48555120+JosephSBoyle@users.noreply.github.com>
Co-authored-by: JosephSBoyle <48555120+JosephSBoyle@users.noreply.github.com>
@JosephSBoyle

Copy link
Copy Markdown

Looks fine to me, thanks @thebean27

@jhnwu3, I wonder if there should be a MIMIC-3 equivalent of this PR.
In any case I look forwards to this patch landing.

Best
Joe

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Internal transfers are counted as readmissions

2 participants