← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15553: Analytics, more descriptive feedback in analytics when tables cannot be updated

 

------------------------------------------------------------
revno: 15553
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-06-04 18:18:39 +0200
message:
  Analytics, more descriptive feedback in analytics when tables cannot be updated
modified:
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsTableManager.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/DefaultAnalyticsTableService.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcCompletenessTableManager.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcCompletenessTargetTableManager.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcOrgUnitTargetTableManager.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-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsTableManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsTableManager.java	2014-05-04 12:21:18 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsTableManager.java	2014-06-04 16:18:39 +0000
@@ -65,8 +65,9 @@
     
     /**
      * Checks if the database content is in valid state for analytics table generation.
+     * Returns null if valid, a descriptive string if invalid.
      */
-    boolean validState();
+    String validState();
     
     /**
      * Returns the base table name.

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/DefaultAnalyticsTableService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/DefaultAnalyticsTableService.java	2014-05-05 10:58:08 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/DefaultAnalyticsTableService.java	2014-06-04 16:18:39 +0000
@@ -95,11 +95,11 @@
     {
         Clock clock = new Clock().startClock().logTime( "Starting update, no of processes: " + getProcessNo() );
         
-        boolean valid = tableManager.validState();
+        String validState = tableManager.validState();
         
-        if ( !valid )
+        if ( validState != null )
         {
-            notifier.notify( taskId, "Table not valid, aborted update" );
+            notifier.notify( taskId, validState );
             return;
         }
         

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java	2014-04-11 15:00:47 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcAnalyticsTableManager.java	2014-06-04 16:18:39 +0000
@@ -76,9 +76,16 @@
     // Implementation
     // -------------------------------------------------------------------------
     
-    public boolean validState()
+    public String validState()
     {
-        return jdbcTemplate.queryForRowSet( "select dataelementid from datavalue limit 1" ).next();
+        boolean hasData = jdbcTemplate.queryForRowSet( "select dataelementid from datavalue limit 1" ).next();
+        
+        if ( !hasData )
+        {
+            return "No data values exist, not updating aggregate analytics tables";
+        }
+        
+        return null;
     }
     
     public String getTableName()

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcCompletenessTableManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcCompletenessTableManager.java	2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcCompletenessTableManager.java	2014-06-04 16:18:39 +0000
@@ -48,9 +48,16 @@
 public class JdbcCompletenessTableManager
     extends AbstractJdbcTableManager
 {
-    public boolean validState()
+    public String validState()
     {
-        return jdbcTemplate.queryForRowSet( "select datasetid from completedatasetregistration limit 1" ).next();
+        boolean hasData = jdbcTemplate.queryForRowSet( "select datasetid from completedatasetregistration limit 1" ).next();
+        
+        if ( !hasData )
+        {
+            return "No complete registrations exist, not updating completeness analytics tables";
+        }
+        
+        return null;
     }
     
     public String getTableName()

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcCompletenessTargetTableManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcCompletenessTargetTableManager.java	2014-05-04 12:21:18 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcCompletenessTargetTableManager.java	2014-06-04 16:18:39 +0000
@@ -56,9 +56,9 @@
         return tables;
     }
     
-    public boolean validState()
+    public String validState()
     {
-        return true;
+        return null;
     }    
     
     public String getTableName()

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java	2014-05-10 11:18:29 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java	2014-06-04 16:18:39 +0000
@@ -94,9 +94,16 @@
         return tables;
     }
 
-    public boolean validState()
+    public String validState()
     {
-        return jdbcTemplate.queryForRowSet( "select dataelementid from trackedentitydatavalue limit 1" ).next();
+        boolean hasData = jdbcTemplate.queryForRowSet( "select dataelementid from trackedentitydatavalue limit 1" ).next();
+        
+        if ( !hasData )
+        {
+            return "No events exist, not updating event analytics tables";
+        }
+        
+        return null;
     }
 
     public String getTableName()

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcOrgUnitTargetTableManager.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcOrgUnitTargetTableManager.java	2014-05-04 12:21:18 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcOrgUnitTargetTableManager.java	2014-06-04 16:18:39 +0000
@@ -55,9 +55,9 @@
         return tables;
     }
 
-    public boolean validState()
+    public String validState()
     {
-        return true;
+        return null;
     }    
     
     public String getTableName()