Skip to content

Docs: say where to get every dataset, and link tasks to their datasets - #1456

Merged
jhnwu3 merged 9 commits into
masterfrom
docs/dataset-access
Nov 13, 2026
Merged

jhnwu3 merged 9 commits into
masterfrom
docs/dataset-access

Conversation

@jhnwu3

@jhnwu3 jhnwu3 commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Why

Most dataset pages showed root="/path/to/..." without saying where the data comes from, whether it needs credentialing, or which folder root should 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:

    • the source link
    • the access type (open / restricted / credentialed)
    • a download command or download=True
    • the folder root should point to
    • an open demo, where one exists

    autoclass renders the docstring, so the docs site and help() show the same text.

  • docs/api/datasets.rst has 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, MIMIC4NoteDataset and MIMIC4CXRDataset. Task docs already referenced them, but the links didn't resolve.

  • Fixes:

    • MedicalTranscriptions linked the wrong Kaggle dataset (a speech-recognition set). The code reads mtsamples.csv from tboyle10/medicaltranscriptions.
    • The TUH downloads.shtml URL (TUAB, TUEV) returns 404. It's replaced with the current page and the request-form process.
    • The SHHS page called the dataset "Sleep-EDF".
    • MIMIC-III/IV and eICU only linked to mimic.mit.edu. They now link to PhysioNet and the open demos, and explain credentialing.
    • MSD and EEGBCI had no source link.
    • MIMICExtract used Markdown links, which showed up as raw text.
    • Fixed copy-pasted root descriptions (SHHS, TUAB, TUEV) and the EHRSHOT example root.

Tasks

  • 85 public task classes now say which dataset they run on (Works with :class:~pyhealth.datasets.X``), so the docs link task → dataset.
  • New pages for the YAIB tasks (eICU, MIMIC-III, MIMIC-IV) and SurvivalPreprocessSupport2. MultimodalMortalityPredictionMIMIC3 is now documented.
  • Fixed the SurvivalPreprocessSupport2 example: \n in a non-raw docstring had turned into real newlines.

