← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1375: Completed validation in dataentry

 

------------------------------------------------------------
revno: 1375
committer: Lars Helge Oeverland <larshelge@xxxxxxxxx>
branch nick: trunk
timestamp: Fri 2010-01-29 18:10:33 +0100
message:
  Completed validation in dataentry
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/META-INF/dhis/beans.xml
  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 13:22:17 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/ValidationAction.java	2010-01-29 17:10:33 +0000
@@ -33,6 +33,7 @@
 import java.util.List;
 import java.util.Map;
 
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.hisp.dhis.dataanalysis.DataAnalysisService;
@@ -100,6 +101,13 @@
         this.stdDevOutlierAnalysisService = stdDevOutlierAnalysisService;
     }
 
+    private DataAnalysisService minMaxOutlierAnalysisService;
+
+    public void setMinMaxOutlierAnalysisService( DataAnalysisService minMaxOutlierAnalysisService )
+    {
+        this.minMaxOutlierAnalysisService = minMaxOutlierAnalysisService;
+    }
+
     // -------------------------------------------------------------------------
     // Output
     // -------------------------------------------------------------------------
@@ -136,6 +144,7 @@
     // Action implementation
     // -------------------------------------------------------------------------
 
+    @SuppressWarnings( "unchecked" )
     public String execute()
         throws Exception
     {
@@ -170,8 +179,14 @@
             }
         }
         
-        dataValues = stdDevOutlierAnalysisService.analyse( orgUnit, dataSet.getDataElements(), ListUtils.getCollection( period ), STD_DEV );
+        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;

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml	2010-01-29 13:22:17 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml	2010-01-29 17:10:33 +0000
@@ -294,6 +294,7 @@
 		<property name="selectedStateManager" ref="org.hisp.dhis.de.state.SelectedStateManager" />
 		<property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
 		<property name="stdDevOutlierAnalysisService" ref="org.hisp.dhis.dataanalysis.StdDevOutlierAnalysisService"/>
+        <property name="minMaxOutlierAnalysisService" ref="org.hisp.dhis.dataanalysis.MinMaxOutlierAnalysisService"/>
 	</bean>
 	
 	<bean id="org.hisp.dhis.de.action.MarkForFollowupAction" class="org.hisp.dhis.de.action.MarkForFollowupAction">

=== 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-01-29 09:39:22 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties	2010-01-29 17:10:33 +0000
@@ -114,3 +114,5 @@
 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 13:22:17 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/validationResult.vm	2010-01-29 17:10:33 +0000
@@ -20,7 +20,7 @@
             #set ( $leftFormula = $leftsideFormulaMap.get( $id ) )
             #set ( $rightFormula = $rightsideFormulaMap.get( $id ) )
             <tr>
-                <td#alternate( $mark )>$encoder.htmlEncode( $result.validationRule.name )</td>
+                <td style="height:32px"#alternate( $mark )>$encoder.htmlEncode( $result.validationRule.name )</td>
                 <td#alternate( $mark )>$leftFormula $result.validationRule.operator $rightFormula</td>
                 <td#alternate( $mark )>$!encoder.htmlEncode( $result.validationRule.leftSide.description )</td>
                 <td#alternate( $mark )>$result.leftsideValue</td>
@@ -37,4 +37,34 @@
     </table>            
 #end
 
+<br>
+
+#if( $dataValues.size() == 0 )
+	<p><b>$encoder.htmlEncode( $i18n.getString( "no_outlier_values_found" ) )</b></p>
+#else
+    <p><b>$encoder.htmlEncode( $i18n.getString( "the_following_values_are_outliers" ) )</b></p>
+    <table class="listTable" style="width:100%">
+	    <tr>
+	        <th>$i18n.getString( "data_element" )</th>
+	        <th style="text-align:center">$i18n.getString( "min" )</th>
+	        <th style="width: 100px; text-align:center">$i18n.getString( "value" )</th>
+	        <th style="text-align:center">$i18n.getString( "max" )</th>
+	    </tr>
+	    #set( $mark = false )	    
+	    #foreach( $value in $dataValues ) 
+	    <tr>	    
+	        <td style="height:32px"#alternate( $mark )>$value.dataElementName $value.categoryOptionComboNameParsed</td>	        
+	        <td style="text-align:center"#alternate( $mark )>$value.min</td>	        
+	        <td style="text-align:center;width:100px"#alternate( $mark )>$value.value</td>	        
+	        <td style="text-align:center"#alternate( $mark )>$value.max</td>
+	    </tr>
+        #if( $mark )
+            #set( $mark = false )
+        #else
+            #set( $mark = true )
+        #end
+	    #end
+	</table>
+#end
+
 <p><input type="button" value="$encoder.htmlEncode( $i18n.getString( "close" ) )" style="width:10em" onclick="window.close()"></p>