Repository navigation
Conversation
Test CoverageTotal: 89.51% (69940 / 78134 lines)
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1789
Summary
Follow-up to #1790 (
PhysioNet2019Dataset) adding the early ICU sepsis prediction task, leak-free pre-onset normalization statistics, cross-hospital splitting, clinicalTaskCardmetadata, synthetic tests, Sphinx documentation, and aJointSeqImagebenchmark example for PhysioNet/CinC Challenge 2019.What's Added
pyhealth/tasks/physionet2019_sepsis.py(exported inpyhealth/tasks/__init__.py):PhysioNet2019Sepsis(BaseTask):SepsisLabel == 1hour (skipping stays positive at admission or with zero dynamic observations in the pre-onset window) and toggleable Raindrop-stylemax_stay_hours=60cohort filter (Noneretains longer stays using their most recentmax_lengthhours, eliminating the<60htruncation-length shortcut).NaNstorage inPhysioNet2019Dataset:missing_mode="raw"(default, preservesNaNforJointSeqImage/ GRU-D) ormissing_mode="vital_ffill"(short-window forward-fill for continuousVITAL_VARIABLESonly while keeping intermittentLAB_VARIABLESun-imputed), plus optionalinclude_missing_features=Trueto output pre-imputationx_maskand GRU-Dx_delta.clean_clinical_units=True(shared Polars expression across task extraction and statistics) to harmonize mixedTemp(°F → °C) andFiO2(% → fraction) units and drop physically impossible vital readings while preserving critical laboratory abnormalities (e.g., highLactate, lowpH).task_card()returning a structuredTaskCarddocumenting cohort criteria, prediction cutoff, clinical variable groups/directions, and site-shift caveats.physionet2019_sepsis_statistics: computes per-variable(mean, std)strictly on pre-onset observations with graceful(0.0, 1.0)fallback for site-specific 100%-missing variables (e.g.,EtCO2in Hospital A).split_by_hospital: deterministic cross-hospital (A ↔ B) patient-level train/val/test split with zero patient overlap.summarize_physionet2019_cohort: summarizes class prevalence, hospital distribution, and septic vs. non-septic pre-onset sequence lengths.tests/core/test_physionet2019_sepsis.py: 8 offline synthetic tests covering cohort rules,<60htoggle, Layer 2rawvs.vital_ffillandx_mask/x_delta, unit cleaning, pre-onset-only statistics,split_by_hospital,TaskCard, miniatureJointSeqImageforward +train_stepintegration, parameter validation, andtest_synthetic_cutoff_prevents_future_leakage(twin-stay cutoff & boundary inclusion test suggested by @anaba5is in Add PhysioNet 2019 Sepsis Dataset and Prediction Task #1789).examples/joint_seq_image_physionet2019_sepsis.py: runnable benchmark supporting--split-mode random|hospital,--missing-mode raw|vital_ffill,--clean-clinical-units,--max-upsample, and--tiny, alongside alength_only_baselinelower bound and documented local reference results.docs/api/tasks/pyhealth.tasks.PhysioNet2019Sepsis.rst, updateddocs/api/tasks.rst, and cross-link fromdocs/api/datasets/pyhealth.datasets.PhysioNet2019Dataset.rst.Verification
pytest tests/core/test_physionet2019.py tests/core/test_physionet2019_sepsis.py -v: 18 passed (pyhealth/tasks/physionet2019_sepsis.pyline coverage: 96%, 250/261).ruff checkandpython tools/check_pr_rules.py --base upstream/master --head HEAD: All PR contribution rules passed.max_stay_hours=60cohort: 38,739 stays (1,561 septic / 37,178 non-septic);max_stay_hours=None: 39,843 stays (2,441 septic / 37,402 non-septic, length-only AUROC drops from 0.689 to 0.438 on Hospital B).JointSeqImage(64×64 random-init Swin, 4 epochs, 6k train / 1.5k val / 3,891 test): randomrawtest AUROC 0.8084 (vs length-only 0.7062), randomvital_ffill0.8045, cross-hospitalA → B0.7741.examples/joint_seq_image_physionet2019_sepsis.py.AI Assistance Disclosure
AI coding tools were used to assist with drafting code, tests, and documentation; all design decisions, clinical checks, and local benchmark verifications were reviewed and executed by the author.