dhis2-users team mailing list archive
-
dhis2-users team
-
Mailing list archive
-
Message #00878
Re: Need some help
The situation in Nigeria (and I suspect in other countries) is that we have
a number of implementing partners who implement programmes and then report
on them supported by a major bilateral development agency. Each partner
needs to be provided access to their data (and only their data). Each
implementing partner has a unique login and each reporting organisation
unit is unique to a single implementing partner, and assigned to
an organisation unit group. In order to maintain compatibility with the
national system and facilitate geographical analysis, reporting units have
been arranged in a geographical hierarchy. Orgunitgroup sets are used to
implement an effective organisational hierarchy (Funding
agency/programmes/partners). As a simple example, each organisationunit is
assigned to an implementing partner (e.g. IRC, etc) and their aggregate
data can be filtered by choosing the corresponding organisationunits with
something like..
SELECT * FROM aggregatedatavalues where organisationunitid in
(SELECT DISTINCT organisationunitid from orgunitgroupmembers where
orgunitgroupid = XXX);
where XXX would the orgunit group you wish to retrieve data for.
Of course the query would need to join a few more tables to make the view
useful. What I hope to implement soon will be a stored procedure in
Postgres to loop through each orgunit group and save this to a file..
In proto-procedureal SQL code...
FOR EACH rec in (SELECT DISTINCT orgunitgroupid from orgunitgroup) LOOP
resultset := SELECT * FROM aggregatedatavalues where organisationunitid in
(SELECT DISTINCT organisationunitid from orgunitgroupmembers where
orgunitgroupid = rec.orgunitgroupid) ;
COPY resultset TO /some/path/rec.orgunitgroupid_data_date().csv;
END LOOP;
In this manner, each CSV file could be provided to the orgunit group,
without any other orgunit groups data. Have not gotten around to the
details of the procedure, but this is what I am planning anyway. This
should be a really trivial stored procedure to implement, and once I get
around to it, I can post here for others (or maybe someone has already done
this another way?)
Regards,
Jason
On Wed, Feb 15, 2012 at 10:35 AM, Wilson,Randy <rwilson@xxxxxxx> wrote:
> This is an interesting issue to Rwanda as well – we have similar
> requirements.****
>
> ** **
>
> Just a quick thought, would it not be possible to use the DHIS-2 user’s
> orgunit access (as assigned when setting up the User by orgunit) to do this
> filtering? How exactly could that be accessed in a view or report table?*
> ***
>
> ** **
>
> Randy Wilson****
>
> ** **
>
> *From:* dhis2-users-bounces+rwilson=msh.org@xxxxxxxxxxxxxxxxxxx [mailto:
> dhis2-users-bounces+rwilson=msh.org@xxxxxxxxxxxxxxxxxxx] *On Behalf Of *Jason
> Pickering
> *Sent:* Wednesday, February 15, 2012 9:26 AM
> *To:* Ola Hodne Titlestad
> *Cc:* dhis2-users@xxxxxxxxxxxxxxxxxxx
> *Subject:* Re: [Dhis2-users] Need some help****
>
> ** **
>
> This problem is somehow related to an issue I was discussing with
> Bob,namely that it would be useful to have a filter in place for certain
> user to only be able to be allowed to download the data for orgunits for
> which they have entered. I do not really know exactly Stephen's issue, but
> I suspect it may be a similar requirement to what we have in Nigeria,
> namely that users should be allowed to get their own aggregate data but not
> the aggregate data of others. So, if IRC has entered data, a filter should
> be put in place to retrieve their data from the orgunits assigned to this
> particular user, and not inherit any other orgunits which have they have
> not been explicitly assigned. ****
>
> ** **
>
> ** **
>
> 2012/2/14 Ola Hodne Titlestad <olati@xxxxxxxxxx>****
>
> If it is only 10 facilities you need I would go with the mydatamart
> approach and select 1 facility at a time and download their data into the
> same local datamart and then create a pivot table on top of that. A bit
> cumbersome, but this requires no extra query on the server side.
> More long term we are planning filters in mydatamart to more easily
> download subsets of facilities or data elements. Right now you can download
> all data for 1 facilty or for all facilities in an area(parent,grandparent
> etc).****
>
> Ola****
>
> On Feb 14, 2012 9:13 PM, "Lars Helge Øverland" <larshelge@xxxxxxxxx>
> wrote:****
>
> ** **
>
References