← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7645: Removed gap analysis

 

------------------------------------------------------------
revno: 7645
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-07-20 09:29:46 +0200
message:
  Removed gap analysis
removed:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/GapAnalysisService.java
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataanalysis/DataAnalysisStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/jdbc/JdbcDataAnalysisStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/index.vm
  dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/menu.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-api/src/main/java/org/hisp/dhis/dataanalysis/DataAnalysisStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataanalysis/DataAnalysisStore.java	2010-04-08 12:12:55 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataanalysis/DataAnalysisStore.java	2012-07-20 07:29:46 +0000
@@ -77,19 +77,6 @@
         Collection<Period> periods, OrganisationUnit organisationUnit, int lowerBound, int upperBound );
     
     /**
-     * Returns a collection of gap DeflatedDataValues for the given input. A gap
-     * is a period for which there is no registered data values among the input periods.
-     * 
-     * @param dataElement the DataElement.
-     * @param categoryOptionCombo the DataElementCategoryOptionCombo.
-     * @param periods the collection of Periods.
-     * @param organisationUnit the OrganisationUnit.
-     * @return
-     */
-    Collection<DeflatedDataValue> getDeflatedDataValueGaps( DataElement dataElement, DataElementCategoryOptionCombo categoryOptionCombo,
-        Collection<Period> periods, OrganisationUnit organisationUnit );
-
-    /**
      * Returns a collection of DeflatedDataValues which are marked for followup.
      * 
      * @return a collection of DeflatedDataValues.

=== removed file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/GapAnalysisService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/GapAnalysisService.java	2011-02-10 23:09:13 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/GapAnalysisService.java	1970-01-01 00:00:00 +0000
@@ -1,100 +0,0 @@
-package org.hisp.dhis.dataanalysis;
-
-/*
- * Copyright (c) 2004-${year}, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- *   be used to endorse or promote products derived from this software without
- *   specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
-import org.hisp.dhis.datavalue.DeflatedDataValue;
-import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.period.Period;
-
-/**
- * @author Lars Helge Overland
- */
-public class GapAnalysisService
-    implements DataAnalysisService
-{
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private OrganisationUnitService organisationUnitService;
-    
-    public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
-    {
-        this.organisationUnitService = organisationUnitService;
-    }
-    
-    private DataAnalysisStore dataAnalysisStore;
-    
-    public void setDataAnalysisStore( DataAnalysisStore dataAnalysisStore )
-    {
-        this.dataAnalysisStore = dataAnalysisStore;
-    }
-
-    // -------------------------------------------------------------------------
-    // DataAnalysisService implementation
-    // -------------------------------------------------------------------------
-
-    public Collection<DeflatedDataValue> analyse( OrganisationUnit organisationUnit,
-        Collection<DataElement> dataElements, Collection<Period> periods, Double stdDevFactor )
-    {
-        Collection<OrganisationUnit> units = organisationUnitService.getOrganisationUnitWithChildren( organisationUnit.getId() );
-
-        Collection<DeflatedDataValue> gapCollection = new ArrayList<DeflatedDataValue>();
-        
-        loop : for ( DataElement dataElement : dataElements )
-        {
-            // TODO filter periods with data element period type
-            
-            if ( dataElement.getType().equals( DataElement.VALUE_TYPE_INT ) )
-            {                    
-                Collection<DataElementCategoryOptionCombo> categoryOptionCombos = dataElement.getCategoryCombo().getOptionCombos();
-                
-                for ( DataElementCategoryOptionCombo categoryOptionCombo : categoryOptionCombos )
-                {
-                    for ( OrganisationUnit unit : units )
-                    {
-                        gapCollection.addAll( dataAnalysisStore.getDeflatedDataValueGaps( dataElement, categoryOptionCombo, periods, unit ) ); 
-                        
-                        if ( gapCollection.size() > MAX_OUTLIERS )
-                        {
-                            break loop;
-                        }                       
-                    }
-                }
-            }
-        }
-
-        return gapCollection;
-    }
-}

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/jdbc/JdbcDataAnalysisStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/jdbc/JdbcDataAnalysisStore.java	2012-05-17 16:47:13 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataanalysis/jdbc/JdbcDataAnalysisStore.java	2012-07-20 07:29:46 +0000
@@ -115,61 +115,6 @@
         }
     }
     
