Triggering Logics
In the previous section, we added an Activity to our study. Participants could respond to this Activity by tapping on its button on the home screen of their app. They could do it as many times as they wanted, and any time they wanted.
In some cases, this is ideal, for example, if we are asking participants to
report anything that motivates them to exercise. But in many cases, we may have
certain conditions on when the Activity should be presented to the participants,
how often it should be presented, and how much time participants have to
complete the Activity. The logic that defines these is called
Triggering Logics
.
Our previous Activity, Exercise Motivations
, used a User Triggering Logic.
It means participants decide when and how many times to trigger the Activity.
That's why the button for the Activity is always on the home screen of the app.
Avicenna supports other types of Triggering Logics as well. For example, a Time Triggering Logic prompts the Activity based on a certain timetable. Another example is the Proximity Triggering Logic which prompts the Survey based on Bluetooth-based sensor data. Or Geo-fence Triggering Logic which uses GPS data for prompting a given Activity.
You can read more about this in the Study Activity documentation. Here we continue our example study by adding a Survey Activity to it which is prompted once a day at 7 pm and asks about their general health.
To do this, we again go to the Activities page on the Researcher Dashboard and
click on Create New Activity
to create a new Survey. We call the Survey
Quality of Life. In the Activity Editor remove the content in the description
and delete the default User Triggering Logic.
Then, in the Triggering Logic section, click on Time
to add a new Time
Triggering Logic.
This dialog has many settings and we don't plan to go through all of them here. But we encourage you to read the details in the Triggering Logics section.
For our use case here, we set the Time Format
to Relative
and Base Time
to
Study Registration Date
. This way, all the calculations will be based on the
midnight before the participant joined the study. For example, whether the
participant joins at 10 am or 5 pm on Nov. 11th, the calculations will be based
on Nov. 11th at 00:00.
We also set the First Trigger
to be on Day 1 at 19:00:00. We further set it to
repeat once a day for 14 days. The image below shows the settings of our
Triggering Logic.
Now if you click on the Test The Schedule
button, you can try out how Avicenna
will calculate the Activity prompt time based on this setting. You can choose a
date and time to represent a participation start time of a hypothetical
participant, and Avicenna shows what time our Survey will be presented.
For example below you can see that based on our settings, if a participant joins on Feb., 26th, at 9:15, they will receive Surveys on Feb., 27th at 19:00, Feb., 28th at 19:00, and so on.
Now if you click on the Save
button in the Triggering Logic dialog, the new
Triggering Logic is saved in our Survey.
Notifications and Expiry
Avicenna by default does not prompt any notification when an Activity is prompted. You need to create your Notification Template and link it to your Activity as well. This will be explained in the Notifications section.
If you need to know more advanced details on this matter, please refer to the Notification article as it will teach you how to create a Notification Template and link it to your Activity.
After linking the Notification Template to your Activity, we also want to give 1
hour to participants to complete each session of the Survey. If they don't
complete a session within this 1 hour, we want it to be expired. To do so, go
back to the Contents
page and open the Settings
tab on the lower right side
of the screen. At the bottom of the Settings find the Expiry Time
option, and
set it to After 60 minutes.
Finishing the Survey
In the last step, we add questions to our Survey. As this is about the quality of health, we use a horizontal Visual Analog Scale (VAS) as shown below:
Then we finish by publishing the Survey. When the Survey is published, Avicenna reloads the device for our current participants and schedules the Survey sessions for them every day at 7 pm.
Checking Scheduled Sessions
Unlike User Triggering Logic, if you check the app as a participant, you will not see any Survey waiting for your response. This is because the first Survey is supposed to be prompted at 7 pm, and be available for 1 hour. You will receive a notification at 7 pm when the Survey is available.
But you can check the schedule Avicenna has for this participant via the Sessions page. So let's go back to the Researcher Dashboard and click on Sessions. Then choose our participant from the list, and from the list of Activities, choose the Survey we just created:
As you can see above, the participant starts receiving the Survey every day at 7 pm, starting from Day 1, and none of those Surveys are responded to yet. As the participant completes these Surveys, the status of these sessions is updated here.
Note that in some cases, the first prompt for the participants might start from day 2. This happens when participants join the study before a survey is added to the study, i.e. if by the time that you add a survey to your study, the participant is already on his or her second day of the study, Avicenna will prompt the survey from the second day.