diff --git a/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/AbstractProcessor.java b/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/AbstractProcessor.java index 4f0d9548..db4261ec 100644 --- a/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/AbstractProcessor.java +++ b/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/AbstractProcessor.java @@ -130,7 +130,7 @@ protected Set applyBooleanLogic(List> filteredIdSets) { protected Set idSetsForEachFilter(Query query) { DistributableQuery distributableQuery = getDistributableQuery(query); - if (distributableQuery.hasFilters()) { + if (!distributableQuery.getPatientIds().isEmpty() && distributableQuery.hasFilters()) { Mono patientMaskForVariantInfoFilters = genomicProcessor.getPatientMask(distributableQuery); return patientMaskForVariantInfoFilters.map(genomicProcessor::patientMaskToPatientIdSet).block(); } @@ -156,7 +156,7 @@ private DistributableQuery getDistributableQuery(Query query) { Set 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. diff --git a/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/PatientVariantJoinHandler.java b/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/PatientVariantJoinHandler.java index ba8878b0..a15f90b2 100644 --- a/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/PatientVariantJoinHandler.java +++ b/processing/src/main/java/edu/harvard/hms/dbmi/avillach/hpds/processing/PatientVariantJoinHandler.java @@ -33,9 +33,8 @@ public BigInteger getPatientIdsForIntersectionOfVariantSets(Set patient Set 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;