Triggering Logics

Triggering Logic

In the previous section, we added one activity to our study. Participants could tap on the button for that activity from the home screen of their app and respond to it. 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 Logic.
Our previous activity, Exercise Motivations, used a User-Triggered 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.
Ethica supports other types of triggering logics as well. For example, a Time-Triggered Triggering Logic prompts the activity based on a certain timetable. Another example is the Proximity-Triggered 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 of the Researcher Dashboard and click on New Activity to create a new survey. In the Survey Editor, I set the name to Quality of Life, and remove the content in the description. I also delete the default User-Triggered Triggering Logic:
Creating a new survey in Ethica Survey Editor
Then, in the Triggering Logic section, click on Time to add a new Time Triggering Logic:
Add new Time-Triggered Triggering Logic in Ethica Survey Editor
This dialog has many settings and we don't plan to go through all of it here. But we encourage you to read the details in the Triggering Logic 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 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:
Configured Time-Triggered Triggering Logic in Ethica Survey Editor
Now if you click on the Test The Schedule button, you can try out how Ethica 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 Ethica shows what time our survey will be presented.
For example below you can see that based on our settings, if a participant joins on Nov., 19th, at 9:15, they will receive surveys on Nov., 20th at 19:00, Nov., 21th at 19:00, and so on:
Example schedule of Time-Triggered Triggering Logic in Ethica Survey Editor
Now if you click anywhere outside of the Triggering Logic box, the new triggering logic is saved in our survey.

Notifications And Expiry

Ethica 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 can be done simply in the Notification Templates section of the Survey Editor.
If you are unfamiliar with these terms, please refer to the following articles as they 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 section 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:
Setting expiry time for the survey

Finishing the Survey

In the last step, we add a question to our survey. As this is about quality of health, we use a vertical visual analog scale as shown below:
Adding questions to our new survey in Ethica Survey Editor
Then we finish by publishing the survey. When the survey is published, Ethica reloads the device for our current participant and schedules the survey sessions for him or her every day at 7 pm.

Checking Scheduled Sessions

Unlike User-Triggered 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 Ethica has for this participant via the Sessions page. So let's go back to the Researcher Dashboard and click on Sessions from the left panel. Then choose our participant from the list, and from the list of activities, choose the survey we just created. For the date range, we choose relative dates from 0 to 45. Pressing Go will show all scheduled surveys for this participant:
Scheduled surveys shown in Sessions page
As you can see above, the participant starts receiving the survey every day at 7 pm, starting from Day 2, and none of those surveys are responded to yet. As the participant completes these surveys, the status of these sessions is updated here.
Also, note that even though we configured our survey to be promoted from day 1, here we see the first prompt for our participant starts from day 2. This is because the participant joined our study before we added this survey. When we added the survey, the participant was already on his or her second day of the study. So Ethica skipped the first prompt and scheduled the remaining 13 sessions.