refactor: remove PumpModelDTO and factory, use PumpModel directly#1066
Merged
refactor: remove PumpModelDTO and factory, use PumpModel directly#1066
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the pump model architecture by removing the obsolete PumpModelDTO layer and directly using PumpModel classes throughout the codebase.
- Eliminates PumpModelDTO data class and associated factory logic
- Updates mapper functions to directly instantiate PumpSingleSpeed and PumpVariableSpeed classes
- Removes the pump/factory.py file and its create_pump_model function
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/libecalc/input/mappers/test_consumer_chart.py | Updates test assertions to work with PumpModel instances instead of PumpModelDTO |
| src/libecalc/presentation/yaml/yaml_entities.py | Changes type annotation and isinstance check from PumpModelDTO to PumpModel |
| src/libecalc/presentation/yaml/mappers/facility_input.py | Refactors mapper functions to directly instantiate PumpSingleSpeed/PumpVariableSpeed with proper chart wrapping |
| src/libecalc/presentation/yaml/mappers/consumer_function_mapper.py | Removes factory import and direct create_pump_model calls |
| src/libecalc/presentation/yaml/domain/reference_service.py | Updates type annotations from PumpModelDTO to PumpModel |
| src/libecalc/domain/process/pump/pump.py | Removes PumpModelDTO class definition |
| src/libecalc/domain/process/pump/factory.py | Deletes entire factory file with pump creation logic |
Comments suppressed due to low confidence (1)
src/libecalc/presentation/yaml/mappers/facility_input.py:1
- The arguments to InvalidConsumptionType are reversed. The 'actual' parameter should receive the 'consumes' value, and 'expected' should receive ConsumptionType.ELECTRICITY.
from typing import Union
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
jsolaas
approved these changes
Aug 26, 2025
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.
Why is this pull request needed?
This PR simplifies the pump model architecture in the codebase by removing the obsolete PumpModelDTO data class and related factory logic. By eliminating the DTO layer and directly using PumpModel and its subclasses, the code becomes more maintainable and easier to work with, reducing unnecessary complexity and potential sources of error.
What does this pull request change?