API call on reportTable with parameters?

Hi,
We currently have a reportTable used to generate a PDF report. We now want to be able to extract the exact same info using the API. I’ve seen that there is a reportTables//data.json option, but I cannot find how to pass it parameters (our table take two - the organisation unit and the period).

Any pointers?

Thanks,

Martin

···

**Martin Van Aken - **Freelance Enthusiast Developer

Mobile : +32 486 899 652

Follow me on Twitter : @martinvanaken

Call me on Skype : vanakenm

Hang out with me : martin@joyouscoding.com

Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken

Company website : www.joyouscoding.com

Hi Martin

You can use ou and date as query parameters

···

On Mon, May 9, 2016 at 3:18 PM, Martin Van Aken martin@joyouscoding.com wrote:

Hi,
We currently have a reportTable used to generate a PDF report. We now want to be able to extract the exact same info using the API. I’ve seen that there is a reportTables//data.json option, but I cannot find how to pass it parameters (our table take two - the organisation unit and the period).

Any pointers?

Thanks,

Martin


**Martin Van Aken - **Freelance Enthusiast Developer

Mobile : +32 486 899 652

Follow me on Twitter : @martinvanaken

Call me on Skype : vanakenm

Hang out with me : martin@joyouscoding.com

Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken

Company website : www.joyouscoding.com


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Morten Olav Hansen

Senior Engineer, DHIS 2

University of Oslo

http://www.dhis2.org

I’m honestly not sure, Lars would have to answer that. The date itself is a normal date object, which means multiple date formats are supported.

@Lars ?

···

On Mon, May 9, 2016 at 3:37 PM, Martin Van Aken martin@joyouscoding.com wrote:

Martin

Thanks a lot for the quick answer. Is the date a period ? (in my case the table represent a selection of data element and indicators which are collected each month in each org units).

Morten Olav Hansen

Senior Engineer, DHIS 2

University of Oslo

http://www.dhis2.org

On Mon, May 9, 2016 at 10:34 AM, Morten Olav Hansen morten@dhis2.org wrote:

Hi Martin

You can use ou and date as query parameters


**Martin Van Aken - **Freelance Enthusiast Developer

Mobile : +32 486 899 652

Follow me on Twitter : @martinvanaken

Call me on Skype : vanakenm

Hang out with me : martin@joyouscoding.com

Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken

Company website : www.joyouscoding.com

Morten Olav Hansen

Senior Engineer, DHIS 2

University of Oslo

http://www.dhis2.org

On Mon, May 9, 2016 at 3:18 PM, Martin Van Aken martin@joyouscoding.com wrote:

Hi,
We currently have a reportTable used to generate a PDF report. We now want to be able to extract the exact same info using the API. I’ve seen that there is a reportTables//data.json option, but I cannot find how to pass it parameters (our table take two - the organisation unit and the period).

Any pointers?

Thanks,

Martin


**Martin Van Aken - **Freelance Enthusiast Developer

Mobile : +32 486 899 652

Follow me on Twitter : @martinvanaken

Call me on Skype : vanakenm

Hang out with me : martin@joyouscoding.com

Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken

Company website : www.joyouscoding.com


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

This looks to be working, even if I’m not clear on the relationship between dates & periods.

Last but not least - I had two ideas to make this work: either use the reportTable as API source (pro: it already existed) or create the equivalent using the analytics web API. My problem in that second case it that I did not find any way to collect all the indicators for a given group for a specific organisation unit except by listing them one by one. There is something call a data element group using a syntax like:

dx:DE_GROUP-

but it does not look to work for indicators group. Is there an alternate, non documented syntax for those?

If both approach can work, any advice on using one vs the other (analytics vs reportTable) ?

Martin

···

On Mon, May 9, 2016 at 10:39 AM, Morten Olav Hansen morten@dhis2.org wrote:

I’m honestly not sure, Lars would have to answer that. The date itself is a normal date object, which means multiple date formats are supported.

@Lars ?

Morten Olav Hansen

Senior Engineer, DHIS 2

University of Oslo

http://www.dhis2.org

On Mon, May 9, 2016 at 3:37 PM, Martin Van Aken martin@joyouscoding.com wrote:

Martin

Thanks a lot for the quick answer. Is the date a period ? (in my case the table represent a selection of data element and indicators which are collected each month in each org units).

On Mon, May 9, 2016 at 10:34 AM, Morten Olav Hansen morten@dhis2.org wrote:

Hi Martin

You can use ou and date as query parameters


**Martin Van Aken - **Freelance Enthusiast Developer

Mobile : +32 486 899 652

Follow me on Twitter : @martinvanaken

Call me on Skype : vanakenm

Hang out with me : martin@joyouscoding.com

Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken

Company website : www.joyouscoding.com

Morten Olav Hansen

Senior Engineer, DHIS 2

