Major Refactor: Unified Event Stream, YAML Config, Multimodal Processor, Simplified Model#319
Merged
Major Refactor: Unified Event Stream, YAML Config, Multimodal Processor, Simplified Model#319
Conversation
1. Patient is now a sequence of event. 2. Updated Patient class to initialize with a Polars DataFrame for event management.
- Unified APIs for all modalities. - Enabled data loading based on YAML configs. - Switched to Polars backend. - Removed deprecated base_dataset, sample_dataset. - Renamed base_dataset_v2 as base_dataset. - Renamed sample_dataset_v2 as sample_dataset. - Moved padding to collate_fn. - Cleaned up unused featurizer classes.
Simplified MIMIC4Dataset class by merging loading functions Introduced a YAML configuration file for dataset management, detailing file paths and attributes for various tables.
- Renamed `TaskTemplate` to `BaseTask`. - Introduced `InHospitalMortalityMIMIC4`. - Introduced `Readmission30DaysMIMIC4`.
- Introduced a new processor registry to manage different data processors. - Implemented base processor classes: `Processor`, `FeatureProcessor`, `SampleProcessor`, and `DatasetProcessor`. - Added specific processors for images (`ImageProcessor`), labels (`BinaryLabelProcessor`, `MultiClassLabelProcessor`, `MultiLabelProcessor`, `RegressionLabelProcessor`), sequences (`SequenceProcessor`), signals (`SignalProcessor`), and time series (`TimeseriesProcessor`). - Each processor includes methods for processing data and managing state, with appropriate error handling and configuration options.
- Updated `BaseModel` to streamline initialization and remove deprecated parameters. - Introduced `EmbeddingModel` for handling embedding layers for various input types. - Refactored `RNN` class to utilize `EmbeddingModel` for embedding inputs, enhancing modularity. - Cleaned up unused code and improved type annotations for better clarity and maintainability.
Contributor
There was a problem hiding this comment.
Copilot reviewed 30 out of 30 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (2)
pyhealth/processors/image_processor.py:75
- [nitpick] The repr method in ImageProcessor returns 'ImageLoadingProcessor', which is inconsistent with the class name. Consider updating it to 'ImageProcessor' to reflect the correct class.
f"ImageLoadingProcessor(image_size={self.image_size}, to_tensor={self.to_tensor}, normalize={self.normalize}, mean={self.mean}, std={self.std})"
pyhealth/data/data.py:35
- The filtering of dictionary keys in Event.from_dict assumes that attribute keys are prefixed with the event_type. This behavior might be fragile if keys are not uniformly prefixed; consider adding validation or documentation to ensure consistency.
for k, v in d.items() if k.startswith(event_type)
jhnwu3
approved these changes
Apr 8, 2025
Collaborator
jhnwu3
left a comment
There was a problem hiding this comment.
Signal processor may need Jathurshan to look at later.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR delivers a full-stack refactor of PyHealth’s data and model pipeline.
Unified Event Stream
YAML Configuration
Multimodal Processor Framework
Simplified Model Structure
Additional Improvements