difficuties to obtain dataelements from oganisation units through the api....

Hi,

I’m trying to use the API to get information on an organisation unit.

For instance i’m trying to extract the ‘contact name’.

My request looks as follow:

…dhis/api/analytics?dimension=dx:IBRoBwdUxkA&dimension=pe:2012&dimension=ou:vzw0YutAWos

and i obtain an answer like this:

{“headers”:[{“name”:“dx”,“column”:“Data”,“type”:“java.lang.String”,“hidden”:false,“meta”:true},{“name”:“pe”,“column”:“Period”,“type”:“java.lang.String”,“hidden”:false,“meta”:true},{“name”:“ou”,“column”:“Organisation unit”,“type”:“java.lang.String”,“hidden”:false,“meta”:true},{“name”:“value”,“column”:“Value”,“type”:“java.lang.Double”,“hidden”:false,“meta”:false}],“metaData”:{“pe”:[“2012”],“co”:[],“ou”:[“vzw0YutAWos”],“names”:{“pe”:“Period”,“ou”:“Organisation unit”,“dx”:“Data”,“IBRoBwdUxkA”:“Nom et prénoms contact”,“2012”:“2012”,“vzw0YutAWos”:“MUTUELLE DE SANTE DE BANIKOARA”}},“height”:0,“rows”:[],“width”:0}

with rows being empty…

I can get dataelements with a numeric value. Is there something specific with datalements that have to return strings ?

Any idea what i am doing wrong ?

Thanks,

Stephane

Hi Stephane,
You should not use the Analytics API to get metadata.

Try this instead:

https://www.dhis2.org/doc/snapshot/en/developer/html/ch01s05.html

Knut

···

On Mon, Oct 13, 2014 at 7:32 PM, Stéphane Delbeke sdelbeke@bluesquare.org wrote:

Hi,

I’m trying to use the API to get information on an organisation unit.

For instance i’m trying to extract the ‘contact name’.

My request looks as follow:

…dhis/api/analytics?dimension=dx:IBRoBwdUxkA&dimension=pe:2012&dimension=ou:vzw0YutAWos

and i obtain an answer like this:

{“headers”:[{“name”:“dx”,“column”:“Data”,“type”:“java.lang.String”,“hidden”:false,“meta”:true},{“name”:“pe”,“column”:“Period”,“type”:“java.lang.String”,“hidden”:false,“meta”:true},{“name”:“ou”,“column”:“Organisation unit”,“type”:“java.lang.String”,“hidden”:false,“meta”:true},{“name”:“value”,“column”:“Value”,“type”:“java.lang.Double”,“hidden”:false,“meta”:false}],“metaData”:{“pe”:[“2012”],“co”:[],“ou”:[“vzw0YutAWos”],“names”:{“pe”:“Period”,“ou”:“Organisation unit”,“dx”:“Data”,“IBRoBwdUxkA”:“Nom et prénoms contact”,“2012”:“2012”,“vzw0YutAWos”:“MUTUELLE DE SANTE DE BANIKOARA”}},“height”:0,“rows”:[],“width”:0}

with rows being empty…

I can get dataelements with a numeric value. Is there something specific with datalements that have to return strings ?

Any idea what i am doing wrong ?

Thanks,

Stephane


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


Knut Staring

Dept. of Informatics, University of Oslo

+4791880522

Skype: knutstar

http://dhis2.org

For just a single type, in this case organisation unit, you can go straight to the resource instead:

/api/organisationUnit/vzw0YutAWos.json

To control which fields you want to display, you can use the fields parameter, e.g:

/api/organisationUnit/vzw0YutAWos.json?fields=id,name,contactPerson

···

On Mon, Oct 13, 2014 at 3:05 PM, Knut Staring knutst@gmail.com wrote:

Hi Stephane,
You should not use the Analytics API to get metadata.

Try this instead:

https://www.dhis2.org/doc/snapshot/en/developer/html/ch01s05.html

Knut


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

On Mon, Oct 13, 2014 at 7:32 PM, Stéphane Delbeke sdelbeke@bluesquare.org wrote:

Hi,

I’m trying to use the API to get information on an organisation unit.

For instance i’m trying to extract the ‘contact name’.

My request looks as follow:

…dhis/api/analytics?dimension=dx:IBRoBwdUxkA&dimension=pe:2012&dimension=ou:vzw0YutAWos

and i obtain an answer like this:

{“headers”:[{“name”:“dx”,“column”:“Data”,“type”:“java.lang.String”,“hidden”:false,“meta”:true},{“name”:“pe”,“column”:“Period”,“type”:“java.lang.String”,“hidden”:false,“meta”:true},{“name”:“ou”,“column”:“Organisation unit”,“type”:“java.lang.String”,“hidden”:false,“meta”:true},{“name”:“value”,“column”:“Value”,“type”:“java.lang.Double”,“hidden”:false,“meta”:false}],“metaData”:{“pe”:[“2012”],“co”:[],“ou”:[“vzw0YutAWos”],“names”:{“pe”:“Period”,“ou”:“Organisation unit”,“dx”:“Data”,“IBRoBwdUxkA”:“Nom et prénoms contact”,“2012”:“2012”,“vzw0YutAWos”:“MUTUELLE DE SANTE DE BANIKOARA”}},“height”:0,“rows”:[],“width”:0}

with rows being empty…

I can get dataelements with a numeric value. Is there something specific with datalements that have to return strings ?

Any idea what i am doing wrong ?

Thanks,

Stephane


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

Knut Staring