University of Oslo

http://www.dhis2.org

On Mon, May 9, 2016 at 3:18 PM, Martin Van Aken martin@joyouscoding.com wrote:

Hi,
We currently have a reportTable used to generate a PDF report. We now want to be able to extract the exact same info using the API. I’ve seen that there is a reportTables//data.json option, but I cannot find how to pass it parameters (our table take two - the organisation unit and the period).

Any pointers?

Thanks,

Martin


**Martin Van Aken - **Freelance Enthusiast Developer

Mobile : +32 486 899 652

Follow me on Twitter : @martinvanaken

Call me on Skype : vanakenm

Hang out with me : martin@joyouscoding.com

Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken

Company website : www.joyouscoding.com


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

**Martin Van Aken - **Freelance Enthusiast Developer

Mobile : +32 486 899 652

Follow me on Twitter : @martinvanaken

Call me on Skype : vanakenm

Hang out with me : martin@joyouscoding.com

Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken

Company website : www.joyouscoding.com

Hi Martin,

I would recommend that you go with the analytics API instead of the report table resource, as the former is a lot more flexible.

Your request is a good one and since it was a quick fix I have added support for the IN_GROUP- syntax in trunk and 2.23. New download ready in 20 minutes.

You can use the “columns” and “rows” query parameters to achieve the tabular response format directly from the analytics API. So combining the new IN_GROUP syntax with columns/rows should be a feasible approach to retrieving large tabular responses:

https://play.dhis2.org/demo/api/analytics.html+css?dimension=pe:2016&dimension=dx:DE_GROUP-qfxEYY9xAl6&filter=ou:ImspTQPwCqd&columns=pe&rows=dx

Docs:

http://dhis2.github.io/dhis2-docs/master/en/developer/html/ch01s32.html

regards,

Lars

···

On Mon, May 9, 2016 at 10:42 AM, Martin Van Aken martin@joyouscoding.com wrote:

This looks to be working, even if I’m not clear on the relationship between dates & periods.

Last but not least - I had two ideas to make this work: either use the reportTable as API source (pro: it already existed) or create the equivalent using the analytics web API. My problem in that second case it that I did not find any way to collect all the indicators for a given group for a specific organisation unit except by listing them one by one. There is something call a data element group using a syntax like:

dx:DE_GROUP-

but it does not look to work for indicators group. Is there an alternate, non documented syntax for those?

If both approach can work, any advice on using one vs the other (analytics vs reportTable) ?

Martin

On Mon, May 9, 2016 at 10:39 AM, Morten Olav Hansen morten@dhis2.org wrote:

I’m honestly not sure, Lars would have to answer that. The date itself is a normal date object, which means multiple date formats are supported.

@Lars ?


**Martin Van Aken - **Freelance Enthusiast Developer

Mobile : +32 486 899 652

Follow me on Twitter : @martinvanaken

Call me on Skype : vanakenm

Hang out with me : martin@joyouscoding.com

Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken

Company website : www.joyouscoding.com

Morten Olav Hansen

Senior Engineer, DHIS 2

University of Oslo

http://www.dhis2.org

On Mon, May 9, 2016 at 3:37 PM, Martin Van Aken martin@joyouscoding.com wrote:

Martin

Thanks a lot for the quick answer. Is the date a period ? (in my case the table represent a selection of data element and indicators which are collected each month in each org units).

On Mon, May 9, 2016 at 10:34 AM, Morten Olav Hansen morten@dhis2.org wrote:

Hi Martin

You can use ou and date as query parameters


**Martin Van Aken - **Freelance Enthusiast Developer

Mobile : +32 486 899 652

Follow me on Twitter : @martinvanaken

Call me on Skype : vanakenm

Hang out with me : martin@joyouscoding.com

Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken

Company website : www.joyouscoding.com

Morten Olav Hansen

Senior Engineer, DHIS 2

University of Oslo

http://www.dhis2.org

On Mon, May 9, 2016 at 3:18 PM, Martin Van Aken martin@joyouscoding.com wrote:

Hi,
We currently have a reportTable used to generate a PDF report. We now want to be able to extract the exact same info using the API. I’ve seen that there is a reportTables//data.json option, but I cannot find how to pass it parameters (our table take two - the organisation unit and the period).

Any pointers?

Thanks,

Martin


**Martin Van Aken - **Freelance Enthusiast Developer

Mobile : +32 486 899 652

Follow me on Twitter : @martinvanaken

Call me on Skype : vanakenm

Hang out with me : martin@joyouscoding.com

Contact me on LinkedIn : http://www.linkedin.com/in/martinvanaken

Company website : www.joyouscoding.com


Mailing list: https://launchpad.net/~dhis2-users

Post to : dhis2-users@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-users

More help : https://help.launchpad.net/ListHelp

Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

lars@dhis2.org

http://www.dhis2.org