Skip logic within groups

Hi all,

I would really appreciate your thoughts and advice on a few questions:

  1. Is it possible to define relevance expressions in Build for
    questions inside the same group? I spent some time trying to work out
    why Collect was crashing every time I tried to open a particular form
    I had made with relevance expressions that I was sure worked. Finally,
    I removed all the the questions from the group, removed it, downloaded
    the form again and it worked perfectly.

If this is the case, can relevance expressions be defined for grouped
questions in the xform?

  1. We are doing a survey of about 6000 households. We want to generate
    a unique id for each respondent consisting of their area, house and an
    respondent number (e.g. area 01, household 123, respondent 12 =
    0112312). I can think of several options, including: a) the
    interviewer answers 3 questions, each corresponding to a relevant
    fieldname (i.e. the area number, the household number; the respondent
    number). For this they will either have to remember information from
    the previous questionnaire or carry a checklist with them; b) pre-
    printing barcodes (one for each area, household and respondent) but
    this would require one for every possible scenario (e.g. 3 respondents
    per house, each with several children); etc. Could anyone share what
    worked for them?

  2. Is it possible to enter a constraint message in the constraint
    property in Build? Similarly, can you set a value based on answers to
    previous questions? For example, if a respondent is at home
    (resphome=1) but does not consent to interview (respconsent=0), can I
    create a field or value intposs=0 (e.g. /data/resphome=1 and /data/
    respconsent=0)? This would make setting subsequent relevance
    properties much easier. Not sure if this last question makes sense:
    I'm getting familiar with ODK but reluctant to play directly with
    xforms.

Sorry for the long post, but I thought better to ask all together than
multiple posts.

Many thanks,
Glyn

hi glyn,

  1. Is it possible to define relevance expressions in Build for
    questions inside the same group? I spent some timee trying to work out
    why Collect was crashing every time I tried to open a particular form
    I had made with relevance expressions that I was sure worked. Finally,
    I removed all the the questions from the group, removed it, downloaded
    the form again and it worked perfectly.
    If this is the case, can relevance expressions be defined for grouped
    questions in the xform?

relevance should work on groups and on questions within groups. the
catch here is that the former doesn't work in collect 1.1.5 due to a
bug and we haven't enabled it in build (bug at
http://code.google.com/p/opendatakit/issues/detail?id=258). should
work well in collect 1.1.7 though.

regardless, if something is crashing, there is something else wrong.
validate (http://opendatakit.org/use/validate) to make sure your form
is working. if that still doesn't work, past your form to
http://dpaste.com and send out a link. if it's a big form, please file
it as a bug at http://code.google.com/p/opendatakit/issues/list and
attach it there.

  1. We are doing a survey of about 6000 households. We want to generate
    a unique id for each respondent consisting of their area, house and an
    respondent number (e.g. area 01, household 123, respondent 12 =
    0112312). I can think of several options, including: a) the
    interviewer answers 3 questions, each corresponding to a relevant
    fieldname (i.e. the area number, the household number; the respondent
    number). For this they will either have to remember information from
    the previous questionnaire or carry a checklist with them; b) pre-
    printing barcodes (one for each area, household and respondent) but
    this would require one for every possible scenario (e.g. 3 respondents
    per house, each with several children); etc. Could anyone share what
    worked for them?

can you explain a bit more about why you need a unique id?
understanding what that data is going to be used for will shape my
suggestions. for example, do you actually need them to remember that
the previous house was #4, and this one is #5? or do you just want
them uniquely identified?

my assumption is that you just want uniques ids and don't care too
much about ordering. if that is the case, you probably want to
generate household and respondent barcodes. when you start at a
household, scan a household id. when you start a respondent, scan a
new respondent id. if the respondent section is in a repeat, then they
are already coupled with their household. if not, then you'll have to
scan household and respondent id for each respondent. you'll also need
a process where you don't generate duplicate ids (look at uuid
generators) and a process where enumerators don't scan ids multiple
times (either have them cross it out, or give it the
household/respondent, et.). area number sounds like something
enumerators can remember (maybe they do an area a day?), so that, they
can enter.

if you want to be really fancy, you can build an id generator into
collect that ensures you don't repeat ids. that requires a programmer
though...

  1. Is it possible to enter a constraint message in the constraint
    property in Build? Similarly, can you set a value based on answers to
    previous questions? For example, if a respondent is at home
    (resphome=1) but does not consent to interview (respconsent=0), can I
    create a field or value intposs=0 (e.g. /data/resphome=1 and /data/
    respconsent=0)? This would make setting subsequent relevance
    properties much easier. Not sure if this last question makes sense:
    I'm getting familiar with ODK but reluctant to play directly with
    xforms.

