Skip to main content

Spart

The Spart experiment consists of 3 stages but first two, from the backend perspective, happens at the same time.
Nontheless, the first stage, called Recall, is delayed 15 minutes. After 15 minutes a patient gets a notification that they can finish it up.

Design level

Handling Spart experiment processes

The flow is:

  1. Patient finishes a Spart Stage 1&2 (CompleteSpartStage1And2Experiment)
  2. The Spart result is stored and it's InTransaction state
  3. The SpartStage1&2ExperimentResultAdded event is published
  4. The SpartStage1&2ExperimentResultAdded event is received by the Spart Saga component
  5. Spart Saga publishes ScheduleSpartRecallExperiment command which is caught by another internal component rensposible for communication with the Scheduler
  6. It registers a OpenSpartRecallTask and ExpireSpartRecallTask commands in scheduler (oneoff)
  7. If that goes OK, the component publishes a SchedulerSavedSpartRecallSuccessfully event
  8. The SchedulerSavedSpartRecallSuccessfully event is received by the Spart Saga and through a FinishSpartRecallConfiguration it lets the Spart Aggregate (Save Spart Experiment Result) that the state can be changed to InProgress
  9. A patient after 15 minutes gets notified about the Spart Recall Task
  10. When the patient finishes the Recall experiment the state is changed to Completed along with the final results
  11. A MaybeCompleteTasks command is published to complete related open tasks

TODO:

  1. Make the Spart Aggregate aware of the expiration so Recall experiments can be failed when related tasks are expired and failed

Handling Spart Experiment

Handling Scheduled Tasks