Repository navigation
Docs: say where to get every dataset, and link tasks to their datasets - #1456
Conversation
Every source-dataset docstring now has a "Getting the data" section: source link, access type (open / restricted / credentialed), download command or download=True, the folder root should point to, and an open demo where one exists. autoclass renders it, so the docs site and help() show the same text. - datasets.rst: new "Accessing the Data" table for all 34 datasets - New pages for MIMIC4EHRDataset, MIMIC4NoteDataset, MIMIC4CXRDataset - Fix MedicalTranscriptions page linking the wrong Kaggle dataset - Replace the dead TUH downloads.shtml URL (TUAB, TUEV) - Fix SHHS page calling the dataset Sleep-EDF; ISRUC typo - MIMIC-III/IV, eICU: link PhysioNet, credentialing, and open demos - Add missing source links for MSD and EEGBCI - MIMICExtract: convert Markdown links to rST - Fix copy-pasted root descriptions (SHHS, TUAB, TUEV) and the EHRSHOT example root Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each public task docstring now names the dataset it runs on with a :class: cross-ref, so the docs link task -> dataset. - New pages for the YAIB tasks (eICU, MIMIC-III, MIMIC-IV) and SurvivalPreprocessSupport2; document MultimodalMortalityPredictionMIMIC3 - Fix SurvivalPreprocessSupport2 example where "\n" in a non-raw docstring became real newlines Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
/review |
A small local Sphinx extension (docs/extensions/dataset_tasks.py) reads the "Works with :class:`~pyhealth.datasets.X`" references in task docstrings at build time and adds a "Tasks for this dataset" list to each dataset page, so new tasks appear there with no docs edits. The combined MIMIC4Dataset page also lists its modules' tasks, and the MSD task pages list the tasks written against the MSD base loader. datasets.rst and tasks.rst now link to pyhealth.dev/datasets and pyhealth.dev/tasks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Test CoverageTotal: 81.80% (32629 / 39891 lines)
|
There was a problem hiding this comment.
Previous review
AI Review
suggestion: need change
decision: need change
Thank you for this contribution. Telling users where each dataset comes from, what access it needs, and which folder root should be makes the docs much easier to use. Linking tasks to their datasets helps too. The change is close, but I found two things to fix first.
To get this merged:
- VSAC row in the "Accessing the Data" table. The table says VSAC has Auto-download "Yes (API key)". Your own definition says auto-download means the class accepts
download=True.VSACDatasethas nodownloadparameter. It has adownload_expansionsmethod. Please change the cell to something like "Viadownload_expansions" (or "No"), so the table matches its definition. - The new
docs/extensions/dataset_tasks.pyextension.docs/conf.pynow loads it by name, and it rewrites every dataset page. Two things to check:- The diff doesn't show
docs/extensionsbeing added tosys.path. Ifconf.pydoesn't already do that, the docs build will fail with an import error. Please add the path or point me to where it's added. - You said the full docs build wasn't run. Please run it, or the build that includes this extension, and confirm it passes and that a dataset page (for example MIMIC3Dataset) shows the "Tasks for this dataset" list.
- The diff doesn't show
Optional suggestions:
- In
sleepedf.py, the "Getting the data:" heading follows the bullet list with no blank line. That may break the RST rendering. Add a blank line before it. - The unconfirmed items you listed (NSRR command, EHRSHOT Redivis steps, COSMIC licensing, TCGA-PRAD filters) are worth a quick check against the live pages if you can.
- The new
.. autoclass::directives for_YAIB*private bases give nitpicky warnings. That is fine as is.
Coverage: The whole repository is at 81.73%, above the 60% bar. Several touched files are below 80% (for example shhs.py, sleepedf.py, mimicextract.py). The Python changes in them are docstring-only, so there is no new logic to test and I'm not asking for more tests there. The extension in docs/ isn't measured by the CI report.
Reviewed commit a9b7410
…steps - datasets.rst: VSAC auto-download cell now says "Via download_expansions" (the class has no download=True) - sleepedf.py: blank line before "Getting the data:"; root arg no longer says to point at the cassette/telemetry subfolder - tcga_prad.py: GDC serves one masked MAF per sample; say to merge them into a single MAF (or use TCGAmutations) - ehrshot.py: name the EHRSHOT research usage agreement, as the EHRSHOT README does Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks for the review. Here is what changed (commits Required
Optional
|
|
/review |
There was a problem hiding this comment.
Previous review
AI Review
suggestion: need change
decision: need change
Thank you for this contribution. Telling users where each dataset comes from, what access it needs and which folder root should point to will help new users. The access table and the task-to-dataset links are also useful, and fixing the wrong MedicalTranscriptions Kaggle link and the broken TUH URL is a welcome catch.
It is close, with one blocking problem.
To get this merged:
- In
pyhealth/datasets/isruc.py, the new "Getting the data" text saysdownload=True"needs7zon Linux". The loader looks for a7zzsbinary (viashutil.which) and asserts if it is missing. A user who installs plain7zas the docstring says would hit that failure. Please change the text to name the binary the code actually needs, or relax the check in the code if that is what you intended. Use the same wording indocs/api/datasets.rstif it mentions this.
Optional suggestions:
- The DREAMT download command uses version
2.1.0, but the same docstring'srootexample mentions1.0.0and2.0.0. Aligning them would avoid confusion. docs/extensions/dataset_tasks.pysilently skips task modules it can't parse. A short log warning, or a small test, would make failures easier to spot.- You flagged these four items as unverified: the NSRR
gem install nsrrcommand, the EHRSHOT Redivis steps, COSMIC licensing and the TCGA-PRAD GDC filters. A maintainer or someone with access may want to confirm them.
Coverage: the whole repository is at 81.73%, above the 60% bar. Several modified files are below the 80% per-file guideline, for example sleepedf.py at 16%, mimicextract.py at 12% and shhs.py at 20%. Each of those changes only docstrings, so I'm not asking for new tests there.
Reviewed commit f48060c
…ped modules - isruc.py, ISRUC page, access table: download=True extracts with the standalone 7-Zip binary 7zzs (Linux/macOS) or patool (Windows); a plain 7z install fails the loader's check - dreamt.py: root example and download command both use 2.1.0 - dataset_tasks.py: log a Sphinx warning when a task module can't be parsed, instead of silently dropping its tasks Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Follow-up for the review of Required
Optional
Checks
|
|
/review |
There was a problem hiding this comment.
Previous review
AI Review
suggestion: need change
decision: need change
Thank you for this PR. Telling users where to get each dataset and which dataset each task runs on will help new users a lot. The 34-dataset access table, the new MIMIC4 and YAIB pages, and the corrected links (MedicalTranscriptions, TUH, SHHS) are all useful.
It's close. I found one gap between the description and the diff.
To get this merged:
- The description says every source-dataset class docstring now has a Getting the data section.
MIMIC4EDDatasetinpyhealth/datasets/mimic4.pydoesn't have one. The newMIMIC4Datasetdocstring and API page also point readers to that class for its download command and layout. Please add a section for it with the source (https://physionet.org/content/mimic-iv-ed/), the credentialed access steps, the download command, therootfolder and the open demo. The other option is to change the description and theMIMIC4Datasetwording so they no longer promise it.
Optional suggestions:
docs/extensions/dataset_tasks.pyreads task files withpath.read_text()and no encoding, and it catches onlySyntaxError. Some task files contain non-ASCII characters, soread_text(encoding="utf-8")would make the build safer on all platforms. AddingUnicodeDecodeErrorto the exception handling would also help.- The
Support2Datasetsection says "Any of the sources above works" but gives no link. Adding the UCI URL there would help. - Coverage: the whole repository is at 81.8%, above the 60% bar. Several touched files are below 80%, for example
sleepedf.py,shhs.pyandmimicextract.py. Those changes only edit docstrings, so there is no new logic to test and I don't see this as a problem.
I found no sharing between components beyond docstring cross-references. Only docstrings, docs pages and a standalone Sphinx extension change, so no base class, Trainer, registry or shared utility is touched.
Reviewed commit 9913125
- MIMIC4EDDataset: add the section (source, credentialed access, wget command, root, open demo); MIMIC4Dataset already pointed readers here - MSD Hippocampus/Prostate/Spleen and MIMICExtract: turn their access prose into the standard section, so the claim holds for every class - Support2Dataset: link the UCI source in the section itself - dataset_tasks.py: read task files as UTF-8 and also skip (with a warning) on UnicodeDecodeError Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Follow-up for the review of Required
Optional
Checks
|
|
/review |
There was a problem hiding this comment.
Previous review
AI Review
suggestion: need change
decision: need change
Thank you for this contribution. Telling users where each dataset comes from, what access it needs and which folder root should be makes the docs much easier to start with. The task-to-dataset links and the new API pages (MIMIC-IV EHR/Note/CXR, YAIB, SUPPORT2) fill real gaps. The change is close, but one part needs attention before it can be merged.
To get this merged:
- Check the new Sphinx extension in a real docs build.
docs/extensions/dataset_tasks.pyrewrites the source of every dataset API page. Your verification says the full docs build wasn't run and the extension wasn't loaded in the Sphinx check. Theconf.pydiff only adds"dataset_tasks"toextensions. I can't see whetherdocs/extensionsis onsys.path, and Sphinx won't find the module without that. Please confirm thatconf.pyaddsdocs/extensionstosys.path(add it if missing). Then build the docs with the extension enabled and confirm that the "Tasks for this dataset" sections render, including the_ALSOgroupings for MIMIC-IV and MSD, and that the links resolve. - Describe the extension in the PR description. It is a sizable piece of the change, but the description doesn't mention it. Please add a short note on what it does (it parses
pyhealth/tasks/*.pyand injects a task list into each dataset page) and why you chose it over listing tasks by hand. - Consider a small test for the extension, for example that
tasks_by_dataset()maps a known dataset to its tasks. It's optional if the build check in step 1 passes.
Optional suggestions:
- Some tasks in the injected lists have no API page, so their names will show unlinked. That is fine, but you may want to note it.
- The TUAB/TUEV instruction to email the signed form to help@nedcdata.org isn't covered by your link checks. A quick re-check against the TUH page would be useful.
- The "all 34 datasets" table groups several datasets, such as TUAB/TUEV and the MIMIC-IV modules. The count could be worded as "table rows".
Coverage: the repository total is 81.8%, above the 60% bar. Many touched files under pyhealth/ are below 80% (for example mimicextract.py, sleepedf.py, isruc.py, shhs.py). In this PR they change only docstrings and examples, so there is no new executable code to test and I don't count it against the change. The new extension lives under docs/ and isn't measured.
Reviewed commit 1d59b0b
tests/core/test_docs_dataset_tasks.py loads docs/extensions/dataset_tasks.py by path and checks the task -> dataset mapping on real tasks, the MIMIC-IV and MSD rollups, that private classes are skipped, where the list is inserted, that other pages are untouched, and that an unparseable module is skipped with a warning. The extension falls back to plain logging when Sphinx isn't installed, so the test runs in the regular test environment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
/review |
| logger = logging.getLogger(__name__) | ||
|
|
||
| TASKS_DIR = Path(__file__).resolve().parents[2] / "pyhealth" / "tasks" | ||
| DATASET_REF = re.compile(r":class:`~?pyhealth\.datasets\.(\w+)`") |
There was a problem hiding this comment.
[low] Task links match any dataset citation in a class docstring
DATASET_REF matches any :class:~pyhealth.datasets.X in a task class docstring, not only the "Works with" line the PR adds. Prose mentions therefore create dataset-page links, e.g. the "Compatible with" line on PTBXLMultilabelClassification and the ED tasks in ed_disposition_mimic4.py that mention MIMIC4Dataset. This matches the description's "cites" wording, so it is not a defect, but a maintainer adding a passing mention will silently change the dataset page. Consider matching only the "Works with" sentence, or documenting that any citation counts.
| - Access: credentialed. Create a BDSP account, complete its credentialing, | ||
| and sign the project's data use agreement; that grants read access to | ||
| the S3 access point above. | ||
| - ``root``: the folder holding the downloaded IIIC files. |
There was a problem hiding this comment.
[low] IIIC root description does not name the expected layout
The Getting the data section says only "the folder holding the downloaded IIIC files". The loader expects either raw .npy files from the BDSP S3 sparcnet_data/ or IIIC_data/ layout, or the processed train/val/test pickle directories described above. Naming one of these layouts would make the section match the other new sections.
There was a problem hiding this comment.
AI Review
suggestion: approve
decision: approve
Thank you for this contribution. The "Getting the data" sections, the access table and the two-way dataset and task links should help new users get started. It looks ready to merge.
- Scope: The changes under
pyhealth/are docstrings and doc examples only. The new pages and thedataset_tasksSphinx extension are docs-only. I found no runtime behavior changes. - Tests: The extension has its own unit tests. They cover the mapping, the rollups, where the list is inserted, private classes, untouched pages and the unparseable-file path.
- Coverage: The whole repository is at 81.8%, above the 60% bar. Several changed files are below 80% (for example
mimicextract.py,sleepedf.py,shhs.pyandisruc.py). Those changes only touch docstrings, so there is no new logic to test, and I don't consider the lower numbers a problem here. - Links between components: The task-to-dataset links are docstring references, and your description names and explains them. I found no code shared between components.
Optional suggestions:
- The extension picks up any task docstring that cites a dataset with
:class:, not only the "Works with" lines. Prose mentions such as "Compatible with" will also create links, so you could restrict the match to the "Works with" phrase. - The IIIC
rootdescription is vague. It could name the expected folder layout.
Reviewed commit 239c37d
Why
Most dataset pages showed
root="/path/to/..."without saying where the data comes from, whether it needs credentialing, or which folderrootshould point to. New users got stuck before writing any code.What changed
Datasets
Every source-dataset class docstring now has a Getting the data section with:
download=Truerootshould point toautoclassrenders the docstring, so the docs site andhelp()show the same text.docs/api/datasets.rsthas a new Accessing the Data table with 34 rows (a few rows group related datasets, such as TUAB/TUEV and the MIMIC-IV modules), so users can see which ones they can try without credentialing.New API pages for
MIMIC4EHRDataset,MIMIC4NoteDatasetandMIMIC4CXRDataset. Task docs already referenced them, but the links didn't resolve.Fixes:
mtsamples.csvfromtboyle10/medicaltranscriptions.downloads.shtmlURL (TUAB, TUEV) returns 404. It's replaced with the current page and the request-form process.rootdescriptions (SHHS, TUAB, TUEV) and the EHRSHOT exampleroot.Tasks
Works with :class:~pyhealth.datasets.X``), so the docs link task → dataset.SurvivalPreprocessSupport2.MultimodalMortalityPredictionMIMIC3is now documented.SurvivalPreprocessSupport2example:\nin a non-raw docstring had turned into real newlines.Dataset → task links (
docs/extensions/dataset_tasks.py)builder-inited, it parsespyhealth/tasks/*.pywithast, without importing them. It collects every public task class whose docstring cites:class:`~pyhealth.datasets.X`.source-read, for eachapi/datasets/pyhealth.datasets.Xpage, it inserts the list just above theautoclassdirective.:class:`.Task`, which resolves wherever the task is documented._ALSO): the combinedMIMIC4Datasetpage also lists the tasks of its EHR, Note, CXR and ED modules. Each MSD task page also lists tasks written forMSDSegmentationDataset.docs/conf.py's existingsys.pathentry fordocs/extensions(lines 24-29, which predate this PR); the diff only adds"dataset_tasks"toextensions.tests/core/test_docs_dataset_tasks.pycovers:Verification
docs/requirements.txt(Sphinx 5.2.3, all configured extensions, includingdataset_tasks). It succeeds.MIMIC3Datasetlists 19 tasks.MIMIC4Datasetlists 27, including its module tasks such as the YAIB and ED tasks.MSDSpleenDatasetlistsMSDSegmentationTask.master. Compared with a full build oforigin/master, unique warnings went from 922 to 927 (11 new, 6 fixed). All 11 new ones are "more than one target found" forPath,BaseTaskorAny. They come from inherited signatures on the newly documented MIMIC-IV module pages andSurvivalPreprocessSupport2, and existing dataset pages give the same warnings.docs/conf.pyrunsimport pyhealthbefore adding the checkout tosys.path. A machine with an olderpyhealthinstalled will document that copy, so I built withPYTHONPATHset to the checkout. This order predates this PR.import pyhealth.datasets, pyhealth.tasksworks.tests/core/test_docs_dataset_tasks.pypasses with Sphinx installed and with the plainloggingfallback that CI's test environment uses.tools/check_pr_rules.pyreports 0 problems.Access details checked against live sources
These were unconfirmed when the PR was opened. All four are now checked:
gem install nsrrandnsrr download shhs/...match the nsrr gem README.🤖 Generated with Claude Code