build is designed to create 80% of the forms people want. the other
20% requires some manual tweaks because adding them makes build hard
to use. so for complex stuff, you will have to play directly with
xforms or hire some of the many groups on this list who make forms.

if you want to add a constraint message, you'll have to enter that
info manually. i've filed a bug to add that feature at
http://code.google.com/p/opendatakit/issues/detail?id=262.

yes, you can do variable assignment. that feature will likely never
show up in build. it looks something like this.

hope that helps,

yaw

Hi Yaw,

Many thanks for your prompt response and helpful advice.

Skip logic within groups:
Here is a result I was getting in Validate when trying to use the
relevant property within a group:

Checking form...
Parsing form...
Title: "Skip test"
Warning: 1 Unrecognized attributes found in Element [data] and will be
ignored: [id] Location:

Problem found at nodeset: /html/head/model/instance/data
With element <data id="build_Skip-test_1310460687">

Xform is valid! See above for any warnings.

I get the same result when I remove the questions from the group, so
do not know if there actually is a problem or not. When I removed the
group, the form downloaded and opened fine, otherwise Collect would
force-close with an “unexpected error”. I will try in 1.1.7 and report
a bug if the problem persists.

Generating unique id numbers:
The main reason we want to use unique ids for each household and
respondent is to be able to locate them later on for follow-up (we
work in densely populated slums and finding the same house can be
tricky). The number ordering is not so important but the id
construction (cluster+hh+respondent and, later in the interview,
adding a child id for each woman) seems logical. Since we will be
taking gps readings of each household, I’m also thinking of displaying
the unique id numbers on a map of each cluster, which enumerators can
use to physically locate the house again. Your idea about generating
barcodes was also what I thought. I tried using an Android QR
generator to make and print sheets with hh, respondent and child
barcodes. I can easily generate a sequential list myself. It worked
well but was time consuming: I'd have to generate a barcode for every
possible scenario (i.e. up to 2 women in 500 households across 12
clusters, each potentially with several children). Also, printing
these uses lots of paper. Using repeats would be very useful but I
haven’t got that far yet.

We will be getting some technical help before we finalise the survey.
But, want to understand how ODK, XML etc works as much as possible so
that I can be precise about what additions/fixes we need without
taking up too much of their time.

Many thanks again for your help and for providing such a useful tool.
Glyn