Dataset → task links (docs/extensions/dataset_tasks.py)

  • A small local Sphinx extension adds a Tasks for this dataset list to each dataset API page, so the links go both ways.
  • How it works:
    • At builder-inited, it parses pyhealth/tasks/*.py with ast, without importing them. It collects every public task class whose docstring cites :class:`~pyhealth.datasets.X` .
    • At source-read, for each api/datasets/pyhealth.datasets.X page, it inserts the list just above the autoclass directive.
    • Links use :class:`.Task` , which resolves wherever the task is documented.
  • Rollups (_ALSO): the combined MIMIC4Dataset page also lists the tasks of its EHR, Note, CXR and ED modules. Each MSD task page also lists tasks written for MSDSegmentationDataset.
  • I chose it over hand-written lists because those would drift: a new task with a "Works with" line now shows up on its dataset's page with no docs edits.
  • It loads through docs/conf.py's existing sys.path entry for docs/extensions (lines 24-29, which predate this PR); the diff only adds "dataset_tasks" to extensions.
  • If it can't parse a task file, it logs a warning and skips that file.
  • tests/core/test_docs_dataset_tasks.py covers:
    • the mapping, using real tasks
    • the rollups
    • skipping private classes
    • where the list is inserted
    • pages it shouldn't touch
    • the unparseable-file path

Verification

  • Full docs build. I ran it with docs/requirements.txt (Sphinx 5.2.3, all configured extensions, including dataset_tasks). It succeeds.
    • 33 dataset pages get a Tasks for this dataset list, and all 113 task links in them resolve; none show unlinked.
    • MIMIC3Dataset lists 19 tasks.
    • MIMIC4Dataset lists 27, including its module tasks such as the YAIB and ED tasks.
    • MSDSpleenDataset lists MSDSegmentationTask.
  • Warnings against master. Compared with a full build of origin/master, unique warnings went from 922 to 927 (11 new, 6 fixed). All 11 new ones are "more than one target found" for Path, BaseTask or Any. They come from inherited signatures on the newly documented MIMIC-IV module pages and SurvivalPreprocessSupport2, and existing dataset pages give the same warnings.
  • Local build note. docs/conf.py runs import pyhealth before adding the checkout to sys.path. A machine with an older pyhealth installed will document that copy, so I built with PYTHONPATH set to the checkout. This order predates this PR.
  • Links. Every link added or changed returned HTTP 200. Access policies for PhysioNet datasets were read from each dataset page.
  • Tests.
    • import pyhealth.datasets, pyhealth.tasks works.
    • The dataset and YAIB unit tests pass: 349 run, 26 skipped.
    • tests/core/test_docs_dataset_tasks.py passes with Sphinx installed and with the plain logging fallback that CI's test environment uses.
    • tools/check_pr_rules.py reports 0 problems.

Access details checked against live sources

These were unconfirmed when the PR was opened. All four are now checked:

  • NSRR: gem install nsrr and nsrr download shhs/... match the nsrr gem README.
  • EHRSHOT: the README says access "requires signing a research usage agreement", and the docstring uses that wording.
  • COSMIC: the download page says non-commercial users register and log in, and commercial users need a license.
  • TUH (TUAB/TUEV): the TUH EEG page says to fill out the request form and email a signed copy to help@nedcdata.org, which is what the docstrings say.
  • TCGA-PRAD: the GDC API lists the masked MAFs as open access under "Simple Nucleotide Variation". GDC serves one MAF per sample, so the docstring says to merge them into a single file.

🤖 Generated with Claude Code

jhnwu3 and others added 2 commits November 12, 2026 15:16
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>
@jhnwu3 jhnwu3 added the status: automatic The PR will go through automatic review process. label Nov 12, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jhnwu3

jhnwu3 commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator Author

/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>
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Test Coverage

Total: 81.80% (32629 / 39891 lines)

Modified file Coverage Lines
pyhealth/datasets/__init__.py 86.67% 52 / 60
pyhealth/datasets/bmd_hs.py 96.15% 25 / 26
pyhealth/datasets/cardiology.py 18.75% 9 / 48
pyhealth/datasets/chaos.py 97.50% 78 / 80
pyhealth/datasets/chbmit.py 91.23% 104 / 114
pyhealth/datasets/chestxray14.py 49.07% 53 / 108
pyhealth/datasets/clinvar.py 47.92% 23 / 48
pyhealth/datasets/cosmic.py 43.40% 23 / 53
pyhealth/datasets/covid19_cxr.py 52.17% 24 / 46
pyhealth/datasets/dreamt.py 94.87% 37 / 39
pyhealth/datasets/eegbci.py 95.65% 88 / 92
pyhealth/datasets/eesm23.py 100.00% 59 / 59
pyhealth/datasets/ehrshot.py 58.33% 7 / 12
pyhealth/datasets/eicu.py 100.00% 14 / 14
pyhealth/datasets/fhir/base.py 82.39% 131 / 159
pyhealth/datasets/fhir/mimic4.py 100.00% 6 / 6
pyhealth/datasets/iiic.py 89.66% 321 / 358
pyhealth/datasets/isruc.py 25.42% 15 / 59
pyhealth/datasets/medical_transcriptions.py 58.82% 10 / 17
pyhealth/datasets/meds.py 93.67% 74 / 79
pyhealth/datasets/metabric.py 94.21% 114 / 121
pyhealth/datasets/mimic3.py 100.00% 21 / 21
pyhealth/datasets/mimic4.py 94.96% 113 / 119
pyhealth/datasets/mimicextract.py 11.92% 18 / 151
pyhealth/datasets/msd.py 100.00% 85 / 85
pyhealth/datasets/omop.py 100.00% 18 / 18
pyhealth/datasets/physionet2012.py 96.72% 118 / 122
pyhealth/datasets/physionet_deid.py 95.80% 114 / 119
pyhealth/datasets/ptbxl.py 86.70% 163 / 188
pyhealth/datasets/rsna_pneumonia.py 97.46% 115 / 118
pyhealth/datasets/shhs.py 20.00% 7 / 35
pyhealth/datasets/sleepedf.py 16.16% 16 / 99
pyhealth/datasets/support2.py 100.00% 12 / 12
pyhealth/datasets/synthea_csv.py 100.00% 23 / 23
pyhealth/datasets/tcga_prad.py 32.56% 28 / 86
pyhealth/datasets/tuab.py 73.42% 58 / 79
pyhealth/datasets/tuev.py 71.28% 67 / 94
pyhealth/datasets/vsac.py 96.89% 156 / 161
pyhealth/tasks/__init__.py 96.67% 58 / 60
pyhealth/tasks/acuity_mimic4.py 97.92% 141 / 144
pyhealth/tasks/benchmark_ehrshot.py 20.51% 8 / 39
pyhealth/tasks/bmd_hs_disease_classification.py 36.36% 8 / 22
pyhealth/tasks/cancer_survival.py 86.11% 62 / 72
pyhealth/tasks/chaos_segmentation.py 97.98% 97 / 99
pyhealth/tasks/chestxray14_binary_classification.py 100.00% 22 / 22
pyhealth/tasks/chestxray14_multilabel_classification.py 100.00% 16 / 16
pyhealth/tasks/covid19_cxr_classification.py 53.85% 7 / 13
pyhealth/tasks/covid19_cxr_generation.py 100.00% 9 / 9
pyhealth/tasks/deid_ner.py 100.00% 27 / 27
pyhealth/tasks/dka.py 92.57% 249 / 269
pyhealth/tasks/drug_recommendation.py 70.19% 186 / 265
pyhealth/tasks/eegbci.py 90.16% 165 / 183
pyhealth/tasks/ehr_text_serialization.py 95.55% 236 / 247
pyhealth/tasks/generate_ehr.py 67.54% 77 / 114
pyhealth/tasks/iiic_seizure_classification.py 86.00% 86 / 100
pyhealth/tasks/in_hospital_mortality_meds.py 93.10% 54 / 58
pyhealth/tasks/in_hospital_mortality_mimic4.py 24.44% 11 / 45
pyhealth/tasks/knowrare_mimic4.py 100.00% 89 / 89
pyhealth/tasks/lab_nowcasting.py 95.76% 113 / 118
pyhealth/tasks/length_of_stay_prediction.py 64.54% 91 / 141
pyhealth/tasks/length_of_stay_stagenet_mimic4.py 88.89% 88 / 99
pyhealth/tasks/medical_coding.py 50.70% 36 / 71
pyhealth/tasks/medical_transcriptions_classification.py 47.06% 8 / 17
pyhealth/tasks/mortality_prediction.py 65.85% 243 / 369
pyhealth/tasks/mortality_prediction_stagenet_mimic4.py 88.79% 95 / 107
pyhealth/tasks/mpf_clinical_prediction.py 93.13% 122 / 131
pyhealth/tasks/msd_segmentation.py 95.24% 20 / 21
pyhealth/tasks/next_visit_diagnosis_prediction.py 94.79% 91 / 96
pyhealth/tasks/patient_linkage_mimic3.py 89.29% 75 / 84
pyhealth/tasks/physionet2012_forecasting.py 95.18% 79 / 83
pyhealth/tasks/ptbxl.py 93.42% 71 / 76
pyhealth/tasks/ptbxl_heartlang.py 100.00% 42 / 42
pyhealth/tasks/readmission_prediction.py 93.79% 166 / 177
pyhealth/tasks/rsna_pneumonia_classification.py 92.31% 12 / 13
pyhealth/tasks/seizure_detection_chbmit.py 91.56% 141 / 154
pyhealth/tasks/sleep_staging_ear_eeg.py 99.12% 113 / 114
pyhealth/tasks/sleep_staging_v2.py 32.14% 9 / 28
pyhealth/tasks/survival_metabric.py 86.76% 59 / 68
pyhealth/tasks/survival_mimic4.py 90.62% 58 / 64
pyhealth/tasks/survival_preprocess_support2.py 85.14% 63 / 74
pyhealth/tasks/temple_university_EEG_tasks.py 80.49% 132 / 164
pyhealth/tasks/value_set_completion.py 98.35% 179 / 182
pyhealth/tasks/variant_classification.py 87.04% 47 / 54
pyhealth/tasks/yaib_eicu.py 91.98% 642 / 698
pyhealth/tasks/yaib_mimic3.py 92.96% 581 / 625
pyhealth/tasks/yaib_mimic4.py 93.16% 531 / 570

Workflow run · 239c37d

@github-actions github-actions Bot 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.

Previous review

Reviewed commit a9b7410

@github-actions github-actions Bot 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.

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:

  1. 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. VSACDataset has no download parameter. It has a download_expansions method. Please change the cell to something like "Via download_expansions" (or "No"), so the table matches its definition.
  2. The new docs/extensions/dataset_tasks.py extension. docs/conf.py now loads it by name, and it rewrites every dataset page. Two things to check:
    • The diff doesn't show docs/extensions being added to sys.path. If conf.py doesn'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.

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

jhnwu3 and others added 2 commits November 12, 2026 16:26
…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>
@jhnwu3

jhnwu3 commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator Author

Thanks for the review. Here is what changed (commits 72a3e584 and f48060cd on top of the previous head):

Required

  1. VSAC table cell. It now reads "Via download_expansions (API key)", so it matches the table's definition of auto-download (download=True).
  2. docs/extensions on sys.path. This was already in place before this PR, so it isn't in the diff. docs/conf.py:24-29 prepends HERE / "extensions" to sys.path. The folder just didn't exist until now.
  3. Full docs build. I ran it with docs/requirements.txt (Sphinx 5.2.3 and all configured extensions). It succeeds (exit 0) with the extension loaded.
    • pyhealth.datasets.MIMIC3Dataset shows a Tasks for this dataset list of 19 tasks, starting with DrugRecommendationMIMIC3, MortalityPredictionMIMIC3 and ReadmissionPredictionMIMIC3.
    • 33 dataset pages get the list, and all 113 task links resolve.
    • Compared with a full build of origin/master, unique warnings went from 922 to 927: 11 new, 6 fixed.
      • 10 of the new ones are "more than one target" for Path, BaseTask or Any. They come from inherited signatures on the newly documented MIMIC4EHRDataset, MIMIC4NoteDataset, MIMIC4CXRDataset and SurvivalPreprocessSupport2 pages, and existing dataset pages give the same warnings.
      • The 11th was a duplicate link target in mimicextract.py, which this PR introduced. It's fixed in the latest commit.
    • A note for anyone building locally: docs/conf.py runs import pyhealth (line 21) before it adds the checkout to sys.path. A machine with an older pyhealth installed will document that copy instead of the checkout. I built with PYTHONPATH set to the checkout. This order predates this PR and I didn't change it.

Optional

  • sleepedf.py: added the blank line before "Getting the data:". I also fixed the root argument, which still told users to point at the cassette/telemetry subfolder.
  • Unconfirmed items: all four are now checked against their live sources.
    • NSRR: the commands match the nsrr gem README.
    • COSMIC: the download page says non-commercial users register and log in, and commercial users need a license.
    • EHRSHOT: the README says access "requires signing a research usage agreement", and the docstring now uses that wording.
    • TCGA-PRAD: the GDC API confirms the masked MAFs are open access under "Simple Nucleotide Variation". GDC now serves one MAF per sample (501 files), while the loader reads a single file, so the docstring now says to merge them (or use TCGAmutations).
  • _YAIB* nitpicky warnings: left as is, as you suggested.

@jhnwu3

jhnwu3 commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator Author

/review

@github-actions github-actions Bot 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.

Previous review

Reviewed commit f48060c

@github-actions github-actions Bot 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.

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 says download=True "needs 7z on Linux". The loader looks for a 7zzs binary (via shutil.which) and asserts if it is missing. A user who installs plain 7z as 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 in docs/api/datasets.rst if it mentions this.

Optional suggestions:

  • The DREAMT download command uses version 2.1.0, but the same docstring's root example mentions 1.0.0 and 2.0.0. Aligning them would avoid confusion.
  • docs/extensions/dataset_tasks.py silently 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 nsrr command, 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>
@jhnwu3

jhnwu3 commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator Author

Follow-up for the review of f48060c. All changes are in 9913125b.

Required

  • ISRUC. You're right. On every non-Windows system (macOS as well as Linux), the loader requires the standalone 7-Zip binary 7zzs on PATH. On Windows it uses patool. The docstring, the ISRUC page and the access table now say this, and they note that a plain 7z install isn't enough. I changed the docs rather than the loader's check, because how the loader extracts files is outside this PR.

Optional

  • DREAMT. The root example and the download command now both use 2.1.0. The older versions are still mentioned as supported.
  • dataset_tasks.py. It now logs a Sphinx warning when it can't parse a task module, instead of silently dropping that module's tasks.
  • "Unverified" items. Those four were checked in the previous round (see my earlier comment). The PR description still called them unconfirmed, and I've now updated it.

Checks

  • An incremental docs build passes.
  • The ISRUC and DREAMT pages render the new text.
  • The MIMIC-III "Tasks for this dataset" list is still there.
  • The DREAMT page's two "Unexpected section title" messages also appear in a full build of master.
  • check_pr_rules reports 0 problems.

@jhnwu3

jhnwu3 commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator Author

/review

@github-actions github-actions Bot 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.

Previous review

Reviewed commit 9913125

@github-actions github-actions Bot 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.

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. MIMIC4EDDataset in pyhealth/datasets/mimic4.py doesn't have one. The new MIMIC4Dataset docstring 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, the root folder and the open demo. The other option is to change the description and the MIMIC4Dataset wording so they no longer promise it.

Optional suggestions:

  • docs/extensions/dataset_tasks.py reads task files with path.read_text() and no encoding, and it catches only SyntaxError. Some task files contain non-ASCII characters, so read_text(encoding="utf-8") would make the build safer on all platforms. Adding UnicodeDecodeError to the exception handling would also help.
  • The Support2Dataset section 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.py and mimicextract.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>
@jhnwu3

jhnwu3 commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator Author

Follow-up for the review of 9913125. All changes are in 1d59b0b5.

Required

  • MIMIC4EDDataset now has a Getting the data section: the source, the credentialed access steps, the wget command for 2.2, root (the version folder holding ed/), and the open demo.
  • I also checked the description's claim literally. Every class with a page under docs/api/datasets/ now has the section, apart from the non-source pages (BaseDataset, SampleDataset, PatchDataset, splitter, utils). The MSD Hippocampus/Prostate/Spleen subclasses and MIMICExtractDataset used to cover this in prose; they now use the standard section.

Optional

  • dataset_tasks.py: it now reads task files with encoding="utf-8", and it also skips a file (with a warning) on UnicodeDecodeError.
  • Support2Dataset: the section now links the UCI source directly.

Checks

  • An incremental docs build passes, and all four updated sections render.
  • MIMICExtractDataset still reports two warnings: "Unexpected indentation" and "Block quote ends". Both come from its existing code_mapping argument list. master reports them too, at lines 32 and 37; they're now at 44 and 49 because of the inserted lines.
  • check_pr_rules reports 0 problems.

@jhnwu3

jhnwu3 commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator Author

/review

@github-actions github-actions Bot 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.

Previous review

Reviewed commit 1d59b0b

@github-actions github-actions Bot 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.

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:

  1. Check the new Sphinx extension in a real docs build. docs/extensions/dataset_tasks.py rewrites 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. The conf.py diff only adds "dataset_tasks" to extensions. I can't see whether docs/extensions is on sys.path, and Sphinx won't find the module without that. Please confirm that conf.py adds docs/extensions to sys.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 _ALSO groupings for MIMIC-IV and MSD, and that the links resolve.
  2. 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/*.py and injects a task list into each dataset page) and why you chose it over listing tasks by hand.
  3. 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>
@jhnwu3

jhnwu3 commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator Author

/review

@github-actions github-actions Bot 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.

Reviewed commit 239c37d

logger = logging.getLogger(__name__)

TASKS_DIR = Path(__file__).resolve().parents[2] / "pyhealth" / "tasks"
DATASET_REF = re.compile(r":class:`~?pyhealth\.datasets\.(\w+)`")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[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.

Comment thread pyhealth/datasets/iiic.py
- 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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[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.

@github-actions github-actions Bot 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.

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 the dataset_tasks Sphinx 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.py and isruc.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 root description is vague. It could name the expected folder layout.

Reviewed commit 239c37d

@jhnwu3
jhnwu3 merged commit edb3ceb into master Nov 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: automatic The PR will go through automatic review process.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant