← Back to team overview

dhis2-devs team mailing list archive

Re: [Bug 714985] Re: Std dev outlier analysis exception

 

OK., there are a couple of issues here.

Currently in trunk, there are single quotes in the query in
MySQLStatementBuilder. It should be something like...

    public String getStandardDeviation( int dataElementId, int
categoryOptionComboId, int organisationUnitId ){
    	
    	return "SELECT STDDEV( value ) FROM datavalue " +
            "WHERE dataelementid =  " + dataElementId +
            "AND categoryoptioncomboid= " + categoryOptionComboId +
            "AND sourceid= " + organisationUnitId + "'";

    }

More bizarre, is the implmentation of the findOutliers method.

    private Collection<DeflatedDataValue> findOutliers(
OrganisationUnit organisationUnit, DataElement dataElement,
        DataElementCategoryOptionCombo categoryOptionCombo,
Collection<Period> periods, Double stdDevFactor )
    {
        Double stdDev = dataAnalysisStore.getStandardDeviation(
dataElement, categoryOptionCombo, organisationUnit );

        if ( !isEqual( stdDev, 0.0 ) ) // No values found or no
outliers exist when 0.0
        {
            Double avg = dataAnalysisStore.getAverage( dataElement,
categoryOptionCombo, organisationUnit );

            double deviation = stdDev * stdDevFactor;
            Double lowerBound = avg - deviation;
            Double upperBound = avg + deviation;
            return dataAnalysisStore.getDeflatedDataValues(
dataElement, categoryOptionCombo, periods,
                organisationUnit, lowerBound.intValue(),
upperBound.intValue() );
        }

        return new ArrayList<DeflatedDataValue>();
    }


So, we are determining the STD DEV for ALL values regardless of the
time period? Shouldn't we be looking for outliers within a given time
period?


I can prepare a patch for this I think, but maybe Lars you can take a
look at this method while you are at it?

Regards,
Jason



On Tue, Feb 8, 2011 at 11:06 AM, Hynek Kruzik <kruzik@xxxxxxxxx> wrote:
> And data sets are also defined.
>
> --
> You received this bug notification because you are a member of DHIS 2
> India Developers, which is subscribed to DHIS.
> https://bugs.launchpad.net/bugs/714985
>
> Title:
>  Std dev outlier analysis exception
>
> Status in DHIS 2 - District Health Information Software:
>  New
>
> Bug description:
>  After selecting date, dataset and organisation unit when user press
>  start button an exception occurred. More details in attached file.
>
>
>


-- 
Jason P. Pickering
email: jason.p.pickering@xxxxxxxxx
tel:+260974901293

-- 
You received this bug notification because you are a member of DHIS 2
developers, which is subscribed to DHIS.
https://bugs.launchpad.net/bugs/714985

Title:
  Std dev outlier analysis exception

Status in DHIS 2 - District Health Information Software:
  New

Bug description:
  After selecting date, dataset and organisation unit when user press
  start button an exception occurred. More details in attached file.





References