Skip to content

Commit

Permalink
Respond to comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alisman committed Nov 12, 2024
1 parent 43297f8 commit bd7320f
Showing 1 changed file with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,25 +158,26 @@ public List<ClinicalDataCountItem> getClinicalDataCounts(StudyViewFilter studyVi
var result = studyViewRepository.getClinicalDataCounts(createContext(studyViewFilter), filteredAttributes);

// fetch the samples by using the provided study view filter
List<Sample> filteredSamples = getFilteredSamples(studyViewFilter);
List<Sample> filteredSamples = studyViewRepository.getFilteredSamples(createContext(studyViewFilter));

var resultWithAllAttributes = StudyViewColumnarServiceUtil.addClinicalDataCountsForMissingAttributes(result, filteredAttributes, filteredSamples);

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);
});
var mergedResult = StudyViewColumnarServiceUtil.mergeClinicalDataCounts(resultWithAllAttributes);

// 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);
// });

return resultWithAllAttributes;
return mergedResult;
}


Expand Down

0 comments on commit bd7320f

Please sign in to comment.