use of org.pmiops.workbench.model.FieldSet in project workbench by all-of-us.
the class CohortMaterializationServiceTest method testMaterializeCohortPersonFieldSetPersonIdWithNumberFilter.
@Test
public void testMaterializeCohortPersonFieldSetPersonIdWithNumberFilter() {
TableQuery tableQuery = new TableQuery();
tableQuery.setTableName("person");
tableQuery.setColumns(ImmutableList.of("person_id"));
ColumnFilter filter = new ColumnFilter();
filter.setColumnName("person_id");
filter.setValueNumber(new BigDecimal(1L));
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.FieldSet in project workbench by all-of-us.
the class CohortMaterializationServiceTest method testMaterializeCohortPersonFieldSetAllColumns.
@Test
public void testMaterializeCohortPersonFieldSetAllColumns() {
TableQuery tableQuery = new TableQuery();
tableQuery.setTableName("person");
FieldSet fieldSet = new FieldSet();
fieldSet.setTableQuery(tableQuery);
MaterializeCohortResponse response = cohortMaterializationService.materializeCohort(null, SearchRequests.males(), makeRequest(fieldSet, 1000));
ImmutableMap<String, Object> p1Map = ImmutableMap.<String, Object>builder().put("person_id", 1L).put("gender_source_value", "1").put("race_source_value", "1").put("gender_concept_id", 8507L).put("year_of_birth", 1980L).put("month_of_birth", 8L).put("day_of_birth", 1L).put("race_concept_id", 1L).put("ethnicity_concept_id", 1L).put("location_id", 1L).put("provider_id", 1L).put("care_site_id", 1L).put("person_source_value", "psv").put("gender_source_concept_id", 1L).put("race_source_concept_id", 1L).put("ethnicity_source_value", "esv").put("ethnicity_source_concept_id", 1L).build();
assertResults(response, p1Map);
assertThat(response.getNextPageToken()).isNull();
}
use of org.pmiops.workbench.model.FieldSet in project workbench by all-of-us.
the class CohortMaterializationServiceTest method testMaterializeCohortPersonFieldSetPersonIdWithNumberGreaterThanOrEqualToFilter.
@Test
public void testMaterializeCohortPersonFieldSetPersonIdWithNumberGreaterThanOrEqualToFilter() {
TableQuery tableQuery = new TableQuery();
tableQuery.setTableName("person");
tableQuery.setColumns(ImmutableList.of("person_id"));
ColumnFilter filter = new ColumnFilter();
filter.setColumnName("person_id");
filter.setOperator(Operator.GREATER_THAN_OR_EQUAL_TO);
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, 2L, 102246L);
assertThat(response.getNextPageToken()).isNull();
}
use of org.pmiops.workbench.model.FieldSet 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.FieldSet 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();
}
Aggregations