onnela-lab / beiwe-backend

Beiwe is a smartphone-based digital phenotyping research platform. This is the Beiwe backend code
https://www.beiwe.org/
BSD 3-Clause "New" or "Revised" License
63 stars 43 forks source link

updating a survey resets (at least) absolute survey schedules #350

Open biblicabeebli opened 7 months ago

biblicabeebli commented 7 months ago

a new survey notification will then be sent from the backend whenever you update a survey.

my specific test case that triggered this involved updating a survey question prompt.

biblicabeebli commented 6 months ago

Hassan probably just got this bug occurring on a weekly survey. hmmm

hydawo commented 6 months ago

Hi Eli,

On our studies server, I'm enrolled as a beta tester in the "Nationwide - Lu - IBS Digital Phenotype" (Study ID: f7XyBE8mkViD4en4yHygMLqa) study with Beiwe ID if9qyadp

This study was initially set up to send:

Attached is a screenshot of the push notification history for this ID.

Image

On the first Saturday (3/9/24) of testing, I correctly received the Weekly survey at 12PM. On the following Wednesday (3/13/24), I received 3 notifications:

f7XyBE8mkViD4en4yHygMLqa_surveys_history_data.json

Image

biblicabeebli commented 6 days ago

(wow this issue got buried)

Will review. This was not a detail I reviewed in my push notification review: https://github.com/onnela-lab/beiwe-backend/issues/402

I'm going to make no guesses at this time about why this happens except to say that the ScheduledEvent creation checks for historical events that align perfectly, so if anything changed with the strict "canonical survey time", which is carefully recorded in the notification history, those surveys should be resent.

Currently, generating ScheduledEvents creates events in the past, which will ~immediately be sent out. We discussed changing this for absolute schedules, this consideration should be added to 402.