dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #03831
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1272: Made part of the outlier analysis code general. Preparing grounds for reusing the code for follow...
------------------------------------------------------------
revno: 1272
committer: Lars Helge Oeverland <larshelge@xxxxxxxxx>
branch nick: trunk
timestamp: Wed 2009-12-23 14:24:39 +0100
message:
Made part of the outlier analysis code general. Preparing grounds for reusing the code for follow-up analysis and gap analysis:
renamed:
dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/outlieranalysis/EditOutlierAction.java => dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/EditDataValueAction.java
dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/outlierAnalysisEditValue.js => dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/editDataValue.js
dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/outlierSearchResult.vm => dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/searchResult.vm
modified:
dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/outlieranalysis/GetOutliersAction.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/resources/struts.xml
dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/EditDataValueAction.java
dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/editDataValue.js
dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/searchResult.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.
=== renamed file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/outlieranalysis/EditOutlierAction.java' => 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/EditDataValueAction.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/outlieranalysis/EditOutlierAction.java 2009-11-25 16:25:53 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/EditDataValueAction.java 2009-12-23 13:24:39 +0000
@@ -1,4 +1,4 @@
-package org.hisp.dhis.validationrule.action.outlieranalysis;
+package org.hisp.dhis.validationrule.action;
/*
* Copyright (c) 2004-${year}, University of Oslo
@@ -27,6 +27,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.dataelement.DataElementCategoryService;
@@ -49,9 +51,11 @@
* @author Jon Moen Drange
*
*/
-public class EditOutlierAction
+public class EditDataValueAction
implements Action
{
+ private static final Log log = LogFactory.getLog( EditDataValueAction.class );
+
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
@@ -203,6 +207,8 @@
statusCode = 0;
message = "";
+ log.info( "Updated data value: " + value );
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/outlieranalysis/GetOutliersAction.java'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/outlieranalysis/GetOutliersAction.java 2009-12-23 12:09:02 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/java/org/hisp/dhis/validationrule/action/outlieranalysis/GetOutliersAction.java 2009-12-23 13:24:39 +0000
@@ -113,16 +113,11 @@
}
// -------------------------------------------------------------------------
- // Input & Output
+ // Input
// -------------------------------------------------------------------------
private String toDateString;
- public String getToDate()
- {
- return toDateString;
- }
-
public void setToDate( String toDate )
{
this.toDateString = toDate.trim();
@@ -130,20 +125,11 @@
private String fromDateString;
- public String getFromDate()
- {
- return fromDateString;
- }
-
public void setFromDate( String fromDate )
{
this.fromDateString = fromDate.trim();
}
- // -------------------------------------------------------------------------
- // Input
- // -------------------------------------------------------------------------
-
private String dataSetId;
public void setDataset( String dataSet )
@@ -176,18 +162,11 @@
// Output
// -------------------------------------------------------------------------
- private Collection<DeflatedDataValue> outlierValues;
-
- public Collection<DeflatedDataValue> getOutlierValues()
- {
- return outlierValues;
- }
-
- private long searchTime;
-
- public long getSearchTime()
- {
- return searchTime;
+ private Collection<DeflatedDataValue> dataValues;
+
+ public Collection<DeflatedDataValue> getDataValues()
+ {
+ return dataValues;
}
// -------------------------------------------------------------------------
@@ -196,8 +175,6 @@
public String execute()
{
- long startTime = System.currentTimeMillis();
-
Collection<DataElement> dataElements = dataElementService.getDataElements( ConversionUtils.getIntegerCollection( dataElementsById ) );
OrganisationUnit organisationUnit = selectionTreeManager.getSelectedOrganisationUnit();
@@ -211,7 +188,6 @@
{
Date epoch = new Date( 0 );
fromDate = epoch;
- fromDateString = "earliest";
}
else
{
@@ -221,7 +197,6 @@
if ( toDateString == null || toDateString.trim().length() == 0 )
{
toDate = new Date();
- toDateString = "now";
}
else
{
@@ -232,19 +207,17 @@
if ( outlierType.equals( TYPE_MINMAX ) )
{
- outlierValues = minMaxOutlierAnalysisService.findOutliers( organisationUnit, dataElements, periods, null );
+ dataValues = minMaxOutlierAnalysisService.findOutliers( organisationUnit, dataElements, periods, null );
}
else if ( outlierType.equals( TYPE_STDDEV ) )
{
- outlierValues = stdDevOutlierAnalysisService.findOutliers( organisationUnit, dataElements, periods, standardDeviation );
+ dataValues = stdDevOutlierAnalysisService.findOutliers( organisationUnit, dataElements, periods, standardDeviation );
}
else
{
return ERROR;
}
- searchTime = System.currentTimeMillis() - startTime;
-
return SUCCESS;
}
}
=== 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 2009-12-23 07:35:17 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/META-INF/dhis/beans.xml 2009-12-23 13:24:39 +0000
@@ -271,8 +271,8 @@
ref="org.hisp.dhis.dataset.DataSetService"/>
</bean>
- <bean id="org.hisp.dhis.validationrule.action.outlieranalysis.EditOutlierAction"
- class="org.hisp.dhis.validationrule.action.outlieranalysis.EditOutlierAction"
+ <bean id="org.hisp.dhis.validationrule.action.EditDataValueAction"
+ class="org.hisp.dhis.validationrule.action.EditDataValueAction"
scope="prototype">
<property name="dataValueService"
ref="org.hisp.dhis.datavalue.DataValueService" />
=== 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 2009-12-17 09:05:15 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/org/hisp/dhis/validationrule/i18n_module.properties 2009-12-23 13:24:39 +0000
@@ -134,8 +134,8 @@
waiting_for_user_to_choose_dataset = Waiting for user to select a data set
select_parent_organisation_unit = Select parent organisation unit
outlier_analysis = Outlier Analysis
-outlier_analysis_search_result = Search result for outlier analysis
-no_outlier_values_found = No outlier values found
+search_result = Search result
+no_values_found = No values found
intro_validation_rule = Add, modify, view and delete validation rules. A validation rule defines certain criterias. Anomalies can be discovered by running validation rules against the data.
intro_validation_rule_group = Add, modify, view and delete validation rule groups. Provides the ability to group and run validation rules together.
intro_run_validation = Run validation rules in order to unveil anomalies and errors in the data in the database.
=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/struts.xml 2009-12-23 07:35:17 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/struts.xml 2009-12-23 13:24:39 +0000
@@ -211,12 +211,12 @@
<action name="searchOutlierResult" class="org.hisp.dhis.validationrule.action.outlieranalysis.GetOutliersAction">
<result name="success" type="velocity">/main.vm</result>
- <param name="page">/dhis-web-validationrule/outlierSearchResult.vm</param>
+ <param name="page">/dhis-web-validationrule/searchResult.vm</param>
<param name="menu">/dhis-web-validationrule/menu.vm</param>
- <param name="javascripts">javascript/outlierAnalysisEditValue.js</param>
+ <param name="javascripts">javascript/editDataValue.js</param>
</action>
- <action name="editOutlier" class="org.hisp.dhis.validationrule.action.outlieranalysis.EditOutlierAction">
+ <action name="editDataValue" class="org.hisp.dhis.validationrule.action.EditDataValueAction">
<result name="success" type="velocity">responseStatus.vm</result>
<result name="error" type="velocity">responseStatus.vm</result>
</action>
=== renamed file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/outlierAnalysisEditValue.js' => 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/editDataValue.js'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/outlierAnalysisEditValue.js 2009-12-23 07:35:17 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/editDataValue.js 2009-12-23 13:24:39 +0000
@@ -1,21 +1,12 @@
-/**
- * @author Jon Moen Drange
- *
- * Javascript file for outlier analysis web UI - update outlier value.
- * Included in outlierSearchResult: updates a outlier value by sending
- * AJAX requests to the server on-the-fly when an user has updated a
- * outlier value.
- *
- */
-function editOutlierValue( outlierId )
+function editValue( valueId )
{
- var field = document.getElementById( 'outlier[' + outlierId + '].value' );
+ var field = document.getElementById( 'value[' + valueId + '].value' );
- var dataElementId = document.getElementById( 'outlier[' + outlierId + '].dataElement' ).value;
- var categoryOptionComboId = document.getElementById( 'outlier[' + outlierId + '].categoryOptionCombo' ).value;
- var periodId = document.getElementById( 'outlier[' + outlierId + '].period' ).value;
- var sourceId = document.getElementById( 'outlier[' + outlierId + '].source' ).value;
+ var dataElementId = document.getElementById( 'value[' + valueId + '].dataElement' ).value;
+ var categoryOptionComboId = document.getElementById( 'value[' + valueId + '].categoryOptionCombo' ).value;
+ var periodId = document.getElementById( 'value[' + valueId + '].period' ).value;
+ var sourceId = document.getElementById( 'value[' + valueId + '].source' ).value;
if ( field.value != '' )
{
@@ -30,8 +21,8 @@
}
else
{
- var minString = document.getElementById('outlier[' + outlierId + '].min').value;
- var maxString = document.getElementById('outlier[' + outlierId + '].max').value;
+ var minString = document.getElementById('value[' + valueId + '].min').value;
+ var maxString = document.getElementById('value[' + valueId + '].max').value;
var min = new Number( minString );
var max = new Number( maxString );
@@ -39,7 +30,7 @@
if ( value < min )
{
- var valueSaver = new ValueSaver( dataElementId, periodId, sourceId, categoryOptionComboId, field.value, outlierId, '#ffcccc' );
+ var valueSaver = new ValueSaver( dataElementId, periodId, sourceId, categoryOptionComboId, field.value, valueId, '#ffcccc' );
valueSaver.save();
alert( "Value is still lower than the lower boundary." );
@@ -48,7 +39,7 @@
if ( value > max )
{
- var valueSaver = new ValueSaver( dataElementId, periodId, sourceId, categoryOptionComboId, field.value, outlierId, '#ffcccc' );
+ var valueSaver = new ValueSaver( dataElementId, periodId, sourceId, categoryOptionComboId, field.value, valueId, '#ffcccc' );
valueSaver.save();
alert( "Value is still higher than the upper boundary." );
@@ -57,7 +48,7 @@
}
}
- var valueSaver = new ValueSaver( dataElementId, periodId, sourceId, categoryOptionComboId, field.value, outlierId, '#ccffcc', '');
+ var valueSaver = new ValueSaver( dataElementId, periodId, sourceId, categoryOptionComboId, field.value, valueId, '#ccffcc', '');
valueSaver.save();
}
@@ -79,7 +70,7 @@
// Saver object (modified version of dataentry/javascript/general.js)
//-----------------------------------------------------------------------------
-function ValueSaver( dataElementId_, periodId_, sourceId_, categoryOptionComboId_, value_, outlierId_, resultColor_, selectedOption_ )
+function ValueSaver( dataElementId_, periodId_, sourceId_, categoryOptionComboId_, value_, valueId_, resultColor_, selectedOption_ )
{
var SUCCESS = '#ccffcc';
var ERROR = '#ccccff';
@@ -89,7 +80,7 @@
var sourceId = sourceId_;
var categoryOptionComboId = categoryOptionComboId_;
var value = value_;
- var outlierId = outlierId_;
+ var valueId = valueId_;
var resultColor = resultColor_;
var selecteOption = selectedOption_;
@@ -99,7 +90,7 @@
request.setCallbackSuccess( handleResponse );
request.setCallbackError( handleHttpError );
request.setResponseTypeXML( 'status' );
- request.send( 'editOutlier.action?'
+ request.send( 'editDataValue.action?'
+ 'dataElementId=' + dataElementId
+ '&periodId=' + periodId
+ '&organisationUnitId=' + sourceId
@@ -131,7 +122,7 @@
function markValue( color )
{
- var element = document.getElementById( 'outlier[' + outlierId + '].value' );
+ var element = document.getElementById( 'value[' + valueId + '].value' );
element.style.backgroundColor = color;
}
}
=== renamed file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/outlierSearchResult.vm' => 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/searchResult.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/outlierSearchResult.vm 2009-12-23 12:09:02 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/searchResult.vm 2009-12-23 13:24:39 +0000
@@ -1,17 +1,13 @@
-<h3>$i18n.getString( "outlier_analysis_search_result" )</h3>
-
-#if ( $outlierValues.size() == 0 )
-
-<span id="info">$i18n.getString( "no_outlier_values_found" ) ($searchTime ms).</span>
+<h3>$i18n.getString( "search_result" )</h3>
+
+#if ( $dataValues.size() == 0 )
+
+<span id="info">$i18n.getString( "no_values_found" )</span>
-<p><strong>$i18n.getString( "from_date" ):</strong> $fromDate <strong>$i18n.getString( "to_date" ):</strong> $toDate</p>
-
#else
-<span id="info">$outlierValues.size() $i18n.getString( "values_found" ) ($searchTime ms).</span>
-
-<p><strong>$i18n.getString( "from_date" ):</strong> $fromDate <strong>$i18n.getString( "to_date" ):</strong> $toDate</p>
+<span id="info">$dataValues.size() $i18n.getString( "values_found" )</span>
<table class="mainPageTable" cellpadding="0">
<tr>
@@ -25,7 +21,7 @@
#set( $count = 0 )
#set( $mark = 0 )
- #foreach( $outlierValue in $outlierValues )
+ #foreach( $value in $dataValues )
#if( $mark == 1 )
#set( $mark = 0 )
@@ -38,41 +34,41 @@
## data element
<td>
- <span id="outlier[$count].name">
- $outlierValue.dataElementName
+ <span id="value[$count].name">
+ $value.dataElementName
</span>
</td>
## organisation unit
<td>
- $outlierValue.sourceName
+ $value.sourceName
</td>
## period
<td>
- $format.formatPeriod( $outlierValue.period )
+ $format.formatPeriod( $value.period )
</td>
## lower bound (min)
<td>
- <div style="text-align:center">$outlierValue.min</div>
+ <div style="text-align:center">$value.min</div>
</td>
## value
<td style="width:100px">
- <input name="outliervalue" id="outlier[$count].value" value="$outlierValue.value"
- style="width: 95%; text-align: center;" tabindex="$count" type="text" onchange="editOutlierValue( $count )">
- <input type="hidden" id="outlier[$count].dataElement" value="$outlierValue.dataElementId">
- <input type="hidden" id="outlier[$count].period" value="$outlierValue.periodId">
- <input type="hidden" id="outlier[$count].source" value="$outlierValue.sourceId">
- <input type="hidden" id="outlier[$count].categoryOptionCombo" value="$outlierValue.categoryOptionComboId">
- <input type="hidden" id="outlier[$count].min" value="$outlierValue.min">
- <input type="hidden" id="outlier[$count].max" value="$outlierValue.max">
+ <input id="value[$count].value" value="$value.value"
+ style="width: 95%; text-align: center;" tabindex="$count" type="text" onchange="editValue( $count )">
+ <input type="hidden" id="value[$count].dataElement" value="$value.dataElementId">
+ <input type="hidden" id="value[$count].period" value="$value.periodId">
+ <input type="hidden" id="value[$count].source" value="$value.sourceId">
+ <input type="hidden" id="value[$count].categoryOptionCombo" value="$value.categoryOptionComboId">
+ <input type="hidden" id="value[$count].min" value="$value.min">
+ <input type="hidden" id="value[$count].max" value="$value.max">
</td>
## upper bound (max)
<td>
- <div style="text-align:center">$outlierValue.max</div>
+ <div style="text-align:center">$value.max</div>
</td>
</tr>