Skip to content

Commit

Permalink
ALS-4947: Change filter logic to be AND not OR between 2 any record o…
Browse files Browse the repository at this point in the history
…f filters
  • Loading branch information
ramari16 committed Aug 24, 2023
1 parent bd7ab07 commit 5912b01
Showing 1 changed file with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -262,20 +262,16 @@ private void addIdSetsForRequiredFields(Query query, ArrayList<Set<Integer>> fil

private void addIdSetsForAnyRecordOf(Query query, ArrayList<Set<Integer>> filteredIdSets) {
if(!query.getAnyRecordOf().isEmpty()) {
Set<Integer> patientsInScope = new ConcurrentSkipListSet<Integer>();
VariantBucketHolder<VariantMasks> bucketCache = new VariantBucketHolder<VariantMasks>();
query.getAnyRecordOf().parallelStream().forEach(path->{
if(patientsInScope.size()<Math.max(
phenotypeMetaStore.getPatientIds().size(),
variantService.getPatientIds().length)) {
if(VariantUtils.pathIsVariantSpec(path)) {
addIdSetsForVariantSpecCategoryFilters(new String[]{"0/1","1/1"}, path, patientsInScope, bucketCache);
} else {
patientsInScope.addAll(getCube(path).keyBasedIndex());
}
VariantBucketHolder<VariantMasks> bucketCache = new VariantBucketHolder<>();
filteredIdSets.addAll(query.getAnyRecordOf().parallelStream().map(path->{
if(VariantUtils.pathIsVariantSpec(path)) {
TreeSet<Integer> patientsInScope = new TreeSet<>();
addIdSetsForVariantSpecCategoryFilters(new String[]{"0/1","1/1"}, path, patientsInScope, bucketCache);
return patientsInScope;
} else {
return new TreeSet<Integer>(getCube(path).keyBasedIndex());
}
});
filteredIdSets.add(patientsInScope);
}).collect(Collectors.toSet()));
}
}

Expand Down

0 comments on commit 5912b01

Please sign in to comment.