use of org.pmiops.workbench.model.SearchGroupItem in project workbench by all-of-us.
the class CohortBuilderControllerTest method countSubjectsDemoExcluded.
@Test
public void countSubjectsDemoExcluded() throws Exception {
Criteria demoGender = createDemoCriteria("DEMO", "GEN", "8507");
SearchParameter demoGenderSearchParam = createSearchParameter(demoGender, null);
SearchParameter demoGenderSearchParamExclude = createSearchParameter(demoGender, null);
SearchGroupItem excludeSearchGroupItem = new SearchGroupItem().type(demoGender.getType()).searchParameters(Arrays.asList(demoGenderSearchParamExclude));
SearchGroup excludeSearchGroup = new SearchGroup().addItemsItem(excludeSearchGroupItem);
SearchRequest searchRequests = createSearchRequests(demoGender.getType(), Arrays.asList(demoGenderSearchParam));
searchRequests.getExcludes().add(excludeSearchGroup);
assertParticipants(controller.countParticipants(cdrVersion.getCdrVersionId(), searchRequests), 0);
}
use of org.pmiops.workbench.model.SearchGroupItem in project workbench by all-of-us.
the class CohortBuilderControllerTest method countSubjectsICD9AndDemo.
@Test
public void countSubjectsICD9AndDemo() throws Exception {
Criteria demoGender = createDemoCriteria("DEMO", "GEN", "8507");
SearchParameter demoGenderSearchParam = createSearchParameter(demoGender, null);
LocalDate birthdate = LocalDate.of(1980, 8, 01);
LocalDate now = LocalDate.now();
Integer age = Period.between(birthdate, now).getYears();
Criteria demoAge = createDemoCriteria("DEMO", "AGE", null);
SearchParameter demoAgeSearchParam = createSearchParameter(demoAge, null);
demoAgeSearchParam.attribute(new Attribute().operator("=").operands(Arrays.asList(age.toString())));
SearchRequest searchRequests = createSearchRequests(demoAge.getType(), Arrays.asList(demoGenderSearchParam, demoAgeSearchParam));
SearchParameter icd9 = createSearchParameter(icd9MeasurementChild, "003.1");
SearchGroupItem anotherSearchGroupItem = new SearchGroupItem().type(icd9.getType()).searchParameters(Arrays.asList(icd9));
searchRequests.getIncludes().get(0).addItemsItem(anotherSearchGroupItem);
assertParticipants(controller.countParticipants(cdrVersion.getCdrVersionId(), searchRequests), 1);
}
Aggregations