use of org.pmiops.workbench.cdr.model.Criteria in project workbench by all-of-us.
the class CohortBuilderController method getCriteriaByTypeAndSubtype.
@Override
public ResponseEntity<CriteriaListResponse> getCriteriaByTypeAndSubtype(Long cdrVersionId, String type, String subtype) {
CdrVersionContext.setCdrVersion(cdrVersionDao.findOne(cdrVersionId));
final List<Criteria> criteriaList = criteriaDao.findCriteriaByTypeAndSubtypeOrderByNameAsc(type, subtype);
CriteriaListResponse criteriaResponse = new CriteriaListResponse();
criteriaResponse.setItems(criteriaList.stream().map(TO_CLIENT_CRITERIA).collect(Collectors.toList()));
return ResponseEntity.ok(criteriaResponse);
}
use of org.pmiops.workbench.cdr.model.Criteria in project workbench by all-of-us.
the class CohortBuilderControllerTest method countSubjectsDemoAge.
@Test
public void countSubjectsDemoAge() throws Exception {
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 demo = createSearchParameter(demoAge, null);
demo.attribute(new Attribute().operator("=").operands(Arrays.asList(age.toString())));
SearchRequest searchRequests = createSearchRequests(demoAge.getType(), Arrays.asList(demo));
assertParticipants(controller.countParticipants(cdrVersion.getCdrVersionId(), searchRequests), 1);
}
use of org.pmiops.workbench.cdr.model.Criteria in project workbench by all-of-us.
the class CohortBuilderController method getCriteriaByTypeAndParentId.
/**
* This method list any of the criteria trees.
*/
@Override
public ResponseEntity<CriteriaListResponse> getCriteriaByTypeAndParentId(Long cdrVersionId, String type, Long parentId) {
CdrVersionContext.setCdrVersion(cdrVersionDao.findOne(cdrVersionId));
final List<Criteria> criteriaList = criteriaDao.findCriteriaByTypeAndParentIdOrderByCodeAsc(type, parentId);
CriteriaListResponse criteriaResponse = new CriteriaListResponse();
criteriaResponse.setItems(criteriaList.stream().map(TO_CLIENT_CRITERIA).collect(Collectors.toList()));
return ResponseEntity.ok(criteriaResponse);
}
use of org.pmiops.workbench.cdr.model.Criteria in project workbench by all-of-us.
the class CohortBuilderController method getCriteriaTreeQuickSearch.
@Override
public ResponseEntity<CriteriaListResponse> getCriteriaTreeQuickSearch(Long cdrVersionId, String type, String value) {
CdrVersionContext.setCdrVersion(cdrVersionDao.findOne(cdrVersionId));
String nameOrCode = value + "*";
final List<Criteria> criteriaList = criteriaDao.findCriteriaByTypeAndNameOrCode(type, nameOrCode);
CriteriaListResponse criteriaResponse = new CriteriaListResponse();
criteriaResponse.setItems(criteriaList.stream().map(TO_CLIENT_CRITERIA).collect(Collectors.toList()));
return ResponseEntity.ok(criteriaResponse);
}
use of org.pmiops.workbench.cdr.model.Criteria in project workbench by all-of-us.
the class CohortBuilderControllerTest method countSubjectsDemoDec.
@Test
public void countSubjectsDemoDec() throws Exception {
Criteria demoGender = createDemoCriteria("DEMO", "DEC", null);
SearchParameter demo = createSearchParameter(demoGender, "Deceased");
SearchRequest searchRequest = createSearchRequests(demoGender.getType(), Arrays.asList(demo));
assertParticipants(controller.countParticipants(cdrVersion.getCdrVersionId(), searchRequest), 1);
}
Aggregations