Hi Devs,
I’m currently using dhis2 API to develop an App, but I have some troubles when I filter by level and ancestor in the same time.
To clarify:
Everything is ok with this one :
URL/api/25/organisationUnits.json?filter=level:eq:‘+level+’&fields=[id,displayName]
But by adding ancestor parameter the level is just ignored:
URL/api/25/organisationUnits.json?filter=level:eq:‘+level+’&filter=ancestors.id:eq:‘+ancestorId+’&fields=[id,displayName]
I will really appreciate your help and any link for an advanced dhis2 API topic.
Best,
Diao
···
**DIALLO Mamadou Diao Conseiller IT, Specialiste de DHIS 2 **( District Health Information Software )
Projet de Renforcement du Système d’Information Sanitaire en Guinée
Phone : 623909413 | 662256106
Skype : diawwdiallo
www.jsi.com
morten
(Morten Hansen)
2
Hi Mamadou
Could you please report a bug to JIRA? jira.dhis2.org
···
On Wed, Jul 26, 2017 at 11:52 PM, Mamadou Diao Diallo diao_diallo@gn.jsi.com wrote:
Hi Devs,
I’m currently using dhis2 API to develop an App, but I have some troubles when I filter by level and ancestor in the same time.
To clarify:
Everything is ok with this one :
URL/api/25/organisationUnits.json?filter=level:eq:‘+level+’&fields=[id,displayName]
But by adding ancestor parameter the level is just ignored:
URL/api/25/organisationUnits.json?filter=level:eq:‘+level+’&filter=ancestors.id:eq:‘+ancestorId+’&fields=[id,displayName]
I will really appreciate your help and any link for an advanced dhis2 API topic.
Best,
Diao
–
**DIALLO Mamadou Diao Conseiller IT, Specialiste de DHIS 2 **( District Health Information Software )
Projet de Renforcement du Système d’Information Sanitaire en Guinée
Phone : 623909413 | 662256106
Skype : diawwdiallo
www.jsi.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
Hi Morten,
Could this be linked to the issue I reported earlier?
DHIS2-1911 (WEB API: Recursive filtering not working with more than one AND filter).
Regards,
GAURAV
···
Hi Mamadou
Could you please report a bug to JIRA?
jira.dhis2.org
–
Morten Olav Hansen
Senior Engineer, DHIS 2
University of Oslo
http://www.dhis2.org
On Wed, Jul 26, 2017 at 11:52 PM, Mamadou Diao Diallo diao_diallo@gn.jsi.com wrote:
Hi Devs,
I’m currently using dhis2 API to develop an App, but I have some troubles when I filter by level and ancestor in the same time.
To clarify:
Everything is ok with this one : URL/api/25/organisationUnits.json?filter=level:eq:‘+level+’&fields=[id,displayName]
But by adding ancestor parameter the level is just ignored:
URL/api/25/organisationUnits.json?filter=level:eq:‘+level+’&filter=ancestors.id:eq:‘+ancestorId+’&fields=[id,displayName]
I will really appreciate your help and any link for an advanced dhis2 API topic.
Best,
Diao
–
DIALLO Mamadou Diao Conseiller IT, Specialiste de DHIS 2 ( District Health Information Software )
Projet de Renforcement du Système d’Information Sanitaire en Guinée
Phone : 623909413 | 662256106
Skype : diawwdiallo
www.jsi.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
jason
(Jason Pickering)
4
Seems to work as its documented (at least in some cases)
https://play.dhis2.org/dev/api/dataElements?filter=name:like:IPT
Gives all data elements which contain IPT
https://play.dhis2.org/dev/api/dataElements?filter=name:like:IPT&filter=name:like:1st
Gives all data elements which contain IPT and 1st (but no others).
This however, does not work
https://play.dhis2.org/dev/api/27/organisationUnits.json?filter=level:eq:4&filter=ancestors.id:eq:O6uvpzGd5pu&fields=id,name,ancestors,level
as you get some level 3 and some level 4 units.
This however does work
https://play.dhis2.org/dev/api/27/organisationUnits.json?filter=level:eq:4&filter=path:like:O6uvpzGd5pu&fields=id,name,ancestors,level
So, maybe the problem is filtering in the nested collections?
/Jason
···
On Thu, Jul 27, 2017 at 10:09 AM, Gaurav Kumar gkumar@internationalmedicalcorps.org wrote:
Hi Morten,
Could this be linked to the issue I reported earlier?
DHIS2-1911 (WEB API: Recursive filtering not working with more than one AND filter).
Regards,
GAURAV
From: Dhis2-devs [mailto:dhis2-devs-bounces+gkumar=internationalmedicalcorps.org@lists.launchpad.net] On Behalf Of Morten Olav Hansen
Sent: Thursday, July 27, 2017 7:16 AM
To: Mamadou Diao Diallo diao_diallo@gn.jsi.com
Cc: dhis2-users dhis2-users@lists.launchpad.net; DHIS 2 developers dhis2-devs@lists.launchpad.net
Subject: Re: [Dhis2-devs] [Dhis2-users] WebAPI Bugs when filtering by level and ancestor
Hi Mamadou
Could you please report a bug to JIRA?
jira.dhis2.org
–
Morten Olav Hansen
Senior Engineer, DHIS 2
University of Oslo
http://www.dhis2.org
On Wed, Jul 26, 2017 at 11:52 PM, Mamadou Diao Diallo diao_diallo@gn.jsi.com wrote:
Hi Devs,
I’m currently using dhis2 API to develop an App, but I have some troubles when I filter by level and ancestor in the same time.
To clarify:
Everything is ok with this one : URL/api/25/organisationUnits.json?filter=level:eq:‘+level+’&fields=[id,displayName]
But by adding ancestor parameter the level is just ignored:
URL/api/25/organisationUnits.json?filter=level:eq:‘+level+’&filter=ancestors.id:eq:‘+ancestorId+’&fields=[id,displayName]
I will really appreciate your help and any link for an advanced dhis2 API topic.
Best,
Diao
–
DIALLO Mamadou Diao Conseiller IT, Specialiste de DHIS 2 ( District Health Information Software )
Projet de Renforcement du Système d’Information Sanitaire en Guinée
Phone : 623909413 | 662256106
Skype : diawwdiallo
www.jsi.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
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
–
Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+46764147049
1 Like
Many thanks for all of you,
I will just use the @Jason idea with path filter before to have a best way to handle it.
Best
Diao
···
On Thu, Jul 27, 2017 at 8:26 AM, Jason Pickering jason.p.pickering@gmail.com wrote:
Seems to work as its documented (at least in some cases)
https://play.dhis2.org/dev/api/dataElements?filter=name:like:IPT
Gives all data elements which contain IPT
https://play.dhis2.org/dev/api/dataElements?filter=name:like:IPT&filter=name:like:1st
Gives all data elements which contain IPT and 1st (but no others).
This however, does not work
https://play.dhis2.org/dev/api/27/organisationUnits.json?filter=level:eq:4&filter=ancestors.id:eq:O6uvpzGd5pu&fields=id,name,ancestors,level
as you get some level 3 and some level 4 units.
This however does work
https://play.dhis2.org/dev/api/27/organisationUnits.json?filter=level:eq:4&filter=path:like:O6uvpzGd5pu&fields=id,name,ancestors,level
So, maybe the problem is filtering in the nested collections?
/Jason
–
On Thu, Jul 27, 2017 at 10:09 AM, Gaurav Kumar gkumar@internationalmedicalcorps.org wrote:
Hi Morten,
Could this be linked to the issue I reported earlier?
DHIS2-1911 (WEB API: Recursive filtering not working with more than one AND filter).
Regards,
GAURAV
From: Dhis2-devs [mailto:dhis2-devs-bounces+gkumar=internationalmedicalcorps.org@lists.launchpad.net] On Behalf Of Morten Olav Hansen
Sent: Thursday, July 27, 2017 7:16 AM
To: Mamadou Diao Diallo diao_diallo@gn.jsi.com
Cc: dhis2-users dhis2-users@lists.launchpad.net; DHIS 2 developers dhis2-devs@lists.launchpad.net
Subject: Re: [Dhis2-devs] [Dhis2-users] WebAPI Bugs when filtering by level and ancestor
Hi Mamadou
Could you please report a bug to JIRA?
jira.dhis2.org
–
Morten Olav Hansen
Senior Engineer, DHIS 2
University of Oslo
http://www.dhis2.org
On Wed, Jul 26, 2017 at 11:52 PM, Mamadou Diao Diallo diao_diallo@gn.jsi.com wrote:
Hi Devs,
I’m currently using dhis2 API to develop an App, but I have some troubles when I filter by level and ancestor in the same time.
To clarify:
Everything is ok with this one : URL/api/25/organisationUnits.json?filter=level:eq:‘+level+’&fields=[id,displayName]
But by adding ancestor parameter the level is just ignored:
URL/api/25/organisationUnits.json?filter=level:eq:‘+level+’&filter=ancestors.id:eq:‘+ancestorId+’&fields=[id,displayName]
I will really appreciate your help and any link for an advanced dhis2 API topic.
Best,
Diao
–
DIALLO Mamadou Diao Conseiller IT, Specialiste de DHIS 2 ( District Health Information Software )
Projet de Renforcement du Système d’Information Sanitaire en Guinée
Phone : 623909413 | 662256106
Skype : diawwdiallo
www.jsi.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
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
Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+46764147049
–
**DIALLO Mamadou Diao Conseiller IT, Specialiste de DHIS 2 **( District Health Information Software )
Projet de Renforcement du Système d’Information Sanitaire en Guinée
Phone : 623909413 | 662256106
Skype : diawwdiallo
www.jsi.com