Problem with randomization in Commcare


#1

Hello,

I am using a Commcare-based survey in which several questions involve
randomly selected scenarios: several random numbers are generated to assign
a scenario, and then the following questions depend on the assigned
scenario.

We have observed that when we exit the app and then reopen a specific form
later, the scenario number is different from the first time (i.e. Commcare
re-does the randomization and therefore assigns a different scenario). This
is a problem because the previously-saved answers no longer correspond to
the questions that appear on the screen.

Do you know if there is a way to prevent CommCare from re-doing the
randomization when reopening a form? (if for example an enumerator has to
finish the survey at a later time)

Thank you in advance for your help!

Best regards

Caroline Delaire


#2

Thanks a lot William for the prompt reply. I think your suggestion with the
case should work for us.

Thanks!

Caroline

··· On Monday, May 22, 2017 at 2:18:12 PM UTC+3, caro...@aquaya.org wrote: > > Hello, > > I am using a Commcare-based survey in which several questions involve > randomly selected scenarios: several random numbers are generated to assign > a scenario, and then the following questions depend on the assigned > scenario. > > We have observed that when we exit the app and then reopen a specific form > later, the scenario number is different from the first time (i.e. Commcare > re-does the randomization and therefore assigns a different scenario). This > is a problem because the previously-saved answers no longer correspond to > the questions that appear on the screen. > > Do you know if there is a way to prevent CommCare from re-doing the > randomization when reopening a form? (if for example an enumerator has to > finish the survey at a later time) > > Thank you in advance for your help! > > Best regards > > Caroline Delaire >

(William Pride) #3

Caroline,

You’re correct that the uuid() function will (by design) re-calculate each
time you re-open the form.

Possibly the easiest way around this would be to have the random number
calculations take place in a short, initial form that asks only a few
identification questions and saves these to a case. Then the majority of
your questions could be asked in a follow-up form associated with this case
with the (now fixed) random values loaded from the same.

If this won’t work for you there’s a slightly more complicated solution
involving custom XML that I could recommend. If you’re interested please
email me directly (wpride@dimagi.com) and I can outline how this would work.

Cheers,
Will

··· On Mon, May 22, 2017 at 7:18 AM, wrote:

Hello,

I am using a Commcare-based survey in which several questions involve
randomly selected scenarios: several random numbers are generated to assign
a scenario, and then the following questions depend on the assigned
scenario.

We have observed that when we exit the app and then reopen a specific form
later, the scenario number is different from the first time (i.e. Commcare
re-does the randomization and therefore assigns a different scenario). This
is a problem because the previously-saved answers no longer correspond to
the questions that appear on the screen.

Do you know if there is a way to prevent CommCare from re-doing the
randomization when reopening a form? (if for example an enumerator has to
finish the survey at a later time)

Thank you in advance for your help!

Best regards

Caroline Delaire


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.


#4

Hi William,

one more question about your suggested solution: for the second form to be
able to retrieve information from the case, would it require having
constant access to internet? Or would the data be stored in the phone and
thus accessible without internet?

Thanks!

Caroline

··· On Monday, May 22, 2017 at 3:32:09 PM UTC+3, caro...@aquaya.org wrote: > > Thanks a lot William for the prompt reply. I think your suggestion with > the case should work for us. > > Thanks! > > Caroline > > On Monday, May 22, 2017 at 2:18:12 PM UTC+3, caro...@aquaya.org wrote: >> >> Hello, >> >> I am using a Commcare-based survey in which several questions involve >> randomly selected scenarios: several random numbers are generated to assign >> a scenario, and then the following questions depend on the assigned >> scenario. >> >> We have observed that when we exit the app and then reopen a specific >> form later, the scenario number is different from the first time (i.e. >> Commcare re-does the randomization and therefore assigns a different >> scenario). This is a problem because the previously-saved answers no longer >> correspond to the questions that appear on the screen. >> >> Do you know if there is a way to prevent CommCare from re-doing the >> randomization when reopening a form? (if for example an enumerator has to >> finish the survey at a later time) >> >> Thank you in advance for your help! >> >> Best regards >> >> Caroline Delaire >> >

