← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19856: Analaytics, implementd query parameter relativePeriodDate which will be used as basis for relativ...

 

------------------------------------------------------------
revno: 19856
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-08-26 11:42:00 +0200
message:
  Analaytics, implementd query parameter relativePeriodDate which will be used as basis for relative periods in response
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
  dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/MockAnalyticsService.java
  dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/AnalyticsServiceTest.java
  dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/jdbc/AnalyticsDataSetReportStore.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AnalyticsController.java
  dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/GeoFeatureController.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	2015-08-04 11:09:17 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/AnalyticsService.java	2015-08-26 09:42:00 +0000
@@ -166,6 +166,7 @@
      * @param displayProperty the property to display for meta-data.
      * @param outputIdScheme the identifier scheme to use in the query response.
      * @param approvalLevel the approval level identifier.
+     * @param relativePeriodDate the date to use as basis for relative periods.
      * @param userOrgUnit the user organisation unit to use, overrides current user.
      * @param program the program identifier.
      * @param stage the program stage identifier.
@@ -174,7 +175,7 @@
      */
     DataQueryParams getFromUrl( Set<String> dimensionParams, Set<String> filterParams, AggregationType aggregationType, String measureCriteria, 
         boolean skipMeta, boolean skipData, boolean skipRounding, boolean hierarchyMeta, boolean ignoreLimit, boolean hideEmptyRows, boolean showHierarchy, 
-        DisplayProperty displayProperty, IdentifiableProperty outputIdScheme, String approvalLevel, String userOrgUnit, 
+        DisplayProperty displayProperty, IdentifiableProperty outputIdScheme, String approvalLevel, Date relativePeriodDate, String userOrgUnit, 
         String program, String stage, I18nFormat format );
     
     /**
@@ -190,12 +191,13 @@
      * Creates a list of DimensionalObject from the given set of dimension params.
      * 
      * @param dimensionParams the dimension URL params.
+     * @param relativePeriodDate the date to use as basis for relative periods.
      * @param userOrgUnit the user organisation unit param, overrides current
      *        user, can be null.
      * @param format the i18n format.
      * @return a list of DimensionalObject.
      */
