← Back to team overview

dhis2-devs team mailing list archive

Re: api/organisationUnitLevels

 

It does return the orgunit levels, but Greg’s initial request was to return them ordered by level instead of name. :)

Kind regards,

Mark Polak
mark@xxxxxxxxxxxxxxx
markpo@xxxxxxxxxx
+47 970 36 752

On 19 Mar 2015, at 10:47, Jason Pickering <jason.p.pickering@xxxxxxxxx> wrote:

> Does this not provide what you need?
> 
> https://apps.dhis2.org/demo/api/metaData.json?assumeTrue=false&organisationUnitLevels=true
> 
> Regards,
> Jason
> 
> 
> 
> On Thu, Mar 19, 2015 at 9:27 AM, Greg Rowles <greg.rowles@xxxxxxxxx> wrote:
> Is there any chance we could get organisationUnitLevels data added into the [metaData] branch of the JSON output?
> 
> On Thu, Mar 19, 2015 at 10:10 AM, Mark Polak <markpo@xxxxxxxxxx> wrote:
> If you are indeed building your own app, you can also sort the levels on the client :)
> 
> Kind regards,
> 
> Mark Polak
> mark@xxxxxxxxxxxxxxx
> markpo@xxxxxxxxxx
> +47 970 36 752
> 
> On 19 Mar 2015, at 08:47, Abyot Gizaw <abyota@xxxxxxxxx> wrote:
> 
>> Seems you are creating your own app? If so, you can fetch OUs based on level whenever drill down/up is triggered
>> 
>> -----
>> Thank you,
>> Abyot.
>> 
>> (sent from mobile)
>> 
>> On Mar 19, 2015 8:14 AM, "Greg Rowles" <greg.rowles@xxxxxxxxx> wrote:
>> Hi Mark
>> 
>> My JSON request:
>> api/analytics.json?dimension=pe:LAST_3_MONTHS&dimension=dx:trqWVUf9e6D;lPVvmrINVHS;eDktBD88IUL&dimension=ou:LEVEL-3;JLA7wl59oN3&hierarchyMeta=true&displayProperty=NAME&showHierarchy=true
>> 
>> The objective is to reconstruct JSON to include columns for all parent-orgunits. 
>> 
>> Some background to this - we have several reports specified in 'pivot table' layout but we need to make these outputs drill-through. Reporting is expected down to facility level for the last 3 months for the entire country - I assume this amount of data would probably choke the browser so I'm wanting to create a dynamic HTML report with drill-through capabilities but starting at regional levels. The current 'show hierarchy' functionality in pivot tables is insufficient plus it does not support drill-through 'mining'. I was planning on using PivotTable.js to accomplish this...
>> 
>> 
>> 
>> On Thu, Mar 19, 2015 at 8:56 AM, Mark Polak <markpo@xxxxxxxxxx> wrote:
>> If you’re getting the data in JSON format. And you’re using it to reconstruct something, how are you retrieving this data? Otherwise it would be trivial to sort it on your side?
>> 
>> Kind regards,
>> 
>> Mark Polak
>> mark@xxxxxxxxxxxxxxx
>> markpo@xxxxxxxxxx
>> +47 970 36 752
>> 
>> On 19 Mar 2015, at 07:49, Greg Rowles <greg.rowles@xxxxxxxxx> wrote:
>> 
>>> Thanks Jason, I'll do some testing. I know offhand of a viewClass parameter but it may not be applicable to this object, will see...
>>> 
>>> Best,
>>> Greg
>>> 
>>> On Thu, Mar 19, 2015 at 7:46 AM, Jason Pickering <jason.p.pickering@xxxxxxxxx> wrote:
>>> Hi Greg,
>>> 
>>> Yeah, I can understand that. Jan can probably provide more detail here, but for instance
>>> 
>>> [1]https://apps.dhis2.org/demo/api/organisationUnitLevels/
>>> 
>>> gives you all levels
>>> 
>>>  [2]https://apps.dhis2.org/demo/api/organisationUnitLevels/H1KlN4QIauv
>>> 
>>> gives you the number of the level, in this case 1. You could do this for each level.
>>> 
>>> [3]https://apps.dhis2.org/demo/api/organisationUnits?filter=level:eq:1
>>> 
>>> Gives all units at a given level, or 
>>> 
>>> https://apps.dhis2.org/demo/api/organisationUnits?fields=id,level,name,parent[id]&paging=false
>>> 
>>> which would give you a list which you could then recursively parse to get what you need I think. 
>>> 
>>> Regards,
>>> Jason
>>> 
>>> 
>>> 
>>> 
>>> On Thu, Mar 19, 2015 at 6:34 AM, greg.rowles@xxxxxxxxx <greg.rowles@xxxxxxxxx> wrote:
>>> Hi Jason 
>>> 
>>> Yes, we've considered that but we want to avoid depending on SQlviews for everything (too many variations need to be built to cater for different OUlevels) which becomes something of a db mgmt concern. I will try a different method of looking up OUlevels - that sequence issue would have made things really simple though. 
>>> 
>>> In DHIS 1.4 we associated a level number with a level name. I see this was not implemented in DHIS2... Does anyone know why not? 
>>> 
>>> Regards, 
>>> Greg 
>>> 
>>> ------ Original message------
>>> From: Jason Pickering
>>> Date: Thu, 19 Mar 2015 07:10
>>> To: greg.rowles@xxxxxxxxx;
>>> Cc: Mark Polak;DHIS 2 developers;
>>> Subject:Re: [Dhis2-devs] api/organisationUnitLevels
>>> 
>>> Hi Greg,
>>> Have you considered (if it is possible for you) to use an SQL view for this? Sounds like it would be rather trivial to generate this view from the _orgunitstructure table by joining with the organisationunit table. May not be feasible in this case, but might save a bit of trouble on the client side. 
>>> 
>>> Regards,
>>> Jason
>>> 
>>> 
>>> On Thu, Mar 19, 2015 at 6:06 AM, greg.rowles@xxxxxxxxx <greg.rowles@xxxxxxxxx> wrote:
>>> Hi Mark
>>> 
>>> I'm reconstructing the JSON output called by the analytics API to (hopefully) give me the parent hierarchy structure in individual "columns". This ties in with my previous email about SHORTNAME outputting long NAME values for the ouNameHierarchy collection. I'm trying to split ouNameHierarchy into its different parent values for use in a custom report. 
>>> 
>>> Regards, 
>>> Greg
>>> 
>>> 
>>> ------ Original message------
>>> From: Mark Polak
>>> Date: Wed, 18 Mar 2015 22:44
>>> To: Greg Rowles;
>>> Cc: DHIS 2 developers;
>>> Subject:Re: [Dhis2-devs] api/organisationUnitLevels
>>> 
>>> Hey Greg,
>>> 
>>> Unfortunately i don’t think sorting through the api is available “yet”.
>>> 
>>> What are you using it for?
>>> 
>>> Kind regards,
>>> 
>>> Mark Polak
>>> mark@xxxxxxxxxxxxxxx
>>> markpo@xxxxxxxxxx
>>> +47 970 36 752
>>> 
>>> On 18 Mar 2015, at 21:26, Greg Rowles <greg.rowles@xxxxxxxxx> wrote:
>>> 
>>>> Hi Devs
>>>> 
>>>> Is it possible to have the organisationUnitLevels stack outputted in the sequence the hierarchy is arranged? E.g. it appears to be sorted by name value with 'National' always appearing down the list (it should be 1st)...
>>>> 
>>>> Best,
>>>> Greg
>>>> 
>>>> -- 
>>>> Health Information Systems Program - South Africa
>>>> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
>>>> Mobile  :    073 246 2992
>>>> Landline:   021 554 3130
>>>> Fax:          086 733 8432 
>>>> Skype:      gregory_rowles
>>>> _______________________________________________
>>>> Mailing list: https://launchpad.net/~dhis2-devs
>>>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>>> More help   : https://help.launchpad.net/ListHelp
>>> 
>>> 
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~dhis2-devs
>>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>> More help   : https://help.launchpad.net/ListHelp
>>> 
>>> 
>>> 
>>> 
>>> -- 
>>> Jason P. Pickering
>>> email: jason.p.pickering@xxxxxxxxx
>>> tel:+46764147049
>>> 
>>> 
>>> 
>>> -- 
>>> Jason P. Pickering
>>> email: jason.p.pickering@xxxxxxxxx
>>> tel:+46764147049
>>> 
>>> 
>>> 
>>> -- 
>>> Health Information Systems Program - South Africa
>>> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
>>> Mobile  :    073 246 2992
>>> Landline:   021 554 3130
>>> Fax:          086 733 8432 
>>> Skype:      gregory_rowles
>> 
>> 
>> 
>> 
>> -- 
>> Health Information Systems Program - South Africa
>> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
>> Mobile  :    073 246 2992
>> Landline:   021 554 3130
>> Fax:          086 733 8432 
>> Skype:      gregory_rowles
>> 
>> _______________________________________________
>> Mailing list: https://launchpad.net/~dhis2-devs
>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~dhis2-devs
>> More help   : https://help.launchpad.net/ListHelp
>> 
> 
> 
> 
> 
> -- 
> Health Information Systems Program - South Africa
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
> Mobile  :    073 246 2992
> Landline:   021 554 3130
> Fax:          086 733 8432 
> Skype:      gregory_rowles
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help   : https://help.launchpad.net/ListHelp
> 
> 
> 
> 
> -- 
> Jason P. Pickering
> email: jason.p.pickering@xxxxxxxxx
> tel:+46764147049


Follow ups

References