Pre-population of data in the forms

Hi,
This is a fairly long question on how to pre-populate the contents of a form
based on the values obtained from another survey. Here's the exact scenario:
We've collected household data (household identified by unique number ->
associated with multiple individuals identified by name). Now, we have to
conduct another survey on the population and are hoping to use the household
data that we already have collected. The flow we would like is

  • Surveyor visits households and scans the ID card given to the household.
  • Based on the scanned number, the list of individuals is shown as a
    "select1"
  • Surveyor chooses one and proceeds with the survey.

The two approaches that we thought about

  1. We could programmatically generate a XForm that hardcodes the household
    members as separate selects with appropriate relevance criterion. This means
    that there will be as many select1 fields as there are households in the
    population. The problem with this approach is that there will be as many
    columns in the resulting csv as there are households (and more!). I'm not
    sure if this is technically feasible at all, since we are talking of nearly
    3000 households. Even if it is, is there a way that the resultant csv can be
    aggregated (col1+col2+col3...., since we know that only of the cols has the
    value we need)?
  2. We explored having a huge select1 consisting of all the persons in the
    population with relevance criteria defined at the level of the option and
    not at the level of the select. We gathered from another discussion thread
    that this is not possible right now. But is the support for this feature
    expected in the near future?
  3. This might be a silly question, but can we use the "Instance Destination"
    field so that many selects can write to the same output variable?

Regards
Deepak

hi deepak,

This is a fairly long question on how to pre-populate the contents of a form based on the values obtained from another survey. Here's the exact scenario: We've collected household data (household identified by unique number -> associated with multiple individuals identified by name). Now, we have to conduct another survey on the population and are hoping to use the household data that we already have collected. The flow we would like is

  • Surveyor visits households and scans the ID card given to the household.
  • Based on the scanned number, the list of individuals is shown as a "select1"
  • Surveyor chooses one and proceeds with the survey.

these are the kinds of use-cases that we want to support better in the future, but we don't support them well today. i've put some ideas inline that may help. an easy alternative is to write a custom widget in collect that calls an on device db (or custom android app) with the barcode information and returns the list of individuals.

  1. We could programmatically generate a XForm that hardcodes the household members as separate selects with appropriate relevance criterion. This means that there will be as many select1 fields as there are households in the population. The problem with this approach is that there will be as many columns in the resulting csv as there are households (and more!). I'm not sure if this is technically feasible at all, since we are talking of nearly 3000 households. Even if it is, is there a way that the resultant csv can be aggregated (col1+col2+col3...., since we know that only of the cols has the value we need)?

i have no idea how collect would behave with that many selects, but probably worth a try. in aggregate 1.0, you can save a filter to view only the relevant columns. i don't think you can export that filtered data, but it should be pretty easy to remove those columns once it gets to your destination.

  1. We explored having a huge select1 consisting of all the persons in the population with relevance criteria defined at the level of the option and not at the level of the select. We gathered from another discussion thread that this is not possible right now. But is the support for this feature expected in the near future?

dunno exactly what you mean, but i think you are talking about cascading selects. this is still not sorted, but clayton (of dimagi) has some sample forms that i'm trying to track down (see http://groups.google.com/group/opendatakit/browse_thread/thread/ba6204204ddd17ed)

  1. This might be a silly question, but can we use the "Instance Destination" field so that many selects can write to the same output variable?

i'm not entirely sure what the instance destination actually does. i've filed a bug at http://code.google.com/p/opendatakit/issues/detail?id=287. regardless, i don't think you can bind multiple selects to one destination without doing lots of intermediate nodes with calculations. i haven't tried, so might be worth it to try. ..

If you have very large external data (1000's of rows), or continually
changing data, you would need to write your own external app that would
interact with your database and return a string with the selections made
back into ODK Collect. Then define calculated fields that pick that string
apart to get at the individual values. This would be the "String from 3rd
party app" example here: http://opendatakit.org/help/form-design/examples/

If you have some ability with Java code, it would be nice to get a
contribution back from the community for a change in ODK Collect group
handling to enable sending multiple values to the 3rd party app and getting
values back from it:
https://code.google.com/p/opendatakit/wiki/XFormControlExtensionProposal

Mitch

ยทยทยท On Wed, Mar 13, 2013 at 1:51 AM, wrote:

Hi Deepak
We have a similar requirement where we want to fetch customer details from
an external database based on a unique QR code. Just wanted to check if you
were able to crack the problem below and if you could give us some pointers.

Thanks a ton

Best regards
Abhinav

On Wednesday, 3 August 2011 10:51:18 UTC+5:30, Deepak Rajanna wrote:

Hi,
This is a fairly long question on how to pre-populate the contents of a
form based on the values obtained from another survey. Here's the exact
scenario: We've collected household data (household identified by unique
number -> associated with multiple individuals identified by name). Now, we
have to conduct another survey on the population and are hoping to use the
household data that we already have collected. The flow we would like is

  • Surveyor visits households and scans the ID card given to the
    household.
  • Based on the scanned number, the list of individuals is shown as a
    "select1"
  • Surveyor chooses one and proceeds with the survey.

The two approaches that we thought about

  1. We could programmatically generate a XForm that hardcodes the
    household members as separate selects with appropriate relevance criterion.
    This means that there will be as many select1 fields as there are
    households in the population. The problem with this approach is that there
    will be as many columns in the resulting csv as there are households (and
    more!). I'm not sure if this is technically feasible at all, since we are
    talking of nearly 3000 households. Even if it is, is there a way that the
    resultant csv can be aggregated (col1+col2+col3...., since we know that
    only of the cols has the value we need)?

  2. We explored having a huge select1 consisting of all the persons in
    the population with relevance criteria defined at the level of the option
    and not at the level of the select. We gathered from another discussion
    thread that this is not possible right now. But is the support for this
    feature expected in the near future?

  3. This might be a silly question, but can we use the "Instance
    Destination" field so that many selects can write to the same output
    variable?

Regards
Deepak

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

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com