-    List<DimensionalObject> getDimensionalObjects( Set<String> dimensionParams, String userOrgUnit, I18nFormat format );
+    List<DimensionalObject> getDimensionalObjects( Set<String> dimensionParams, Date relativePeriodDate, String userOrgUnit, I18nFormat format );
     
     /**
      * Returns a persisted DimensionalObject generated from the given  dimension 

=== 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	2015-08-21 01:47:02 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/DefaultAnalyticsService.java	2015-08-26 09:42:00 +0000
@@ -910,7 +910,7 @@
     public DataQueryParams getFromUrl( Set<String> dimensionParams, Set<String> filterParams, AggregationType aggregationType,
         String measureCriteria, boolean skipMeta, boolean skipData, boolean skipRounding, boolean hierarchyMeta, boolean ignoreLimit,
         boolean hideEmptyRows, boolean showHierarchy, DisplayProperty displayProperty, IdentifiableProperty outputIdScheme, 
-        String approvalLevel, String userOrgUnit, String program, String stage, I18nFormat format )
+        String approvalLevel, Date relativePeriodDate, String userOrgUnit, String program, String stage, I18nFormat format )
     {
         DataQueryParams params = new DataQueryParams();
         
@@ -919,12 +919,12 @@
 
         if ( dimensionParams != null && !dimensionParams.isEmpty() )
         {
-            params.addDimensions( getDimensionalObjects( dimensionParams, userOrgUnit, format ) );
+            params.addDimensions( getDimensionalObjects( dimensionParams, relativePeriodDate, userOrgUnit, format ) );
         }
 
         if ( filterParams != null && !filterParams.isEmpty() )
         {
-            params.getFilters().addAll( getDimensionalObjects( filterParams, userOrgUnit, format ) );
+            params.getFilters().addAll( getDimensionalObjects( filterParams, relativePeriodDate, userOrgUnit, format ) );
         }
 
         if ( measureCriteria != null && !measureCriteria.isEmpty() )
@@ -988,7 +988,7 @@
     }
 
     @Override
-    public List<DimensionalObject> getDimensionalObjects( Set<String> dimensionParams, String userOrgUnit, I18nFormat format )
+    public List<DimensionalObject> getDimensionalObjects( Set<String> dimensionParams, Date relativePeriodDate, String userOrgUnit, I18nFormat format )
     {
         List<DimensionalObject> list = new ArrayList<>();
         
@@ -1003,7 +1003,7 @@
 
                 if ( dimension != null && items != null )
                 {
-                    list.add( getDimension( dimension, items, null, userOrgUnits, format, false ) );
+                    list.add( getDimension( dimension, items, relativePeriodDate, userOrgUnits, format, false ) );
                 }
             }
         }

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/MockAnalyticsService.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/MockAnalyticsService.java	2015-08-04 11:09:17 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/data/MockAnalyticsService.java	2015-08-26 09:42:00 +0000
@@ -85,7 +85,7 @@
     @Override
     public DataQueryParams getFromUrl( Set<String> dimensionParams, Set<String> filterParams, AggregationType aggregationType, 
         String measureCriteria, boolean skipMeta, boolean skipData, boolean skipRounding, boolean hierarchyMeta, boolean ignoreLimit, boolean hideEmptyRows, 
-        boolean showHierarchy, DisplayProperty displayProperty, IdentifiableProperty idScheme, String approvalLevel, String userOrgUnit, 
+        boolean showHierarchy, DisplayProperty displayProperty, IdentifiableProperty idScheme, String approvalLevel, Date relativePeriodDate, String userOrgUnit, 
         String program, String stage, I18nFormat format )
     {
         throw new NotImplementedException( "" );
@@ -98,7 +98,7 @@
     }
     
     @Override
-    public List<DimensionalObject> getDimensionalObjects( Set<String> dimensionParams, String userOrgUnit, I18nFormat format )
+    public List<DimensionalObject> getDimensionalObjects( Set<String> dimensionParams, Date relateivePeriodDate, String userOrgUnit, I18nFormat format )
     {
         throw new NotImplementedException( "" );
     }

=== modified file 'dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/AnalyticsServiceTest.java'
--- dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/AnalyticsServiceTest.java	2015-08-04 11:09:17 +0000
+++ dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/data/AnalyticsServiceTest.java	2015-08-26 09:42:00 +0000
@@ -193,7 +193,7 @@
         filterParams.add( "ou:" + ouA.getUid() + ";" + ouB.getUid() + ";" + ouC.getUid() + ";" + ouD.getUid() + ";" + ouE.getUid() );
         
         DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null, 
-            false, false, false, false, false, false, false, null, null, null, null, null, null, null );
+            false, false, false, false, false, false, false, null, null, null, null, null, null, null, null );
         
         assertEquals( 4, params.getDataElements().size() );
         assertEquals( 3, params.getPeriods().size() );
@@ -211,7 +211,7 @@
         filterParams.add( "ou:" + ouA.getUid() );
         
         DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null, 
-            false, false, false, false, false, false, false, null, null, null, null, null, null, null );
+            false, false, false, false, false, false, false, null, null, null, null, null, null, null, null );
         
         assertEquals( 4, params.getDataElements().size() );
         assertEquals( 1, params.getFilterOrganisationUnits().size() );
@@ -227,7 +227,7 @@
         filterParams.add( "ou:" + ouA.getUid() );
         
         DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null, 
-            false, false, false, false, false, false, false, null, null, null, null, null, null, null );
+            false, false, false, false, false, false, false, null, null, null, null, null, null, null, null );
         
         assertEquals( 2, params.getDataElements().size() );
         assertEquals( 2, params.getProgramDataElements().size() );
@@ -244,7 +244,7 @@
         filterParams.add( "ou:" + ouA.getUid() );
         
         DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null, 
-            false, false, false, false, false, false, false, null, null, null, null, null, null, null );
+            false, false, false, false, false, false, false, null, null, null, null, null, null, null, null );
         
         assertEquals( 2, params.getDataElements().size() );
         assertEquals( 2, params.getProgramAttributes().size() );
@@ -263,7 +263,7 @@
         filterParams.add( "ou:" + ouA.getUid() + ";" + ouB.getUid() + ";" + ouC.getUid() );
         
         DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null, 
-            false, false, false, false, false, false, false, null, null, null, null, null, null, null );
+            false, false, false, false, false, false, false, null, null, null, null, null, null, null, null );
         
         assertEquals( 3, params.getDataElements().size() );
         assertEquals( 2, params.getPeriods().size() );
@@ -282,7 +282,7 @@
         filterParams.add( "ou:" + ouA.getUid() + ";" + ouB.getUid() );
 
         DataQueryParams params = analyticsService.getFromUrl( dimensionParams, filterParams, null, null, 
-            false, false, false, false, false, false, false, null, null, null, null, null, null, null );
+            false, false, false, false, false, false, false, null, null, null, null, null, null, null, null );
         
         assertEquals( 4, params.getDataElements().size() );
         assertEquals( 12, params.getPeriods().size() );
@@ -298,7 +298,7 @@
         dimensionParams.add( "pe:2011;2012" );
         
         DataQueryParams params = analyticsService.getFromUrl( dimensionParams, null, null, null, 
-            false, false, false, false, false, false, false, null, null, null, null, null, null, null );
+            false, false, false, false, false, false, false, null, null, null, null, null, null, null, null );
         
         assertEquals( 1, params.getOrganisationUnits().size() );  
         assertEquals( 2, params.getDataElements().size() );
@@ -314,7 +314,7 @@
         dimensionParams.add( "pe:2011;2012" );
         
         DataQueryParams params = analyticsService.getFromUrl( dimensionParams, null, null, null, 
-            false, false, false, false, false, false, false, null, null, null, null, null, null, null );
+            false, false, false, false, false, false, false, null, null, null, null, null, null, null, null );
         
         assertEquals( 3, params.getOrganisationUnits().size() );  
         assertEquals( 2, params.getDataElements().size() );
@@ -330,7 +330,7 @@
         dimensionParams.add( "pe:2011;2012" );
         
         DataQueryParams params = analyticsService.getFromUrl( dimensionParams, null, null, null, 
-            false, false, false, false, false, false, false, null, null, null, null, null, null, null );
+            false, false, false, false, false, false, false, null, null, null, null, null, null, null, null );
         
         assertEquals( 2, params.getOrganisationUnits().size() );  
         assertEquals( 2, params.getDataElements().size() );
@@ -345,7 +345,7 @@
         dimensionParams.add( "pe:2012,2012S1,2012S2" );
         
         analyticsService.getFromUrl( dimensionParams, null, null, null, 
-            false, false, false, false, false, false, false, null, null, null, null, null, null, null );        
+            false, false, false, false, false, false, false, null, null, null, null, null, null, null, null );        
     }
     
     @Test( expected = IllegalQueryException.class )
@@ -356,7 +356,7 @@
         dimensionParams.add( "pe" );
 
         analyticsService.getFromUrl( dimensionParams, null, null, null, 
-            false, false, false, false, false, false, false, null, null, null, null, null, null, null );        
+            false, false, false, false, false, false, false, null, null, null, null, null, null, null, null );        
     }
 
     @Test( expected = IllegalQueryException.class )
@@ -367,7 +367,7 @@
         dimensionParams.add( "ou" );
         
         analyticsService.getFromUrl( dimensionParams, null, null, null, 
-            false, false, false, false, false, false, false, null, null, null, null, null, null, null );        
+            false, false, false, false, false, false, false, null, null, null, null, null, null, null, null );        
     }
 
     @Test( expected = IllegalQueryException.class )
@@ -378,7 +378,7 @@
         dimensionParams.add( "yebo:2012,2012S1,2012S2" );
         
         analyticsService.getFromUrl( dimensionParams, null, null, null, 
-            false, false, false, false, false, false, false, null, null, null, null, null, null, null );        
+            false, false, false, false, false, false, false, null, null, null, null, null, null, null, null );        
     }
     
     @Test

=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/jdbc/AnalyticsDataSetReportStore.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/jdbc/AnalyticsDataSetReportStore.java	2015-08-03 12:01:11 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/datasetreport/jdbc/AnalyticsDataSetReportStore.java	2015-08-26 09:42:00 +0000
@@ -88,7 +88,7 @@
         
         if ( dimensions != null )
         {
-            params.setFilters( analyticsService.getDimensionalObjects( dimensions, null, null ) );
+            params.setFilters( analyticsService.getDimensionalObjects( dimensions, null, null, null ) );
         }
         
         Map<String, Object> map = analyticsService.getAggregatedDataValueMapping( params );
@@ -137,7 +137,7 @@
 
                 if ( dimensions != null )
                 {
-                    params.setFilters( analyticsService.getDimensionalObjects( dimensions, null, null ) );
+                    params.setFilters( analyticsService.getDimensionalObjects( dimensions, null, null, null ) );
                 }
                 
                 Map<String, Object> map = analyticsService.getAggregatedDataValueMapping( params );
@@ -173,7 +173,7 @@
 
         if ( dimensions != null )
         {
-            params.setFilters( analyticsService.getDimensionalObjects( dimensions, null, null ) );
+            params.setFilters( analyticsService.getDimensionalObjects( dimensions, null, null, null ) );
         }
         
         Map<String, Object> map = analyticsService.getAggregatedDataValueMapping( params );
@@ -207,7 +207,7 @@
 
         if ( dimensions != null )
         {
-            params.setFilters( analyticsService.getDimensionalObjects( dimensions, null, null ) );
+            params.setFilters( analyticsService.getDimensionalObjects( dimensions, null, null, null ) );
         }
         
         Map<String, Object> map = analyticsService.getAggregatedDataValueMapping( params );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AnalyticsController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AnalyticsController.java	2015-08-04 11:09:17 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/AnalyticsController.java	2015-08-26 09:42:00 +0000
@@ -30,6 +30,7 @@
 
 import static org.hisp.dhis.common.DimensionalObjectUtils.getItemsFromParam;
 
+import java.util.Date;
 import java.util.Set;
 
 import javax.servlet.http.HttpServletResponse;
@@ -91,6 +92,7 @@
         @RequestParam( required = false ) DisplayProperty displayProperty,
         @RequestParam( required = false ) IdentifiableProperty outputIdScheme,
         @RequestParam( required = false ) String approvalLevel,
+        @RequestParam( required = false ) Date relativePeriodDate,
         @RequestParam( required = false ) String userOrgUnit,
         @RequestParam( required = false ) String program,
         @RequestParam( required = false ) String stage,
@@ -100,7 +102,7 @@
         HttpServletResponse response ) throws Exception
     {
         DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, skipMeta, skipData, skipRounding, hierarchyMeta, 
-            ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, userOrgUnit, program, stage, i18nManager.getI18nFormat() );
+            ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, relativePeriodDate, userOrgUnit, program, stage, i18nManager.getI18nFormat() );
 
         contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_JSON, CacheStrategy.RESPECT_SYSTEM_SETTING );
         Grid grid = analyticsService.getAggregatedDataValues( params, tableLayout, getItemsFromParam( columns ), getItemsFromParam( rows ) );
@@ -126,6 +128,7 @@
         @RequestParam( required = false ) DisplayProperty displayProperty,
         @RequestParam( required = false ) IdentifiableProperty outputIdScheme,
         @RequestParam( required = false ) String approvalLevel,
+        @RequestParam( required = false ) Date relativePeriodDate,
         @RequestParam( required = false ) String userOrgUnit,
         @RequestParam( required = false ) String program,
         @RequestParam( required = false ) String stage,
@@ -135,7 +138,7 @@
         HttpServletResponse response ) throws Exception
     {
         DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, skipMeta, skipData, skipRounding, hierarchyMeta, 
-            ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, userOrgUnit, program, stage, i18nManager.getI18nFormat() );
+            ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, relativePeriodDate, userOrgUnit, program, stage, i18nManager.getI18nFormat() );
 
         contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_XML, CacheStrategy.RESPECT_SYSTEM_SETTING );
         Grid grid = analyticsService.getAggregatedDataValues( params, tableLayout, getItemsFromParam( columns ), getItemsFromParam( rows ) );
@@ -159,6 +162,7 @@
         @RequestParam( required = false ) DisplayProperty displayProperty,
         @RequestParam( required = false ) IdentifiableProperty outputIdScheme,
         @RequestParam( required = false ) String approvalLevel,
+        @RequestParam( required = false ) Date relativePeriodDate,
         @RequestParam( required = false ) String userOrgUnit,
         @RequestParam( required = false ) String program,
         @RequestParam( required = false ) String stage,
@@ -168,7 +172,7 @@
         HttpServletResponse response ) throws Exception
     {
         DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, skipMeta, skipData, skipRounding, hierarchyMeta, 
-            ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, userOrgUnit, program, stage, i18nManager.getI18nFormat() );
+            ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, relativePeriodDate, userOrgUnit, program, stage, i18nManager.getI18nFormat() );
 
         contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_HTML, CacheStrategy.RESPECT_SYSTEM_SETTING );
         Grid grid = analyticsService.getAggregatedDataValues( params, tableLayout, getItemsFromParam( columns ), getItemsFromParam( rows ) );
@@ -192,6 +196,7 @@
         @RequestParam( required = false ) DisplayProperty displayProperty,
         @RequestParam( required = false ) IdentifiableProperty outputIdScheme,
         @RequestParam( required = false ) String approvalLevel,
+        @RequestParam( required = false ) Date relativePeriodDate,
         @RequestParam( required = false ) String userOrgUnit,
         @RequestParam( required = false ) String program,
         @RequestParam( required = false ) String stage,
@@ -201,7 +206,7 @@
         HttpServletResponse response ) throws Exception
     {
         DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, skipMeta, skipData, skipRounding, hierarchyMeta, 
-            ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, userOrgUnit, program, stage, i18nManager.getI18nFormat() );
+            ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, relativePeriodDate, userOrgUnit, program, stage, i18nManager.getI18nFormat() );
 
         contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_HTML, CacheStrategy.RESPECT_SYSTEM_SETTING );
         Grid grid = analyticsService.getAggregatedDataValues( params, tableLayout, getItemsFromParam( columns ), getItemsFromParam( rows ) );
@@ -225,6 +230,7 @@
         @RequestParam( required = false ) DisplayProperty displayProperty,
         @RequestParam( required = false ) IdentifiableProperty outputIdScheme,
         @RequestParam( required = false ) String approvalLevel,
+        @RequestParam( required = false ) Date relativePeriodDate,
         @RequestParam( required = false ) String userOrgUnit,
         @RequestParam( required = false ) String program,
         @RequestParam( required = false ) String stage,
@@ -234,7 +240,7 @@
         HttpServletResponse response ) throws Exception
     {
         DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, skipMeta, skipData, skipRounding, hierarchyMeta, 
-            ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, userOrgUnit, program, stage, i18nManager.getI18nFormat() );
+            ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, relativePeriodDate, userOrgUnit, program, stage, i18nManager.getI18nFormat() );
 
         contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_CSV, CacheStrategy.RESPECT_SYSTEM_SETTING, "data.csv", true );
         Grid grid = analyticsService.getAggregatedDataValues( params, tableLayout, getItemsFromParam( columns ), getItemsFromParam( rows ) );
@@ -258,6 +264,7 @@
         @RequestParam( required = false ) DisplayProperty displayProperty,
         @RequestParam( required = false ) IdentifiableProperty outputIdScheme,
         @RequestParam( required = false ) String approvalLevel,
+        @RequestParam( required = false ) Date relativePeriodDate,
         @RequestParam( required = false ) String userOrgUnit,
         @RequestParam( required = false ) String program,
         @RequestParam( required = false ) String stage,
@@ -267,7 +274,7 @@
         HttpServletResponse response ) throws Exception
     {
         DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, skipMeta, skipData, skipRounding, hierarchyMeta, 
-            ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, userOrgUnit, program, stage, i18nManager.getI18nFormat() );
+            ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, relativePeriodDate, userOrgUnit, program, stage, i18nManager.getI18nFormat() );
 
         contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_EXCEL, CacheStrategy.RESPECT_SYSTEM_SETTING, "data.xls", true );
         Grid grid = analyticsService.getAggregatedDataValues( params, tableLayout, getItemsFromParam( columns ), getItemsFromParam( rows ) );
@@ -291,6 +298,7 @@
         @RequestParam( required = false ) DisplayProperty displayProperty,
         @RequestParam( required = false ) IdentifiableProperty outputIdScheme,
         @RequestParam( required = false ) Integer approvalLevel,
+        @RequestParam( required = false ) Date relativePeriodDate,
         @RequestParam( required = false ) String userOrgUnit,
         @RequestParam( required = false ) String program,
         @RequestParam( required = false ) String stage,
@@ -300,7 +308,7 @@
         HttpServletResponse response ) throws Exception
     {
         DataQueryParams params = analyticsService.getFromUrl( dimension, filter, null, null,
-            true, false, false, false, false, false, false, null, null, null, null, null, null, i18nManager.getI18nFormat() );
+            true, false, false, false, false, false, false, null, null, null, null, null, null, null, i18nManager.getI18nFormat() );
 
         contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_XML, CacheStrategy.RESPECT_SYSTEM_SETTING, "data.jrxml", false );
         Grid grid = analyticsService.getAggregatedDataValues( params );
@@ -325,6 +333,7 @@
         @RequestParam( required = false ) DisplayProperty displayProperty,
         @RequestParam( required = false ) IdentifiableProperty outputIdScheme,
         @RequestParam( required = false ) String approvalLevel,
+        @RequestParam( required = false ) Date relativePeriodDate,
         @RequestParam( required = false ) String userOrgUnit,
         @RequestParam( required = false ) String program,
         @RequestParam( required = false ) String stage,
@@ -334,7 +343,7 @@
         HttpServletResponse response ) throws Exception
     {
         DataQueryParams params = analyticsService.getFromUrl( dimension, filter, aggregationType, measureCriteria, skipMeta, skipData, skipRounding, hierarchyMeta, 
-            ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, userOrgUnit, program, stage, i18nManager.getI18nFormat() );
+            ignoreLimit, hideEmptyRows, showHierarchy, displayProperty, outputIdScheme, approvalLevel, relativePeriodDate, userOrgUnit, program, stage, i18nManager.getI18nFormat() );
 
         contextUtils.configureResponse( response, ContextUtils.CONTENT_TYPE_TEXT, CacheStrategy.NO_CACHE, "debug.sql", false );
         return AnalyticsUtils.getDebugDataSql( params );

=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/GeoFeatureController.java'
--- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/GeoFeatureController.java	2015-08-05 14:30:34 +0000
+++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/webapi/controller/mapping/GeoFeatureController.java	2015-08-26 09:42:00 +0000
@@ -32,6 +32,7 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
+import java.util.Date;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -100,6 +101,7 @@
     public void getGeoFeaturesJson(
         @RequestParam String ou,
         @RequestParam( required = false ) DisplayProperty displayProperty,
+        @RequestParam( required = false ) Date relativePeriodDate,
         @RequestParam( required = false ) String userOrgUnit,
         @RequestParam( defaultValue = "false", value = "includeGroupSets" ) boolean rpIncludeGroupSets,
         @RequestParam Map<String, String> parameters,
@@ -108,7 +110,7 @@
         WebOptions options = new WebOptions( parameters );
         boolean includeGroupSets = "detailed".equals( options.getViewClass() ) || rpIncludeGroupSets;
 
-        List<GeoFeature> features = getGeoFeatures( ou, displayProperty, userOrgUnit, request, response, includeGroupSets );
+        List<GeoFeature> features = getGeoFeatures( ou, displayProperty, relativePeriodDate, userOrgUnit, request, response, includeGroupSets );
         
         if ( features == null )
         {
@@ -123,6 +125,7 @@
     public void getGeoFeaturesJsonP(
         @RequestParam String ou,
         @RequestParam( required = false ) DisplayProperty displayProperty,
+        @RequestParam( required = false ) Date relativePeriodDate,
         @RequestParam( required = false ) String userOrgUnit,
         @RequestParam( defaultValue = "callback" ) String callback,
         @RequestParam( defaultValue = "false", value = "includeGroupSets" ) boolean rpIncludeGroupSets,
@@ -132,7 +135,7 @@
         WebOptions options = new WebOptions( parameters );
         boolean includeGroupSets = "detailed".equals( options.getViewClass() ) || rpIncludeGroupSets;
 
-        List<GeoFeature> features = getGeoFeatures( ou, displayProperty, userOrgUnit, request, response, includeGroupSets );
+        List<GeoFeature> features = getGeoFeatures( ou, displayProperty, relativePeriodDate, userOrgUnit, request, response, includeGroupSets );
 
         if ( features == null )
         {
@@ -153,20 +156,21 @@
      * 
      * @param ou the organisation unit parameter.
      * @param displayProperty the display property.
+     * @param relativePeriodDate the date to use as basis for relative periods.
      * @param userOrgUnit the user organisation unit parameter.
      * @param request the HTTP request.
      * @param response the HTTP response.
      * @param includeGroupSets whether to include organisation unit group sets.
      * @return a list of geo features or null.
      */
-    private List<GeoFeature> getGeoFeatures( String ou, DisplayProperty displayProperty, 
+    private List<GeoFeature> getGeoFeatures( String ou, DisplayProperty displayProperty, Date relativePeriodDate, 
         String userOrgUnit, HttpServletRequest request, HttpServletResponse response, boolean includeGroupSets )
     {
         Set<String> set = new HashSet<>();
         set.add( ou );
 
         DataQueryParams params = analyticsService.getFromUrl( set, null, AggregationType.SUM, null,
-            false, false, false, false, false, false, false, displayProperty, null, null, userOrgUnit, null, null, null );
+            false, false, false, false, false, false, false, displayProperty, null, null, relativePeriodDate, userOrgUnit, null, null, null );
 
         DimensionalObject dim = params.getDimension( DimensionalObject.ORGUNIT_DIM_ID );
 


Follow ups