use of org.pmiops.workbench.model.MaterializeCohortResponse in project workbench by all-of-us.
the class CohortMaterializationServiceTest method testMaterializeCohortObservationPersonNotFound.
@Test
public void testMaterializeCohortObservationPersonNotFound() {
TableQuery tableQuery = new TableQuery();
tableQuery.setTableName("observation");
FieldSet fieldSet = new FieldSet();
fieldSet.setTableQuery(tableQuery);
MaterializeCohortResponse response = cohortMaterializationService.materializeCohort(null, SearchRequests.females(), makeRequest(fieldSet, 1000));
assertResults(response);
assertThat(response.getNextPageToken()).isNull();
}
use of org.pmiops.workbench.model.MaterializeCohortResponse in project workbench by all-of-us.
the class CohortMaterializationServiceTest method testMaterializeCohortPersonFieldSetOrderByGenderConceptIdDesc.
@Test
public void testMaterializeCohortPersonFieldSetOrderByGenderConceptIdDesc() {
TableQuery tableQuery = new TableQuery();
tableQuery.setTableName("person");
tableQuery.setColumns(ImmutableList.of("person_id", "gender_concept_id"));
tableQuery.setOrderBy(ImmutableList.of("gender_concept_id DESC"));
FieldSet fieldSet = new FieldSet();
fieldSet.setTableQuery(tableQuery);
MaterializeCohortResponse response = cohortMaterializationService.materializeCohort(null, SearchRequests.allGenders(), makeRequest(fieldSet, 1000));
ImmutableMap<String, Object> p1Map = ImmutableMap.of("person_id", 1L, "gender_concept_id", 8507L);
ImmutableMap<String, Object> p2Map = ImmutableMap.of("person_id", 2L, "gender_concept_id", 2L);
ImmutableMap<String, Object> p3Map = ImmutableMap.of("person_id", 102246L, "gender_concept_id", 8532L);
assertResults(response, p3Map, p1Map, p2Map);
assertThat(response.getNextPageToken()).isNull();
}
use of org.pmiops.workbench.model.MaterializeCohortResponse in project workbench by all-of-us.
the class CohortMaterializationServiceTest method testMaterializeCohortPersonFieldSetPersonIdWithNumberLessThanFilter.
@Test
public void testMaterializeCohortPersonFieldSetPersonIdWithNumberLessThanFilter() {
TableQuery tableQuery = new TableQuery();
tableQuery.setTableName("person");
tableQuery.setColumns(ImmutableList.of("person_id"));
ColumnFilter filter = new ColumnFilter();
filter.setColumnName("person_id");
filter.setOperator(Operator.LESS_THAN);
filter.setValueNumber(new BigDecimal(2L));
tableQuery.addFiltersItem(ImmutableList.of(filter));
FieldSet fieldSet = new FieldSet();
fieldSet.setTableQuery(tableQuery);
MaterializeCohortResponse response = cohortMaterializationService.materializeCohort(null, SearchRequests.allGenders(), makeRequest(fieldSet, 1000));
assertPersonIds(response, 1L);
assertThat(response.getNextPageToken()).isNull();
}
use of org.pmiops.workbench.model.MaterializeCohortResponse in project workbench by all-of-us.
the class CohortMaterializationServiceTest method testMaterializeCohortObservationFilterObservationDateLessThan.
@Test
public void testMaterializeCohortObservationFilterObservationDateLessThan() {
TableQuery tableQuery = new TableQuery();
tableQuery.setTableName("observation");
tableQuery.setColumns(ImmutableList.of("observation_id"));
ColumnFilter columnFilter = new ColumnFilter();
columnFilter.setColumnName("observation_date");
columnFilter.setOperator(Operator.LESS_THAN);
columnFilter.setValueDate("2009-12-04");
tableQuery.addFiltersItem(ImmutableList.of(columnFilter));
FieldSet fieldSet = new FieldSet();
fieldSet.setTableQuery(tableQuery);
MaterializeCohortResponse response = cohortMaterializationService.materializeCohort(null, SearchRequests.males(), makeRequest(fieldSet, 1000));
assertResults(response, ImmutableMap.of("observation_id", 5L));
assertThat(response.getNextPageToken()).isNull();
}
use of org.pmiops.workbench.model.MaterializeCohortResponse in project workbench by all-of-us.
the class CohortMaterializationServiceTest method testMaterializeCohortOneMale.
@Test
public void testMaterializeCohortOneMale() {
MaterializeCohortResponse response = cohortMaterializationService.materializeCohort(null, SearchRequests.males(), makeRequest(1000));
assertPersonIds(response, 1L);
assertThat(response.getNextPageToken()).isNull();
}
Aggregations