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

Fix missing clinical data NA counts which have been filtered out #11163

Open
wants to merge 6 commits into
base: demo-rfc80-poc
Choose a base branch
from

Conversation

alisman
Copy link
Contributor

@alisman alisman commented Nov 5, 2024

Fixers #11159

@alisman alisman changed the base branch from master to demo-rfc80-poc November 11, 2024 16:00
//studyIds, sampleIds, attributes.stream().map(a -> a.getAttributeId()).collect(Collectors.toList()));

// fetch the samples by using the provided study view filter
List<Sample> filteredSamples = studyViewColumnarService.getFilteredSamples(studyViewFilter);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would push this business logic down into the service (eventually business logic shouldn't even be at this layer)

and utilize the studyViewRepository.getFilteredSamplesCount().

Probably wrap this in a function.

Comment on lines 165 to 176
resultWithAllAttributes.stream().forEach(attr -> {
Map<String, List<ClinicalDataCount>> countsPerType = attr.getCounts().stream()
.collect(Collectors.groupingBy(ClinicalDataCount::getValue));
List<ClinicalDataCount> res = countsPerType.entrySet().stream().map((entry)->{
ClinicalDataCount mergedCount = new ClinicalDataCount();
mergedCount.setAttributeId(attr.getAttributeId());
mergedCount.setValue(entry.getKey());
mergedCount.setCount(entry.getValue().stream().mapToInt(ClinicalDataCount::getCount).sum());
return mergedCount;
}).collect(Collectors.toList());
attr.setCounts(res);
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

Did you mean to use StudyViewColumnarServiceUtil.mergeClinicalDataCounts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point 😆

var result = studyViewRepository.getClinicalDataCounts(createContext(studyViewFilter), filteredAttributes);

// fetch the samples by using the provided study view filter
List<Sample> filteredSamples = getFilteredSamples(studyViewFilter);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would still suggest this studyViewRepository.getFilteredSamplesCount()

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 my understanding was just that you wanted me to call the repository directly, right here

Comment on lines 167 to 178
// resultWithAllAttributes.stream().forEach(attr -> {
// Map<String, List<ClinicalDataCount>> countsPerType = attr.getCounts().stream()
// .collect(Collectors.groupingBy(ClinicalDataCount::getValue));
// List<ClinicalDataCount> res = countsPerType.entrySet().stream().map((entry)->{
// ClinicalDataCount mergedCount = new ClinicalDataCount();
// mergedCount.setAttributeId(attr.getAttributeId());
// mergedCount.setValue(entry.getKey());
// mergedCount.setCount(entry.getValue().stream().mapToInt(ClinicalDataCount::getCount).sum());
// return mergedCount;
// }).collect(Collectors.toList());
// attr.setCounts(res);
// });
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you remove?

Copy link

sonarcloud bot commented Nov 12, 2024

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.

2 participants