Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rfc85 dynamic virtual study #11040

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Rfc85 dynamic virtual study #11040

wants to merge 9 commits into from

Conversation

forus
Copy link
Contributor

@forus forus commented Oct 2, 2024

Fix # (see https://help.github.com/en/articles/closing-issues-using-keywords)

Describe changes proposed in this pull request:

  • add a flag to indicate if virtual study dynamic
  • calculate sample IDs using virtual study view filters if study is dynamic

Checks

Any screenshots or GIFs?

If this is a new visual feature please add a before/after screenshot or gif
here with e.g. Giphy CAPTURE or Peek

Notify reviewers

Read our Pull request merging
policy
. It can help to figure out who worked on the
file before you. Please use git blame <filename> to determine that
and notify them either through slack or by assigning them as a reviewer on the PR

Copy link
Member

@pieterlukasse pieterlukasse left a comment

Choose a reason for hiding this comment

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

code looks good to me. Thanks @forus !

I added two questions.

Comment on lines +247 to +252
/**
* This method populates the `virtualStudyData` object with a new set of sample IDs retrieved as the result of executing a query based on virtual study view filters.
* It first applies the filters defined within the study view, runs the query to fetch the relevant sample IDs, and then updates the virtualStudyData to reflect these fresh results.
* This ensures that the virtual study contains the latest sample IDs.
* @param virtualStudyData
*/
Copy link
Member

Choose a reason for hiding this comment

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

Nice! Quick question: will this be cached? If yes, how?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pieterlukasse this method is not cached, but studyViewFilterApplier.apply(virtualStudyData.getStudyViewFilter()); is. I don't think we should cache this method as it'd be cheap transformation.

Comment on lines 254 to 274
List<SampleIdentifier> sampleIdentifiers = studyViewFilterApplier.apply(virtualStudyData.getStudyViewFilter());
Map<String, Set<String>> sampleIdsByStudyId = sampleIdentifiers
.stream()
.collect(
Collectors.groupingBy(
SampleIdentifier::getStudyId,
Collectors.mapping(SampleIdentifier::getSampleId, Collectors.toSet())));
Set<VirtualStudySamples> virtualStudySamples = sampleIdsByStudyId.entrySet().stream().map(entry -> {
VirtualStudySamples vss = new VirtualStudySamples();
vss.setId(entry.getKey());
vss.setSamples(entry.getValue());
return vss;
}).collect(Collectors.toSet());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Opinion, but I would extract this into a function called extractVirtualStudySamples or something similar.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@haynescd Please have a look eda7367

@forus forus force-pushed the rfc85-dynamic-virtual-study branch from eda7367 to 1adca8c Compare October 28, 2024 14:29
- Use the constructor dep. injection
- return value withou assigning it to a variable
@forus forus removed the do not merge label Nov 5, 2024
Copy link

sonarcloud bot commented Nov 5, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants