Advice request - how to get the date a form was created into the case record

Hi

I’d like some advice please on how to get the date a form was saved to the
tablet into the case record.

At the moment we have a visit form and we need to save the date of the last
visit to the case. I understand how to save data from forms to a case. My
question is how can you most reliably collect today’s date? Given that you
cannot always rely on the ‘system date’ on the tablet to be set correctly.

Thanks in anticipation.

Simon

Hi Simon,

I’m sad to say we’ve tried to “solve” this problem with technology in a lot
of different ways over the years. We’ve tried applying adjustments to dates
on the phone based on the difference between the server date and phone
date, and various other methods. Unfortunately they all come with major
limitations. If you apply adjustments, you can’t know whether the phone’s
date corrects itself properly in between, and generally trying to manage
two different clocks causes major issues when making inferences about the
data.

Our current best practice has been to try to manage phones not having
up-to-date times instead, by either using reports tracking dates to see
when phones have bad dates and updating them, or adding things like display
conditions to forms which check whether “today()” is before when we know
the project started. Android phones are now on average quite robust at
maintaining today’s date as long as there is connectivity, so it’s been
less and less of an issue over time.

Sorry this couldn’t be more helpful, I think what I’m mostly trying to say
boils down to “trying to help programs identify phones with bad dates has
generally been more helpful than trying to “fix” bad dates at the data
level”. We’re working on always improving our tools, and one of the areas
that comes down to is helping deployments manage their devices and spot
problem areas, this is definitely something that we can be thinking about
when we are approaching that future work.

-Clayton

··· On Tue, Nov 22, 2016 at 8:58 AM, Simon Berry wrote:

Hi

I’d like some advice please on how to get the date a form was saved to the
tablet into the case record.

At the moment we have a visit form and we need to save the date of the
last visit to the case. I understand how to save data from forms to a case.
My question is how can you most reliably collect today’s date? Given that
you cannot always rely on the ‘system date’ on the tablet to be set
correctly.

Thanks in anticipation.

Simon


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.

Thanks for this quick and comprehensive reply Clayton. It’s reassuring that
it’s not just me!

What we will do is ask for the date at the beginning of each form and set
the default for that question to today() and hope the clock on the device
is correct.

What about this though. What if part of the routines was to:

  • Update the App on the first day of the month (eg Oct-16) with a
    validation condition on the date question (with default set to today())
    which checked that the date entered was >= 1-Oct-16. What would be the
    precise validation syntax for this? Is it as simple as: date_entered >=
    2016-10-01

This would at least ensure that the date entered was in the right month
which, in our case, is all we are interested in.

Regards

Simon
22/11/16

··· On Tuesday, November 22, 2016 at 2:21:51 PM UTC, Clayton Sims wrote: > > Hi Simon, > > I'm sad to say we've tried to "solve" this problem with technology in a > lot of different ways over the years. We've tried applying adjustments to > dates on the phone based on the difference between the server date and > phone date, and various other methods. Unfortunately they all come with > major limitations. If you apply adjustments, you can't know whether the > phone's date corrects itself properly in between, and generally trying to > manage two different clocks causes major issues when making inferences > about the data. > > Our current best practice has been to try to manage phones not having > up-to-date times instead, by either using reports tracking dates to see > when phones have bad dates and updating them, or adding things like display > conditions to forms which check whether "today()" is before when we know > the project started. Android phones are now on average quite robust at > maintaining today's date as long as there is connectivity, so it's been > less and less of an issue over time. > > Sorry this couldn't be more helpful, I think what I'm mostly trying to say > boils down to "trying to help programs identify phones with bad dates has > generally been more helpful than trying to "fix" bad dates at the data > level". We're working on always improving our tools, and one of the areas > that comes down to is helping deployments manage their devices and spot > problem areas, this is definitely something that we can be thinking about > when we are approaching that future work. > > -Clayton > > On Tue, Nov 22, 2016 at 8:58 AM, Simon Berry <si...@colalife.org > wrote: > >> Hi >> >> I'd like some advice please on how to get the date a form was saved to >> the tablet into the case record. >> >> At the moment we have a visit form and we need to save the date of the >> last visit to the case. I understand how to save data from forms to a case. >> My question is how can you most reliably collect today's date? Given that >> you cannot always rely on the 'system date' on the tablet to be set >> correctly. >> >> Thanks in anticipation. >> >> Simon >> >> -- >> 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. >> > >

Simon,

That should work, yes. In order to do a date comparison I’d set the
hard-coded date component with

date(“2016-10-01”)

just to make sure it’s unambiguous.

I’m a bit surprised to hear that the bad dates you are encountering are new
enough for it to be an issue. Generally in my experience “Bad” dates have
been years and years old (generally the date the phone left the factory or
something similar), so just not letting the user proceed if today() <
date(“2016-01-01”) has been effective when this has come up.

-Clayton

··· On Tue, Nov 22, 2016 at 11:15 AM, Simon Berry wrote:

Thanks for this quick and comprehensive reply Clayton. It’s reassuring
that it’s not just me!

What we will do is ask for the date at the beginning of each form and set
the default for that question to today() and hope the clock on the device
is correct.

What about this though. What if part of the routines was to:

  • Update the App on the first day of the month (eg Oct-16) with a
    validation condition on the date question (with default set to today())
    which checked that the date entered was >= 1-Oct-16. What would be the
    precise validation syntax for this? Is it as simple as: date_entered >=
    2016-10-01

