dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #21048
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9863: Minor
------------------------------------------------------------
revno: 9863
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2013-02-21 16:21:16 +0100
message:
Minor
modified:
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsService.java
dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.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/AnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsService.java 2013-02-01 14:57:34 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsService.java 2013-02-21 15:21:16 +0000
@@ -38,7 +38,10 @@
Grid getAggregatedDataValues( DataQueryParams params )
throws IllegalQueryException, Exception;
- Map<String, Double> getAggregatedDataValueMap( DataQueryParams params, String tableName )
+ Map<String, Double> getAggregatedDataValueMap( DataQueryParams params )
+ throws IllegalQueryException, Exception;
+
+ Map<String, Double> getAggregatedCompletenessValueMap( DataQueryParams params )
throws IllegalQueryException, Exception;
DataQueryParams getFromUrl( Set<String> dimensionParams, Set<String> filterParams,
=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java 2013-02-19 16:12:47 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java 2013-02-21 15:21:16 +0000
@@ -106,7 +106,6 @@
//TODO completeness
//TODO make sure data x dims are successive
- //TODO check if partition table exists before query
@Autowired
private AnalyticsManager analyticsManager;
@@ -181,7 +180,7 @@
dataSourceParams = replaceIndicatorsWithDataElements( dataSourceParams, indicatorIndex );
- Map<String, Double> aggregatedDataMap = getAggregatedDataValueMap( dataSourceParams, ANALYTICS_TABLE_NAME );
+ Map<String, Double> aggregatedDataMap = getAggregatedDataValueMap( dataSourceParams );
Map<String, Map<DataElementOperand, Double>> permutationOperandValueMap = dataSourceParams.getPermutationOperandValueMap( aggregatedDataMap );
@@ -228,7 +227,7 @@
dataSourceParams.removeDimension( INDICATOR_DIM_ID );
dataSourceParams.removeDimension( DATASET_DIM_ID );
- Map<String, Double> aggregatedDataMap = getAggregatedDataValueMap( dataSourceParams, ANALYTICS_TABLE_NAME );
+ Map<String, Double> aggregatedDataMap = getAggregatedDataValueMap( dataSourceParams );
for ( Map.Entry<String, Double> entry : aggregatedDataMap.entrySet() )
{
@@ -250,7 +249,7 @@
dataSourceParams.removeDimension( CATEGORYOPTIONCOMBO_DIM_ID );
dataSourceParams.setAggregationType( AggregationType.COUNT );
- Map<String, Double> aggregatedDataMap = getAggregatedDataValueMap( dataSourceParams, COMPLETENESS_TABLE_NAME );
+ Map<String, Double> aggregatedDataMap = getAggregatedCompletenessValueMap( dataSourceParams );
for ( Map.Entry<String, Double> entry : aggregatedDataMap.entrySet() )
{
@@ -268,7 +267,7 @@
if ( params.getIndicators() == null && params.getDataElements() == null && params.getDataSets() == null )
{
- Map<String, Double> aggregatedDataMap = getAggregatedDataValueMap( new DataQueryParams( params ), ANALYTICS_TABLE_NAME );
+ Map<String, Double> aggregatedDataMap = getAggregatedDataValueMap( new DataQueryParams( params ) );
for ( Map.Entry<String, Double> entry : aggregatedDataMap.entrySet() )
{
@@ -292,7 +291,24 @@
return grid;
}
- public Map<String, Double> getAggregatedDataValueMap( DataQueryParams params, String tableName )
+ public Map<String, Double> getAggregatedDataValueMap( DataQueryParams params )
+ throws IllegalQueryException, Exception
+ {
+ return getAggregatedValueMap( params, ANALYTICS_TABLE_NAME );
+ }
+
+ public Map<String, Double> getAggregatedCompletenessValueMap( DataQueryParams params )
+ throws IllegalQueryException, Exception
+ {
+ return getAggregatedValueMap( params, COMPLETENESS_TABLE_NAME );
+ }
+
+ /**
+ * Generates a mapping between a dimension key and the aggregated value. The
+ * dimension key is a concatenation of the identifiers in for the dimensions
+ * separated by "-".
+ */
+ private Map<String, Double> getAggregatedValueMap( DataQueryParams params, String tableName )
throws IllegalQueryException, Exception
{
queryPlanner.validate( params );