← Back to team overview

dhis2-devs team mailing list archive

Re: web api

 

Hi Alice

Copying to developer list ...

On 28 June 2012 07:01, Alice E Tessen <aet289@xxxxxxx> wrote:
> Hi Bob,
>
> I'm not sure you'll know an answer to this, if you don't I'll be happy to
> send it to the developers' list. My project is to build a health portal for
> the state of Tamil Nadu, but with coding that is generic so that it can be
> reused to make portals for other Indian states. The idea is to develop an
> interface to allow a user to choose the organisation unit, indicator, and
> period and then display data from the DHIS2 Web API according to these
> specifications. I'm using cURL to get lists of orgUnits and indicators, but
> I would like to be able to take advantage of the orgUnit hierarchy in the
> API to allow the user to choose state>>district>>block>>facility, and I'm
> not sure how to do that when all of the orgUnits are listed together. Is
> there some way that I can specify which level of the hierarchy I would like
> to use?

I'm not sure if this is the correct answer but perhaps Morten or Lars
will chip in if they have time.  As far as I can see you are right ..
there is no parent field in the listed orgunits at
api/organisationUnits which you would need to construct the hierarchy.

You can get this information however by querying the metadata as a
more complete collection: eg
http://apps.dhis2.org/demo/api/metaData.xml

This will give you the list of orgunits with parent field and also
conveniently in order from top of the tree down to the base (a
breadth-wise traversal).  You should be able to construct your
javascript or html UI with this data.

There are also some options to restrict whether *only* orgunits are
shown but I can't remember them offhand.  Once I've looked up I'll let
you know.

Cheers
Bob

>
> Thanks,
>   Alice
>
>
> On Wed, Jun 27, 2012 at 5:02 PM, Bob Jolliffe <bobjolliffe@xxxxxxxxx> wrote:
>>
>> Sure.  Alice I don't know what you are going to ask or if I have the
>> answer, but in case I don't. I presume you won't have a problem if I
>> direct to the dhis2 developers list?
>>
>> On 27 June 2012 12:27, Sundeep Sahay <sundeep.sahay@xxxxxxxxx> wrote:
>> > bob,
>> > alice had some queries on the WebAPI
>> > can i direct her to you?
>> > thanks
>
>


Follow ups