-    public Collection<DeflatedDataValue> getDeflatedDataValueGaps( DataElement dataElement, DataElementCategoryOptionCombo categoryOptionCombo,
-        Collection<Period> periods, OrganisationUnit organisationUnit )
-    {
-        final StatementHolder holder = statementManager.getHolder();
-
-        final ObjectMapper<DeflatedDataValue> mapper = new ObjectMapper<DeflatedDataValue>();
-        
-        final String periodIds = TextUtils.getCommaDelimitedString( ConversionUtils.getIdentifiers( Period.class, periods ) );
-        
-        final String minValueSql = 
-            "SELECT minvalue FROM minmaxdataelement " +
-            "WHERE sourceid=' " + organisationUnit.getId() + "' " +
-            "AND dataelementid='" + dataElement.getId() + "' " +
-            "AND categoryoptioncomboid='" + categoryOptionCombo.getId() + "'";
-    
-        final String maxValueSql = 
-            "SELECT maxvalue FROM minmaxdataelement " +
-            "WHERE sourceid=' " + organisationUnit.getId() + "' " +
-            "AND dataelementid='" + dataElement.getId() + "' " +
-            "AND categoryoptioncomboid='" + categoryOptionCombo.getId() + "'";
-        
-        final String sql = 
-            "SELECT '" + dataElement.getId() + "' AS dataelementid, pe.periodid, " +
-            "'" + organisationUnit.getId() + "' AS sourceid, '" + categoryOptionCombo.getId() + "' AS categoryoptioncomboid, " +
-            "'' AS value, '' AS storedby, '1900-01-01' AS lastupdated, '' AS comment, false AS followup, " +
-            "( " + minValueSql + " ) AS minvalue, ( " + maxValueSql + " ) AS maxvalue, " +
-            statementBuilder.encode( dataElement.getName() ) + " AS dataelementname, pt.name AS periodtypename, pe.startdate, pe.enddate, " +
-            statementBuilder.encode( organisationUnit.getName() ) + " AS sourcename, " + 
-            statementBuilder.encode( categoryOptionCombo.getName() ) + " AS categoryoptioncomboname " + //TODO join?
-            "FROM period AS pe " +
-            "JOIN periodtype AS pt ON (pe.periodtypeid = pt.periodtypeid) " +
-            "WHERE periodid IN (" + periodIds + ") " +
-            "AND pt.periodtypeid='" + dataElement.getPeriodType().getId() + "' " +
-            "AND periodid NOT IN ( " +
-                "SELECT periodid FROM datavalue " +
-                "WHERE dataelementid='" + dataElement.getId() + "' " +
-                "AND categoryoptioncomboid='" + categoryOptionCombo.getId() + "' " +
-                "AND sourceid='" + organisationUnit.getId() + "' )";
-        
-        try
-        {   
-            final ResultSet resultSet = holder.getStatement().executeQuery( sql );
-            
-            return mapper.getCollection( resultSet, new DeflatedDataValueNameMinMaxRowMapper() );
-        }
-        catch ( SQLException ex )
-        {
-            throw new RuntimeException( "Failed to get deflated data values", ex );
-        }
-        finally
-        {
-            holder.close();
-        }
-    }
-
     public Collection<DeflatedDataValue> getDataValuesMarkedForFollowup()
     {
         final StatementHolder holder = statementManager.getHolder();

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2012-07-20 07:04:42 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml	2012-07-20 07:29:46 +0000
@@ -403,11 +403,6 @@
     <property name="dataAnalysisStore" ref="org.hisp.dhis.dataanalysis.jdbc.DataAnalysisStore" />
   </bean>
 
-  <bean id="org.hisp.dhis.dataanalysis.GapAnalysisService" class="org.hisp.dhis.dataanalysis.GapAnalysisService">
-    <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
-    <property name="dataAnalysisStore" ref="org.hisp.dhis.dataanalysis.jdbc.DataAnalysisStore" />
-  </bean>
-
   <bean id="org.hisp.dhis.dataanalysis.FollowupAnalysisService" class="org.hisp.dhis.dataanalysis.FollowupAnalysisService">
     <property name="dataAnalysisStore" ref="org.hisp.dhis.dataanalysis.jdbc.DataAnalysisStore" />
   </bean>
@@ -429,12 +424,6 @@
         </entry>
         <entry>
           <key>
-            <value>gap</value>
-          </key>
-          <ref bean="org.hisp.dhis.dataanalysis.GapAnalysisService" />
-        </entry>
-        <entry>
-          <key>
             <value>followup</value>
           </key>
           <ref bean="org.hisp.dhis.dataanalysis.FollowupAnalysisService" />

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/index.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/index.vm	2012-03-04 13:26:24 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/index.vm	2012-07-20 07:29:46 +0000
@@ -13,6 +13,5 @@
     #introListImgItem( "showRunValidationForm.action" "validation_rule_analysis" "validationanalysis" )
     #introListImgItem( "viewAnalysisForm.action?key=stddevoutlier" "stddevoutlier_analysis" "validationanalysis" )
     #introListImgItem( "viewAnalysisForm.action?key=minmaxoutlier" "minmaxoutlier_analysis" "validationanalysis" )
-    #introListImgItem( "viewAnalysisForm.action?key=gap" "gap_analysis" "validationanalysis" )
     #introListImgItem( "viewFollowUpAnalysisForm.action" "followup_analysis" "validationanalysis" )
 </ul>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/menu.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/menu.vm	2011-09-26 09:31:56 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/menu.vm	2012-07-20 07:29:46 +0000
@@ -10,6 +10,5 @@
 	<li><a href="showRunValidationForm.action">$i18n.getString( "validation_rule_analysis" )&nbsp;</a></li>
     <li><a href="viewAnalysisForm.action?key=stddevoutlier">$i18n.getString( "stddevoutlier_analysis" )&nbsp;</a></li>
     <li><a href="viewAnalysisForm.action?key=minmaxoutlier">$i18n.getString( "minmaxoutlier_analysis" )&nbsp;</a></li>
-    <li><a href="viewAnalysisForm.action?key=gap">$i18n.getString( "gap_analysis" )&nbsp;</a></li>
     <li><a href="viewFollowUpAnalysisForm.action">$i18n.getString( "followup_analysis" )&nbsp;</a></li>
 </ul>