← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5879: Including aggregated org unit values in clear data mart function

 

------------------------------------------------------------
revno: 5879
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-02-07 20:52:19 +0100
message:
  Including aggregated org unit values in clear data mart function
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedOrgUnitDataValueService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedOrgUnitDataValueStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedOrgUnitDataValueService.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedOrgUnitDataValueStore.java
  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/scheduling/DataMartTask.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/maintenance/PerformMaintenanceAction.java
  resources/sql/integritychecks.sql


--
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/aggregation/AggregatedOrgUnitDataValueService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedOrgUnitDataValueService.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedOrgUnitDataValueService.java	2012-02-07 19:52:19 +0000
@@ -51,6 +51,8 @@
     
     void deleteAggregatedDataValues( Collection<Integer> periodIds );
     
+    void deleteAggregatedDataValues();
+    
     void createIndex( boolean dataElement, boolean indicator );
     
     void dropIndex( boolean dataElement, boolean indicator );
@@ -64,4 +66,6 @@
     void deleteAggregatedIndicatorValues( Collection<Integer> indicatorIds, Collection<Integer> periodIds, Collection<Integer> organisationUnitIds );
     
     void deleteAggregatedIndicatorValues( Collection<Integer> periodIds );
+    
+    void deleteAggregatedIndicatorValues();
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedOrgUnitDataValueStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedOrgUnitDataValueStore.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/aggregation/AggregatedOrgUnitDataValueStore.java	2012-02-07 19:52:19 +0000
@@ -41,6 +41,8 @@
     
     void deleteAggregatedDataValues( Collection<Integer> periodIds );
     
+    void deleteAggregatedDataValues();
+    
     void createIndex( boolean dataElement, boolean indicator );
     
     void dropIndex( boolean dataElement, boolean indicator );
@@ -54,4 +56,6 @@
     void deleteAggregatedIndicatorValues( Collection<Integer> indicatorIds, Collection<Integer> periodIds, Collection<Integer> organisationUnitIds );
     
     void deleteAggregatedIndicatorValues( Collection<Integer> periodIds );
+    
+    void deleteAggregatedIndicatorValues();
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedOrgUnitDataValueService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedOrgUnitDataValueService.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/DefaultAggregatedOrgUnitDataValueService.java	2012-02-07 19:52:19 +0000
@@ -73,6 +73,11 @@
     {
         aggregatedDataValueStore.deleteAggregatedDataValues( periodIds );
     }
+
+    public void deleteAggregatedDataValues()
+    {
+        aggregatedDataValueStore.deleteAggregatedDataValues();
+    }
     
     public void createIndex( boolean dataElement, boolean indicator )
     {
@@ -102,4 +107,9 @@
     {
         aggregatedDataValueStore.deleteAggregatedIndicatorValues( periodIds );
     }
+    
+    public void deleteAggregatedIndicatorValues()
+    {
+        aggregatedDataValueStore.deleteAggregatedIndicatorValues();
+    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedOrgUnitDataValueStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedOrgUnitDataValueStore.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/aggregation/jdbc/JdbcAggregatedOrgUnitDataValueStore.java	2012-02-07 19:52:19 +0000
@@ -90,6 +90,13 @@
         statementManager.getHolder().executeUpdate( sql );
     }
 
+    public void deleteAggregatedDataValues()
+    {
+        final String sql = "DELETE FROM aggregatedorgunitdatavalue";
+        
+        statementManager.getHolder().executeUpdate( sql );
+    }
+
     public void createIndex( boolean dataElement, boolean indicator )
     {
         if ( dataElement )
@@ -184,5 +191,12 @@
             "WHERE periodid IN ( " + getCommaDelimitedString( periodIds ) + " )";
 
         statementManager.getHolder().executeUpdate( sql );
-    }    
+    }
+    
+    public void deleteAggregatedIndicatorValues()
+    {
+        final String sql = "DELETE FROM aggregatedorgunitindicatorvalue ";
+        
+        statementManager.getHolder().executeUpdate( sql );
+    }
 }

=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/scheduling/DataMartTask.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/scheduling/DataMartTask.java	2012-02-02 20:01:36 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/scheduling/DataMartTask.java	2012-02-07 19:52:19 +0000
@@ -46,7 +46,6 @@
 import org.hisp.dhis.dataset.DataSetService;
 import org.hisp.dhis.indicator.Indicator;
 import org.hisp.dhis.indicator.IndicatorService;
-import org.hisp.dhis.setting.SystemSettingManager;
 import org.hisp.dhis.organisationunit.OrganisationUnit;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
 import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
@@ -56,6 +55,7 @@
 import org.hisp.dhis.period.PeriodService;
 import org.hisp.dhis.period.RelativePeriods;
 import org.hisp.dhis.period.YearlyPeriodType;
+import org.hisp.dhis.setting.SystemSettingManager;
 import org.hisp.dhis.system.util.ConversionUtils;
 import org.hisp.dhis.system.util.Filter;
 import org.hisp.dhis.system.util.FilterUtils;

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/maintenance/PerformMaintenanceAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/maintenance/PerformMaintenanceAction.java	2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/maintenance/PerformMaintenanceAction.java	2012-02-07 19:52:19 +0000
@@ -138,6 +138,9 @@
             aggregatedDataValueService.deleteAggregatedDataValues();
             aggregatedDataValueService.deleteAggregatedIndicatorValues();
             
+            aggregatedOrgUnitDataValueService.deleteAggregatedDataValues();
+            aggregatedOrgUnitDataValueService.deleteAggregatedIndicatorValues();
+            
             log.info( "Cleared data mart" );
         }
         

=== modified file 'resources/sql/integritychecks.sql'
--- resources/sql/integritychecks.sql	2012-01-23 04:32:46 +0000
+++ resources/sql/integritychecks.sql	2012-02-07 19:52:19 +0000
@@ -6,6 +6,18 @@
 join dataelement de on (dm.dataelementid=de.dataelementid)
 where de.name = 'Adverse Events Following Immunization';
 
+-- Get dataelements not part of any dataset
+
+select dataelementid, name from dataelement where dataelementid not in (
+select dataelementid from datasetmembers)
+and domaintype='aggregate'
+order by name;
+
+-- Get category combo with no data elements
+
+select cc.categorycomboid, cc.name from categorycombo cc where cc.categorycomboid not in (
+select distinct categorycomboid from dataelement);
+
 -- Get dataelement name and category combo for a section
 
 select de.name as dataelementname, cc.name as categorycomboname from dataelement de