Best possible approach to list all the data elements of a program

Dear devs,

What will be the best possible approach (minimum number of API calls) to get all the dataElements which are relevant for a selected program.

I couldn’t find out a direct API call for this, so currently following the below flow.

Program (1) → programStages (n) → programStageDataElements (m) → dataElement (m)

Assuming a Program has n programStages and, each programStage has m programStageDataElements, to get all the dataElements (displayName of data elements) it takes n x m x m API calls.

Since this isn’t an acceptable approach, would it be possible to minimize the number of API calls?

Thanks

Chathura

Maybe something like this:

https://play.dhis2.org/demo/api/programs/IpHINAT79UW.json?fields=programStages[programStageDataElements[:all]]

···

On Sun, May 15, 2016 at 6:48 PM, chathura widanage chathurawidanage@gmail.com wrote:

Dear devs,

What will be the best possible approach (minimum number of API calls) to get all the dataElements which are relevant for a selected program.

I couldn’t find out a direct API call for this, so currently following the below flow.

Program (1) → programStages (n) → programStageDataElements (m) → dataElement (m)

Assuming a Program has n programStages and, each programStage has m programStageDataElements, to get all the dataElements (displayName of data elements) it takes n x m x m API calls.

Since this isn’t an acceptable approach, would it be possible to minimize the number of API calls?

Thanks

Chathura


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

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

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

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

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

Or better:
https://play.dhis2.org/demo/api/programs/IpHINAT79UW.json?fields=programStages[programStageDataElements[dataElement[name,id]]]

···

On Sun, May 15, 2016 at 7:09 PM, Knut Staring knutst@gmail.com wrote:

Maybe something like this:

https://play.dhis2.org/demo/api/programs/IpHINAT79UW.json?fields=programStages[programStageDataElements[:all]]

On Sun, May 15, 2016 at 6:48 PM, chathura widanage chathurawidanage@gmail.com wrote:

Dear devs,

What will be the best possible approach (minimum number of API calls) to get all the dataElements which are relevant for a selected program.

I couldn’t find out a direct API call for this, so currently following the below flow.

Program (1) → programStages (n) → programStageDataElements (m) → dataElement (m)

Assuming a Program has n programStages and, each programStage has m programStageDataElements, to get all the dataElements (displayName of data elements) it takes n x m x m API calls.

Since this isn’t an acceptable approach, would it be possible to minimize the number of API calls?

Thanks

Chathura


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

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

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

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

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

Hi Knut,

This is really amazing. Didn’t know that this kind of querying is possible with the API.

Thank you very much.

···

On Sun, May 15, 2016 at 10:40 PM, Knut Staring knutst@gmail.com wrote:

Or better:
https://play.dhis2.org/demo/api/programs/IpHINAT79UW.json?fields=programStages[programStageDataElements[dataElement[name,id]]]

On Sun, May 15, 2016 at 7:09 PM, Knut Staring knutst@gmail.com wrote:

Maybe something like this:

https://play.dhis2.org/demo/api/programs/IpHINAT79UW.json?fields=programStages[programStageDataElements[:all]]


Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

On Sun, May 15, 2016 at 6:48 PM, chathura widanage chathurawidanage@gmail.com wrote:

Dear devs,

What will be the best possible approach (minimum number of API calls) to get all the dataElements which are relevant for a selected program.

I couldn’t find out a direct API call for this, so currently following the below flow.

Program (1) → programStages (n) → programStageDataElements (m) → dataElement (m)

Assuming a Program has n programStages and, each programStage has m programStageDataElements, to get all the dataElements (displayName of data elements) it takes n x m x m API calls.

Since this isn’t an acceptable approach, would it be possible to minimize the number of API calls?

Thanks

Chathura


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

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

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

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

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

Best Regards,

Chathura Widanage,

Undergraduate,

Department of Computer Science and Engineering,

University of Moratuwa,

Sri Lanka

Hi Chathura,

Yeah, it is pretty powerful. More examples in the documentation, also on filtering exactly which results and what fields you like to see.

Have fun!

Knut

···

On Sun, May 15, 2016 at 7:17 PM, chathura widanage chathurawidanage@gmail.com wrote:

Hi Knut,

This is really amazing. Didn’t know that this kind of querying is possible with the API.

Thank you very much.

On Sun, May 15, 2016 at 10:40 PM, Knut Staring knutst@gmail.com wrote:

Or better:
https://play.dhis2.org/demo/api/programs/IpHINAT79UW.json?fields=programStages[programStageDataElements[dataElement[name,id]]]

Best Regards,

Chathura Widanage,

Undergraduate,

Department of Computer Science and Engineering,

University of Moratuwa,

Sri Lanka

On Sun, May 15, 2016 at 7:09 PM, Knut Staring knutst@gmail.com wrote:

Maybe something like this:

https://play.dhis2.org/demo/api/programs/IpHINAT79UW.json?fields=programStages[programStageDataElements[:all]]


Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

On Sun, May 15, 2016 at 6:48 PM, chathura widanage chathurawidanage@gmail.com wrote:

Dear devs,

What will be the best possible approach (minimum number of API calls) to get all the dataElements which are relevant for a selected program.

I couldn’t find out a direct API call for this, so currently following the below flow.

Program (1) → programStages (n) → programStageDataElements (m) → dataElement (m)

Assuming a Program has n programStages and, each programStage has m programStageDataElements, to get all the dataElements (displayName of data elements) it takes n x m x m API calls.

