Skip to content

Conversation

@dweindl
Copy link
Member

@dweindl dweindl commented Dec 18, 2024

Implement an object model for the various PEtab entities as an alternative to working with the plain DataFrames.

Related to #337.

Object names are very likely to change. This is more of a proof of concept.

Also adapt to recent changes in PEtab-dev/PEtab#581

@codecov-commenter
Copy link

codecov-commenter commented Dec 18, 2024

Codecov Report

Attention: Patch coverage is 70.70218% with 121 lines in your changes missing coverage. Please review.

Project coverage is 74.50%. Comparing base (c848722) to head (7e021ce).
Report is 28 commits behind head on develop.

Files with missing lines Patch % Lines
petab/v2/core.py 69.59% 100 Missing and 21 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #345      +/-   ##
===========================================
- Coverage    74.83%   74.50%   -0.33%     
===========================================
  Files           56       57       +1     
  Lines         5603     6002     +399     
  Branches       982     1039      +57     
===========================================
+ Hits          4193     4472     +279     
- Misses        1036     1133      +97     
- Partials       374      397      +23     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dweindl dweindl self-assigned this Dec 19, 2024
@dweindl dweindl force-pushed the object_model branch 5 times, most recently from 6e7f91d to fca15e4 Compare December 20, 2024 14:22
@dweindl dweindl force-pushed the object_model branch 2 times, most recently from 9ba7fa2 to b7b8b5b Compare March 12, 2025 09:25
@dweindl dweindl marked this pull request as ready for review March 12, 2025 11:43
@dweindl dweindl requested a review from a team as a code owner March 12, 2025 11:43
Copy link
Member

@dilpath dilpath left a comment

Choose a reason for hiding this comment

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

Looks good! I reviewed this without considering the other PEtab v2 things, i.e. I only checked that the OOP code look good, since I guess those other things are out-of-scope here.

Comment on lines +137 to +139
OT_CUR_VAL = "setCurrentValue"
OT_NO_CHANGE = "noChange"
Copy link
Member

Choose a reason for hiding this comment

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

Other constants in C.py are not shortened, so could stick to that "convention". To reduce the length, OT/OPERATION_TYPE could be dropped from the start of the name, since I don't think we have that style elsewhere either.

Copy link
Member Author

Choose a reason for hiding this comment

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

I would prefer introducing prefixes elsewhere than dropping them. I find that this makes it clearer where they belong.

Copy link
Member Author

Choose a reason for hiding this comment

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

Also fine to completely replace them by enums.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll leave it for now, as there is a good chance that "operation types" will be dropped completely

arbitrary_types_allowed = True


class ObservablesTable(BaseModel):
Copy link
Member

Choose a reason for hiding this comment

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

I guess this PR is independent of any decision on choice between "observable table" and "observables table" naming style, or is this the decision?

Copy link
Member Author

Choose a reason for hiding this comment

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

Independent. Happy to rename just about anything here after the v2 specs are finalized.

Comment on lines +217 to +213
class OperationType(str, Enum):
"""Operation types for model changes in the PEtab conditions table."""

# TODO update names
SET_CURRENT_VALUE = "setCurrentValue"
NO_CHANGE = "noChange"
...
Copy link
Member

Choose a reason for hiding this comment

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

Same with this, can replace the "same" thing in C.py

Copy link
Member

Choose a reason for hiding this comment

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

There is a lot of repeated code (e.g. from/to_dataframe/tsv, and add/iadd). Is it nicer/possible to somehow only define these once?

Copy link
Member Author

Choose a reason for hiding this comment

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

I expect that some additional validation will happen there in the future which would make it rather difficult to implement that only once. I think the classes will me more understandable if they have their own add/iadd instead of some complex function combining the logic of all the different types.

@dweindl dweindl merged commit dbd7e04 into PEtab-dev:develop Mar 13, 2025
7 checks passed
@dweindl dweindl deleted the object_model branch March 13, 2025 08:46
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.

3 participants