Relevant OR limits

Hi,
I'm not sure what's causing this issue, but I have an idea for a way you
might be able to avoid it. Try breaking the formula up by using multiple
variables and binds with calculate attributes. I don't guarantee it will
work but it's the next thing I would try.
Hope this helps,
-Nathan

··· On Sunday, June 24, 2012 3:16:29 PM UTC-7, colind...@gmail.com wrote: > > Hi all, > > While creating a form for a health researcher I may stumbled into some > fundamental ODK/Android OS limits. > > Basically, I want to show one of two messages upon form completion > (Eligible and Not, roughly). In order to determine Eligibility, we need to > look at several fields that are entered into the tablet, including weight > and height, and then compare those to WHO averages (this chart > http://www.who.int/nutrition/publications/severemalnutrition/9789241598163_eng.pdf > ). > So, if I male is 45 cm tall, if his weight is less than 1.9 kg, he is > ineligible. If he is 46 cm tall, if his weight is less than 2.0 kg, he is > ineligible. Etc. > > I have a readonly field that says, 'Ineligible', and is displayed to the > user under the above circumstances, using ODK's 'relevant'. > > So far so good. > > However, there are about 200 conditions under which to show this readonly > (some nested), separated by ORs. When I get to about the 50th or, ODK will > no longer load the form (Unfortunately, ODK Collect has stopped). Logcat > shows a stack overflow. > > I assume this is an issue of trying to deal with so many ORs. Does that > seem correct to people? Is this an ODK or Android issue? Is there any way > around this? Maybe there's a better way to do these messages (rather than > ~200 ORs!)? > > CODE (simplified): > readonly="true()" relevant= > "(selected(/data/CES2_4, '1') > or > ( > selected(/data/CES1_1, '2') and ( > ( ((/data/MUAC_group/MUAC1 + /data/MUAC_group/MUAC2) div 2) > < 11) > or > ( (/data/MUAC_group/MUAC1 = '') and ((/data/CES2_1_a + > /data/CES2_1_b) div 2) < 11) > ) > ) > or > ( > selected(/data/CES1_1, '3') and ( > ( ((/data/MUAC_group/MUAC1 + /data/MUAC_group/MUAC2) div 2) > < 11.5) > or > ( (/data/MUAC_group/MUAC1 = '') and ((/data/CES2_1_a + > /data/CES2_1_b) div 2) < 11.5) > ) > ) > or > ( > selected(/data/CES1_2, '1') and ( > ( (((/data/height_group/height1 + > /data/height_group/height2) div 2) = 45) and (/data/CES2_2 < 1.9)) > or > ( (((/data/height_group/height1 + > /data/height_group/height2) div 2) = 46) and (/data/CES2_2 < 2)) > or > ( (((/data/height_group/height1 + > /data/height_group/height2) div 2) = 47) and (/data/CES2_2 < 2.1)) > or > ( (((/data/height_group/height1 + > /data/height_group/height2) div 2) = 48) and (/data/CES2_2 < 2.3)) > or > ( (((/data/height_group/height1 + > /data/height_group/height2) div 2) = 49) and (/data/CES2_2 < 2.4)) > or > ( (((/data/height_group/height1 + > /data/height_group/height2) div 2) = 50) and (/data/CES2_2 < 2.6)) > ... > >

I believe Android still imposes an 8K intermediate-storage (stack) limit,
and it is likely that you are hitting that limit. Nathan's suggestion is a
good one.

Mitch

··· On Sun, Jun 24, 2012 at 10:15 PM, Nathan wrote:

Hi,
I'm not sure what's causing this issue, but I have an idea for a way you
might be able to avoid it. Try breaking the formula up by using multiple
variables and binds with calculate attributes. I don't guarantee it will
work but it's the next thing I would try.
Hope this helps,
-Nathan

On Sunday, June 24, 2012 3:16:29 PM UTC-7, colind...@gmail.com wrote:

Hi all,

While creating a form for a health researcher I may stumbled into some
fundamental ODK/Android OS limits.

Basically, I want to show one of two messages upon form completion
(Eligible and Not, roughly). In order to determine Eligibility, we need to
look at several fields that are entered into the tablet, including weight
and height, and then compare those to WHO averages (this chart
http://www.who.int/nutrition/**publications/**severemalnutrition/**
9789241598163_eng.pdfhttp://www.who.int/nutrition/publications/severemalnutrition/9789241598163_eng.pdf
).
So, if I male is 45 cm tall, if his weight is less than 1.9 kg, he is
ineligible. If he is 46 cm tall, if his weight is less than 2.0 kg, he is
ineligible. Etc.

I have a readonly field that says, 'Ineligible', and is displayed to the
user under the above circumstances, using ODK's 'relevant'.

So far so good.

However, there are about 200 conditions under which to show this readonly
(some nested), separated by ORs. When I get to about the 50th or, ODK will
no longer load the form (Unfortunately, ODK Collect has stopped). Logcat
shows a stack overflow.

I assume this is an issue of trying to deal with so many ORs. Does that
seem correct to people? Is this an ODK or Android issue? Is there any way
around this? Maybe there's a better way to do these messages (rather than
~200 ORs!)?

