Question Logic Trouble (Project specific) - Can anyone spot the error?

I can’t make my logic for the respirator counter work. I am trying to write
the code to classify a child between 6 and 11 months with a respiratory
rate above 50 as a “rapid” breather and a child between 12 and 60 months
with a respiratory rate above 40 as a “rapid” breather. With any other
signs of gravity these cases should be classified as “pneumonie grave” and
without any signs of gravity they should be “pneumonie simple”. A child
without “rapid” breathing should just be classified as a case of
"TouxRhume".
However, I can’t make it work. With the most recently deployed version of
the app ti seems to classify all cases as TouxRhume. I think it is doing
that because that is the default and something is wrong with the other code
but I can’t figure it out for the life of me. Any ideas?

Here is the code I wrote:
Android App Callout Variable for Respiratory Counter = “results_respcount”

Hidden Variable “Resp_classification” = if(((/data/Identification_du_patient/age_mois>=2
and /data/Identification_du_patient/age_mois<12) and
/data/PEC_pneumonie/results_respcount>=50),“Rapide”,if((/data/Identification_du_patient/age_mois>=12
and /data/Identification_du_patient/age_mois<=60) and
/data/PEC_pneumonie/results_respcount>=40,“Rapide”,“Normale”))

Hidden Variable “IRA_classification”
= if(/data/PEC_pneumonie/Resp_classification=“Rapide” and
/data/Rechercher_les_signes_de_gravite/signes_pneumonie_grave=“yes”,“Pneumonie
Grave”,if(/data/PEC_pneumonie/Resp_classification=“Normale” and
/data/Rechercher_les_signes_de_gravite/signes_pneumonie_grave=“no”,“Pneumonie
Simple”,“TouxRhume”))

The display logic is: (it is the same for all 3 because they are in the
same folder)
selected(/data/symptomes, ‘toux’) and
/data/Population_vulnerable/Pop_vulnerable = ‘no’ and /data/PEC_eligible =
‘yes’ and /data/Ebola/ebola_suspect != ‘yes’

Hidden Variable “Pop_vulnerable”
= if(/data/Identification_du_patient/age_mois<2, “moins2mois”,
if(/data/Population_vulnerable/status_enceinte=“oui”, “enceinte”,
if(/data/Population_vulnerable/status_enceinte = “ne_sait_pas”, “etat
grossesse inconnue”, “no”)))

Hidden Variable “PEC_eligible”
= if(/data/Identification_du_patient/age_mois<=60 or
(/data/Identification_du_patient/age_mois>60 and selected(/data/symptomes,
‘fievre’)),“yes”,“no”)

Hidden Variable “ebola_suspect” = if(/data/Ebola/voyage = ‘oui’ and
(selected(/data/Ebola/pays_voyage, ‘guinee’) or
selected(/data/Ebola/pays_voyage, ‘sierra_leone’)), ‘yes’, ‘no’)

Hi Sarah,

It seems like your IRA_classification hidden value is missing some catching
expression.

Can you try to debug the application step by step to identify the issue.

You should try to display the hidden values in a label to see what is
returned by each of them. To do so:

  • create a label question in your form
  • drag and drop your hidden values (Resp_classification,
    signes_pneumonie_grave …) preceded by the name of the value to identify
    them.

If you can send screen prints of those we can try to see what your test
values are…

Kind Regards

Ismaila

··· *______________________________________________* *Ismaila DIENE*

Field Technician

Dimagi, West Africa

m: + <%28617%29%20596%206243>221 7814 78314 / +221 7601 01633
f: + <%28617%29%20596%206243>221 33 820 7375

skype: isaack007
web: http://www.dimagi.com/


On Sat, Jun 6, 2015 at 10:24 AM, Sarah Mollenkopf smollenk@gmail.com wrote:

I can’t make my logic for the respirator counter work. I am trying to
write the code to classify a child between 6 and 11 months with a
respiratory rate above 50 as a “rapid” breather and a child between 12 and
60 months with a respiratory rate above 40 as a “rapid” breather. With any
other signs of gravity these cases should be classified as “pneumonie
grave” and without any signs of gravity they should be “pneumonie simple”.
A child without “rapid” breathing should just be classified as a case of
"TouxRhume".
However, I can’t make it work. With the most recently deployed version of
the app ti seems to classify all cases as TouxRhume. I think it is doing
that because that is the default and something is wrong with the other code
but I can’t figure it out for the life of me. Any ideas?

Here is the code I wrote:
Android App Callout Variable for Respiratory Counter = “results_respcount”

Hidden Variable “Resp_classification” = if(((/data/Identification_du_patient/age_mois>=2
and /data/Identification_du_patient/age_mois<12) and
/data/PEC_pneumonie/results_respcount>=50),“Rapide”,if((/data/Identification_du_patient/age_mois>=12
and /data/Identification_du_patient/age_mois<=60) and
/data/PEC_pneumonie/results_respcount>=40,“Rapide”,“Normale”))

Hidden Variable “IRA_classification”
= if(/data/PEC_pneumonie/Resp_classification=“Rapide” and
/data/Rechercher_les_signes_de_gravite/signes_pneumonie_grave=“yes”,“Pneumonie
Grave”,if(/data/PEC_pneumonie/Resp_classification=“Normale” and
/data/Rechercher_les_signes_de_gravite/signes_pneumonie_grave=“no”,“Pneumonie
Simple”,“TouxRhume”))

The display logic is: (it is the same for all 3 because they are in the
same folder)
selected(/data/symptomes, ‘toux’) and
/data/Population_vulnerable/Pop_vulnerable = ‘no’ and /data/PEC_eligible =
‘yes’ and /data/Ebola/ebola_suspect != ‘yes’

Hidden Variable “Pop_vulnerable”
= if(/data/Identification_du_patient/age_mois<2, “moins2mois”,
if(/data/Population_vulnerable/status_enceinte=“oui”, “enceinte”,
if(/data/Population_vulnerable/status_enceinte = “ne_sait_pas”, “etat
grossesse inconnue”, “no”)))

Hidden Variable “PEC_eligible”
= if(/data/Identification_du_patient/age_mois<=60 or
(/data/Identification_du_patient/age_mois>60 and selected(/data/symptomes,
‘fievre’)),“yes”,“no”)

Hidden Variable “ebola_suspect” = if(/data/Ebola/voyage = ‘oui’ and
(selected(/data/Ebola/pays_voyage, ‘guinee’) or
selected(/data/Ebola/pays_voyage, ‘sierra_leone’)), ‘yes’, ‘no’)


You received this message because you are subscribed to the Google Groups
"commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.