Skip to content

Commit

Permalink
Fix bug where 0 patients was assumed all patients in genomic processing
Browse files Browse the repository at this point in the history
  • Loading branch information
ramari16 committed Jan 26, 2024
1 parent e93f9f7 commit 22129ae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ protected Set<Integer> applyBooleanLogic(List<Set<Integer>> filteredIdSets) {
protected Set<Integer> idSetsForEachFilter(Query query) {
DistributableQuery distributableQuery = getDistributableQuery(query);

if (distributableQuery.hasFilters()) {
if (!distributableQuery.getPatientIds().isEmpty() && distributableQuery.hasFilters()) {
Mono<BigInteger> patientMaskForVariantInfoFilters = genomicProcessor.getPatientMask(distributableQuery);
return patientMaskForVariantInfoFilters.map(genomicProcessor::patientMaskToPatientIdSet).block();
}
Expand All @@ -156,7 +156,7 @@ private DistributableQuery getDistributableQuery(Query query) {

Set<Integer> phenotypicPatientSet;
//AND logic to make sure all patients match each filter
if(patientIdSets.size()>0) {
if(!patientIdSets.isEmpty()) {
phenotypicPatientSet = applyBooleanLogic(patientIdSets);
} else {
// if there are no patient filters, use all patients.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ public BigInteger getPatientIdsForIntersectionOfVariantSets(Set<Integer> patient
Set<Integer> patientIds = Arrays.asList(
variantService.getPatientIds()).stream().map((String id)->{
return Integer.parseInt(id);}).collect(Collectors.toSet());
if(!patientSubset.isEmpty()) {
// for now, empty means there were no phenotypic filters and all patients are eligible. we should
// change this to be nullable or have a separate method, this is very counter intuitive
if(patientSubset == null) {
// for now, null means there were no phenotypic filters and all patients are eligible
patientsInScope = Sets.intersection(patientIds, patientSubset);
} else {
patientsInScope = patientIds;
Expand Down

0 comments on commit 22129ae

Please sign in to comment.