Schedule Sessions with Customized Timing for Each Participant

While Avicenna’s triggering logics cover most use cases, you may want to prompt surveys on personalized schedules that require a more flexible approach. For complete flexibility, we offer the following options:

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

The Situation

Your participant pool includes individuals scheduled for surgery on different dates. You want to prompt each participant with a daily survey at 9:00 AM for the 10 days immediately following their specific surgery date.

What to Do?

To set up this personalized schedule, you will first prepare the necessary surveys in Avicenna and then generate the CSV file for upload. Before you begin, please review the important rules below to ensure your upload is successful.

[!note] Important CSV Upload Rules:

  • The file must be under 1MB and have no more than 10,000 rows.
  • Sessions can only be created for active participants.
  • Each scheduled_time must be at least one hour in the future and fall within the participant’s specific participation period.

Here are the steps in detail:

  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.

    [!note]
    If you want to link a notification template to your survey, you need at least one triggering logic; otherwise, the system won’t let you publish the survey. As a workaround, you can add a dummy Time triggering logic and set its criteria to 1 != 1, which will always be evaluated to False, prompting no sessions.

  2. Create a baseline survey to capture the surgery date for each participant. The survey should contain one calendar question with its Selector set to Date. You can also add other questions to this survey if needed.

  3. Create and link a notification template to the baseline survey to get notified whenever a participant submits the baseline survey. This is essential to ensure the timely scheduling of sessions.

  4. To generate CSV files for upload, you can use tools like R, Python, Excel, or Google Sheets. For this example, we will use Google Sheets. Open your spreadsheet. Create two sheets. Let’s name the first one CSV and the second one Parameters.

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

  6. Go to the first sheet and define three columns: user_id, activity_id, and scheduled_time. The sheet should contain 10 rows, plus a header row. Use the Google Sheets formula and parameters to populate the first sheet:

    • For cells under the user_id column, use =Parameters!$B$1.
    • For cells under the activity_id column, use =Parameters!$B$2.
    • For the scheduled_time column, use this formula to generate a readable date and time string in the required YYYY-MM-DD HH:MM:SS format:
      =TEXT(DATE(YEAR(Parameters!$B$3), MONTH(Parameters!$B$3), DAY(Parameters!$B$3) + (ROW() - 1)) + TIME(9, 0, 0), "yyyy-mm-dd hh:mm:ss")
      

  7. Download the CSV sheet: To do this, go to File > Download and choose Comma Separated Values (.csv).

  8. Upload the CSV file into Avicenna: On the Activity Sessions page, click Create New Sessions and select Create via CSV File.

  9. Review the upload results: After the upload is processed, a summary dialog will appear. It will show you how many sessions were created successfully and list any that failed, along with the reason for the failure.

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

Pro Tips

For simplicity, this guide does not consider participant time zones or daylight saving time. 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.

[!note]Good to Know: