← Back to team overview

dhis2-devs team mailing list archive

Re: Min - Max Values

 

Many thanks Jason!
Sent from my BlackBerry® wireless handheld from Glo Mobile.

-----Original Message-----
From: Jason Pickering <jason.p.pickering@xxxxxxxxx>
Date: Thu, 9 Feb 2012 09:05:44 
To: Dapo Adejumo<dapo_adejumo@xxxxxxxxx>
Cc: Lars Helge Øverland<larshelge@xxxxxxxxx>; dhis2-devs@xxxxxxxxxxxxxxxxxxx<dhis2-devs@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Dhis2-devs] Min - Max Values

Here is the SQL I use for this purpose. Of course you may need to adjust it
slightly to your needs

The first number is the dataelement ID you wish to update.
The second number is the categoryoptioncomboid you wish to update.
Third number is the desired minvalue
Fourth number is the desired maxvalue
The false statement indicates whether this is a generated value or not
(assume it should be FALSE here).

The last WHERE clause may need to be adjusted slightly, to determine
exactly which organisational units you wish to update. In this example, I
am updating all level 4 organisationunits.

This query will produce a series of SQL Insert statements, which you can
then execute on your database.

Hope this helps. Of course, it would be useful to have this functionality
through the UI. :)

Best regards,
Jason


SELECT DISTINCT
'INSERT INTO minmaxdataelement VALUES (' ||
 nextval('hibernate_sequence'::regclass) ||
',' ||
organisationunitid  ||
',' ||

22::integer ||
',' ||

15::integer ||
',' ||

0::integer ||
',' ||

100::integer ||
',' || 'FALSE);'

 FROM organisationunit where organisationunitid
in (SELECT DISTINCT idlevel4 from _orgunitstructure)

On Wed, Feb 8, 2012 at 11:26 PM, Dapo Adejumo <dapo_adejumo@xxxxxxxxx>wrote:

> Thanks Lars and Jason,
> I think it might be worthwhile considering adding this functionality in
> the future especially considering the potential number of facilities a
> database could hold.
>
>
> ------------------------------
>
> Regards,
>
> Adedapo Adejumo.
> Mobile : +2348033683677
> Skype  : dapojorge
>
> ----- Original Message -----
> From: Lars Helge Øverland <larshelge@xxxxxxxxx>
> To: Jason Pickering <jason.p.pickering@xxxxxxxxx>
> Cc: Dapo Adejumo <dapo_adejumo@xxxxxxxxx>; "dhis2-devs@xxxxxxxxxxxxxxxxxxx"
> <dhis2-devs@xxxxxxxxxxxxxxxxxxx>
> Sent: Wednesday, 8 February 2012 9:52 PM
> Subject: Re: [Dhis2-devs] Min - Max Values
>
> Hi,
>
> if this turns out to be a common requirement we can consider creating
> a system function for this. I.e. generating min-max values with fixed
> limits per data element for all org units.
>
> The current min-max generation function will generate limits based on
> all available data for each org unit/data element, where the limits
> are set 2 standard deviations from the mean.
>
> Lars
>
>
>
> On Mon, Feb 6, 2012 at 7:13 AM, Jason Pickering
> <jason.p.pickering@xxxxxxxxx> wrote:
> > Hi Dapo,
> >
> > By double clicking the data value from the data entry screen, you can set
> > individual min/max limits for particular data element/orgunits. In other
> > cases when we needed to set a sort of uniform limit, it was easier to do
> > this with SQL and store the results in the minmaxdataelement
> > minmaxdataelement table. The method through the data entry screen works
> fine
> > if you have a few to enter, but is rather painful if you wan to do it for
> > all the facilities in Nigeria for instance. I could not really find a
> way to
> > set a predetermined mix max either, so that is why we resorted to using
> SQL
> >  in this case.
> >
> > Regards,
> > Jason
> >
> >
> >
> >
> > 2012/2/5 Dapo Adejumo <dapo_adejumo@xxxxxxxxx>
> >>
> >> Thanks Lars,
> >> I had used that functionality but wasnt exactly sure what the command
> >> 'generate' does . Apart from the impression that it seems the action
> will
> >> generate values for all the elements in a particular dataset, I presume
> this
> >> generation will be based on statistical deductions from values entered
> for
> >> particular elements for particular org - units ( say 6 months history )
> .
> >> What I am hoping to do is to be able to set custom values for selected
> data
> >> elements - Is this possible?
> >>
> >> Thanks
> >>
> >>
> >> ________________________________
> >>
> >> Regards,
> >>
> >> Adedapo Adejumo.
> >> Mobile : +2348033683677
> >> Skype  : dapojorge
> >>
> >> ----- Original Message -----
> >> From: Lars Helge Øverland <larshelge@xxxxxxxxx>
> >> To: Dapo Adejumo <dapo_adejumo@xxxxxxxxx>
> >> Cc: "dhis2-devs@xxxxxxxxxxxxxxxxxxx" <dhis2-devs@xxxxxxxxxxxxxxxxxxx>
> >> Sent: Sunday, 5 February 2012 1:24 PM
> >> Subject: Re: [Dhis2-devs] Min - Max Values
> >>
> >> Hello Dapo,
> >>
> >> please go to "data administration" module and then "Min-Max Value
> >> Generation" in the left-side menu.
> >>
> >> regards Lars
> >>
> >>
> >> On Sat, Feb 4, 2012 at 9:45 AM, Dapo Adejumo <dapo_adejumo@xxxxxxxxx>
> >> wrote:
> >> > Hello,
> >> > I was wondering if anyone knew how to set Min and Max values for data
> >> > elements apart from the data entry screen . Setting this value from
> the
> >> > data
> >> > entry screen only sets the values for the particular element, month
> and
> >> > Org
> >> > Unit. I am hoping to be able to define this min/max value for
> particular
> >> > elements irrespective of Org Unit or period. This was largely possible
> >> > in
> >> > 1.4....
> >> >
> >> > Thanks.
> >> >
> >> >
> >> > ________________________________
> >> >
> >> > Regards,
> >> >
> >> > Adedapo Adejumo.
> >> > Mobile : +2348033683677
> >> > Skype  : dapojorge
> >> >
> >> > _______________________________________________
> >> > 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
> >>
> >
>


Follow ups

References