Skip to main content

Schedule Sessions with Customized Timing for Each Participant

Avicenna's triggering logics already cover most use cases, but surely there will be cases where you want to prompt surveys on certain schedules, and none of our triggering logics fit. For full flexibility, we offer the following:

In this article, we'll focus on the third approach.

The Situation

The participant pool includes those scheduled for a surgery. Each participant's surgery date will be different. You want to prompt them with a survey on a daily basis at 9 o'clock for 10 days following their surgery.

What to Do?

  1. Create your daily survey. Do not add any triggering logic to it, and delete the existing default triggering logics. Save and publish the survey. Ignore the warnings.

    Activity editor with no triggering logic

  2. Create a baseline survey so you can get the surgery date of each participant. The survey should have one calendar question with its Selector set as Date. You can add more questions if you want of course.

    Baseline survey with the surgery date question

  3. Create and link a notification template to the baseline survey to get notified whenever a participant submits the baseline survey. This is essential if you don't want to schedule sessions late.

    Activity editor with a "Session Completed" notification template linked

  4. To generate CSV files for upload, you can use tools like R, Python, Excel, or Google Sheets. We go with Google Sheets here. Open your spreadsheet. Create two sheets. Let's name the first one CSV and the second one Parameters.

    CSV and Parameters sheets

  5. Define three parameters in the second sheet: Participant ID, Survey ID, and Surgery Date. You can set some values for them.

    Parameters sheet

  6. Go to the first sheet and define three columns: user_id, activity_id, and scheduled_time. The sheet should have 10 rows (+1 header row). Use the Google Sheets formula and parameters to populate the first sheet:

    • For cells under the first column, use = Parameters!$B$1.
    • For cells under the second column, use = Parameters!$B$2.
    • Since the scheduled times in the CSV you're going to upload should be in milliseconds since the Unix epoch, for cells under the third column, use this formula:
      = (DATE(YEAR(Parameters!$B$3), MONTH(Parameters!$B$3), DAY(Parameters!$B$3) + (ROW() - 1)) + TIME(9, 0, 0) - DATE(1970, 1, 1)) * 86400000

    CSV sheet

  7. Download the first sheet as a CSV.

    Downloading the CSV sheet

  8. Upload the CSV into Avicenna.

    Uploading the CSV

  9. To see the generated sessions more easily, you can switch to the Year view mode.

    Activity Sessions in "Year" view with the generated sessions

Pro Tips

This article hasn't considered the participant's timezone or the daylight saving time for the sake of simplicity; the date/time values will be in UTC when uploaded and after the upload, you might notice a shift in the time (and probably date). You can define the participant's timezone or the date range for daylight saving time as new parameters and adjust the formula for the scheduled_time column accordingly.

That being said, we're going to improve how we handle the date/time values in the future.