Criteria

Criteria in Ethica is a conditional expression, or a formula, which instructs Ethica whether an action has to happen or not. Ethica allows adding a criteria to the following elements:

An eligibility survey (i.e. a survey with an Eligibility Triggering Logic) is required to have a criteria, which specifies who is considered eligible to join the study. When a prospective participant tries to join the study, Ethica asks them to complete the eligibility survey and then it evaluates the eligibility criteria. If the eligibility criteria is evaluated to True, the individual proceeds to join the study.

Other surveys can also contain a criteria. If a survey contains a criteria, Ethica continuously evaluates it. For those participants that the survey criteria is evaluated to True and as long as it remains True, they survey can be prompted to that participant per it's Triggering Logic specification. For those participants that the survey criteria is evalauted to False and as long as it remains False, the survey will not be prompted regardless of its Triggering Logic.

Furthermore, each Triggering Logic also can have a criteria, which determines whether it should be enabled or not. Ethica continuously monitor the criteria for each Triggering Logic and only activates them if their criteria is evaluated to True. For survey pages, Ethica shows or skips the page depending on whether it's criteria is evaluated to True or False.

By default, components mentioned above do not have a criteria. Ethica evaluates an empty criteria to True. Therefore, these components are active by default. If a criteria is entered but it's invalid or it cannot be evaluated, Ethica evaluates it to False and will deactivate the associated component.

Syntax

Criteria in Ethica are very similar to any other programming languages. It is a set of one or more conditions, which are connected together using a logical connective, i.e. AND, OR, or NOT. If the expression is properly constructed, it will always evaluate to True or False. The following line shows a sample criteria:

Q58_31 == 0 AND Q58_20 > Q58_27

Here the 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
  • ==: Equal
  • !=: Not equal

The left operand should always point to a question, whether in the current survey or in other surveys within 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 that is 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 has an ID unique within that survey. So a combination of survey ID and question ID always points to the same question in your study.

The right operand can either be a number, or a reference to a question, just as explained above. For evaluation, Ethica converts the question response (or both responses, if both left and right operands are references to questions) to a number, and performs the comparison on the numbers. For example, Q58_31 == 0 means:

The numeric value of the response to the question 31 of the
survey ID 58 should be 0.

Similarly, Q58_20 > Q58_27 means:

The numeric value of the response to question 20 of survey ID 58 should
be greater than the numeric value of the response to question 27 of
survey ID 58.

The comparison happens based on the rules explained below.

Condition Evaluation

Below we explain how Ethica evaluates different question types used in a given condition. For the examples used in the following sections, assume your survey ID is 1, and it contains the following question IDs:

  • Q1_1: Single choice question. It contains three answers: A1, A2, and A3.
  • Q1_2: Multiple choice question. It contains three answers: A1, A2, and A3.
  • Q1_3: Text question
  • Q1_4: Audio question
  • Q1_5: Video question
  • Q1_6: Image question
  • Q1_7: Audio/Text question
  • Q1_8: Number question
  • Q1_9: Length question
  • Q1_10: Mass question
  • Q1_11: Visual analog scale question
  • Q1_12: Barcode question
  • Q1_13: Calendar question
  • Q1_14: Information question

Single Choice Questions

Single-choice questions allow participants to select one answer from a set of potential answers. Each answer in Ethica has a numeric ID. Ethica uses the ID of the answer selected by the participant as the numeric value of the response provided for the given single-choice question. Then it compares this number with the numeric value of the other operand.

Single-choice questions can be compared to other numeric questions, or plain numbers. It cannot be compared to any other questions. Therefore, in the example survey above, the following comparisons are valid:

Q1_1 == Q1_8
Q1_1 == Q1_9
Q1_1 == Q1_10
Q1_1 == Q1_11
Q1_1 == 2

You may also use any other valid operator instead of ==, or flip the sides for example to Q1_8 == Q1_1 (except the last item as 2 == Q1_1 is not accepted). But the following comparisons are invalid and they are always evaluated to False:

Q1_1 == Q1_2
Q1_1 == Q1_3
Q1_1 == Q1_4
Q1_1 == Q1_5
Q1_1 == Q1_6
Q1_1 == Q1_7
Q1_1 == Q1_12
Q1_1 == Q1_13
Q1_1 == Q1_14

Multiple Choice Questions

Multiple-choice questions are similar to single-choice questions, except the user can choose more than one potential answer. Similar to single-choice questions, you can only compare them to other numeric questions or plain numbers. But unlike single-choice questions, you can only use == and != operators. Other operators are not defined for use with multiple-choice questions and using them will always be evaluated to False.

The == operator checks whether an answer with the ID equal to the other number is available in the selected answers of the multiple-choice question. Similarly, the != operator evaluates whether such answer is not available in the selected answers. For example, Q1_2 == 1 is True if answer 1 is selected for question 2, and is False if answer 1 is not selected. Note that this comparison does not check anything about answer 2 or 3 of this question. Whether they are selected or not is irrelevant. This condition only checks the selection of A1 for Q1_2.

In the example above, the following comparisons are valid:

Q1_2 == Q1_8
Q1_2 == Q1_9
Q1_2 == Q1_10
Q1_2 == Q1_11
Q1_2 == 2

You may also use != operator instead of ==, or flip the sides. But the following comparisons are invalid and they are always evaluated to False:

Q1_2 == Q1_1
Q1_2 == Q1_3
Q1_2 == Q1_4
Q1_2 == Q1_5
Q1_2 == Q1_6
Q1_2 == Q1_7
Q1_2 == Q1_12
Q1_2 == Q1_13
Q1_2 == Q1_14

Numeric Questions

Numeric questions are referred to number, length, mass, and visual analog scale questions, because their response is a numeric value. Ethica uses their response directly to compare it with the other operand. You can use any of the available operators with these question types. Therefore, in the example above, the following conditions are valid:

Q1_8 == Q1_9
Q1_9 >= Q1_1
Q1_10 != Q1_2
Q1_11 < Q1_10

But the following comparisons are invalid and are always evaluated to False:

Q1_8 >= Q1_2
Q1_9 == Q1_3
Q1_10 != Q1_4
Q1_11 < Q1_5
Q1_8 > Q1_6
Q1_9 <= Q1_7
Q1_10 != Q1_12
Q1_11 == Q1_13
Q1_8 == Q1_14

Other Questions

Using any of the following question types as an operand in a condition, regardless of the other operand and the applied operator, is always evaluated to False:

  • Text question
  • Audio question
  • Video question
  • Image question
  • Audio/Text question
  • Barcode question
  • Calendar question
  • Information question