Skip to content

Fix PatientLinkageMIMIC3Task crashing on invalid processor names - #1204

Merged
jhnwu3 merged 2 commits into
sunlabuiuc:masterfrom
lehendo:patientlinkagefix
Sep 2, 2026
Merged

Fix PatientLinkageMIMIC3Task crashing on invalid processor names#1204
jhnwu3 merged 2 commits into
sunlabuiuc:masterfrom
lehendo:patientlinkagefix

Conversation

@lehendo

@lehendo lehendo commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator
  • input_schema used "integer"/"string"/"datetime" processor-type strings, none of which are registered in pyhealth.processors, so dataset.set_task() failed immediately with ValueError: Unknown processor. Fixed to use "raw" (pass-through), the correct processor for these metadata fields
  • Fix the class docstring's example, which referenced a non-existent patient_linkage_mimic3 importable name instead of the class itself
  • Add the missing docs page for PatientLinkageMIMIC3Task
  • examples/patient_linkage_mimic3_medlink.py uses this exact class and was broken by the same bug plus two unrelated .stat()/.stats() typos; fix the typos and confirm data loading + task application now run and produce real samples

- input_schema used "integer"/"string"/"datetime" processor-type
  strings, none of which are registered in pyhealth.processors, so
  dataset.set_task() failed immediately with ValueError: Unknown
  processor. Fixed to use "raw" (pass-through), the correct processor
  for these metadata fields. Verified end-to-end against real MIMIC-III
  data.
- Fix the class docstring's example, which referenced a non-existent
  patient_linkage_mimic3 importable name instead of the class itself.
- Add the missing docs page for PatientLinkageMIMIC3Task.
- examples/patient_linkage_mimic3_medlink.py uses this exact class and
  was broken by the same bug plus two unrelated .stat()/.stats() typos;
  fix the typos and confirm data loading + task application now run
  and produce real samples. The rest of that example (MedLink model
  training, BM25, ranking metrics) is unverified and out of scope here.
@DarylOkeke

Copy link
Copy Markdown
Contributor

SampleDataset doesn't have a .samples attribute, so the updated example still crashes here. convert_to_ir_format() only iterates its input, so passing sample_dataset directly should work. Could the test cover that step too?

…kage example

A reviewer (DarylOkeke) on PR sunlabuiuc#1204 pointed out that even after fixing
PatientLinkageMIMIC3Task's processor-name crash, the example script still
failed one line later: SampleDataset has no .samples attribute (only
__iter__/__getitem__/__len__), so convert_to_ir_format(sample_dataset.samples)
raised AttributeError. Confirmed directly: reproduced the exact
AttributeError against real MIMIC-III demo data.

convert_to_ir_format() only iterates its argument, so passing
sample_dataset directly (dropping .samples) works -- confirmed via a new
regression test that runs the real set_task() -> convert_to_ir_format()
pipeline end to end.
@lehendo

lehendo commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator Author

@DarylOkeke fixed. Pls let me know if we are good to merge.

@fbonc

fbonc commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Looks good.

@DarylOkeke

Copy link
Copy Markdown
Contributor

@DarylOkeke fixed. Pls let me know if we are good to merge.

Looks good!!

@jhnwu3 jhnwu3 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the cleanup

@jhnwu3
jhnwu3 merged commit 38107ac into sunlabuiuc:master Sep 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants