Update case based on user details and passage of time

Hi all,

I am a newcomer to Commcare and have managed to work through the
introductory tutorial(
Beginner Tutorial - CommCare Public - CommCare Public) and
got the demonstrated case system working using CommcareHQ and Commcare ODK.

What I would like to do is to have a case transition based on a combination
of data entered when a person is registered and the passage of time. Take
the pregnancy application for example, I want to setup a registration form
where the expectant mother will be asked what month of their pregnancy they
are in. I will then create three follow up forms which will be administered
between 1-3 months, 4-6 months and 7-9 months of the pregnancy. The case
should be transitioned from one form to the next based on a calculation
that will add the months that have passed since the mother was registered
to the number of months she was pregnant at the time of registration.

My question is therefore, can this be done currently and if it can
directions as to where I could find the documentation for this are welcome.

Thanks,
Eric

Hi Eric,

Welcome to the group! At the moment, what you'd like to do isn't possible
(all the forms you create for a particular module are always available).
There are a couple options for how you can handle this:

  1. Use a single follow up form, then add logic within the form to show
    questions based on how many months into the pregnancy a mother is. You'll
    need to add a case property that stores the expected date of delivery (EDD)
    and then write some Display Logic comparing the EDD to today().

  2. Use multiple follow up forms, but have some logic in the form that
    determines if it is valid based on the EDD. You can put all of the form's
    questions within a group with some Display Logic that determines whether it
    is valid. I then add a label (outside of the group) that displays an error
    message to the user if they try open that form at the wrong time. You'll
    need to train your users to exit the form if they see this error.

Let me know if you need additional details on any of the either two options.

Thanks!
Sheel

··· On Tue, Nov 20, 2012 at 7:50 PM, Eric Kamara wrote:

Hi all,

I am a newcomer to Commcare and have managed to work through the
introductory tutorial(
Beginner Tutorial - CommCare Public - CommCare Public)
and got the demonstrated case system working using CommcareHQ and Commcare
ODK.

What I would like to do is to have a case transition based on a
combination of data entered when a person is registered and the passage of
time. Take the pregnancy application for example, I want to setup a
registration form where the expectant mother will be asked what month of
their pregnancy they are in. I will then create three follow up forms which
will be administered between 1-3 months, 4-6 months and 7-9 months of the
pregnancy. The case should be transitioned from one form to the next based
on a calculation that will add the months that have passed since the mother
was registered to the number of months she was pregnant at the time of
registration.

My question is therefore, can this be done currently and if it can
directions as to where I could find the documentation for this are welcome.

Thanks,
Eric

--
Sheel Shah
Project Manager | Dimagi India
t: +91 1146704670 | m: +91 9560187282

Hi Eric,

For another workaround, check out the recent discussion Ray started here:
https://groups.google.com/forum/?fromgroups=#!topic/commcare-users/5eiNh1FIooA

You can take advantage of module-level filtering to ensure people always
use the right followup form. Instead of using postpartum = 'yes' in the
filter, you can use math on the expected delivery date, e.g. "int(edd -
today()) <= 30"

Amelia

··· On Tue, Nov 20, 2012 at 4:28 PM, Sheel Shah wrote:

Hi Eric,

Welcome to the group! At the moment, what you'd like to do isn't
possible (all the forms you create for a particular module are always
available). There are a couple options for how you can handle this:

  1. Use a single follow up form, then add logic within the form to show
    questions based on how many months into the pregnancy a mother is. You'll
    need to add a case property that stores the expected date of delivery (EDD)
    and then write some Display Logic comparing the EDD to today().

  2. Use multiple follow up forms, but have some logic in the form that
    determines if it is valid based on the EDD. You can put all of the form's
    questions within a group with some Display Logic that determines whether it
    is valid. I then add a label (outside of the group) that displays an error
    message to the user if they try open that form at the wrong time. You'll
    need to train your users to exit the form if they see this error.

Let me know if you need additional details on any of the either two
options.

Thanks!
Sheel

On Tue, Nov 20, 2012 at 7:50 PM, Eric Kamara ekamara@gmail.com wrote:

Hi all,

I am a newcomer to Commcare and have managed to work through the
introductory tutorial(
Beginner Tutorial - CommCare Public - CommCare Public)
and got the demonstrated case system working using CommcareHQ and Commcare
ODK.

What I would like to do is to have a case transition based on a
combination of data entered when a person is registered and the passage of
time. Take the pregnancy application for example, I want to setup a
registration form where the expectant mother will be asked what month of
their pregnancy they are in. I will then create three follow up forms which
will be administered between 1-3 months, 4-6 months and 7-9 months of the
pregnancy. The case should be transitioned from one form to the next based
on a calculation that will add the months that have passed since the mother
was registered to the number of months she was pregnant at the time of
registration.

My question is therefore, can this be done currently and if it can
directions as to where I could find the documentation for this are welcome.

Thanks,
Eric

--
Sheel Shah
Project Manager | Dimagi India
t: +91 1146704670 | m: +91 9560187282

Thanks Sheel and Amelia. I will try out the options advanced and give
feedback as to which one worked best for me.

Wish me luck!

Eric

··· On 20 November 2012 20:48, Amelia Sagoff wrote:

Hi Eric,

For another workaround, check out the recent discussion Ray started here:
Redirecting to Google Groups

You can take advantage of module-level filtering to ensure people always
use the right followup form. Instead of using postpartum = 'yes' in the
filter, you can use math on the expected delivery date, e.g. "int(edd -
today()) <= 30"

Amelia

On Tue, Nov 20, 2012 at 4:28 PM, Sheel Shah sshah@dimagi.com wrote:

Hi Eric,

Welcome to the group! At the moment, what you'd like to do isn't
possible (all the forms you create for a particular module are always
available). There are a couple options for how you can handle this:

  1. Use a single follow up form, then add logic within the form to show
    questions based on how many months into the pregnancy a mother is. You'll
    need to add a case property that stores the expected date of delivery (EDD)
    and then write some Display Logic comparing the EDD to today().

  2. Use multiple follow up forms, but have some logic in the form that
    determines if it is valid based on the EDD. You can put all of the form's
    questions within a group with some Display Logic that determines whether it
    is valid. I then add a label (outside of the group) that displays an error
    message to the user if they try open that form at the wrong time. You'll
    need to train your users to exit the form if they see this error.

Let me know if you need additional details on any of the either two
options.

Thanks!
Sheel

On Tue, Nov 20, 2012 at 7:50 PM, Eric Kamara ekamara@gmail.com wrote:

Hi all,

I am a newcomer to Commcare and have managed to work through the
introductory tutorial(
Beginner Tutorial - CommCare Public - CommCare Public)
and got the demonstrated case system working using CommcareHQ and Commcare
ODK.

What I would like to do is to have a case transition based on a
combination of data entered when a person is registered and the passage of
time. Take the pregnancy application for example, I want to setup a
registration form where the expectant mother will be asked what month of
their pregnancy they are in. I will then create three follow up forms which
will be administered between 1-3 months, 4-6 months and 7-9 months of the
pregnancy. The case should be transitioned from one form to the next based
on a calculation that will add the months that have passed since the mother
was registered to the number of months she was pregnant at the time of
registration.

My question is therefore, can this be done currently and if it can
directions as to where I could find the documentation for this are welcome.

Thanks,
Eric

--
Sheel Shah
Project Manager | Dimagi India
t: +91 1146704670 | m: +91 9560187282

--
Eric

--Ad augusta per angusta