← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1647: Improved data entry validation template

 

------------------------------------------------------------
revno: 1647
committer: Lars Helge Oeverland <larshelge@xxxxxxxxx>
branch nick: trunk
timestamp: Mon 2010-03-15 13:08:51 +0100
message:
  Improved data entry validation template
modified:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/ValidationAction.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/validationResult.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-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/ValidationAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/ValidationAction.java	2010-01-29 17:10:33 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/ValidationAction.java	2010-03-15 12:08:51 +0000
@@ -53,6 +53,7 @@
 
 /**
  * @author Margrethe Store
+ * @author Lars Helge Overland
  * @version $Id: ValidationAction.java 5426 2008-06-16 04:33:05Z larshelg $
  */
 public class ValidationAction
@@ -157,15 +158,29 @@
 
         DataSet dataSet = selectedStateManager.getSelectedDataSet();
 
+        // ---------------------------------------------------------------------
+        // Min-max and outlier analysis
+        // ---------------------------------------------------------------------
+
+        Collection<DeflatedDataValue> stdDevs = stdDevOutlierAnalysisService.
+            analyse( orgUnit, dataSet.getDataElements(), ListUtils.getCollection( period ), STD_DEV );
+
+        Collection<DeflatedDataValue> minMaxs = minMaxOutlierAnalysisService.
+            analyse( orgUnit, dataSet.getDataElements(), ListUtils.getCollection( period ), null );
+        
+        dataValues = CollectionUtils.union( stdDevs, minMaxs );
+        
+        log.info( "Number of outlier values: " + dataValues.size() );
+
+        // ---------------------------------------------------------------------
+        // Validation rule analysis
+        // ---------------------------------------------------------------------
+
         results = new ArrayList<ValidationResult>( validationRuleService.validate( dataSet, period, orgUnit ) );
 
         log.info( "Number of validation violations: " + results.size() );
-        
-        if ( results.size() == 0 )
-        {
-            return NONE;
-        }
-        else
+                
+        if ( results.size()> 0 )
         {
             leftsideFormulaMap = new HashMap<Integer, String>( results.size() );
             rightsideFormulaMap = new HashMap<Integer, String>( results.size() );
@@ -179,16 +194,6 @@
             }
         }
         
-        Collection<DeflatedDataValue> stdDevs = stdDevOutlierAnalysisService.
-            analyse( orgUnit, dataSet.getDataElements(), ListUtils.getCollection( period ), STD_DEV );
-
-        Collection<DeflatedDataValue> minMaxs = minMaxOutlierAnalysisService.
-            analyse( orgUnit, dataSet.getDataElements(), ListUtils.getCollection( period ), null );
-        
-        dataValues = CollectionUtils.union( stdDevs, minMaxs );
-        
-        log.info( "Number of outlier values: " + dataValues.size() );
-        
-        return SUCCESS;
+        return dataValues.size() == 0 && results.size() == 0 ? NONE : SUCCESS;
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties	2010-03-11 10:42:29 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties	2010-03-15 12:08:51 +0000
@@ -78,10 +78,12 @@
 run_validation						= Run validation
 validation_result					= Validation Result
 expression							= Expression
-successful_validation				= The values successfully passed validation.
+successful_validation				= The data entry screen successfully passed validation
+unsuccessful_validation				= The data entry screen has validation errors, please fix these errors before proceeding
+the_following_values_violates_rules = The following values violates validation rules
+the_following_values_are_outliers   = The following values are considered as outliers (min-max or std dev)
 value								= Value
 operator							= Operator
-unsuccessful_validation				= The following values did not pass validation.
 right_description					= Right Description
 left_description					= Left Description
 description							= Description
@@ -114,5 +116,4 @@
 followup							= Follow-up
 interpolation						= Interpolation
 validation_rule						= Validation rule
-the_following_values_are_outliers   = The following values are considered as outliers (min-max or std dev).
 no_outlier_values_found				= No outlier values found.
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/validationResult.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/validationResult.vm	2010-01-29 17:10:33 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/validationResult.vm	2010-03-15 12:08:51 +0000
@@ -1,9 +1,13 @@
 <h3>$encoder.htmlEncode( $i18n.getString( "validation_result" ) )</h3>
 
-#if( $results.size() == 0)
+#if( $results.size() == 0 && $dataValues.size() == 0 )  
     <p><b>$encoder.htmlEncode( $i18n.getString( "successful_validation" ) )</b></p>
 #else
     <p><b>$encoder.htmlEncode( $i18n.getString( "unsuccessful_validation" ) )</b></p>
+#end
+
+#if( $results.size() > 0)
+    <p><b>$encoder.htmlEncode( $i18n.getString( "the_following_values_violates_rules" ) )</b></p>
     <table class="listTable" width="100%">
         <tr>
             <th style="width:110px">$encoder.htmlEncode( $i18n.getString( "validation_rule" ) )</th>                
@@ -34,14 +38,10 @@
             #set( $mark = true )
         #end
         #end
-    </table>            
+    </table><br>       
 #end
 
-<br>
-
-#if( $dataValues.size() == 0 )
-	<p><b>$encoder.htmlEncode( $i18n.getString( "no_outlier_values_found" ) )</b></p>
-#else
+#if( $dataValues.size() > 0 )
     <p><b>$encoder.htmlEncode( $i18n.getString( "the_following_values_are_outliers" ) )</b></p>
     <table class="listTable" style="width:100%">
 	    <tr>