Skip to content

Commit

Permalink
Fix NA values for Data Source attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
cbioportal import user committed Jan 17, 2025
1 parent 0cf587f commit b351574
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,13 @@ private List<ClinicalDataCountItem> addDataSourceToClinicalDataCounts(
}

public List<ClinicalDataCountItem> cachedClinicalDataCounts(ClinicalDataCountFilter interceptedClinicalDataCountFilter) {

List<ClinicalDataFilter> attributes = interceptedClinicalDataCountFilter.getAttributes();
StudyViewFilter studyViewFilter = interceptedClinicalDataCountFilter.getStudyViewFilter();

// Remove DATA_SOURCE if it is present -- this is a virtual attribute we add ourselves, it is not stored in the db
boolean dataSourceRequested = attributes.removeIf(attr -> attr.getAttributeId().equals("DATA_SOURCE"));

if (attributes.size() == 1) {
studyViewFilterUtil.removeSelfFromFilter(attributes.get(0).getAttributeId(), studyViewFilter);
}
Expand All @@ -115,13 +120,10 @@ public List<ClinicalDataCountItem> cachedClinicalDataCounts(ClinicalDataCountFil
List<ClinicalDataCountItem> result = clinicalDataService.fetchClinicalDataCounts(
studyIds, sampleIds, attributes.stream().map(a -> a.getAttributeId()).collect(Collectors.toList()));

boolean dataSourceRequested = interceptedClinicalDataCountFilter
.getAttributes()
.stream()
.anyMatch(attr -> attr.getAttributeId().equals("DATA_SOURCE"));
if (dataSourceRequested) {
result = addDataSourceToClinicalDataCounts(result, sampleIds.size());
}

return result;
}

Expand Down

0 comments on commit b351574

Please sign in to comment.