(William Pride) #5

Hi Caroline,

In the workflow you described you would not need internet - the case would
be available on the phone as soon as its created in the first form. The
only situation where you would need internet would be if you wanted to fill
out the second (follow-up form) on a separate device than the one that
filled out the first (randomization) form.

Cheers,
Will

··· On Mon, May 22, 2017 at 9:57 AM, wrote:

Hi William,

one more question about your suggested solution: for the second form to be
able to retrieve information from the case, would it require having
constant access to internet? Or would the data be stored in the phone and
thus accessible without internet?

Thanks!

Caroline

On Monday, May 22, 2017 at 3:32:09 PM UTC+3, caro...@aquaya.org wrote:

Thanks a lot William for the prompt reply. I think your suggestion with
the case should work for us.

Thanks!

Caroline

On Monday, May 22, 2017 at 2:18:12 PM UTC+3, caro...@aquaya.org wrote:

Hello,

I am using a Commcare-based survey in which several questions involve
randomly selected scenarios: several random numbers are generated to assign
a scenario, and then the following questions depend on the assigned
scenario.

We have observed that when we exit the app and then reopen a specific
form later, the scenario number is different from the first time (i.e.
Commcare re-does the randomization and therefore assigns a different
scenario). This is a problem because the previously-saved answers no longer
correspond to the questions that appear on the screen.

Do you know if there is a way to prevent CommCare from re-doing the
randomization when reopening a form? (if for example an enumerator has to
finish the survey at a later time)

Thank you in advance for your help!

Best regards

Caroline Delaire


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.


#6

Thanks a lot William!

··· On Monday, May 22, 2017 at 5:45:08 PM UTC+3, William Pride wrote: > > Hi Caroline, > > In the workflow you described you would not need internet - the case would > be available on the phone as soon as its created in the first form. The > only situation where you would need internet would be if you wanted to fill > out the second (follow-up form) on a separate device than the one that > filled out the first (randomization) form. > > Cheers, > Will > > On Mon, May 22, 2017 at 9:57 AM, <caro...@aquaya.org > wrote: > >> Hi William, >> >> one more question about your suggested solution: for the second form to >> be able to retrieve information from the case, would it require having >> constant access to internet? Or would the data be stored in the phone and >> thus accessible without internet? >> >> Thanks! >> >> Caroline >> >> On Monday, May 22, 2017 at 3:32:09 PM UTC+3, caro...@aquaya.org wrote: >>> >>> Thanks a lot William for the prompt reply. I think your suggestion with >>> the case should work for us. >>> >>> Thanks! >>> >>> Caroline >>> >>> On Monday, May 22, 2017 at 2:18:12 PM UTC+3, caro...@aquaya.org wrote: >>>> >>>> Hello, >>>> >>>> I am using a Commcare-based survey in which several questions involve >>>> randomly selected scenarios: several random numbers are generated to assign >>>> a scenario, and then the following questions depend on the assigned >>>> scenario. >>>> >>>> We have observed that when we exit the app and then reopen a specific >>>> form later, the scenario number is different from the first time (i.e. >>>> Commcare re-does the randomization and therefore assigns a different >>>> scenario). This is a problem because the previously-saved answers no longer >>>> correspond to the questions that appear on the screen. >>>> >>>> Do you know if there is a way to prevent CommCare from re-doing the >>>> randomization when reopening a form? (if for example an enumerator has to >>>> finish the survey at a later time) >>>> >>>> Thank you in advance for your help! >>>> >>>> Best regards >>>> >>>> Caroline Delaire >>>> >>> -- >> 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-user...@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > >

(Alicea Cock-Esteb) #7

Hi Will,

I’m not sure if you are still around at Dimagi, but I work with Caroline and we are working on a new study and are having the same issue. Could I reach out to you to see if the custom XML option would work for us?

Thanks,
Alicea