Repository navigation
PyHealth 2.0: modules still targeting the 1.x API #1198
Copy link
Copy link
Closed
Description
Several PyHealth modules still target the 1.x in-memory dataset API. In 2.0 those base classes are empty deprecation stubs (BaseEHRDataset, BaseSignalDataset, Visit, SampleBaseDataset removed without a stub). The modules import cleanly and fail later, except kg_emb, whose import already breaks.
This issue tracks the leftovers. A follow-up PR will restore kg_emb as a standalone torch.utils.data.Dataset (replacing #1192 / related to #952). Other rows are out of that PR on purpose.
Inventory
| Module | 1.x symbol | Breaks at | Notes |
|---|---|---|---|
medcode/.../kg_emb |
SampleBaseDataset |
import | SampleKGDataset subclasses a removed name; constructor still passes a list into 2.0 SampleDataset (streaming + schema.pkl) |
datasets/mimicextract.py |
BaseEHRDataset, Visit, parallel_apply |
runtime | Constructor only warns; parse_basic_info never reaches parallel_apply; Visit is a stub; Patient 2.0 has no add_visit |
datasets/shhs.py |
BaseSignalDataset |
runtime | No local __init__; stub never sets root |
datasets/isruc.py |
BaseSignalDataset |
runtime | Same as SHHS |
datasets/cardiology.py |
BaseSignalDataset |
runtime (partial) | Sets self.root after a no-op super(); 1.x set_task pipeline is gone |
models/vae.py |
BaseSignalDataset, SampleSignalDataset |
__main__ example |
Stub does not store samples |
models/gan.py |
BaseSignalDataset |
unused import | Dead 1.x import |
models/safedrug.py |
SampleEHRDataset |
annotation only | Runtime still goes through BaseModel |
models/contrawr.py |
SampleSignalDataset |
docstring | 1.x doctest example |
metrics/fairness_utils/utils.py |
BaseEHRDataset, dataset.patients |
if called | Patient 2.0 surface differs |
tasks/drug_recommendation.py |
Visit, patient[i] |
runtime | 2.0 Patient has no visit __len__ / __getitem__ |
Also observed (not a 1.x class, but 2.0 API drift)
get_dataloadernow requireslitdata.StreamingDataset.set_shuffle(). It is still documented as a general helper. Map-style datasets (including a restoredkg_emb) should usetorch.utils.data.DataLoader+collate_fn_dict_with_paddingdirectly.collate_fn_dict_with_paddingtreats every 2-tuple as(time, values). KG triples are 3-tuples, so they currently fall through to the list branch. Latent fragility if a 2-tuple feature is added later.
Suggested order
- Restore
kg_embwithout inheritingSampleDataset(map-style Dataset + Protocol). - Drop unused
pandarallel(initialize()only inkg_emb/datasets/umls.py; noparallel_applyinkg_emb; mimicextract cannot reachparallel_apply). - Separate PRs for mimicextract / signal datasets / drug_recommendation.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
AxelNoun commentedon Aug 25, 2026
Superseded by #1201, which carries the same inventory in a cleaner form. Closing the discussion here to keep it in one place.