Repository navigation
Add LUDB dataset support and a per-lead ECG delineation task - #1593
sidwanjara wants to merge 2 commits into
Conversation
d024024 to
ab98846
Compare
Test CoverageTotal: 86.26% (45526 / 52779 lines)
|
|
/review |
|
|
||
| import pandas as pd | ||
|
|
||
| from pyhealth.tasks import ECGDelineationLUDB |
There was a problem hiding this comment.
[medium] Dataset links to its task class without the description saying so
LUDBDataset imports ECGDelineationLUDB at module level and returns it from default_task (line 197). This is a new link from a dataset to a concrete task, and the PR description does not mention it. Other datasets in the repo do the same (for example chbmit.py and isruc.py), so it is a common pattern. Either confirm the link and say in the description that default_task points to the companion task, or keep the dataset self-contained by dropping default_task.
| rows.append( | ||
| { | ||
| "patient_id": str(record_id), | ||
| "signal_file": str((record_dir / str(record_id)).absolute()), |
There was a problem hiding this comment.
[low] Cached metadata stores absolute record paths that go stale when the folder moves
signal_file is stored as an absolute path in ludb-pyhealth.csv, which lives inside the dataset folder. If the folder is moved, prepare_metadata skips rebuilding the CSV, and ECGDelineationLUDB.call catches the FileNotFoundError from wfdb.rdsamp and skips every record with only a warning. Consider storing paths relative to root, or raising an error when no records can be read. Other datasets in the repo also use absolute paths, so this need not block the merge.
There was a problem hiding this comment.
AI Review
suggestion: approve
decision: human review
Thank you for this contribution. It adds LUDBDataset and a per-lead ECG delineation task, ECGDelineationLUDB. It also adds a reproducible UNet2D example with noise and filter ablations, API docs and tests. It looks ready to merge.
- Correctness: The mask construction, band-pass filter, seeded noise and metadata parsing all look correct. The behaviour matches the description and docs. The dataset cites its PhysioNet source and the LUDB paper.
- Coverage: This meets the bar. The whole repository is at 86.3%, against the 60% guideline.
ludb.pyis at 98.3% andecg_delineation_ludb.pyis at 93.1%, both above the 80% guideline. - Links between components:
LUDBDataset.default_taskreturnsECGDelineationLUDB. The dataset and task are submitted together as a pair, and the docs name the task as the default, so I read this as intended. The example reuses the existingUNet2D, and the description explains why.
Optional suggestions:
- Add a sentence to the description saying that
LUDBDataset.default_taskpoints toECGDelineationLUDBon purpose. - The cached
ludb-pyhealth.csvstores absolute record paths. If the data folder is moved, records are skipped with only a warning. Consider a note in the docs about deleting the CSV after moving the data. - The
--syntheticmode could be shortened or mentioned in the docs, but this is not needed.
Reviewed commit ab98846
|
Why this PR has Nothing more is needed from you right now. If you see something in #1615's or #1594's LUDB code that yours lacks, say so here. |
|
Picked as PyHealth's LUDB dataset and delineation task. We compared #1593, #1615 and #1594. Yours has the best training target and careful signal handling:
It was also opened first. Before it can merge. Two models will build on this, so a few things are worth settling now:
Once these fixes are pushed, we'll move this PR to |
solarsys
left a comment
There was a problem hiding this comment.
Approved by a maintainer. The AI review suggests approve on the current commit, and the build passes.
|
Approved by a maintainer, and ready to merge once it no longer conflicts with master. Recent merges touched the same registration lines in |
Contributors: Shray Srivastava (ssriv5@illinois.edu), Sid Wanjara (swanj2@illinois.edu)
Contribution Type: New Dataset + New Task
Paper: J. Park et al., "Benchmarking ECG Delineation using Deep Neural Network-based
Semantic Segmentation Models," CHIL 2025, PMLR 287:63-88.
https://proceedings.mlr.press/v287/park25a.html
Description:
Adds the Lobachevsky University Electrocardiography Database (LUDB, PhysioNet, open access)
and an ECG delineation task that follows the paper's setup.
LUDBDatasetindexes the 200 ten-second, 12-lead, 500 Hz records together with theirmetadata from
ludb.csv(sex, age, rhythm, electric axis).ECGDelineationLUDBmakes one sample per lead, as the paper does. Each sample has a(1, 1, 5000)signal and a(1, 5000)mask (0 background, 1 P, 2 QRS, 3 T).since the cardiologists did not label them.
turned off.
noise_snr_db) is added before filtering, forrobustness tests.
UNet2Don the authors' own 160/20/20 recordsplit and reports per-wave IoU and mIoU.
has no effect on clean data but adds +0.09 mIoU at 0 dB SNR. Full results and
findings are in the example's docstring.
No core PyHealth code is changed; the only edits outside the new files are the two
__init__.pyimports and the doc/README index entries.Files to Review:
pyhealth/datasets/ludb.py- dataset implementationpyhealth/datasets/configs/ludb.yaml- dataset configpyhealth/tasks/ecg_delineation_ludb.py- delineation task andannotations_to_masktests/core/test_ludb.py- tests on synthetic WFDB records (no real data)examples/ludb_ecg_delineation_unet.py- training, evaluation and ablation; runswithout data via
--syntheticdocs/api/datasets/pyhealth.datasets.LUDBDataset.rst,docs/api/tasks/pyhealth.tasks.ECGDelineationLUDB.rst- API docsdocs/api/datasets.rst,docs/api/tasks.rst,examples/README.md- index entriespyhealth/datasets/__init__.py,pyhealth/tasks/__init__.py- imports