Dept. of Informatics, University of Oslo

+4791880522

Skype: knutstar

http://dhis2.org

Hi,

Thanks a lot for the quick reply, i can now retrieve a single value with something like this: :

api/dataValues?de=IBRoBwdUxkA&pe=2012&ou=vzw0YutAWos

I am also trying to get the complete dataset using this:

/api/dataValueSets?dataSet=iShiRf8NdCv&period=201201&orgUnit=vzw0YutAWos

but it returns nothing…

Am i missing something ?

Is there another way to get a complete dataset ?

I’d like to request all datasets of all organisationunits at once, how can this be done ?

Thanks,

Stephane

···

On Mon, Oct 13, 2014 at 3:05 PM, Knut Staring knutst@gmail.com wrote:

Hi Stephane,
You should not use the Analytics API to get metadata.

Try this instead:

https://www.dhis2.org/doc/snapshot/en/developer/html/ch01s05.html

Knut

On Mon, Oct 13, 2014 at 7:32 PM, Stéphane Delbeke sdelbeke@bluesquare.org wrote:

Hi,

I’m trying to use the API to get information on an organisation unit.

For instance i’m trying to extract the ‘contact name’.

My request looks as follow:

…dhis/api/analytics?dimension=dx:IBRoBwdUxkA&dimension=pe:2012&dimension=ou:vzw0YutAWos

and i obtain an answer like this:

{“headers”:[{“name”:“dx”,“column”:“Data”,“type”:“java.lang.String”,“hidden”:false,“meta”:true},{“name”:“pe”,“column”:“Period”,“type”:“java.lang.String”,“hidden”:false,“meta”:true},{“name”:“ou”,“column”:“Organisation unit”,“type”:“java.lang.String”,“hidden”:false,“meta”:true},{“name”:“value”,“column”:“Value”,“type”:“java.lang.Double”,“hidden”:false,“meta”:false}],“metaData”:{“pe”:[“2012”],“co”:[],“ou”:[“vzw0YutAWos”],“names”:{“pe”:“Period”,“ou”:“Organisation unit”,“dx”:“Data”,“IBRoBwdUxkA”:“Nom et prénoms contact”,“2012”:“2012”,“vzw0YutAWos”:“MUTUELLE DE SANTE DE BANIKOARA”}},“height”:0,“rows”:[],“width”:0}

with rows being empty…

I can get dataelements with a numeric value. Is there something specific with datalements that have to return strings ?

Any idea what i am doing wrong ?

Thanks,

Stephane


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

Knut Staring

Dept. of Informatics, University of Oslo

+4791880522

Skype: knutstar

http://dhis2.org

Hi Stephane,

You can see how read a large bulk of data values here:

https://www.dhis2.org/doc/snapshot/en/developer/html/ch01s09.html#d5e1242

In your second query your period id is “201201” whereas in the first its “2012”. That might explain it.

regards,

Lars

···

On Tue, Oct 14, 2014 at 3:02 PM, Stéphane Delbeke sdelbeke@bluesquare.org wrote:

Hi,

Thanks a lot for the quick reply, i can now retrieve a single value with something like this: :

api/dataValues?de=IBRoBwdUxkA&pe=2012&ou=vzw0YutAWos

I am also trying to get the complete dataset using this:

/api/dataValueSets?dataSet=iShiRf8NdCv&period=201201&orgUnit=vzw0YutAWos

but it returns nothing…

Am i missing something ?

Is there another way to get a complete dataset ?

I’d like to request all datasets of all organisationunits at once, how can this be done ?

Thanks,

Stephane


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

On Mon, Oct 13, 2014 at 3:05 PM, Knut Staring knutst@gmail.com wrote:

Hi Stephane,
You should not use the Analytics API to get metadata.

Try this instead:

https://www.dhis2.org/doc/snapshot/en/developer/html/ch01s05.html

Knut

On Mon, Oct 13, 2014 at 7:32 PM, Stéphane Delbeke sdelbeke@bluesquare.org wrote:

Hi,

I’m trying to use the API to get information on an organisation unit.

For instance i’m trying to extract the ‘contact name’.

My request looks as follow:

…dhis/api/analytics?dimension=dx:IBRoBwdUxkA&dimension=pe:2012&dimension=ou:vzw0YutAWos

and i obtain an answer like this:

{“headers”:[{“name”:“dx”,“column”:“Data”,“type”:“java.lang.String”,“hidden”:false,“meta”:true},{“name”:“pe”,“column”:“Period”,“type”:“java.lang.String”,“hidden”:false,“meta”:true},{“name”:“ou”,“column”:“Organisation unit”,“type”:“java.lang.String”,“hidden”:false,“meta”:true},{“name”:“value”,“column”:“Value”,“type”:“java.lang.Double”,“hidden”:false,“meta”:false}],“metaData”:{“pe”:[“2012”],“co”:[],“ou”:[“vzw0YutAWos”],“names”:{“pe”:“Period”,“ou”:“Organisation unit”,“dx”:“Data”,“IBRoBwdUxkA”:“Nom et prénoms contact”,“2012”:“2012”,“vzw0YutAWos”:“MUTUELLE DE SANTE DE BANIKOARA”}},“height”:0,“rows”:[],“width”:0}

with rows being empty…

I can get dataelements with a numeric value. Is there something specific with datalements that have to return strings ?

Any idea what i am doing wrong ?

Thanks,

Stephane


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

Knut Staring

Dept. of Informatics, University of Oslo

+4791880522

Skype: knutstar

http://dhis2.org