API for reading categoryOptions per categoryOptionCombo

Dear all,

I am experimenting with the DHIS2-api within the context of loading bigger amounts of external data into a DHIS2 dataSet. At on point I need the codes of all categoryOptions involved in all categoryOptionCombos of a categoryCombo of a dataSet in order to join them against the codes in my external data for mapping purposes. I am currently using categoryCombos.categoryOptionCombos to get all the combos, and then categoryOptionCombos to get the involved categoryOptions.

This means: I have to call the categoryOptionCombos-api once for each categoryOptionCombo (in the current test-setting already over 8000 with 5 Categories and 4-12 Optiions each)

I wonder if there is a more efficient api-access to get all categroyOptions per categoryCombo at one go. I don’t want to access teh DB directly.

Grateful for any ideas …

Regards, Uwe

Hi Uwe,

try using field filtering like this:

https://play.dhis2.org/demo/api/categoryCombos/O4VaNks6tta.json?fields=id,categoryOptionCombos[categoryOptions[id,code,name]]

Docs here.

regards,

Lars

···

On Wed, Nov 25, 2015 at 10:52 AM, Uwe Wahser uwe@wahser.de wrote:

Dear all,

I am experimenting with the DHIS2-api within the context of loading bigger amounts of external data into a DHIS2 dataSet. At on point I need the codes of all categoryOptions involved in all categoryOptionCombos of a categoryCombo of a dataSet in order to join them against the codes in my external data for mapping purposes. I am currently using categoryCombos.categoryOptionCombos to get all the combos, and then categoryOptionCombos to get the involved categoryOptions.

This means: I have to call the categoryOptionCombos-api once for each categoryOptionCombo (in the current test-setting already over 8000 with 5 Categories and 4-12 Optiions each)

I wonder if there is a more efficient api-access to get all categroyOptions per categoryCombo at one go. I don’t want to access teh DB directly.

Grateful for any ideas …

Regards, Uwe


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

http://www.dhis2.org

A slight variation on Lars's suggestion gives you them broken down
into categories (which might make mapping easier)

curl -u admin:district -X GET -g
"https://play.dhis2.org/demo/api/categoryCombos/O4VaNks6tta.json?fields=id,name,code,categories[id,code,name,categoryOptions[id,code,name]]"

···

On 25 November 2015 at 11:33, Lars Helge Øverland <larshelge@gmail.com> wrote:

Hi Uwe,

try using field filtering like this:

https://play.dhis2.org/demo/api/categoryCombos/O4VaNks6tta.json?fields=id,categoryOptionCombos[categoryOptions[id,code,name]]

Docs here.

regards,

Lars

On Wed, Nov 25, 2015 at 10:52 AM, Uwe Wahser <uwe@wahser.de> wrote:

Dear all,

I am experimenting with the DHIS2-api within the context of loading bigger
amounts of external data into a DHIS2 dataSet. At on point I need the codes
of all categoryOptions involved in all categoryOptionCombos of a
categoryCombo of a dataSet in order to join them against the codes in my
external data for mapping purposes. I am currently using
categoryCombos.categoryOptionCombos to get all the combos, and then
categoryOptionCombos to get the involved categoryOptions.

This means: I have to call the categoryOptionCombos-api once for each
categoryOptionCombo (in the current test-setting already over 8000 with 5
Categories and 4-12 Optiions each)

I wonder if there is a more efficient api-access to get all
categroyOptions per categoryCombo at one go. I don't want to access teh DB
directly.

Grateful for any ideas ...

Regards, Uwe

_______________________________________________
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
http://www.dhis2.org

_______________________________________________
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

Thanks to both of you - that brought down the extraction time in this specific step from 20 minutes to only one :slight_smile:

Actually I need both variants, as I have to get the dimensions, that are responsible for a specific option in a optionCombo by linking the option-id from the optionCombo to the option-id of the dimension. However, this only works, when the dimensions don't share options. That makes it difficult to work with unique option-codes for Missing or Others, especially since DHIS2 only allows to define globally unique option.codes and names.

Is there a way to find out, which dimension signs responsible for which option in an optionCombo, e.g. is the order of the values in an optionCombo reliably linked to the order of the dimensions in that categoryCombo?

Regards, Uwe

···

Am 25.11.2015 um 17:59 schrieb Bob Jolliffe:

A slight variation on Lars's suggestion gives you them broken down
into categories (which might make mapping easier)

curl -u admin:district -X GET -g
"https://play.dhis2.org/demo/api/categoryCombos/O4VaNks6tta.json?fields=id,name,code,categories[id,code,name,categoryOptions[id,code,name]]"

On 25 November 2015 at 11:33, Lars Helge Øverland <larshelge@gmail.com> wrote:

Hi Uwe,

try using field filtering like this:

https://play.dhis2.org/demo/api/categoryCombos/O4VaNks6tta.json?fields=id,categoryOptionCombos[categoryOptions[id,code,name]]

Docs here.

regards,

Lars

On Wed, Nov 25, 2015 at 10:52 AM, Uwe Wahser <uwe@wahser.de> wrote:

Dear all,

I am experimenting with the DHIS2-api within the context of loading bigger
amounts of external data into a DHIS2 dataSet. At on point I need the codes
of all categoryOptions involved in all categoryOptionCombos of a
categoryCombo of a dataSet in order to join them against the codes in my
external data for mapping purposes. I am currently using
categoryCombos.categoryOptionCombos to get all the combos, and then
categoryOptionCombos to get the involved categoryOptions.

This means: I have to call the categoryOptionCombos-api once for each
categoryOptionCombo (in the current test-setting already over 8000 with 5
Categories and 4-12 Optiions each)

I wonder if there is a more efficient api-access to get all
categroyOptions per categoryCombo at one go. I don't want to access teh DB
directly.

Grateful for any ideas ...

Regards, Uwe

_______________________________________________
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
http://www.dhis2.org

_______________________________________________
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