··· On Jul 14, 12:36 am, Yaw Anokwa wrote: > hi glyn, > > > 1. Is it possible to define relevance expressions in Build for > > questions inside the same group? I spent some timee trying to work out > > why Collect was crashing every time I tried to open a particular form > > I had made with relevance expressions that I was sure worked. Finally, > > I removed all the the questions from the group, removed it, downloaded > > the form again and it worked perfectly. > > If this is the case, can relevance expressions be defined for grouped > > questions in the xform? > > relevance should work on groups and on questions within groups. the > catch here is that the former doesn't work in collect 1.1.5 due to a > bug and we haven't enabled it in build (bug athttp://code.google.com/p/opendatakit/issues/detail?id=258). should > work well in collect 1.1.7 though. > > regardless, if something is crashing, there is something else wrong. > validate (http://opendatakit.org/use/validate) to make sure your form > is working. if that still doesn't work, past your form tohttp://dpaste.comand send out a link. if it's a big form, please file > it as a bug athttp://code.google.com/p/opendatakit/issues/listand > attach it there. > > > 2. We are doing a survey of about 6000 households. We want to generate > > a unique id for each respondent consisting of their area, house and an > > respondent number (e.g. area 01, household 123, respondent 12 = > > 0112312). I can think of several options, including: a) the > > interviewer answers 3 questions, each corresponding to a relevant > > fieldname (i.e. the area number, the household number; the respondent > > number). For this they will either have to remember information from > > the previous questionnaire or carry a checklist with them; b) pre- > > printing barcodes (one for each area, household and respondent) but > > this would require one for every possible scenario (e.g. 3 respondents > > per house, each with several children); etc. Could anyone share what > > worked for them? > > can you explain a bit more about why you need a unique id? > understanding what that data is going to be used for will shape my > suggestions. for example, do you actually need them to remember that > the previous house was #4, and this one is #5? or do you just want > them uniquely identified? > > my assumption is that you just want uniques ids and don't care too > much about ordering. if that is the case, you probably want to > generate household and respondent barcodes. when you start at a > household, scan a household id. when you start a respondent, scan a > new respondent id. if the respondent section is in a repeat, then they > are already coupled with their household. if not, then you'll have to > scan household and respondent id for each respondent. you'll also need > a process where you don't generate duplicate ids (look at uuid > generators) and a process where enumerators don't scan ids multiple > times (either have them cross it out, or give it the > household/respondent, et.). area number sounds like something > enumerators can remember (maybe they do an area a day?), so that, they > can enter. > > if you want to be really fancy, you can build an id generator into > collect that ensures you don't repeat ids. that requires a programmer > though... > > > 3. Is it possible to enter a constraint message in the constraint > > property in Build? Similarly, can you set a value based on answers to > > previous questions? For example, if a respondent is at home > > (resphome=1) but does not consent to interview (respconsent=0), can I > > create a field or value intposs=0 (e.g. /data/resphome=1 and /data/ > > respconsent=0)? This would make setting subsequent relevance > > properties much easier. Not sure if this last question makes sense: > > I'm getting familiar with ODK but reluctant to play directly with > > xforms. > > build is designed to create 80% of the forms people want. the other > 20% requires some manual tweaks because adding them makes build hard > to use. so for complex stuff, you will have to play directly with > xforms or hire some of the many groups on this list who make forms. > > if you want to add a constraint message, you'll have to enter that > info manually. i've filed a bug to add that feature athttp://code.google.com/p/opendatakit/issues/detail?id=262. > > yes, you can do variable assignment. that feature will likely never > show up in build. it looks something like this. > calculate="if(/data/resphome=1 and /data/respconsent=0, '1', '0')"/> > > hope that helps, > > yaw

Add addendum

The other reason we want to generate unique id numbers is to use them
as primary keys, should we want to merge datasets later on. In
previous surveys, we have built relational databases and analysed data
using SPSS and Stata. We are still figuring out how best to do this
using ODK as a front end.

Best,
Glyn

there is an example household form with respondent repeats at
http://code.google.com/p/opendatakit/source/browse/Household+Survey.xml

would this work? the phone can automatically use the combination of
gps location, form start time, and enumerator name to uniquely
identify the household. the phone also knows how many repeats you
have, and so you use that order (maybe plus something else) to id each
respondent in the household.

another option is to add a pseudo-random number generator in to the
core library we use -- that should only take a programmer an hour or
so to do...

··· On Wed, Jul 13, 2011 at 22:56, Glyn Alcock wrote: > Add addendum > > The other reason we want to generate unique id numbers is to use them > as primary keys, should we want to merge datasets later on. In > previous surveys, we have built relational databases and analysed data > using SPSS and Stata. We are still figuring out how best to do this > using ODK as a front end. > > Best, > Glyn > > -- > Post: opendatakit@googlegroups.com > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > Options: http://groups.google.com/group/opendatakit?hl=en >

Thanks Yaw, this is great.
You've given me a few viable options to choose from. Your link to the
household survey didn't work but I found it in the ODK samples page.

Kind regards,
Glyn

··· On Jul 15, 8:39 am, Yaw Anokwa wrote: > there is an example household form with respondent repeats athttp://code.google.com/p/opendatakit/source/browse/Household+Survey.xml > > would this work? the phone can automatically use the combination of > gps location, form start time, and enumerator name to uniquely > identify the household. the phone also knows how many repeats you > have, and so you use that order (maybe plus something else) to id each > respondent in the household. > > another option is to add a pseudo-random number generator in to the > core library we use -- that should only take a programmer an hour or > so to do...On Wed, Jul 13, 2011 at 22:56, Glyn Alcock wrote: > > Add addendum > > > The other reason we want to generate unique id numbers is to use them > > as primary keys, should we want to merge datasets later on. In > > previous surveys, we have built relational databases and analysed data > > using SPSS and Stata. We are still figuring out how best to do this > > using ODK as a front end. > > > Best, > > Glyn > > > -- > > Post: opendatakit@googlegroups.com > > Unsubscribe: opendatakit+unsubscribe@googlegroups.com > > Options:http://groups.google.com/group/opendatakit?hl=en

You've given me a few viable options to choose from. Your link to the
household survey didn't work but I found it in the ODK samples page.

For the archive, the correct link is:

http://code.google.com/p/opendatakit/source/browse/Household+Survey.xml?repo=forms

--Patrick

··· On Sat, Jul 16, 2011 at 1:09 AM, Glyn Alcock wrote: