Skip to content

Bugfix/estelle/61/num score sets and experiments#447

Merged
EstelleDa merged 19 commits intorelease-2025.2.0from
bugfix/estelle/61/numScoreSetsAndExperiments
Jun 5, 2025
Merged

Bugfix/estelle/61/num score sets and experiments#447
EstelleDa merged 19 commits intorelease-2025.2.0from
bugfix/estelle/61/numScoreSetsAndExperiments

Conversation

@EstelleDa
Copy link
Copy Markdown
Member

Due to the superseding score set and reading permission checks, it's a little complex than expected.

bencap and others added 10 commits March 28, 2025 17:22
filter condition so that it works correctly.
…02-01 and will be fully unsupported by 2025-04-15. Workflows using the ubuntu-20.04 image label should be updated to ubuntu-latest, ubuntu-22.04, ubuntu-24.04.
…appedVariants

Modify the mapped variants' filter condition so that it works correctly.
…t and score set in router functions. Found a bug in add_contributor function that leads to some tests can't pass. Fix that one first then I'll keep adding more tests.
@EstelleDa EstelleDa linked an issue May 30, 2025 that may be closed by this pull request
@EstelleDa EstelleDa requested a review from bencap May 30, 2025 06:30
Copy link
Copy Markdown
Collaborator

@bencap bencap left a comment

Choose a reason for hiding this comment

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

Thanks for working on this Estelle. The calculation logic looks good, and I left a few minor comments. I messaged you on Slack about how we might fix the failing test cases.

In the future, I want to think about how to integrate some of these calculations into our Pydantic classes. It would be nice if we could just create an Experiment view model and have these fields be calculated automatically. Because of the user permissions, I think it is a bit tricky though and I want to wait until we are on Pydantic 2.0+ at least to try it.

Comment on lines +148 to +152
filtered_score_sets = [score_set for score_set in filter_superseded_score_set_tails if score_set is not None]
filtered_score_set_urns = []
if filtered_score_sets:
filtered_score_set_urns = list(set([score_set.urn for score_set in filtered_score_sets]))
filtered_score_set_urns.sort()
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.

I believe this can be done in one line

Suggested change
filtered_score_sets = [score_set for score_set in filter_superseded_score_set_tails if score_set is not None]
filtered_score_set_urns = []
if filtered_score_sets:
filtered_score_set_urns = list(set([score_set.urn for score_set in filtered_score_sets]))
filtered_score_set_urns.sort()
filtered_score_sets = list(set([score_set for score_set in filter_superseded_score_set_tails if score_set is not None])).sort()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'll modify this part. We need the urn list.

expected_response = update_expected_response_for_created_resources(
deepcopy(TEST_MINIMAL_SEQ_SCORESET_RESPONSE), experiment, response_data
)
expected_response["experiment"].update({"numScoreSets": 1})
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.

Would it make more sense to add a property to the expected response constant in tests.helpers.constants with this property so that we don't have to update the expected response each time?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I considered this one before. It's a dynamic value, especially when testing the permission, whether private or public, for contributors and superseding cases. That's why I finally don't put it in tests.helpers.constants. Even though we put it in tests.helpers.constants, most of the time we still need to update it manually. I modify this part to set it to 0 in tests.helpers.constants, and manually update it on the rest tests. I don't have any other better solution for this part.

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.

Yeah, that's true. I guess it can probably work like the keys after the # keys to be set after receiving response comment. In the default case the key is 0, but we have to manually set it when we update. I like what you changed it to.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I moved it to the keys part.

@EstelleDa
Copy link
Copy Markdown
Member Author

Thanks for working on this Estelle. The calculation logic looks good, and I left a few minor comments. I messaged you on Slack about how we might fix the failing test cases.

In the future, I want to think about how to integrate some of these calculations into our Pydantic classes. It would be nice if we could just create an Experiment view model and have these fields be calculated automatically. Because of the user permissions, I think it is a bit tricky though and I want to wait until we are on Pydantic 2.0+ at least to try it.

I agree with you. I also tried to process the data in Pydantic classes, but finally I gave up because we need function calls. We can try it when we are on Pydantic 2.0+ and see whether we can handle the permission check problem. Otherwise, it's really a messy task if we need to modify them.

@EstelleDa EstelleDa merged commit 0a0ebaa into release-2025.2.0 Jun 5, 2025
8 checks passed
@EstelleDa EstelleDa deleted the bugfix/estelle/61/numScoreSetsAndExperiments branch June 10, 2025 02:28
@bencap bencap mentioned this pull request Jun 11, 2025
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.

Experiment record showing the wrong number of score sets

2 participants