Search in sources :

Example 21 with Indicator

use of org.hisp.dhis.indicator.Indicator in project dhis2-core by dhis2.

the class DefaultMappingService method getIndicatorLastYearMapView.

@Override
public MapView getIndicatorLastYearMapView(String indicatorUid, String organisationUnitUid, int level) {
    MapView mapView = new MapView();
    Period period = periodService.reloadPeriod(new RelativePeriods().setThisYear(true).getRelativePeriods().iterator().next());
    Indicator indicator = indicatorService.getIndicator(indicatorUid);
    OrganisationUnit unit = organisationUnitService.getOrganisationUnit(organisationUnitUid);
    mapView.addDataDimensionItem(indicator);
    mapView.getPeriods().add(period);
    mapView.getOrganisationUnits().add(unit);
    mapView.getOrganisationUnitLevels().add(level);
    mapView.setName(indicator.getName());
    return mapView;
}
Also used : OrganisationUnit(org.hisp.dhis.organisationunit.OrganisationUnit) RelativePeriods(org.hisp.dhis.period.RelativePeriods) Period(org.hisp.dhis.period.Period) Indicator(org.hisp.dhis.indicator.Indicator)

Example 22 with Indicator

use of org.hisp.dhis.indicator.Indicator in project dhis2-core by dhis2.

the class DefaultExpressionService method getDimensionalItemObjectsInIndicators.

@Override
public Set<DimensionalItemObject> getDimensionalItemObjectsInIndicators(Collection<Indicator> indicators) {
    Set<DimensionalItemObject> items = Sets.newHashSet();
    for (Indicator indicator : indicators) {
        items.addAll(getDimensionalItemObjectsInExpression(indicator.getNumerator()));
        items.addAll(getDimensionalItemObjectsInExpression(indicator.getDenominator()));
    }
    return items;
}
Also used : DimensionalItemObject(org.hisp.dhis.common.DimensionalItemObject) Indicator(org.hisp.dhis.indicator.Indicator)

Example 23 with Indicator

use of org.hisp.dhis.indicator.Indicator in project dhis2-core by dhis2.

the class ExpressionUpgrader method upgradeIndicators.

private void upgradeIndicators() {
    Collection<Indicator> indicators = indicatorService.getAllIndicators();
    for (Indicator indicator : indicators) {
        String numerator = upgradeExpression(indicator.getNumerator());
        String denominator = upgradeExpression(indicator.getDenominator());
        if (numerator != null || denominator != null) {
            indicator.setNumerator(numerator);
            indicator.setDenominator(denominator);
            indicatorService.updateIndicator(indicator);
        }
    }
}
Also used : Indicator(org.hisp.dhis.indicator.Indicator)

Aggregations

Indicator (org.hisp.dhis.indicator.Indicator)23 Test (org.junit.Test)8 DataElement (org.hisp.dhis.dataelement.DataElement)7 IndicatorType (org.hisp.dhis.indicator.IndicatorType)7 OrganisationUnit (org.hisp.dhis.organisationunit.OrganisationUnit)7 ProgramIndicator (org.hisp.dhis.program.ProgramIndicator)7 DhisSpringTest (org.hisp.dhis.DhisSpringTest)5 Period (org.hisp.dhis.period.Period)5 DataSet (org.hisp.dhis.dataset.DataSet)4 ArrayList (java.util.ArrayList)3 DhisConvenienceTest (org.hisp.dhis.DhisConvenienceTest)3 DataElementCategoryOptionCombo (org.hisp.dhis.dataelement.DataElementCategoryOptionCombo)3 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 List (java.util.List)2 Matcher (java.util.regex.Matcher)2 DimensionalItemObject (org.hisp.dhis.common.DimensionalItemObject)2 DimensionalObject (org.hisp.dhis.common.DimensionalObject)2 IndicatorGroupSet (org.hisp.dhis.indicator.IndicatorGroupSet)2 IndicatorValue (org.hisp.dhis.indicator.IndicatorValue)2