← Back to team overview

dhis2-devs team mailing list archive

Re: /api/analytics not returning values for the correct period

 

Hi Sandesh,

this is not a bug and intended behavior, although some would call it a bit
strange.

Currently the way it works is that we subtract 1 month from the current
date before calculating the relative periods. So this year becomes 2015 on
Feb 1, this quarter becomes 2015Q1 on Feb 1, etc.

We have done it because of the nature of routine data. When you create e.g.
a chart with "this month" or "last year" or whatever, in most situations
you don't want the chart to "switch" period until after some time, because
you will not have any data for that period immediately, as people cannot
enter routine data before the period is over.

Example: If you collect data quarterly, e.g. for quarter 2, you cannot
enter routine data before that quarter is over, and it also takes a bit of
time to get people to enter data into the system. So if the system switches
"this quarter" exactly at the day quarter 2 is over, all charts in your
dashboard will become empty and boring for a long time.

That's why we made it like that.

I know it is not satisfying all scenarios. We have been thinking of a way
to explicitly define a "time lag" per chart/pivot/map where you can define
this yourself, and we go back to having the relative periods "switch" on
the day the period ends.

regards,

Lars






On Fri, Jan 9, 2015 at 11:37 AM, Sandesh Sukumar Doolipeta <
sandeshd@xxxxxxxxxxxxxxxx> wrote:

> Hi ,
>
>
>      We are using the /api/analytics api to get the analytics data for a
> particular period using the dimension filter. The following is the call we
> are making ,
>
> *     /api/analytics?dimension=dx:someid&dimension=pe:THIS_YEAR*
>
>      Though the period specified using the 'pe' parameter is 'THIS_YEAR' ,
> the data is being returned for the year 2014.
>
>      The same error can also be seen in the data visualizer. In the data
> visualizer screen , changing the period filter to 'This year' and clicking
> on update , shows the data of the previous year i.e 2014.
>
>
>
>
>
>
> --
> *Sandesh Doolipeta**Application Developer*
> Emailsandeshd@xxxxxxxxxxxxxxxx
> Telephone9686062727
> [image: ThoughtWorks] <http://www.thoughtworks.com/>
>

Follow ups

References