← Back to team overview

dhis2-users team mailing list archive

Re: What is the recommended way to export facility data from DHIS as XML?

 

Just wanted to add a clarification and another approach.

I stated incorrectly that the FRED API only returns the lowest level. In
fact, it returns all orgunits, irrespective of their placement in the
hierarchy. This obviously makes it challenging to distinguish facilities
from districts. After chatting with Morten about this, something like
"paramater.level=4" may be added soon, to be able to distinguish between
different orgunit levels, but this would only work in you case, if all
facilities are at the same level, which is often not the case.

The last approach, which may be simpler from an integration point of view
perhaps, is the creation of an SQL view, which you can then call from the
WebAPI documented
here<http://www.dhis2.org/doc/snapshot/en/user/html/ch25s18.html> and
here <http://www.dhis2.org/doc/snapshot/en/user/html/apcs07.html>.

Regards,
Jason



On Fri, Aug 16, 2013 at 11:00 AM, Lars Helge Øverland
<larshelge@xxxxxxxxx>wrote:

> To add to what Jason is saying.. Like suggested above there are at least
> two approaches:
>
> - Use the org unit level. One caveat is that all org units at a level may
> not necessarily be facilities. To fetch all org units at the level you can
> GET at
>
> http://apps.dhis2.org/dev/api/organisationUnits.xml?level=2    (use .json
> if necessary)
>
> - Use a group. This is more flexible but requires that all facilities
> obviously are put in that group. To get all units in a group you can GET at:
>
> http://apps.dhis2.org/dev/api/organisationUnitGroups/w1Atoz18PCL.xml
>
> where w1.. is the uid of the group and use whatever approach is most
> feasible for each DHIS deployment. Some ideas for your use-case:
>
> 1. Make fetching of DHIS facilities configurable as an URL on the iHRIS
> side.
>
> 2. DHIS could expose a special "/facilities" resource and we could do the
> mapping on the DHIS side. But then we are maybe starting to step FRED on
> its toes.
>
> cheers
>
> Lars
>
>
>
>
>
> On Thu, Aug 15, 2013 at 11:32 AM, Jason Pickering <
> jason.p.pickering@xxxxxxxxx> wrote:
>
>> Hi Carl,
>>
>> This is of course going to depend on each implementation and what a
>> "facility" actually means.
>>
>> As an example provides us this...
>>
>> http://apps.dhis2.org/demo/api/organisationUnitLevels.xml
>>
>> <organisationUnitLevel name="PHU" created="2011-12-24T11:24:22.935+0000"
>> lastUpdated="2011-12-24T11:24:22.935+0000" level="4"href="
>> http://apps.dhis2.org/demo/api/organisationUnitLevels/m9lBJogzE95";
>> id="m9lBJogzE95"/>
>>
>> which defines the organisation unit levels, and we see "PHU" which I
>> guess is the equivalent to the facility level.
>>
>> As an example.
>>
>> http://apps.dhis2.org/demo/api/organisationUnits/ueuQlqb8ccl.xml shows
>> this has the attribute level="4".
>>
>> So, it is just a matter filtering out the orgunits which have a
>> particular level means "facility" to you
>>
>> The FRED API of course is the other alternative, but this will only work
>> currently, if your lowest organisation unit is the facility level. In our
>> case, the facility level is 4, but our lowest organisation unit is level 6,
>> so FRED does not work for us. I do think it would be good however to
>> indicate which level is the facility level, and this would be the level
>> which is used by FRED. Of course, if you have facilities at different
>> levels, (health posts for instance, which may be children of health
>> centers), which could be problematic.But, an orgunit group "Facility" which
>> would be part of an "Organisationunit group set" such as "Type" would also
>> do the job, again filtering out the orgunits which are part of the
>> "Facility" organisation unit group.
>>
>> Regards,
>> Jason
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Thu, Aug 15, 2013 at 11:09 AM, Knut Staring <knutst@xxxxxxxxx> wrote:
>> >
>> > Hi Carl,
>> >
>> > Just forwarding your question to this list, where it is likely to be
>> seen by more people:
>> > https://answers.launchpad.net/dhis2/+question/234034
>> >
>> >
>> > We have run across the task of needed to get a list of the facilities
>> in DHIS2 to export to other systems. My particular use case is with iHRIS,
>> though I have need to do this for setting up provider registries which need
>> to reference facility data that DHIS2 is the authoritative source for.
>> >
>> > Among several DHIS installations, It does not seem that there is a
>> consistent way to easily determine which of the organizational units are
>> facilities. I have been looking in particular at the metadata Export.xml to
>> try to extract this data and although there are some heuristics that will
>> get us 90% of what we want, I would like to have something we can
>> consistently rely on.
>> >
>> > A few options come to mind:
>> >
>> > 1) request that DHIS2 implementations create an organisationUnitGroup
>> called "Facility" and add each of the facilities to this group? Presumably
>> we would request that they would also create additional
>> organisationUnitGroups for each of the levels of the organizationGroup
>> hierarchy (e.g. Block, District, State) and put all of this under a
>> organisationUnitGroupSet called something like "Administrative Hierarchy."
>> This would require no additional programming to the existing DHIS2 codebase
>> as I understand.
>> >
>> > 2) Ask the DHIS2 developers to add a boolean flag, "Facility," to the
>> main organisationalUnit record. Presumably this would be relatively quick
>> to do.
>> >
>> > 3) Wait until this issue in FRED:
>> >    https://github.com/facilityregistry/fred-api/issues/62
>> > gets resolved and implemented in DHIS? This seems like it would require
>> a fair amount of developer time and specification that is not yet done.
>> >
>> > I don't care to much which of the above options gets implemented (or
>> even if there is another alternative that works better), but I would like
>> to have a "best practice" to point to when trying to extract facility
>> information from DHIS as XML.
>> >
>> > Thanks so much!
>> >
>> > Cheers.
>> > -carl
>> >
>> >
>> > _______________________________________________
>> > Mailing list: https://launchpad.net/~dhis2-users
>> > Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
>> > Unsubscribe : https://launchpad.net/~dhis2-users
>> > More help   : https://help.launchpad.net/ListHelp
>> >
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~dhis2-users
>> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~dhis2-users
>> More help   : https://help.launchpad.net/ListHelp
>>
>>
>

References