use of org.pmiops.workbench.model.TableQuery in project workbench by all-of-us.
the class CohortMaterializationServiceTest method testMaterializeCohortPersonFieldSetPersonIdWithStringsFilter.
@Test
public void testMaterializeCohortPersonFieldSetPersonIdWithStringsFilter() {
TableQuery tableQuery = new TableQuery();
tableQuery.setTableName("person");
tableQuery.setColumns(ImmutableList.of("person_id"));
ColumnFilter filter = new ColumnFilter();
filter.setColumnName("person_source_value");
filter.setOperator(Operator.IN);
filter.setValues(ImmutableList.of("foobar", "psv"));
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, 102246L);
assertThat(response.getNextPageToken()).isNull();
}
use of org.pmiops.workbench.model.TableQuery in project workbench by all-of-us.
the class CohortMaterializationServiceTest method testMaterializeCohortPersonFieldSetPersonIdWithStringLikeFilter.
@Test
public void testMaterializeCohortPersonFieldSetPersonIdWithStringLikeFilter() {
TableQuery tableQuery = new TableQuery();
tableQuery.setTableName("person");
tableQuery.setColumns(ImmutableList.of("person_id"));
ColumnFilter filter = new ColumnFilter();
filter.setColumnName("person_source_value");
filter.setOperator(Operator.LIKE);
filter.setValue("p%");
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, 102246L);
assertThat(response.getNextPageToken()).isNull();
}
use of org.pmiops.workbench.model.TableQuery in project workbench by all-of-us.
the class CohortMaterializationServiceTest method testMaterializeCohortObservationFilterObservationDateEqual.
@Test
public void testMaterializeCohortObservationFilterObservationDateEqual() {
TableQuery tableQuery = new TableQuery();
tableQuery.setTableName("observation");
tableQuery.setColumns(ImmutableList.of("observation_id"));
ColumnFilter columnFilter = new ColumnFilter();
columnFilter.setColumnName("observation_date");
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.TableQuery in project workbench by all-of-us.
the class CohortMaterializationServiceTest method testMaterializeCohortObservationFilterObservationDateGreaterThan.
@Test
public void testMaterializeCohortObservationFilterObservationDateGreaterThan() {
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);
columnFilter.setValueDate("2009-12-02");
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.TableQuery in project workbench by all-of-us.
the class CohortMaterializationServiceTest method testMaterializeCohortPersonFieldSetPersonIdWithStringFilter.
@Test
public void testMaterializeCohortPersonFieldSetPersonIdWithStringFilter() {
TableQuery tableQuery = new TableQuery();
tableQuery.setTableName("person");
tableQuery.setColumns(ImmutableList.of("person_id"));
ColumnFilter filter = new ColumnFilter();
filter.setColumnName("person_source_value");
filter.setValue("psv");
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, 102246L);
assertThat(response.getNextPageToken()).isNull();
}
Aggregations