Protocols (formerly known as client templates) are useful tools to enrol multiple people into the same survey schedule. Usually, you would set up your m-Path platform to automatically enrol anyone who joins your population into a standard protocol, or manually assign protocols afterwards. However, if you have various protocols for different cases that you want to automatically assign, the Apply Protocol module provides the additional control you need.

The Apply Protocol module has just one field, named Protocol. This field generates a dropdown menu containing all your active protocols. Select the one you want to enroll this user in, and as soon as the user finishes the questionnaire containing this item, they will be enrolled in the selected protocol.
General
Specific
Start relative to
The default is ‘Current day‘. This means that the protocol is applied, starting on the current day. The other option is ‘Custom date‘. In this case the protocol is shifted to the specific date reference date.
Shift time (seconds or label)
Here it is possible to shift the protocol with a certain amount of seconds. It is possible to input a number. For example 3600 will shift the protocol with 1 hour. It is also possible to shift the protocol with a specific label. It is for example possible to set a specific label to a number in a computation item such as:
toShift=7200
Subsequently, toShift can be filled in the field Shift time (seconds or label). In this case, the protocol would be shifted with 2 hours.
Clear this protocol and don’t reschedule
If this is enabled, the specific protocol is cleared. All scheduled interactions from this protocol are removed for the participant or client.
Clear all existing notifications
All scheduled interactions are cleared. It is possible to add a new protocol in the same apply protocol. In this case, first everything is cleared and subsequently the new protocol is added.
How to personalize a schedule.
Using Apply Protocol, it is possible to personalize a schedule for a specific participant. Here we propose an example on how to do so.
First, create a protocol where the daily schedule starts at the earliest possible time for all participants (for example 06:00 in the morning). We call this protocol defaultProtocol:

Second, in the intake questionnaire (the questionnaire that is presented to the participant immediately when the participants adds your research), the question is asked when the participant wakes up. Here, a multiple choice question is used.

Third, conditionally on this multiple choice question we apply the protocol with a specific shift. For example, when the participant indicates she/he wakes up at 08:00, we shift the protocol that starts at 06:00 with two hours or 7200 seconds. This is shown in the following picture. The protocol with name defaultProtocol will now start everyday at 08:00 for this participant.

How to make a protocol start on a certain day of the week
Case: Your EMA study needs to start on a specific weekday (e.g., Monday) regardless of when the intake questionnaire is completed. Default behaviour schedules the protocol relative to the intake completion date, which can shift the study days. So if you always want to start your protocol on the same day of the week, we got an example to show you how to do so, you can achieve it in 2 simple steps!
To help you out, we made an example intake questionnaire, you can find it in the library under the name:
Example intake questionnaire “Start on certain day of the week”

Step 1: Calculate the shift in days
Add a Computation item, to make the calculation for the shift in days relative to the current weekday. In this example, we made a computation to calculate the shift of time until the next Monday.

This is the code you can copy:
# 1. determine the current day
currentDay = as.weekday(Sys.time)
# 2. calculate days to Monday
daysToMonday = ((1 - currentDay + 7 ) %% 7)
# 3. calculate how many days the apply protocol should be shifted
# (reuse this variable in Apply protocol)
shiftDays = daysToMonday * 24 * 60 * 60
A little more explanation for part two of the calculation because this is the part you need to alter when you want it to start on a different day:
daysToMonday = ((1 - currentDay + 7 ) %% 7)
1is Monday, every day of the week has a number from 1 to 7 (1 = Monday … 7 = Sunday).
1 - currentDaytells you how far Monday is, but this can be negative.
- Adding 7 makes the number positive, so the calculation never goes below zero.
%% 7gives the remainder after dividing by 7. It makes sure the result always stays within one week. It turns any number into what it would be if you ‘looped’ it back inside a 7-day cycle, so the answer can never be less than 0 or more than 6.
If you want to alter the day, just replace the 1 with the number of the day you want your survey to start. For example, if I want my survey to start on the next Saturday:
daysToSaturday = ((6 - currentDay + 7 ) %% 7)
Step 2: use the calculation in the Apply protocol item
Now add the Apply protocol item after the calculation. Give it a label and select the protocol you want to start.
Go to the tab Specific in your item, choose Start relative to: Current day. And for Shift time (seconds or label) take the same variable you had your calculations in the previous step, in this case shiftDays.