This would at least ensure that the date entered was in the right month
which, in our case, is all we are interested in.

Regards

Simon
22/11/16

On Tuesday, November 22, 2016 at 2:21:51 PM UTC, Clayton Sims wrote:

Hi Simon,

I’m sad to say we’ve tried to “solve” this problem with technology in a
lot of different ways over the years. We’ve tried applying adjustments to
dates on the phone based on the difference between the server date and
phone date, and various other methods. Unfortunately they all come with
major limitations. If you apply adjustments, you can’t know whether the
phone’s date corrects itself properly in between, and generally trying to
manage two different clocks causes major issues when making inferences
about the data.

Our current best practice has been to try to manage phones not having
up-to-date times instead, by either using reports tracking dates to see
when phones have bad dates and updating them, or adding things like display
conditions to forms which check whether “today()” is before when we know
the project started. Android phones are now on average quite robust at
maintaining today’s date as long as there is connectivity, so it’s been
less and less of an issue over time.

Sorry this couldn’t be more helpful, I think what I’m mostly trying to
say boils down to “trying to help programs identify phones with bad dates
has generally been more helpful than trying to “fix” bad dates at the data
level”. We’re working on always improving our tools, and one of the areas
that comes down to is helping deployments manage their devices and spot
problem areas, this is definitely something that we can be thinking about
when we are approaching that future work.

-Clayton

On Tue, Nov 22, 2016 at 8:58 AM, Simon Berry si...@colalife.org wrote:

Hi

I’d like some advice please on how to get the date a form was saved to
the tablet into the case record.

At the moment we have a visit form and we need to save the date of the
last visit to the case. I understand how to save data from forms to a case.
My question is how can you most reliably collect today’s date? Given that
you cannot always rely on the ‘system date’ on the tablet to be set
correctly.

Thanks in anticipation.

Simon


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.


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.

Thanks for the code Clayton.

What happened in this case is that Iin a recent update I inadvertently set
the default date to the existing value when everyone was used to it being
set to today() and so they were used to it being correct and just swiping
through it.

So it was an own goal! But I’ve learnt so that’s the main thing.

Thanks again.

Simon

··· On Tue, Nov 22, 2016 at 8:08 PM, Clayton Sims wrote:

Simon,

That should work, yes. In order to do a date comparison I’d set the
hard-coded date component with

date(“2016-10-01”)

just to make sure it’s unambiguous.

I’m a bit surprised to hear that the bad dates you are encountering are
new enough for it to be an issue. Generally in my experience “Bad” dates
have been years and years old (generally the date the phone left
the factory or something similar), so just not letting the user proceed if
today() < date(“2016-01-01”) has been effective when this has come up.

-Clayton

On Tue, Nov 22, 2016 at 11:15 AM, Simon Berry simon@colalife.org wrote:

Thanks for this quick and comprehensive reply Clayton. It’s reassuring
that it’s not just me!

What we will do is ask for the date at the beginning of each form and set
the default for that question to today() and hope the clock on the device
is correct.

What about this though. What if part of the routines was to:

  • Update the App on the first day of the month (eg Oct-16) with a
    validation condition on the date question (with default set to today())
    which checked that the date entered was >= 1-Oct-16. What would be the
    precise validation syntax for this? Is it as simple as: date_entered >=
    2016-10-01

This would at least ensure that the date entered was in the right month
which, in our case, is all we are interested in.

Regards

Simon
22/11/16

On Tuesday, November 22, 2016 at 2:21:51 PM UTC, Clayton Sims wrote:

Hi Simon,

I’m sad to say we’ve tried to “solve” this problem with technology in a
lot of different ways over the years. We’ve tried applying adjustments to
dates on the phone based on the difference between the server date and
phone date, and various other methods. Unfortunately they all come with
major limitations. If you apply adjustments, you can’t know whether the
phone’s date corrects itself properly in between, and generally trying to
manage two different clocks causes major issues when making inferences
about the data.

Our current best practice has been to try to manage phones not having
up-to-date times instead, by either using reports tracking dates to see
when phones have bad dates and updating them, or adding things like display
conditions to forms which check whether “today()” is before when we know
the project started. Android phones are now on average quite robust at
maintaining today’s date as long as there is connectivity, so it’s been
less and less of an issue over time.

Sorry this couldn’t be more helpful, I think what I’m mostly trying to say
boils down to “trying to help programs identify phones with bad dates has
generally been more helpful than trying to “fix” bad dates at the data
level”. We’re working on always improving our tools, and one of the areas
that comes down to is helping deployments manage their devices and spot
problem areas, this is definitely something that we can be thinking about
when we are approaching that future work.

-Clayton

On Tue, Nov 22, 2016 at 8:58 AM, Simon Berry si...@colalife.org wrote:

Hi

I’d like some advice please on how to get the date a form was saved to the
tablet into the case record.

At the moment we have a visit form and we need to save the date of the
last visit to the case. I understand how to save data from forms to a case.
My question is how can you most reliably collect today’s date? Given that
you cannot always rely on the ‘system date’ on the tablet to be set
correctly.

Thanks in anticipation.

Simon


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.


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.


You received this message because you are subscribed to a topic in the
Google Groups “commcare-users” group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/commcare-users/773thNrQglI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
commcare-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.