Autosave Surveys Periodically

Hello ODK,
Here at Grameen Foundation Uganda, we ran into a scenario where our field
teams running Surveys on ODK would lose their data whenever our Apps force
closed, or when the battery died. We decided to make a small change to the
code so that in the event that the FormEntryActivity was stopped, the survey
being conducted would be saved automatically. Another thing we did with the
code was to autosave the survey after every 3 swipes. The number of swipes
chosen was arbitrary, we can still choose to increase it to 5 or 10 or
whatever.
The other issue we want to deal with is Discard Changes, since we have now
implemented an autosave feature, Discard Changes does not work as well as it
should.Here is our scenario: A user loads a form with about 5 questions,
the first of which is Name. The user enters Steven as the name, fills out
the other 4 questions as well and saves. The user then realizes that they
somehow misspelt Steven, that it should have been Stephen, so they go to
Continue Saved Form and load up that form, correct the spelling of Steven to
Stephen and as they review the other entered data an autosave occurs. Then
at that moment it actually dawns on the user that they were right after all,
that Steven is the correct spelling, so they go to Discard Changes. At the
moment, what will happen is that all changes that had not been autosaved
will be undone, but those that were, will be persisted. In this case,
Discard Changes will not affect the Name question,meaning it will have
Stephen as the answer.
We have a plan to go about making sure that Discard Changes works well in
our scenario but we thought it would not be a bad idea to share our
experiences with the ODK team and get suggestions where possible on the best
way to go about this. I have attached a patch of our changes so that you
guys can take a look and see what we have done so far. The patch basically
has the saving feature we did. Any comments and suggestions will be
appreciated.

Refactored ODK Collect.org.odk.collect.android.activities.FormEntryActivity.patch (2.34 KB)

··· -- Steven Nsubuga Software Developer AppLab Uganda Grameen Foundation

agreed with the enthusiasm about making the user's life easier, but i
think there is an cleaner way to get autosave.

instead of writing out to xml every n swipes, use the local database.
so when you start a form filling process, the answer for each prompt
of the current form session get written to that store on swipe. on
crash, you can restore those easily, and on a totally new and
different form (or on discard changes), you just wipe that store and
start over. this gets you auto save on every answer with very little
overhead. when you exit a form or mark it finished, you write out what
is in the database to xml.

··· On Wed, May 25, 2011 at 06:23, Andrew Marder wrote: > Let me throw a little enthusiasm on the fire... > > Huzzah! I think auto save is a great feature, particularly when there > is a chance the phone will crash in the middle of a long survey. Way > to go Steven and Grameen Uganda! > > Andrew > > On Wed, May 25, 2011 at 4:15 AM, Steven Nsubuga wrote: >> Hello ODK, >> Here at Grameen Foundation Uganda, we ran into a scenario where our field >> teams running Surveys on ODK would lose their data whenever our Apps force >> closed, or when the battery died. We decided to make a small change to the >> code so that in the event that the FormEntryActivity was stopped, the survey >> being conducted would be saved automatically. Another thing we did with the >> code was to autosave the survey after every 3 swipes. The number of swipes >> chosen was arbitrary, we can still choose to increase it to 5 or 10 or >> whatever. >> The other issue we want to deal with is Discard Changes, since we have now >> implemented an autosave feature, Discard Changes does not work as well as it >> should.Here is our scenario: A user loads a form with about 5 questions, >> the first of which is Name. The user enters Steven as the name, fills out >> the other 4 questions as well and saves. The user then realizes that they >> somehow misspelt Steven, that it should have been Stephen, so they go to >> Continue Saved Form and load up that form, correct the spelling of Steven to >> Stephen and as they review the other entered data an autosave occurs. Then >> at that moment it actually dawns on the user that they were right after all, >> that Steven is the correct spelling, so they go to Discard Changes. At the >> moment, what will happen is that all changes that had not been autosaved >> will be undone, but those that were, will be persisted. In this case, >> Discard Changes will not affect the Name question,meaning it will have >> Stephen as the answer. >> We have a plan to go about making sure that Discard Changes works well in >> our scenario but we thought it would not be a bad idea to share our >> experiences with the ODK team and get suggestions where possible on the best >> way to go about this. I have attached a patch of our changes so that you >> guys can take a look and see what we have done so far. The patch basically >> has the saving feature we did. Any comments and suggestions will be >> appreciated. >> >> -- >> Steven Nsubuga >> Software Developer >> AppLab Uganda >> Grameen Foundation >> >> -- >> Post: opendatakit@googlegroups.com >> Unsubscribe: opendatakit+unsubscribe@googlegroups.com >> Options: http://groups.google.com/group/opendatakit?hl=en >> > > -- > Post: opendatakit@googlegroups.com > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > Options: http://groups.google.com/group/opendatakit?hl=en >

Let me throw a little enthusiasm on the fire...

Huzzah! I think auto save is a great feature, particularly when there
is a chance the phone will crash in the middle of a long survey. Way
to go Steven and Grameen Uganda!

Andrew

