Apply Protocol

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

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.

If the specific protocol in apply protocol was already scheduled for the participant, the old protocol is removed. However, if another protocol was already scheduled, nothing happens to the old protocol and the new protocol is added.

General

Specific

This specific settings are currently only available starting from dashboard version 15b. If you cannot find this module and are sure you need it, contact us at contact@m-path.io.

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”

Screenshot of the m-Path dashboard, the survey with three items. The first is "Welcome to our intake questionnaire" and is type text. The second is called 'shiftDaysToMonday" and is of type computation. The last item is Apply protocol item named 'start_protocol'.

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.

Screenshot of the item "ShiftDaysToMonday" and it shows the computation code that is given underneath this image.

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)
  • 1 is Monday, every day of the week has a number from 1 to 7 (1 = Monday … 7 = Sunday).
  • 1 - currentDay tells you how far Monday is, but this can be negative.
  • Adding 7 makes the number positive, so the calculation never goes below zero.
  • %% 7 gives 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.

Screenshot of the apply protocol item. Label is "start_protocol". Type is "Apply protocol". There is not protocol selected. The tab "Specific" is open and "Start relative to" is the radio button "Current day" chosen. Under "Shift time (seconds or label)" it says "shiftDays". The checkboxes "Clear this protocol and don't reschedule" and "Clear all existing notifications" are not checked.
Updated on November 27, 2025
Was this article helpful?

Related Articles

Need Support?
Can't find the answer you're looking for?
Contact Support

Leave a Comment