use of org.pmiops.workbench.model.ColumnFilter in project workbench by all-of-us.
the class CohortMaterializationServiceTest method testMaterializeCohortPersonFieldSetPersonIdWithStringFilterNullNonMatch.
@Test
public void testMaterializeCohortPersonFieldSetPersonIdWithStringFilterNullNonMatch() {
TableQuery tableQuery = new TableQuery();
tableQuery.setTableName("person");
tableQuery.setColumns(ImmutableList.of("person_id"));
ColumnFilter filter = new ColumnFilter();
filter.setColumnName("ethnicity_source_value");
filter.setValue("esv");
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, 2L);
assertThat(response.getNextPageToken()).isNull();
}
use of org.pmiops.workbench.model.ColumnFilter in project workbench by all-of-us.
the class CohortMaterializationServiceTest method testMaterializeCohortPersonFieldSetPersonIdWithStringIsNull.
@Test
public void testMaterializeCohortPersonFieldSetPersonIdWithStringIsNull() {
TableQuery tableQuery = new TableQuery();
tableQuery.setTableName("person");
tableQuery.setColumns(ImmutableList.of("person_id"));
ColumnFilter filter = new ColumnFilter();
filter.setColumnName("ethnicity_source_value");
filter.setOperator(Operator.EQUAL);
filter.setValueNull(true);
tableQuery.addFiltersItem(ImmutableList.of(filter));
FieldSet fieldSet = new FieldSet();
fieldSet.setTableQuery(tableQuery);
MaterializeCohortResponse response = cohortMaterializationService.materializeCohort(null, SearchRequests.allGenders(), makeRequest(fieldSet, 1000));
assertPersonIds(response, 102246L);
assertThat(response.getNextPageToken()).isNull();
}
use of org.pmiops.workbench.model.ColumnFilter in project workbench by all-of-us.
the class CohortMaterializationServiceTest method testMaterializeCohortObservationFilterObservationDatetimeLessThanOrEqualTo.
@Test
public void testMaterializeCohortObservationFilterObservationDatetimeLessThanOrEqualTo() {
TableQuery tableQuery = new TableQuery();
tableQuery.setTableName("observation");
tableQuery.setColumns(ImmutableList.of("observation_id"));
ColumnFilter columnFilter = new ColumnFilter();
columnFilter.setColumnName("observation_datetime");
columnFilter.setOperator(Operator.LESS_THAN_OR_EQUAL_TO);
columnFilter.setValueDate("2009-12-03 05:00:00 UTC");
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.ColumnFilter in project workbench by all-of-us.
the class CohortMaterializationServiceTest method testMaterializeCohortObservationFilterObservationDateGreaterThanOrEqualTo.
@Test
public void testMaterializeCohortObservationFilterObservationDateGreaterThanOrEqualTo() {
TableQuery tableQuery = new TableQuery();
tableQuery.setTableName("observation");
tableQuery.setColumns(ImmutableList.of("observation_id"));
ColumnFilter columnFilter = new ColumnFilter();
columnFilter.setColumnName("observation_date");
columnFilter.setOperator(Operator.GREATER_THAN_OR_EQUAL_TO);
columnFilter.setValueDate("2009-12-03");
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.ColumnFilter in project workbench by all-of-us.
the class CohortMaterializationServiceTest method testMaterializeCohortObservationFilterObservationDatetimeEqual.
@Test
public void testMaterializeCohortObservationFilterObservationDatetimeEqual() {
TableQuery tableQuery = new TableQuery();
tableQuery.setTableName("observation");
tableQuery.setColumns(ImmutableList.of("observation_id"));
ColumnFilter columnFilter = new ColumnFilter();
columnFilter.setColumnName("observation_datetime");
columnFilter.setValueDate("2009-12-03 05:00:00 UTC");
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();
}
Aggregations