Ranking previously collected list of names

Hi all,

I have been having some difficulties trying to program the following data collection sequence.

  1. List the names of the respondent's siblings
  2. order that list from the oldest to the youngest
  3. ask a short series of questions about each sibling (e.g., age, gender, educational level).

I have been able to get 1) and 3) to work, using indexed-repeat(), but I can't find a way to get 2) to work.

Unfortunately, I cannot directly ask the respondent to give the list of their siblings by birth order in step 1). Instead, I have to ask them to first list all the names in whatever order they come to mind, and then in a second step, ask them to order that list.

Any suggestions you may provide would be very helpful!

Thanks, stephane

You can use https://docs.opendatakit.org/form-question-types/#rank-widget to order items.

Thank you, Grzegorz! The rank widget is useful, but I cannot pre-specify the options in the "choices" tab. These come from a list of names that is collected during the interview itself. In other words, I do not know beforehand the names of the respondent's siblings nor do I know how many of them there are.

Is there a way to pull this list of names as an option set for the ranking widget? is there another strategy that may accomplish the same?

thanks again,
s

But how do you collect that list? Is it a select multiple question for example and you can choose let's say 10 from 100 elements and then order it or maybe you want them to come from a group of text questions (and you can add any text)?

Sorry for the lack of precision. I want the elements of that list to ne ranked to come from a group of text questions that we ask just before. These questions can contain any text.

Stephane

Unfortunately building a rank or generally a list (select_one /select_multiple) out of repeat_group of text questions is not possible in ODK Collect as I know. Maybe I'm missing something so let's wait for other opinions (our users are really smart and creative) but I'm pretty sure it's not possible.

I haven't used the rank widget much myself, but you may be able to dynamically build a list of options in the rank widget using this method.

Basically replace the "select_one" with the rank widget.

dynamic-choices-v1.xlsx (14.0 KB)
choices

Then, they can be manually ranked by age.

The more aesthetic route would be some kind of iterative logic, or a sort() function, but these do not exist currently.

Thanks for including that detail. I think it's really important to always start by considering alternative ways to present the information and questions to respondents. Asking for siblings in their birth order would be my natural first inclination. A related question would be whether you really need to ask for the order or whether you can derive it from the ages given. Are you concerned two siblings might have the same age? That a respondent may not know one of his or her siblings' age but could order them?

If you really do need to get the respondent to order the siblings, how do you plan on analyzing that resulting data? That will help figure out the best way to represent the sibling order.

@Joseph_E_Flack_IV's approach can work if you know a maximum number of siblings but as he described, it's somewhat tedious.

You can rank a dynamic list from a repeat in XForms but unfortunately there isn't yet a great way to represent this in XLSForm. There's an issue filed at https://github.com/XLSForm/pyxform/issues/38 to add that functionality.

In the mean time, you can make a small XML modification to an XLSForm as described at Generate multiple choice alternatives, based on the answers in a repeat - #4 by LN.

For your scenario, I started with this XLSForm, converted it and then replaced the rank item definition with

		<odk:rank ref="/rank-from-select/sibling_ages">
			<label>Please order the siblings from youngest to oldest</label>
			<itemset nodeset="/rank-from-select/siblings">
				<value ref="current_sibling"/>
				<label ref="sibling_name"/>
			</itemset>
		</odk:rank>

Fully working XML: rank-from-select.xml (2.6 KB)

4 Likes

Thanks very much for this neat solution. This works well indeed for listing, and then sorting the siblings by age. For some reason, I'm now struggling inserting the sibling's name into the follow-up questions we ask about each of them (ODK inserts "1" rather than ${name1}). I tried using jr: choice-name but that leaves a blank.

Thanks a lot, Hélène. I completely agree with first considering alternative ways to ask questions, and display information. But in our project, we cannot ask the respondents to list their siblings directly by birth order, because we are doing a validation study of an established questionnaire. So we can't deviate from their design and practice, which is to first get an unsorted list of names, then to order that list (that questionnaire has been mainly collected on paper so far). Thanks for suggesting the solution in XForms, that's really helpful.

1 Like