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 clinical data NA count logic #10991

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.Map;

Expand Down Expand Up @@ -228,11 +229,13 @@ public static List<ClinicalDataCountItem> calculateMissingNaCountsForClinicalDat
}

// find "NA" or else create a new one
ClinicalDataCount naClinicalDataCount = clinicalDataCountItem
Optional<ClinicalDataCount> naClinicalDataCountOptional = clinicalDataCountItem
.getCounts()
.stream()
.filter(c -> c.getValue().equals("NA"))
.findFirst()
.findFirst();

ClinicalDataCount naClinicalDataCount = naClinicalDataCountOptional
.orElseGet(() -> {
// this should only happen when there are multiple studies
ClinicalDataCount count = new ClinicalDataCount();
Expand All @@ -242,6 +245,11 @@ public static List<ClinicalDataCountItem> calculateMissingNaCountsForClinicalDat
return count;
});

// if not present we need to add naClinicalDataCount to the existing counts
if (naClinicalDataCountOptional.isEmpty()) {
clinicalDataCountItem.getCounts().add(naClinicalDataCount);
}

naClinicalDataCount.setCount(naClinicalDataCount.getCount() + casesWithoutClinicalData);
}
}
Expand Down
Loading