Criteria
So far, we have created a new study in Avicenna and added a few data sources to
it to collect sensor data. In this section, we will learn how to use the
powerful Criteria
feature in Avicenna. We also added a few surveys and
configured them both to be triggered by the participant at any time or to be
triggered at a certain time.
Here we want to discuss another powerful feature in Avicenna called Criteria
.
Criteria is a condition that you assign to a part of your study, and they enable
or disable that part depending on whether they are evaluated as True
or
False
. Avicenna continuously evaluates the Criteria set in your study for each
participant using their most recent responses and prompts each participant with
the components that are evaluated as True
. This way, you can create a
personalized experience for your participants.
You can assign Criteria to an Activity, to a Triggering Logic, to a section of your survey, or to a single question. Here we should know how Criteria can be used in our demo study. So far, we added a survey with a User-Triggered Triggering Logic that asked participants to share their motivation for exercise. We will add another survey and ask about their nutrition habits. Then we add a third survey that asks participants whether they want to participate in the Exercise Motivation part of the study, the Nutrition Habits part of the study, or both.
So let's go back to the Researcher Dashboard and click on Activities. Then
create a new survey by clicking on the
Create New Activity
button. We assume you are already comfortable with
creating a survey in Avicenna. So we just go ahead and create one survey with
the following configurations:
- User-Triggered Triggering Logic with the button caption set to
Food Diary
. - Starts with an
Information
block telling participants: "We want to know more about your dietary habits." - Add an
Image
question that asks "Please share a picture of the food or snack you are having."
Now go back to the Activities page, and add a new survey, with the following settings:
- User-Triggered Triggering Logic with the button caption set to
Select Your Survey
. - Add just one Multiple-Answer question on the
Content
page asking: "Which part of the study do you prefer to participate in?" - Add two choices to your question: Exercise and Nutrition.
So your survey's question flow should look like the following:
Take note of the ID of the question. Here the ID of the question is 1 (Q1).
Also, note the ID of the choices you added. In the above example, Exercise
is
answer ID 1 (A1), and Nutrition
is answer ID 2 (A2). Publish the survey and go
back to the Activities page. Your Activities page should now look like the
following:
Pay attention to the ID of each survey. You need these to set up your Criteria. Your survey IDs definitely will be different from the ones we see in this example. For our example here, the IDs are as follows:
- ID 18345: Exercise Motivations
- ID 18347: Quality of Life
- ID 18350: Nutrition Habits
- ID 18351: Survey Selector
Now we want to change the Exercise Motivations such that it's only shown if the
participant chooses Exercise
as their answer to Question ID 1 of survey
ID 18351. We also want the Nutrition Habits to be shown only if the participant
chooses Nutrition
as their answer to Q1 of ID 18351.
To do so, open the Exercise Motivations survey, and go to the Triggering Logics
page. In the User Triggering Logic
dialog that opens, click on Edit
and set
the Criteria to Q18351_1 == 1
(Note that the IDs will be different for your
example).
This means the Triggering Logic should be enabled and accordingly the survey
will be prompted to the participants, only if the participant chooses Answer ID
1 (i.e., Exercise
) as part of their response to Question ID 1 of survey
Activity ID 18351.
Save the change to the Triggering Logic, then save and publish the survey, and
navigate back to the Activities list. Then follow the same steps for the
Nutrition Habits survey, and set the Criteria for its Triggering Logic to
Q18351_1 == 2
.
Save the changes to the Nutrition Habits survey. Now we are done with the changes, we can check out the changes to our study.
Try As a Participant
Let's check the participant's experience of the changes we made above. Switch
back to the app where you had logged in as a participant. You should see that
the button for Exercise Motivation
is removed and a new button is added that
is called Select Your Survey
.
If you do not see these, it might be because the study settings are not reloaded on your phone just yet. To force-reload, the settings, open the app, go to Settings -> My Studies, and tap on Reload Studies from Server.
Here you can see that none of the buttons for the Exercise or Nutrition Surveys
are shown. That's because, as a participant, we have not answered the survey
Selector question. Therefore, Avicenna finds no answer to Question ID 1 of
survey ID 18351 and evaluates the Criteria to False
. Click on the "Select Your
Survey" button and choose one or both of the presented options. Here we are
choosing both "Exercise" and "Nutrition". Press Submit
to save the survey and
return to the app's home screen. Depending on your response, different Surveys
are shown on the home screen.
That's because we chose both options and therefore both Q18351_1 == 1
and
Q18351_1 == 2
were evaluated as True
. You can click on the
Select Your Survey
button as many times as you like, and change your options.
Your option is immediately applied to the home screen of the app.
Other Uses of Criteria
In the above example, we used the Criteria on a User Triggering Logic. This helped us to see immediately how the Criteria work in action. You can use Criteria on many other components. For example, if you put Criteria on a survey section, Avicenna evaluates the Criteria immediately before presenting that section to the participant, and depending on the result of the evaluation, it either skips the whole section or shows the section to the participant. Similarly, you can put Criteria on a single question to present or skip that question.
You can also include both positive and negative values in your criteria. For
example, a condition like Q58_31 == -10
or Q1_3 > -5
can be used, where
-10
and -5
are negative values.
Another useful use of the criteria is Time Triggering Logic. This defines if Avicenna should present a survey or not and if yes when the survey should be presented.