Allow for analytics responses to be ordered, limited, and offset

Registered by jason.p.pickering on 2015-08-19

Currently, analytics responses are not ordered according to any of the dimensions.

An additional set of paramaters should be introduced.

1) "orderBy" would accept the same dimensions as in the request. For instance with this call

apps.dhis2.org/demo/api/analytics.json?dimension=dx:eTDtyyaSA7f;FbKK4ofIv5R&dimension=pe:2014Q1;2014Q2&filter=ou:ImspTQPwCqd

this could be extended to

api/analytics.json?dimension=dx:eTDtyyaSA7f;FbKK4ofIv5R&dimension=pe:2014Q1;2014Q2&filter=ou:ImspTQPwCqd&orderBy=[dx,pe]

2) Once the response has a known order, it could be limited with
api/analytics.json?dimension=dx:eTDtyyaSA7f;FbKK4ofIv5R&dimension=pe:2014Q1;2014Q2&filter=ou:ImspTQPwCqd&orderBy=[dx,pe]&limit=100

to return the first 100 records. (1-100) and ordered by the dimensions specified in brackets.

api/analytics.json?dimension=dx:eTDtyyaSA7f;FbKK4ofIv5R&dimension=pe:2014Q1;2014Q2&filter=ou:ImspTQPwCqd&orderBy=[value:desc,dx,pe]&limit=100

Would return the first 100 records ordered first by the value (descending) and then the other dimensions.

3) Once the limit is in place, the records could be offset with a call like

api/analytics.json?dimension=dx:eTDtyyaSA7f;FbKK4ofIv5R&dimension=pe:2014Q1;2014Q2&filter=ou:ImspTQPwCqd&orderBy=[dx,pe]&limit=100&offset=100

to return the next batch of 100 records. (101-200)

Blueprint information

Status:
Not started
Approver:
Lars Helge Ă˜verland
Priority:
Undefined
Drafter:
jason.p.pickering
Direction:
Needs approval
Assignee:
Lars Helge Ă˜verland
Definition:
New
Series goal:
None
Implementation:
Unknown
Milestone target:
None

Related branches

Sprints

Whiteboard

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.