use of org.hisp.dhis.common.BaseDimensionalObject in project dhis2-core by dhis2.
the class QueryPlannerTest method validateMissingOrgUnitDimensionOutputFormatDataValueSet.
@Test(expected = IllegalQueryException.class)
public void validateMissingOrgUnitDimensionOutputFormatDataValueSet() {
DataQueryParams params = DataQueryParams.newBuilder().addDimension(new BaseDimensionalObject(DATA_X_DIM_ID, DimensionType.DATA_X, getList(deA, deB))).addDimension(new BaseDimensionalObject(PERIOD_DIM_ID, DimensionType.PERIOD, getList(peA, peB))).withOutputFormat(OutputFormat.DATA_VALUE_SET).build();
queryPlanner.validate(params);
}
use of org.hisp.dhis.common.BaseDimensionalObject in project dhis2-core by dhis2.
the class QueryPlannerTest method validateFailureMultipleIndicatorsFilter.
@Test(expected = IllegalQueryException.class)
public void validateFailureMultipleIndicatorsFilter() {
DataQueryParams params = DataQueryParams.newBuilder().addDimension(new BaseDimensionalObject(ORGUNIT_DIM_ID, DimensionType.ORGANISATION_UNIT, getList(ouA, ouB))).addDimension(new BaseDimensionalObject(PERIOD_DIM_ID, DimensionType.PERIOD, getList(peA, peB))).addFilter(new BaseDimensionalObject(DATA_X_DIM_ID, DimensionType.DATA_X, getList(inA, inB))).build();
queryPlanner.validate(params);
}
use of org.hisp.dhis.common.BaseDimensionalObject in project dhis2-core by dhis2.
the class QueryPlannerTest method validateSuccesA.
@Test
public void validateSuccesA() {
DataQueryParams params = DataQueryParams.newBuilder().addDimension(new BaseDimensionalObject(ORGUNIT_DIM_ID, DimensionType.ORGANISATION_UNIT, getList(ouA, ouB))).addDimension(new BaseDimensionalObject(PERIOD_DIM_ID, DimensionType.PERIOD, getList(peA, peB))).addDimension(new BaseDimensionalObject(DATA_X_DIM_ID, DimensionType.DATA_X, getList(deA, deB))).build();
queryPlanner.validate(params);
}
use of org.hisp.dhis.common.BaseDimensionalObject in project dhis2-core by dhis2.
the class QueryPlannerTest method validateSuccesSingleIndicatorFilter.
@Test
public void validateSuccesSingleIndicatorFilter() {
DataQueryParams params = DataQueryParams.newBuilder().addDimension(new BaseDimensionalObject(ORGUNIT_DIM_ID, DimensionType.ORGANISATION_UNIT, getList(ouA, ouB))).addDimension(new BaseDimensionalObject(PERIOD_DIM_ID, DimensionType.PERIOD, getList(peA, peB))).addFilter(new BaseDimensionalObject(DATA_X_DIM_ID, DimensionType.DATA_X, getList(inA))).build();
queryPlanner.validate(params);
}
use of org.hisp.dhis.common.BaseDimensionalObject in project dhis2-core by dhis2.
the class DefaultAnalyticsService method getAggregatedDataValueMap.
/**
* Returns a mapping between dimension items and values for the given data
* query and list of indicators. The dimensional items part of the indicator
* numerators and denominators are used as dimensional item for the aggregated
* values being retrieved.
*
* @param params the {@link DataQueryParams}.
* @param indicators the list of indicators.
* @return a dimensional items to aggregate values map.
*/
private Map<String, Double> getAggregatedDataValueMap(DataQueryParams params, List<Indicator> indicators) {
List<DimensionalItemObject> items = Lists.newArrayList(expressionService.getDimensionalItemObjectsInIndicators(indicators));
items = DimensionalObjectUtils.replaceOperandTotalsWithDataElements(items);
DimensionalObject dimension = new BaseDimensionalObject(DimensionalObject.DATA_X_DIM_ID, DimensionType.DATA_X, null, DISPLAY_NAME_DATA_X, items);
DataQueryParams dataSourceParams = DataQueryParams.newBuilder(params).replaceDimension(dimension).withIncludeNumDen(false).withSkipHeaders(true).withSkipMeta(true).build();
Grid grid = getAggregatedDataValueGridInternal(dataSourceParams);
return grid.getAsMap(grid.getWidth() - 1, DimensionalObject.DIMENSION_SEP);
}
Aggregations