There are three ways to control the flow of a question set and the questions which participants should respond. The branching criteria you define in these approaches can take into account responses participants have provided previously in the current survey, or in any other survey in the current study. In other words, when a participant provides an answer to a question during her participation in this study, regardless of whether that question is part of the current survey or not, the answer can be used as a factor in defining the branching criteria.
The first approach is by defining a conditional expression for a question set or a survey page. Each question set or survey page can optionally have a condition associated with it. In this case, Ethica evaluates the condition before prompting the question set, or before showing the page to the participant. If the condition evaluates to True it proceeds forward. Otherwise, it skips the requested question set or page.
The second approach is selecting the next page based on the responses in the current page. Each response to a single choice or multiple choice question can optionally determine what is the next page. If the participant selects this response and presses Next to go to the next page, Ethica will load the specified page which can be different than the default behaviour.
Additionally, each response to a single choice or multiple choice question can enable or disable another question, as long as the question is on the same page. These three methods collectively provide full control over the flow of the question set and allow you to define a complex skip-pattern.
This section explains each of these approaches in more details.
Criteria and Conditional Expressions
Conditional expressions allow you to define a condition for an action and control whether the action can take place or not. You can use conditional expressions in three situations:
To determine whether a participant is eligible for the study or not, based on their responses to the eligibility questions, as described in Eligibility Survey.
To determine whether a question set should be prompted, based on the previous responses of the participant to questions in other surveys.
To determine whether a survey page should be shown or it should be skipped, based on the participant's previous responses, whether to the questions in other surveys presented before, or previous questions in the current survey.
Conditional expressions in Ethica are very similar to any other programming language. If you are already familiar with these expressions, you should be able to quickly read through this section. If you are not familiar with this concept, the description here should be all you need.
A conditional expression is a set of one or more conditions, which are connected together using a logical connective, i.e. AND, OR, or NOT. Assuming the expression is properly constructed, it will always evaluate to True or False. The following line shows a sample conditional expression:
Q58_31 == 0 AND Q58_20 > Q58_27
Q58_31 == 0 and
Q58_20 > Q58_27 are the conditions and
AND is the logical connective. You can have as many conditions as you need. Each condition consists of three parts: left operand, operator, and right operand. The operator compares the left and right operands and can be one of the following:
- Greater than:
- Greater than or equal to:
- Less than:
- Less than or equal to:
- Not equal:
The left operand should always point to a question, whether in the current survey or in other surveys in the current study. It always starts with the letter
Q, followed by two numbers separated by an underline. The letter
Q helps Ethica to understand this is a reference to a question. The two numbers following
Q are pointing to the survey ID and the question ID referenced here, respectively. In this example,
Q58_31 is referring to question 31 of survey ID 58.
Remember each survey has a unique ID, automatically assigned to it by Ethica. Each question also should have an ID unique in that survey, not only in the containing question set. So the same question ID can be used in other surveys, but if a survey contains multiple question sets (as discussed here), their questions are still required to have a unique ID.
The right operand can either be a number, or a reference to a question, just as explained above. If it's a number, Ethica compares the value of the left question to the provided number. For example,
Q58_31 == 0 means "The response to question 31 of survey ID 58 should be 0". Otherwise, if the right operand is a reference to another question, Ethica compares the response of the left question to the response of the right question. For example,
Q58_20 > Q58_27 means "The response to question 20 of survey ID 58 should be greater than the response to question 27 of survey ID 58.". The comparison happens based on the rules explained below.
If the left operand is a Single-Choice question, the right operand can be either a number, or a number-based question (i.e. Number question, Mass question, Length question, or Visual Analog Scale). In this case, the ID of the selected answer from the left operand will be compared to the right operand number, or to the response of the right operand question. As long as the left operand is a Single-Choice question and the right operand is a number or a number-based question, all valid operators are accepted.
If the left operand is a Multiple-Choice question, the right operand can be either a number or a number-based question. For this case, only the Equal and Not-Equal operators are defined. Using any other operator will be rejected. Ethica will compare the right operand with the answers to the left operand. If the operator is Equal, there should be one answer selected in the left operand with the ID specified in the right operand. If the operator is Not-Equal, none of the answers selected in the left operand (the Multiple-Choice question) should have the ID specified by the right operand.
If the left operand is a number-based question, such as Visual-Analog Scale, Number, Mass, or Length question, the right operand can be a number or any other number-based question. In this case, all operators are considered as valid, and Ethica will compare the number from the response to the left operand, with the number from the right operand.
None of the other question types can be used in conditional expressions, including free-form text questions, multi-media questions, calendar questions, or barcodes.
Ethica will evaluate each condition to True or False based on the rules described above. Subsequently, it will use the logical connectives between them to evaluate the whole expression to one boolean value. Therefore, the whole expression will result to True or False, and based on this result, Ethica decides whether an action has to take place or not:
If the conditional expression is used as eligibility criteria of an Eligibility Survey, Ethica either allows the user to register in the study or prevents them from participation.
If the conditional expression is added as criteria to a question set, and a request to prompt the question set has received (whether through a context analyzer, from a participant, or directly from a researcher), the result of the expression determines whether in fact the question set should be released or not. If the survey is a User-Triggered survey, the button to trigger this survey will not be shown on the Ethica UI until the criteria evaluates to True.
If the conditional expression is added as criteria to a survey page which the participant is currently answering, Ethica evaluates the expression just before taking the participant to the page (e.g. as soon as participant presses Next to arrive at the page). Based on the results, Ethica can show the page or skip it. If the page is skipped, the following page is shown, or if there are no more pages, the question set will be finished.
Changing the Next Page
Each page in a given question set has an index which starts from 0. For example, if a question set contains 3 pages, they are referred to as Page 0, Page 1, and Page 2. By default, Ethica starts from page 0 and sequentially goes through all pages in the question set. So in this example, Ethica will show Page 0 first, followed by Page 1 and Page 2, and then the question set is finished.
If a given page includes any single choice or multiple choice question, each of their potential answers can optionally change the next page. For example, assume you are working on a survey on smoking, and you have three pages of questions as follow:
And the last page, Page 2:
The default behaviour is that participant is first presented with Page 0, followed by Page 1 and Page 2. But if they select "No" in Page 0, this will change the next page from Page 1 to Page 2. Hence pressing Next will take them to the Page 2.
Any potential answer to a single choice or multiple choice question can optionally define the index of the page which should be shown following the current page.
If in a multiple choice question multiple answers define different indexes for next page, the last option selected by the participant will override the previous options. This leads to a nondeterministic behaviour and is not suggested. You need to make sure in a multiple choice question, if answers are expected to change the index of the next page, they all point to the same page index.
While Criteria and Conditional Expressions allow you to control whether a given question set or a page should be shown or not, in some scenarios you might prefer to enable or disable a given question based on a response provided for another question.
Any potential answer for a single choice or multiple choice question has a property called Enable question, which receives a list of comma-separated question IDs to be enabled if the participant selects this answer. All questions being enabled are expected to be on the same page as the Single-Choice or Multiple-choice question containing the potential answer.
For example, assume you want to know if participants have experienced coughing during the last week and if yes, do they think that was due to low air quality. You can create Question 1 asking: "Did you experience coughing or wheezing the last week?", where the answer options are "Yes" and "No". Question 2 asks: "Do you believe that it is likely that these symptoms were related to poor air quality?". Question 2 is disabled by default, and it should be enabled only if the response to Question 1 is "Yes". Therefore, you set Question 2 as disabled, and set the "Enable Questions" property of answer "Yes" of Question 1 to 2. The number 2 here refers to the ID of Question 2, which will be enabled if the participant responds "Yes" to Question 1.