-
Notifications
You must be signed in to change notification settings - Fork 507
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
base: demo-rfc80-poc
Are you sure you want to change the base?
Conversation
//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); |
There was a problem hiding this comment.
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.
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); | ||
}); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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()
There was a problem hiding this comment.
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
// 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); | ||
// }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove?
Quality Gate passedIssues Measures |
Fixers #11159