← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8197: Removed the aggregated data validation analysis, just does not make sense

 

------------------------------------------------------------
revno: 8197
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2012-09-22 20:42:59 +0200
message:
  Removed the aggregated data validation analysis, just does not make sense
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleServiceTest.java
  dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/RunValidationAction.java
  dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/org/hisp/dhis/validationrule/i18n_module.properties
  dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/dataAnalysisForm.vm
  dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/runValidation.js
  dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/runValidationForm.vm
  dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/viewValidationResultForm.vm


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleService.java	2012-02-01 10:50:31 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleService.java	2012-09-22 18:42:59 +0000
@@ -27,16 +27,14 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import org.hisp.dhis.common.Grid;
+import java.util.Collection;
+import java.util.Date;
+
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
 
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-
 /**
  * @author Margrethe Store
  * @version $Id: ValidationRuleService.java 5434 2008-06-18 18:57:59Z larshelg $
@@ -52,33 +50,6 @@
     // -------------------------------------------------------------------------
 
     /**
-     * Returns a Grid containing the percentage of aggregated violations. Periods
-     * are listed as columns and Sources are listed as rows.
-     */
-    Grid getAggregateValidationResult( Collection<ValidationResult> results, List<Period> periods, List<OrganisationUnit> sources );
-
-    /**
-     * Validates AggregatedDataValues.
-     *
-     * @param startDate the start date.
-     * @param endDate   the end date.
-     * @param sources   a collection of Sources.
-     * @return a collection of ValidationResults for each validation violation.
-     */
-    Collection<ValidationResult> validateAggregate( Date startDate, Date endDate, Collection<OrganisationUnit> sources );
-
-    /**
-     * Validate AggregatedDataValues.
-     *
-     * @param startDate the start date.
-     * @param endDate   the end date.
-     * @param sources   a collection of Sources.
-     * @param group     a group of ValidationRules.
-     * @return a collection of ValidationResults for each validation violation.
-     */
-    public Collection<ValidationResult> validateAggregate( Date startDate, Date endDate, Collection<OrganisationUnit> sources, ValidationRuleGroup group );
-
-    /**
      * Validate DataValues.
      *
      * @param startDate the start date.

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java	2012-09-22 15:04:26 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/validation/DefaultValidationRuleService.java	2012-09-22 18:42:59 +0000
@@ -38,27 +38,20 @@
 import java.util.Collection;
 import java.util.Date;
 import java.util.HashSet;
-import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.commons.lang.StringUtils;
 import org.hisp.dhis.common.GenericIdentifiableObjectStore;
-import org.hisp.dhis.common.Grid;
 import org.hisp.dhis.constant.ConstantService;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementOperand;
-import org.hisp.dhis.dataelement.DataElementService;
 import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.dataset.DataSetService;
 import org.hisp.dhis.datavalue.DataValueService;
 import org.hisp.dhis.expression.ExpressionService;
 import org.hisp.dhis.i18n.I18nService;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.period.Period;
 import org.hisp.dhis.period.PeriodService;
-import org.hisp.dhis.system.grid.ListGrid;
-import org.hisp.dhis.system.util.CompositeCounter;
 import org.hisp.dhis.system.util.Filter;
 import org.hisp.dhis.system.util.FilterUtils;
 import org.springframework.transaction.annotation.Transactional;
@@ -106,20 +99,6 @@
         this.periodService = periodService;
     }
 
-    private DataSetService dataSetService;
-
-    public void setDataSetService( DataSetService dataSetService )
-    {
-        this.dataSetService = dataSetService;
-    }
-
-    private DataElementService dataElementService;
-
-    public void setDataElementService( DataElementService dataElementService )
-    {
-        this.dataElementService = dataElementService;
-    }
-
     private DataValueService dataValueService;
 
     public void setDataValueService( DataValueService dataValueService )
@@ -145,106 +124,6 @@
     // ValidationRule business logic
     // -------------------------------------------------------------------------
 
-    // -------------------------------------------------------------------------
-    // Aggregate TODO remove
-    // -------------------------------------------------------------------------
-
-    public Grid getAggregateValidationResult( Collection<ValidationResult> results, List<Period> periods,
-        List<OrganisationUnit> sources )
-    {
-        int number = validationRuleStore.getCount();
-
-        Grid grid = new ListGrid();
-
-        CompositeCounter counter = new CompositeCounter();
-
-        for ( ValidationResult result : results )
-        {
-            counter.count( result.getPeriod(), result.getSource() );
-        }
-
-        grid.addRow();
-        grid.addValue( StringUtils.EMPTY );
-
-        for ( Period period : periods )
-        {
-            grid.addValue( period.getName() );
-        }
-
-        for ( OrganisationUnit source : sources )
-        {
-            grid.addRow();
-            grid.addValue( source.getName() );
-
-            for ( Period period : periods )
-            {
-                double percentage = (double) (100 * counter.getCount( period, source )) / number;
-
-                grid.addValue( String.valueOf( getRounded( percentage, DECIMALS ) ) );
-            }
-        }
-
-        return grid;
-    }
-
-    public Collection<ValidationResult> validateAggregate( Date startDate, Date endDate,
-        Collection<OrganisationUnit> sources )
-    {
-        Map<Integer, Double> constantMap = constantService.getConstantMap();
-        
-        Collection<Period> periods = periodService.getPeriodsBetweenDates( startDate, endDate );
-
-        Collection<ValidationRule> validationRules = getAllValidationRules();
-        
-        Set<DataElement> dataElements = getDataElementsInValidationRules( validationRules );
-
-        Collection<ValidationResult> validationViolations = new HashSet<ValidationResult>();
-
-        for ( OrganisationUnit source : sources )
-        {
-            for ( Period period : periods )
-            {
-                validationViolations.addAll( validateInternal( period, source, validationRules, dataElements, constantMap, true,
-                    validationViolations.size() ) );
-            }
-        }
-
-        return validationViolations;
-    }
-
-    public Collection<ValidationResult> validateAggregate( Date startDate, Date endDate,
-        Collection<OrganisationUnit> sources, ValidationRuleGroup group )
-    {
-        Map<Integer, Double> constantMap = constantService.getConstantMap();
-        
-        Collection<Period> periods = periodService.getPeriodsBetweenDates( startDate, endDate );
-
-        Collection<DataSet> dataSets = dataSetService.getDataSetsBySources( sources );
-
-        Set<DataElement> dataElements = new HashSet<DataElement>( dataElementService.getDataElementsByDataSets( dataSets ) );
-
-        Collection<ValidationRule> validationRules = getValidationRulesByDataElements( dataElements );
-
-        validationRules.retainAll( group.getMembers() );
-
-        Collection<ValidationResult> validationViolations = new HashSet<ValidationResult>();
-
-        for ( OrganisationUnit source : sources )
-        {
-            for ( Period period : periods )
-            {
-                validationViolations.addAll( validateInternal( period, source, validationRules, dataElements, constantMap, true,
-                    validationViolations.size() ) );
-            }
-        }
-
-        return validationViolations;
-    }
-
-    // -------------------------------------------------------------------------
-    // Regular
-    // -------------------------------------------------------------------------
-
     public Collection<ValidationResult> validate( Date startDate, Date endDate, Collection<OrganisationUnit> sources )
     {
         Map<Integer, Double> constantMap = constantService.getConstantMap();

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2012-09-19 03:00:37 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2012-09-22 18:42:59 +0000
@@ -364,8 +364,6 @@
     <property name="validationRuleGroupStore" ref="org.hisp.dhis.validation.ValidationRuleGroupStore" />
     <property name="expressionService" ref="org.hisp.dhis.expression.ExpressionService" />
     <property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
-    <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
-    <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
 	<property name="constantService" ref="org.hisp.dhis.constant.ConstantService" />
 	<property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
     <property name="i18nService" ref="org.hisp.dhis.i18n.I18nService" />

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleServiceTest.java'
--- dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleServiceTest.java	2012-07-20 11:41:57 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/test/java/org/hisp/dhis/validation/ValidationRuleServiceTest.java	2012-09-22 18:42:59 +0000
@@ -38,17 +38,11 @@
 import static org.hisp.dhis.expression.Operator.less_than;
 import static org.hisp.dhis.expression.Operator.less_than_or_equal_to;
 
-import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
-import java.util.List;
 import java.util.Set;
 
-import org.amplecode.quick.BatchHandler;
-import org.amplecode.quick.BatchHandlerFactory;
 import org.hisp.dhis.DhisTest;
-import org.hisp.dhis.aggregation.AggregatedDataValue;
-import org.hisp.dhis.common.Grid;
 import org.hisp.dhis.dataelement.DataElement;
 import org.hisp.dhis.dataelement.DataElementCategoryCombo;
 import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
@@ -59,7 +53,6 @@
 import org.hisp.dhis.datavalue.DataValueService;
 import org.hisp.dhis.expression.Expression;
 import org.hisp.dhis.expression.ExpressionService;
-import org.hisp.dhis.jdbc.batchhandler.AggregatedDataValueBatchHandler;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
 import org.hisp.dhis.period.MonthlyPeriodType;
@@ -67,7 +60,6 @@
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.period.PeriodType;
 import org.hisp.dhis.system.util.MathUtils;
-import org.junit.Ignore;
 import org.junit.Test;
 
 /**
@@ -77,8 +69,6 @@
 public class ValidationRuleServiceTest
     extends DhisTest
 {
-    private BatchHandlerFactory batchHandlerFactory;
-
     private DataElement dataElementA;
 
     private DataElement dataElementB;
@@ -145,8 +135,6 @@
     public void setUpTest()
         throws Exception
     {
-        batchHandlerFactory = (BatchHandlerFactory) getBean( "batchHandlerFactory" );
-
         validationRuleService = (ValidationRuleService) getBean( ValidationRuleService.ID );
 
         dataElementService = (DataElementService) getBean( DataElementService.ID );
@@ -257,118 +245,6 @@
     // ----------------------------------------------------------------------
 
     @Test
-    public void testGetAggregatedValidationResult()
-    {
-        validationRuleService.saveValidationRule( validationRuleA );
-        validationRuleService.saveValidationRule( validationRuleB );
-        validationRuleService.saveValidationRule( validationRuleC );
-        validationRuleService.saveValidationRule( validationRuleD );
-
-        List<Period> periods = new ArrayList<Period>();
-        periods.add( periodA );
-        periods.add( periodB );
-
-        List<OrganisationUnit> sources = new ArrayList<OrganisationUnit>();
-        sources.add( sourceA );
-        sources.add( sourceB );
-
-        Collection<ValidationResult> results = new HashSet<ValidationResult>();
-
-        results.add( new ValidationResult( periodA, sourceA, validationRuleA, 1, 1 ) );
-        results.add( new ValidationResult( periodA, sourceA, validationRuleB, 1, 1 ) );
-        results.add( new ValidationResult( periodA, sourceA, validationRuleC, 1, 1 ) );
-        results.add( new ValidationResult( periodB, sourceB, validationRuleA, 1, 1 ) );
-        results.add( new ValidationResult( periodB, sourceB, validationRuleB, 1, 1 ) );
-
-        Grid grid = validationRuleService.getAggregateValidationResult( results, periods, sources );
-
-        // First row is Periods, first column in each row is Source
-
-        assertEquals( "75.0", grid.getValue( 1, 1 ) );
-        assertEquals( "0.0", grid.getValue( 1, 2 ) );
-        assertEquals( "0.0", grid.getValue( 2, 1 ) );
-        assertEquals( "50.0", grid.getValue( 2, 2 ) );
-    }
-
-    @Test
-    @Ignore
-    public void testValidateAggregatedDateDateSources()
-    {
-        periodService.addPeriod( periodA );
-        periodService.addPeriod( periodB );
-
-        BatchHandler<AggregatedDataValue> batchHandler = batchHandlerFactory.createBatchHandler(
-            AggregatedDataValueBatchHandler.class ).init();
-
-        batchHandler.addObject( new AggregatedDataValue( dataElementA.getId(), categoryOptionCombo.getId(), periodA
-            .getId(), 0, sourceA.getId(), 0, 1.0 ) );
-        batchHandler.addObject( new AggregatedDataValue( dataElementB.getId(), categoryOptionCombo.getId(), periodA
-            .getId(), 0, sourceA.getId(), 0, 2.0 ) );
-        batchHandler.addObject( new AggregatedDataValue( dataElementC.getId(), categoryOptionCombo.getId(), periodA
-            .getId(), 0, sourceA.getId(), 0, 3.0 ) );
-        batchHandler.addObject( new AggregatedDataValue( dataElementD.getId(), categoryOptionCombo.getId(), periodA
-            .getId(), 0, sourceA.getId(), 0, 4.0 ) );
-
-        batchHandler.addObject( new AggregatedDataValue( dataElementA.getId(), categoryOptionCombo.getId(), periodB
-            .getId(), 0, sourceA.getId(), 0, 1.0 ) );
-        batchHandler.addObject( new AggregatedDataValue( dataElementB.getId(), categoryOptionCombo.getId(), periodB
-            .getId(), 0, sourceA.getId(), 0, 2.0 ) );
-        batchHandler.addObject( new AggregatedDataValue( dataElementC.getId(), categoryOptionCombo.getId(), periodB
-            .getId(), 0, sourceA.getId(), 0, 3.0 ) );
-        batchHandler.addObject( new AggregatedDataValue( dataElementD.getId(), categoryOptionCombo.getId(), periodB
-            .getId(), 0, sourceA.getId(), 0, 4.0 ) );
-
-        batchHandler.addObject( new AggregatedDataValue( dataElementA.getId(), categoryOptionCombo.getId(), periodA
-            .getId(), 0, sourceB.getId(), 0, 1.0 ) );
-        batchHandler.addObject( new AggregatedDataValue( dataElementB.getId(), categoryOptionCombo.getId(), periodA
-            .getId(), 0, sourceB.getId(), 0, 2.0 ) );
-        batchHandler.addObject( new AggregatedDataValue( dataElementC.getId(), categoryOptionCombo.getId(), periodA
-            .getId(), 0, sourceB.getId(), 0, 3.0 ) );
-        batchHandler.addObject( new AggregatedDataValue( dataElementD.getId(), categoryOptionCombo.getId(), periodA
-            .getId(), 0, sourceB.getId(), 0, 4.0 ) );
-
-        batchHandler.addObject( new AggregatedDataValue( dataElementA.getId(), categoryOptionCombo.getId(), periodB
-            .getId(), 0, sourceB.getId(), 0, 1.0 ) );
-        batchHandler.addObject( new AggregatedDataValue( dataElementB.getId(), categoryOptionCombo.getId(), periodB
-            .getId(), 0, sourceB.getId(), 0, 2.0 ) );
-        batchHandler.addObject( new AggregatedDataValue( dataElementC.getId(), categoryOptionCombo.getId(), periodB
-            .getId(), 0, sourceB.getId(), 0, 3.0 ) );
-        batchHandler.addObject( new AggregatedDataValue( dataElementD.getId(), categoryOptionCombo.getId(), periodB
-            .getId(), 0, sourceB.getId(), 0, 4.0 ) );
-
-        batchHandler.flush();
-
-        validationRuleService.saveValidationRule( validationRuleA );
-        validationRuleService.saveValidationRule( validationRuleB );
-        validationRuleService.saveValidationRule( validationRuleC );
-        validationRuleService.saveValidationRule( validationRuleD );
-
-        Collection<ValidationResult> results = validationRuleService.validateAggregate( getDate( 2000, 2, 1 ), getDate(
-            2000, 6, 1 ), sourcesA );
-
-        Collection<ValidationResult> reference = new HashSet<ValidationResult>();
-
-        reference.add( new ValidationResult( periodA, sourceA, validationRuleA, 3.0, -1.0 ) );
-        reference.add( new ValidationResult( periodB, sourceA, validationRuleA, 3.0, -1.0 ) );
-        reference.add( new ValidationResult( periodA, sourceB, validationRuleA, 3.0, -1.0 ) );
-        reference.add( new ValidationResult( periodB, sourceB, validationRuleA, 3.0, -1.0 ) );
-
-        reference.add( new ValidationResult( periodA, sourceA, validationRuleB, -1.0, 4.0 ) );
-        reference.add( new ValidationResult( periodB, sourceA, validationRuleB, -1.0, 4.0 ) );
-        reference.add( new ValidationResult( periodA, sourceB, validationRuleB, -1.0, 4.0 ) );
-        reference.add( new ValidationResult( periodB, sourceB, validationRuleB, -1.0, 4.0 ) );
-
-        for ( ValidationResult result : results )
-        {
-            assertFalse( MathUtils.expressionIsTrue( result.getLeftsideValue(), result.getValidationRule()
-                .getOperator(), result.getRightsideValue() ) );
-        }
-
-        assertEquals( results.size(), 8 );
-        assertEquals( reference, results );
-    }
-
-    @Test
     public void testValidateDateDateSources()
     {
         dataValueService.addDataValue( createDataValue( dataElementA, periodA, sourceA, "1", categoryOptionCombo ) );

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/RunValidationAction.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/RunValidationAction.java	2012-07-20 11:41:57 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/RunValidationAction.java	2012-09-22 18:42:59 +0000
@@ -38,8 +38,6 @@
 import org.hisp.dhis.i18n.I18nFormat;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.period.Period;
-import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.util.SessionUtils;
 import org.hisp.dhis.validation.ValidationResult;
 import org.hisp.dhis.validation.ValidationRuleGroup;
@@ -84,13 +82,6 @@
     {
         this.organisationUnitService = organisationUnitService;
     }
-
-    private PeriodService periodService;
-
-    public void setPeriodService( PeriodService periodService )
-    {
-        this.periodService = periodService;
-    }
     
     // -------------------------------------------------------------------------
     // Input/output
@@ -148,18 +139,6 @@
         return aggregateResults;
     }
 
-    private boolean aggregate;
-
-    public boolean isAggregate()
-    {
-        return aggregate;
-    }
-
-    public void setAggregate( boolean aggregate )
-    {
-        this.aggregate = aggregate;
-    }
-    
     private boolean maxExceeded;
 
     public boolean isMaxExceeded()
@@ -182,54 +161,23 @@
     {
         organisationUnit = organisationUnitService.getOrganisationUnit( organisationUnitId );
         
-        if ( aggregate ) // Aggregate data source
+        Collection<OrganisationUnit> organisationUnits = organisationUnitService.getOrganisationUnitWithChildren( organisationUnit.getId() );
+
+        if ( validationRuleGroupId == -1 )
         {
-            List<OrganisationUnit> organisationUnits = new ArrayList<OrganisationUnit>( organisationUnit.getChildren() );
-
-            List<Period> periods = new ArrayList<Period>( periodService.namePeriods( 
-                periodService.getPeriodsBetweenDates( format.parseDate( startDate ), format.parseDate( endDate ) ), format ) );
-            
-            log.info( "Number of periods: " + periods.size() + ", number of organisation units: " + organisationUnits.size() );
-                        
-            if ( validationRuleGroupId == -1 )
-            {
-                log.info( "Validating aggregate data for all rules" );
-
-                validationResults = new ArrayList<ValidationResult>( validationRuleService.validateAggregate( format
-                    .parseDate( startDate ), format.parseDate( endDate ), organisationUnits ) );
-            }
-            else
-            {
-                ValidationRuleGroup group = validationRuleService.getValidationRuleGroup( validationRuleGroupId );
-
-                log.info( "Validating aggregate data for rules for group: '" + group.getName() + "'" );
-
-                validationResults = new ArrayList<ValidationResult>( validationRuleService.validateAggregate( format
-                    .parseDate( startDate ), format.parseDate( endDate ), organisationUnits, group ) );
-            }
-            
-            aggregateResults = validationRuleService.getAggregateValidationResult( validationResults, periods, organisationUnits );
+            log.info( "Validating captured data for all rules" );
+
+            validationResults = new ArrayList<ValidationResult>( validationRuleService.validate( format
+                .parseDate( startDate ), format.parseDate( endDate ), organisationUnits ) );
         }
-        else // Captured data source
+        else
         {
-            Collection<OrganisationUnit> organisationUnits = organisationUnitService.getOrganisationUnitWithChildren( organisationUnit.getId() );
-
-            if ( validationRuleGroupId == -1 )
-            {
-                log.info( "Validating captured data for all rules" );
-    
-                validationResults = new ArrayList<ValidationResult>( validationRuleService.validate( format
-                    .parseDate( startDate ), format.parseDate( endDate ), organisationUnits ) );
-            }
-            else
-            {
-                ValidationRuleGroup group = validationRuleService.getValidationRuleGroup( validationRuleGroupId );
-    
-                log.info( "Validating captured data for rules for group: '" + group.getName() + "'" );
-    
-                validationResults = new ArrayList<ValidationResult>( validationRuleService.validate( format
-                    .parseDate( startDate ), format.parseDate( endDate ), organisationUnits, group ) );
-            }
+            ValidationRuleGroup group = validationRuleService.getValidationRuleGroup( validationRuleGroupId );
+
+            log.info( "Validating captured data for rules for group: '" + group.getName() + "'" );
+
+            validationResults = new ArrayList<ValidationResult>( validationRuleService.validate( format
+                .parseDate( startDate ), format.parseDate( endDate ), organisationUnits, group ) );
         }
 
         maxExceeded = validationResults.size() > ValidationRuleService.MAX_VIOLATIONS;

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/META-INF/dhis/beans.xml	2012-07-25 13:18:48 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/META-INF/dhis/beans.xml	2012-09-22 18:42:59 +0000
@@ -191,9 +191,6 @@
     <property name="organisationUnitService">
       <ref bean="org.hisp.dhis.organisationunit.OrganisationUnitService" />
     </property>
-    <property name="periodService">
-      <ref bean="org.hisp.dhis.period.PeriodService" />
-    </property>
   </bean>
 
   <bean id="org.hisp.dhis.validationrule.action.GetValidationResultDetailsAction" class="org.hisp.dhis.validationrule.action.GetValidationResultDetailsAction"

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/org/hisp/dhis/validationrule/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/org/hisp/dhis/validationrule/i18n_module.properties	2012-07-26 11:14:41 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/org/hisp/dhis/validationrule/i18n_module.properties	2012-09-22 18:42:59 +0000
@@ -123,4 +123,5 @@
 max_values_exceeded=More than 500 values found, please fix the violations or narrow the search to see all
 specify_dataset=Please specify data sets
 analysing_please_wait=Analysing data, please wait
-skip_for_missing_values=Skip for missing values
\ No newline at end of file
+skip_for_missing_values=Skip for missing values
+select_parameters=Select parameters
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/dataAnalysisForm.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/dataAnalysisForm.vm	2012-07-26 09:59:38 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/dataAnalysisForm.vm	2012-09-22 18:42:59 +0000
@@ -77,7 +77,7 @@
 
 <table>
 	<tr>
-		<th colspan="2" style="min-width:325px">$i18n.getString( "select_parent_organisation_unit" )</th>
+		<th colspan="2">$i18n.getString( "select_parent_organisation_unit" )</th>
 	</tr>
 	<tr>
 		<td colspan="2">

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/runValidation.js'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/runValidation.js	2012-07-26 08:45:54 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/runValidation.js	2012-09-22 18:42:59 +0000
@@ -45,21 +45,6 @@
     return false;
 }
 
-function drillDownValidation( orgUnitId )
-{
-    setHeaderWaitMessage( i18n_analysing_please_wait );
-
-    var url = 'runValidationAction.action?organisationUnitId=' + orgUnitId + '&startDate=' + startDate + '&endDate='
-            + endDate + '&validationRuleGroupId=' + validationRuleGroupId + '&aggregate=' + aggregate;
-
-    $.get( url, function( data )
-    {
-        hideHeaderMessage();
-        $( "div#analysisResult" ).html( data );
-        setTableStyles();
-    } );
-}
-
 function displayValidationDetailsDialog()
 {
 	$( '#validationResultDetailsDiv' ).dialog( {
@@ -78,44 +63,6 @@
 	);
 }
 
-function aggregateChanged()
-{
-    var aggregate = getListValue( 'aggregate' );
-
-    if ( aggregate == 'true' )
-    {
-        $( 'span#info' ).html( i18n_aggregate_data_info );
-    } else
-    {
-        $( 'span#info' ).html( i18n_captured_data_info );
-    }
-}
-
-function showAggregateResults()
-{
-    $( 'div#validationResults' ).hide();
-    $( 'div#aggregateResults' ).show();
-    var button = document.getElementById( "resultTypeButton" );
-    button.onclick = function()
-    {
-        showValidationResults();
-    };
-    button.value = "See validation";
-}
-
-function showValidationResults()
-{
-    $( 'div#aggregateResults' ).hide();
-    $( 'div#validationResults' ).show();
-
-    var button = document.getElementById( "resultTypeButton" );
-    button.onclick = function()
-    {
-        showAggregateResults();
-    };
-    button.value = "See statistics";
-}
-
 function exportValidationResult( type )
 {
     var url = 'exportValidationResult.action?type=' + type + 

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/runValidationForm.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/runValidationForm.vm	2012-07-26 08:45:54 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/runValidationForm.vm	2012-09-22 18:42:59 +0000
@@ -18,6 +18,9 @@
 <div id="analysisInput">
 
 <table>
+	<tr>
+		<th colspan="2">$i18n.getString( 'select_parameters' )</th>
+	</tr>
     <tr>
     	<td>
         	<label for="startDate">$i18n.getString( 'start_date' )</label>
@@ -48,22 +51,14 @@
     	</td>
     </tr>
     <tr>
-    	<td>
-    		<label for="aggregate">$i18n.getString( "data_source" )</label>
-	    </td>
-	    <td>
-	    	<select id="aggregate" name="aggregate" style="width:20em" onchange="aggregateChanged()">
-	    		<option value="false" selected="selected">$i18n.getString( "use_captured_data" )</option>
-	    		<option value="true">$i18n.getString( "use_aggregated_data" )</option>
-	    	</select>
-    	</td>
+    	<td colspan="2" style="height:20px"></td>
     </tr>
     <tr>
-    	<td colspan="2"><span id="info">$i18n.getString( "captured_data_info" )</span></td>
+        <th colspan="2">$i18n.getString( "select_parent_organisation_unit" )</th>
     </tr>
     <tr>
         <td colspan="2">
-    		<div id="selectionTree" style="width:35em;height:350px;overflow:auto;border:1px solid #cccccc"></div>
+    		<div id="selectionTree" style="width:400px;height:260px;overflow:auto;border:1px solid #cccccc"></div>
     	</td>
     </tr>
     <tr>

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/viewValidationResultForm.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/viewValidationResultForm.vm	2011-09-08 17:31:21 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/viewValidationResultForm.vm	2012-09-22 18:42:59 +0000
@@ -16,24 +16,21 @@
 	    <col width="150">
         <col width="150">
         <col width="150">
-        <col width="150">
 	</colgroup>
 	<tr>
 		<td>$i18n.getString( "start_date" ):</td>
 		<td>$startDate</td>
 		<td><input type="button" value="$i18n.getString( 'get_report_as_pdf' )" style="width:140px" onclick="exportValidationResult( 'pdf' )"></td>
 		<td><input type="button" value="$i18n.getString( 'get_report_as_xls' )" style="width:140px" onclick="exportValidationResult( 'xls' )"></td>
-		<td>#if( $aggregate )<input id="resultTypeButton" type="button" value="$i18n.getString( 'see_statistics' )" style="width:140px" onclick="showAggregateResults()">#end</td>
     </tr>
 	<tr>
 		<td>$i18n.getString( "end_date" ):</td>
 		<td>$endDate</td>
 		<td><input type="button" value="$i18n.getString( 'get_report_as_csv' )" style="width:140px" onclick="exportValidationResult( 'csv' )"></td>
 		<td><input name="button" type="button" style="width:140px" onclick="window.location.href='showRunValidationForm.action'" value="$i18n.getString( 'done' )"></td>
-		<td></td>
 	</tr>
 	<tr>
-		<td colspan="5" height="15"></td>
+		<td colspan="4" height="15"></td>
 	</tr>
 </table>
 
@@ -77,7 +74,7 @@
 	<tbody>
 		#foreach( $result in $validationResults )
 		<tr id="tr${result.id}">
-		  <td#if( $aggregate ) style="cursor:pointer" onclick="drillDownValidation( '$!result.source.id' )"#end>$!result.source.name</td>
+		  <td>$!result.source.name</td>
 		  <td>$!format.formatPeriod( $result.period )</td>
 		  <td>$!result.validationRule.leftSide.description</td>
 		  <td>$!result.leftsideValue</td>
@@ -96,34 +93,6 @@
 
 </div>
 
-<div id="aggregateResults" style="display:none">
-
-#if( $aggregate )
-	
-<table class="listTable" style="width:100%">
-	<thead>
-		#foreach( $col in $aggregateResults.getRow( 0 ) )
-		<th>$col</th>
-		#end
-	</thead>
-	<tbody>
-		#set( $lastIndex = $aggregateResults.rows.size() - 1 )
-		#foreach( $row in $aggregateResults.rows )
-		#if ( $velocityCount <= $lastIndex )
-		<tr style="height:32px">
-			#foreach( $col in $aggregateResults.getRow( $velocityCount ) )
-			<td>$col</td>
-			#end
-		</tr>
-		#end
-		#end
-	</tbody>
-</table>
-
-#end
-
-</div>
-
 #end
 
 <div id="validationResultDetailsDiv" class="page"></div>