Enable an initial state for individual and expression parameters#2729
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds initial state tracking capabilities to IndividualParameter and ExpressionParameter classes by introducing a new abstract base class ParameterValueWithInitialState. This enables storing original values set by PK-Sim for later reversion in MoBi.
Key changes:
- New abstract class
ParameterValueWithInitialStatewith properties forInitialValue,InitialFormulaId, andInitialUnit - Updated
IndividualParameterandExpressionParameterto inherit from the new base class - Added serialization support for the new initial state properties
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/OSPSuite.Core/Domain/Builder/ParameterValueWithInitialState.cs | New abstract base class that tracks initial state for parameters with properties for value, formula ID, and unit |
| src/OSPSuite.Core/Domain/Builder/IndividualParameter.cs | Updated to inherit from ParameterValueWithInitialState |
| src/OSPSuite.Core/Domain/Builder/ExpressionParameter.cs | Updated to inherit from ParameterValueWithInitialState |
| src/OSPSuite.Core/Serialization/Xml/ParameterValueXmlSerializer.cs | Added ParameterValueWithInitialStateSerializer to serialize/deserialize initial state properties |
| src/OSPSuite.Core/Domain/Constants.cs | Added INITIAL_UNIT constant for serialization attribute |
| tests/OSPSuite.Core.Tests/Domain/ExpressionParameterSpecs.cs | Added unit tests for HasInitialState property behavior |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/OSPSuite.Core/Domain/Builder/ParameterValueWithInitialState.cs
Outdated
Show resolved
Hide resolved
…e.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/OSPSuite.Core/Domain/Builder/ParameterValueWithInitialState.cs
Outdated
Show resolved
Hide resolved
src/OSPSuite.Core/Domain/Builder/ParameterValueWithInitialState.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| protected override XElement TypedSerialize(T pathAndValueEntity, SerializationContext serializationContext) | ||
| { | ||
| var element = base.TypedSerialize(pathAndValueEntity, serializationContext); | ||
| if (pathAndValueEntity.InitialUnit is not null) |
There was a problem hiding this comment.
why not != lol. What's teh point of this is not syntax?
There was a problem hiding this comment.
why not? It reads nice.
Fixes #2728
Description
We need a spot to store original values as set by PK-Sim so they can be reverted when changed in MoBi.
Type of change
Please mark relevant options with an
xin the brackets.How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Reviewer checklist
Mark everything that needs to be checked before merging the PR.
This change requires a documentation updateabove is selectedScreenshots (if appropriate):
Questions (if appropriate):