dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #03843
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1277: Checking only periods with the same period type as the data element in outlier analysis.
------------------------------------------------------------
revno: 1277
committer: Lars Helge Oeverland <larshelge@xxxxxxxxx>
branch nick: trunk
timestamp: Wed 2009-12-23 18:00:56 +0100
message:
Checking only periods with the same period type as the data element in outlier analysis.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/outlieranalysis/OutlierAnalysisStore.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/outlieranalysis/MinMaxOutlierAnalysisService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/outlieranalysis/StdDevOutlierAnalysisService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/outlieranalysis/jdbc/JdbcOutlierAnalysisStore.java
--
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/outlieranalysis/OutlierAnalysisStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/outlieranalysis/OutlierAnalysisStore.java 2009-12-23 12:09:02 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/outlieranalysis/OutlierAnalysisStore.java 2009-12-23 17:00:56 +0000
@@ -34,6 +34,7 @@
import org.hisp.dhis.datavalue.DeflatedDataValue;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodType;
/**
* @author Lars Helge Overland
@@ -45,5 +46,5 @@
Double getAverage( DataElement dataElement, DataElementCategoryOptionCombo categoryOptionCombo, OrganisationUnit organisationUnit );
Collection<DeflatedDataValue> getDeflatedDataValues( DataElement dataElement, DataElementCategoryOptionCombo categoryOptionCombo,
- Collection<Period> periods, OrganisationUnit organisationUnit, int lowerBound, int upperBound );
+ Collection<Period> periods, OrganisationUnit organisationUnit, PeriodType periodType, int lowerBound, int upperBound );
}
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/outlieranalysis/MinMaxOutlierAnalysisService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/outlieranalysis/MinMaxOutlierAnalysisService.java 2009-12-23 12:54:35 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/outlieranalysis/MinMaxOutlierAnalysisService.java 2009-12-23 17:00:56 +0000
@@ -114,8 +114,8 @@
if ( minMaxDataElement != null )
{
- return outlierAnalysisStore.getDeflatedDataValues(
- dataElement, categoryOptionCombo, periods, organisationUnit, minMaxDataElement.getMin(), minMaxDataElement.getMax() );
+ return outlierAnalysisStore.getDeflatedDataValues( dataElement, categoryOptionCombo, periods,
+ organisationUnit, dataElement.getPeriodType(), minMaxDataElement.getMin(), minMaxDataElement.getMax() );
}
return new ArrayList<DeflatedDataValue>();
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/outlieranalysis/StdDevOutlierAnalysisService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/outlieranalysis/StdDevOutlierAnalysisService.java 2009-12-23 12:54:35 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/outlieranalysis/StdDevOutlierAnalysisService.java 2009-12-23 17:00:56 +0000
@@ -111,8 +111,8 @@
Double lowerBound = avg - deviation;
Double upperBound = avg + deviation;
- return outlierAnalysisStore.getDeflatedDataValues(
- dataElement, categoryOptionCombo, periods, organisationUnit, lowerBound.intValue(), upperBound.intValue() );
+ return outlierAnalysisStore.getDeflatedDataValues( dataElement, categoryOptionCombo, periods,
+ organisationUnit, dataElement.getPeriodType(), lowerBound.intValue(), upperBound.intValue() );
}
return new ArrayList<DeflatedDataValue>();
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/outlieranalysis/jdbc/JdbcOutlierAnalysisStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/outlieranalysis/jdbc/JdbcOutlierAnalysisStore.java 2009-12-23 14:21:57 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/outlieranalysis/jdbc/JdbcOutlierAnalysisStore.java 2009-12-23 17:00:56 +0000
@@ -41,6 +41,7 @@
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.outlieranalysis.OutlierAnalysisStore;
import org.hisp.dhis.period.Period;
+import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.system.objectmapper.DeflatedDataValueNameMinMaxRowMapper;
import org.hisp.dhis.system.util.ConversionUtils;
import org.hisp.dhis.system.util.TextUtils;
@@ -96,7 +97,7 @@
}
public Collection<DeflatedDataValue> getDeflatedDataValues( DataElement dataElement, DataElementCategoryOptionCombo categoryOptionCombo,
- Collection<Period> periods, OrganisationUnit organisationUnit, int lowerBound, int upperBound )
+ Collection<Period> periods, OrganisationUnit organisationUnit, PeriodType periodType, int lowerBound, int upperBound )
{
final StatementHolder holder = statementManager.getHolder();
@@ -120,6 +121,7 @@
"WHERE dv.dataelementid='" + dataElement.getId() + "' " +
"AND dv.categoryoptioncomboid='" + categoryOptionCombo.getId() + "' " +
"AND dv.periodid IN (" + periodIds + ") " +
+ "AND pt.periodtypeid='" + periodType.getId() + "' " +
"AND dv.sourceid='" + organisationUnit.getId() + "' " +
"AND ( CAST( dv.value AS " + statementBuilder.getDoubleColumnType() + " ) < '" + lowerBound + "' " +
"OR CAST( dv.value AS " + statementBuilder.getDoubleColumnType() + " ) > '" + upperBound + "' )";