··· On Wed, May 25, 2011 at 4:15 AM, Steven Nsubuga wrote: > Hello ODK, > Here at Grameen Foundation Uganda, we ran into a scenario where our field > teams running Surveys on ODK would lose their data whenever our Apps force > closed, or when the battery died. We decided to make a small change to the > code so that in the event that the FormEntryActivity was stopped, the survey > being conducted would be saved automatically. Another thing we did with the > code was to autosave the survey after every 3 swipes. The number of swipes > chosen was arbitrary, we can still choose to increase it to 5 or 10 or > whatever. > The other issue we want to deal with is Discard Changes, since we have now > implemented an autosave feature, Discard Changes does not work as well as it > should.Here is our scenario: A user loads a form with about 5 questions, > the first of which is Name. The user enters Steven as the name, fills out > the other 4 questions as well and saves. The user then realizes that they > somehow misspelt Steven, that it should have been Stephen, so they go to > Continue Saved Form and load up that form, correct the spelling of Steven to > Stephen and as they review the other entered data an autosave occurs. Then > at that moment it actually dawns on the user that they were right after all, > that Steven is the correct spelling, so they go to Discard Changes. At the > moment, what will happen is that all changes that had not been autosaved > will be undone, but those that were, will be persisted. In this case, > Discard Changes will not affect the Name question,meaning it will have > Stephen as the answer. > We have a plan to go about making sure that Discard Changes works well in > our scenario but we thought it would not be a bad idea to share our > experiences with the ODK team and get suggestions where possible on the best > way to go about this. I have attached a patch of our changes so that you > guys can take a look and see what we have done so far. The patch basically > has the saving feature we did. Any comments and suggestions will be > appreciated. > > -- > Steven Nsubuga > Software Developer > AppLab Uganda > Grameen Foundation > > -- > Post: opendatakit@googlegroups.com > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > Options: http://groups.google.com/group/opendatakit?hl=en >

Hate to bring back an old thread, but I keep getting emails about
this. So, for the public record...

We have not had the time to build auto-save. I've filed the feature
request at http://code.google.com/p/opendatakit/issues/detail?id=388.

If you need this feature soon, it'll be easiest to hire a developer to
build it. http://opendatakit.org/help/help-for-hire is a good place to
start looking.

··· On Wed, May 25, 2011 at 06:37, Yaw Anokwa wrote: > agreed with the enthusiasm about making the user's life easier, but i > think there is an cleaner way to get autosave. > > instead of writing out to xml every n swipes, use the local database. > so when you start a form filling process, the answer for each prompt > of the current form session get written to that store on swipe. on > crash, you can restore those easily, and on a totally new and > different form (or on discard changes), you just wipe that store and > start over. this gets you auto save on every answer with very little > overhead. when you exit a form or mark it finished, you write out what > is in the database to xml. > > On Wed, May 25, 2011 at 06:23, Andrew Marder wrote: >> Let me throw a little enthusiasm on the fire... >> >> Huzzah! I think auto save is a great feature, particularly when there >> is a chance the phone will crash in the middle of a long survey. Way >> to go Steven and Grameen Uganda! >> >> Andrew >> >> On Wed, May 25, 2011 at 4:15 AM, Steven Nsubuga wrote: >>> Hello ODK, >>> Here at Grameen Foundation Uganda, we ran into a scenario where our field >>> teams running Surveys on ODK would lose their data whenever our Apps force >>> closed, or when the battery died. We decided to make a small change to the >>> code so that in the event that the FormEntryActivity was stopped, the survey >>> being conducted would be saved automatically. Another thing we did with the >>> code was to autosave the survey after every 3 swipes. The number of swipes >>> chosen was arbitrary, we can still choose to increase it to 5 or 10 or >>> whatever. >>> The other issue we want to deal with is Discard Changes, since we have now >>> implemented an autosave feature, Discard Changes does not work as well as it >>> should.Here is our scenario: A user loads a form with about 5 questions, >>> the first of which is Name. The user enters Steven as the name, fills out >>> the other 4 questions as well and saves. The user then realizes that they >>> somehow misspelt Steven, that it should have been Stephen, so they go to >>> Continue Saved Form and load up that form, correct the spelling of Steven to >>> Stephen and as they review the other entered data an autosave occurs. Then >>> at that moment it actually dawns on the user that they were right after all, >>> that Steven is the correct spelling, so they go to Discard Changes. At the >>> moment, what will happen is that all changes that had not been autosaved >>> will be undone, but those that were, will be persisted. In this case, >>> Discard Changes will not affect the Name question,meaning it will have >>> Stephen as the answer. >>> We have a plan to go about making sure that Discard Changes works well in >>> our scenario but we thought it would not be a bad idea to share our >>> experiences with the ODK team and get suggestions where possible on the best >>> way to go about this. I have attached a patch of our changes so that you >>> guys can take a look and see what we have done so far. The patch basically >>> has the saving feature we did. Any comments and suggestions will be >>> appreciated. >>> >>> -- >>> Steven Nsubuga >>> Software Developer >>> AppLab Uganda >>> Grameen Foundation >>> >>> -- >>> Post: opendatakit@googlegroups.com >>> Unsubscribe: opendatakit+unsubscribe@googlegroups.com >>> Options: http://groups.google.com/group/opendatakit?hl=en >>> >> >> -- >> Post: opendatakit@googlegroups.com >> Unsubscribe: opendatakit+unsubscribe@googlegroups.com >> Options: http://groups.google.com/group/opendatakit?hl=en >>