CODE (simplified):
<bind nodeset="/data/CES_yes_**readonly" type="string"
readonly="true()" relevant=
"(selected(/data/CES2_4, '1')
or
(
selected(/data/CES1_1, '2') and (
( ((/data/MUAC_group/MUAC1 + /data/MUAC_group/MUAC2) div 2)
< 11)
or
( (/data/MUAC_group/MUAC1 = '') and ((/data/CES2_1_a +
/data/CES2_1_b) div 2) < 11)
)
)
or
(
selected(/data/CES1_1, '3') and (
( ((/data/MUAC_group/MUAC1 + /data/MUAC_group/MUAC2) div 2)
< 11.5)
or
( (/data/MUAC_group/MUAC1 = '') and ((/data/CES2_1_a +
/data/CES2_1_b) div 2) < 11.5)
)
)
or
(
selected(/data/CES1_2, '1') and (
( (((/data/height_group/height1 +
/data/height_group/height2) div 2) = 45) and (/data/CES2_2 < 1.9))
or
( (((/data/height_group/height1 +
/data/height_group/height2) div 2) = 46) and (/data/CES2_2 < 2))
or
( (((/data/height_group/height1 +
/data/height_group/height2) div 2) = 47) and (/data/CES2_2 < 2.1))
or
( (((/data/height_group/height1 +
/data/height_group/height2) div 2) = 48) and (/data/CES2_2 < 2.3))
or
( (((/data/height_group/height1 +
/data/height_group/height2) div 2) = 49) and (/data/CES2_2 < 2.4))
or
( (((/data/height_group/height1 +
/data/height_group/height2) div 2) = 50) and (/data/CES2_2 < 2.6))
...

--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

I put part of your chart in Excel and extracted a fit to a 2nd order
polynomial. I just did 45 to 57 for -3SD and got the following:

y = 0.0063x**2 + 0.0887x + 1.8028

where x is the height and y is -3SD cutoff. This gives a really good fit.

You might try finding out the equation from which WHO generated this data.

··· On Mon, Jun 25, 2012 at 11:44 AM, Mitch S wrote: > I believe Android still imposes an 8K intermediate-storage (stack) limit, > and it is likely that you are hitting that limit. Nathan's suggestion is a > good one. > > Mitch > > > On Sun, Jun 24, 2012 at 10:15 PM, Nathan wrote: >> >> Hi, >> I'm not sure what's causing this issue, but I have an idea for a way you >> might be able to avoid it. Try breaking the formula up by using multiple >> variables and binds with calculate attributes. I don't guarantee it will >> work but it's the next thing I would try. >> Hope this helps, >> -Nathan >> >> >> On Sunday, June 24, 2012 3:16:29 PM UTC-7, colind...@gmail.com wrote: >>> >>> Hi all, >>> >>> While creating a form for a health researcher I may stumbled into some >>> fundamental ODK/Android OS limits. >>> >>> Basically, I want to show one of two messages upon form completion >>> (Eligible and Not, roughly). In order to determine Eligibility, we need to >>> look at several fields that are entered into the tablet, including weight >>> and height, and then compare those to WHO averages (this chart >>> http://www.who.int/nutrition/publications/severemalnutrition/9789241598163_eng.pdf). >>> So, if I male is 45 cm tall, if his weight is less than 1.9 kg, he is >>> ineligible. If he is 46 cm tall, if his weight is less than 2.0 kg, he is >>> ineligible. Etc. >>> >>> I have a readonly field that says, 'Ineligible', and is displayed to the >>> user under the above circumstances, using ODK's 'relevant'. >>> >>> So far so good. >>> >>> However, there are about 200 conditions under which to show this readonly >>> (some nested), separated by ORs. When I get to about the 50th or, ODK will >>> no longer load the form (Unfortunately, ODK Collect has stopped). Logcat >>> shows a stack overflow. >>> >>> I assume this is an issue of trying to deal with so many ORs. Does that >>> seem correct to people? Is this an ODK or Android issue? Is there any way >>> around this? Maybe there's a better way to do these messages (rather than >>> ~200 ORs!)? >>> >>> CODE (simplified): >>> >> readonly="true()" relevant= >>> "(selected(/data/CES2_4, '1') >>> or >>> ( >>> selected(/data/CES1_1, '2') and ( >>> ( ((/data/MUAC_group/MUAC1 + /data/MUAC_group/MUAC2) div 2) >>> < 11) >>> or >>> ( (/data/MUAC_group/MUAC1 = '') and ((/data/CES2_1_a + >>> /data/CES2_1_b) div 2) < 11) >>> ) >>> ) >>> or >>> ( >>> selected(/data/CES1_1, '3') and ( >>> ( ((/data/MUAC_group/MUAC1 + /data/MUAC_group/MUAC2) div 2) >>> < 11.5) >>> or >>> ( (/data/MUAC_group/MUAC1 = '') and ((/data/CES2_1_a + >>> /data/CES2_1_b) div 2) < 11.5) >>> ) >>> ) >>> or >>> ( >>> selected(/data/CES1_2, '1') and ( >>> ( (((/data/height_group/height1 + >>> /data/height_group/height2) div 2) = 45) and (/data/CES2_2 < 1.9)) >>> or >>> ( (((/data/height_group/height1 + >>> /data/height_group/height2) div 2) = 46) and (/data/CES2_2 < 2)) >>> or >>> ( (((/data/height_group/height1 + >>> /data/height_group/height2) div 2) = 47) and (/data/CES2_2 < 2.1)) >>> or >>> ( (((/data/height_group/height1 + >>> /data/height_group/height2) div 2) = 48) and (/data/CES2_2 < 2.3)) >>> or >>> ( (((/data/height_group/height1 + >>> /data/height_group/height2) div 2) = 49) and (/data/CES2_2 < 2.4)) >>> or >>> ( (((/data/height_group/height1 + >>> /data/height_group/height2) div 2) = 50) and (/data/CES2_2 < 2.6)) >>> ... >> >> -- >> Post: opendatakit@googlegroups.com >> Unsubscribe: opendatakit+unsubscribe@googlegroups.com >> Options: http://groups.google.com/group/opendatakit?hl=en > > > > > -- > Mitch Sundt > Software Engineer > University of Washington > mitchellsundt@gmail.com > > -- > Post: opendatakit@googlegroups.com > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > Options: http://groups.google.com/group/opendatakit?hl=en

** is "to the power of", so x**2 is x squared. Old notation. Sorry about that.

··· On Wed, Jun 27, 2012 at 10:31 PM, wrote: > Wow, nice. These are both good solutions (and reverse engineering the WHO formula is gotta be worth some bonus points!) > > I'm going to give both these methods a go and see which fits better. Gaetano, my math notation is a little fuzzy (it's been a while). What does the ** indicate in the formula? I tried the obvious things such as x^2 etc, but couldn't find anything that fits > > > Nathan, if I understand your suggestion correctly, I would have a bunch of variables that are never displayed, and then call them in the relevant for the Eligibility screen? > Maybe one var for each (/data/height_group/height1 + /data/height_group/height2) div 2) = XX)? > > Thanks again for these suggestions! > > -- > Post: opendatakit@googlegroups.com > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > Options: http://groups.google.com/group/opendatakit?hl=en