How to define a question that allow the user to select a group or repeat block

For a project, we are standardizing our forms based on a standardized conceptual information models. Those models are like building blocks and concepts within a model can point to other models. For example, our Procedure model has a concept named Indiction that references a Condition model to state the reason for the Procedure or a reference to a HealthProfessional as the performer of the procedure.

We are trying to build our XLSForms, used in data collection in healthcare settings, based on these standard information models. However, I am running into the problem of how to best define those references.

I am currently thinking of two options.
A: remove the reference question and add the whole target model reference into the XLSForm for every reference that is made, prefixed with something to make the name unique. You will then get n instantiations of the model for n references.
B: add an additional option question to every repeat/group block that can hold an 'id' filled in by the form filler. In the reference questions, this id can then be given. You will get 1 instantiation of the model for n references.

Is this a familiar problem?
What do you think of the solutions?
Perhaps I am missing something, and there is some kind of support for this?

1 Like

Stepping back a bit, and just addressing your original question: "How to define a question that allow the user to select a group [or repeat block]"... try looking at this form:

group.xlsx (6.5 KB)

Basically, you can actually add a relevant condition on a group, as well as on individual question. So to show/hide an entire group - say, based on a previously answered question - just add the appropriate relevant condition on the group itself. Does this address your need? Note, you can certainly expand the example to additional groups as needed.

[Bonus point: who knows what film this is from? :slight_smile: ]

Thanks for stepping in Xiphware, and providing a detailed answer.
Unfortunately, that is not the answer for us. I want an individual question to be able to 'select' or point to a group. That group could be 'reused' by other questions as well. For example, one health professional can be the performer of different procedures. So in my form, I want to have the information of that particular health professional only once, and in other questions point to that health professional.

I was thinking of doing something like this. But I am not sure if this is the correct way...
20230305-CBBandXLSForm-References solution B xlsform.xlsx (29.2 KB)

It is very simplistic and drafty form yet. It is just to show the concepts.

So in ODK Collect [actually, XForms in general...] you dont, or cant, so much as 'point' (directly) to a specific question, or group; rather, you must explicitly hide (ie relevant = false) everything intervening. But you can certainly add additional relevant conditions on when to display a specific question or group; eg

relevant: (${q1} = 'm') or (${q3} < 10)

That way, you can show your desired group under a variety of (pre)conditions. Does that help?

Thanks again, at least now I know that I am not missing a defined feature for this.

I understand the relevant conditions. I do however not think this helps our intended use. Therefore, I wonder if other people on this forum might have experience with our described use case.

It may be good to mention that we intend to use the XForm definition primarily to describe in a standard way which information we want to collect. Based on the XForm we can then generate different kinds of submission schemas. Besides this, forms will be offered too, to support manually entering the data too if automation is not possible.