Since this isn’t an acceptable approach, would it be possible to minimize the number of API calls?

Thanks

Chathura


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

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

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

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

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

Hi Chathura,

I use the following nested web api code to retrieve data elements, attributes and option sets related to a program with registrations

http://URL/api/programs.json?filter=programType:eq:WITH_REGISTRATION&paging=false&fields=id,version,name,programTrackedEntityAttributes[trackedEntityAttribute[id,name,optionSet[id,version,options[id,name]]]],programStages[id,name,version,programStageDataElements[dataElement[id,name,optionSet[id,name,version,options[id,name]]]]]

···

On Sun, May 15, 2016 at 10:50 PM, Knut Staring knutst@gmail.com wrote:

Hi Chathura,

Yeah, it is pretty powerful. More examples in the documentation, also on filtering exactly which results and what fields you like to see.

Have fun!

Knut


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

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

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

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

On Sun, May 15, 2016 at 7:17 PM, chathura widanage chathurawidanage@gmail.com wrote:

Hi Knut,

This is really amazing. Didn’t know that this kind of querying is possible with the API.

Thank you very much.


Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

On Sun, May 15, 2016 at 10:40 PM, Knut Staring knutst@gmail.com wrote:

Or better:
https://play.dhis2.org/demo/api/programs/IpHINAT79UW.json?fields=programStages[programStageDataElements[dataElement[name,id]]]

Best Regards,

Chathura Widanage,

Undergraduate,

Department of Computer Science and Engineering,

University of Moratuwa,

Sri Lanka

On Sun, May 15, 2016 at 7:09 PM, Knut Staring knutst@gmail.com wrote:

Maybe something like this:

https://play.dhis2.org/demo/api/programs/IpHINAT79UW.json?fields=programStages[programStageDataElements[:all]]


Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

On Sun, May 15, 2016 at 6:48 PM, chathura widanage chathurawidanage@gmail.com wrote:

Dear devs,

What will be the best possible approach (minimum number of API calls) to get all the dataElements which are relevant for a selected program.

I couldn’t find out a direct API call for this, so currently following the below flow.

Program (1) → programStages (n) → programStageDataElements (m) → dataElement (m)

Assuming a Program has n programStages and, each programStage has m programStageDataElements, to get all the dataElements (displayName of data elements) it takes n x m x m API calls.

Since this isn’t an acceptable approach, would it be possible to minimize the number of API calls?

Thanks

Chathura


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

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

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

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

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

Regards,
Pamod Amarakoon

Confidentiality Notice: the information contained in this email and any attachments may be legally privileged and confidential. If you are not an intended recipient, you are hereby notified that any dissemination, distribution, or copying of this e-mail is strictly prohibited. If you have received this e-mail in error, please notify the sender and permanently delete the e-mail and any attachments immediately. You should not retain, copy or use this e-mail or any attachments for any purpose, nor disclose all or any part of the contents to any other person.

Hi Knut & Dr. Pamod,

Thank you very much. You just solved multiple problems that I worried such as higher bandwidth usage, having to use multiple requests to fetch a single data, filtering etc.

Thanks again. :slight_smile:

Chathura

···

On Sun, May 15, 2016 at 10:50 PM, Knut Staring knutst@gmail.com wrote:

Hi Chathura,

Yeah, it is pretty powerful. More examples in the documentation, also on filtering exactly which results and what fields you like to see.

Have fun!

Knut


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

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

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

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


Regards,
Pamod Amarakoon

Confidentiality Notice: the information contained in this email and any attachments may be legally privileged and confidential. If you are not an intended recipient, you are hereby notified that any dissemination, distribution, or copying of this e-mail is strictly prohibited. If you have received this e-mail in error, please notify the sender and permanently delete the e-mail and any attachments immediately. You should not retain, copy or use this e-mail or any attachments for any purpose, nor disclose all or any part of the contents to any other person.

On Sun, May 15, 2016 at 7:17 PM, chathura widanage chathurawidanage@gmail.com wrote:

Hi Knut,

This is really amazing. Didn’t know that this kind of querying is possible with the API.

Thank you very much.


Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

On Sun, May 15, 2016 at 10:40 PM, Knut Staring knutst@gmail.com wrote:

Or better:
https://play.dhis2.org/demo/api/programs/IpHINAT79UW.json?fields=programStages[programStageDataElements[dataElement[name,id]]]

Best Regards,

Chathura Widanage,

Undergraduate,

Department of Computer Science and Engineering,

University of Moratuwa,

Sri Lanka

On Sun, May 15, 2016 at 7:09 PM, Knut Staring knutst@gmail.com wrote:

Maybe something like this:

https://play.dhis2.org/demo/api/programs/IpHINAT79UW.json?fields=programStages[programStageDataElements[:all]]


Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org

On Sun, May 15, 2016 at 6:48 PM, chathura widanage chathurawidanage@gmail.com wrote:

Dear devs,

What will be the best possible approach (minimum number of API calls) to get all the dataElements which are relevant for a selected program.

I couldn’t find out a direct API call for this, so currently following the below flow.

Program (1) → programStages (n) → programStageDataElements (m) → dataElement (m)

Assuming a Program has n programStages and, each programStage has m programStageDataElements, to get all the dataElements (displayName of data elements) it takes n x m x m API calls.

Since this isn’t an acceptable approach, would it be possible to minimize the number of API calls?

Thanks

Chathura


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

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

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

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

Knut Staring

Dept. of Informatics, University of Oslo

Norway: +4791880522

Skype: knutstar

http://dhis2.org