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:
- Patient finishes a Spart Stage 1&2 (
CompleteSpartStage1And2Experiment) - The Spart result is stored and it's
InTransactionstate - The
SpartStage1&2ExperimentResultAddedevent is published - The
SpartStage1&2ExperimentResultAddedevent is received by theSpart Sagacomponent Spart SagapublishesScheduleSpartRecallExperimentcommand which is caught by another internal component rensposible for communication with the Scheduler- It registers a
OpenSpartRecallTaskandExpireSpartRecallTaskcommands in scheduler (oneoff) - If that goes OK, the component publishes a
SchedulerSavedSpartRecallSuccessfullyevent - The
SchedulerSavedSpartRecallSuccessfullyevent is received by theSpart Sagaand through aFinishSpartRecallConfigurationit lets theSpart Aggregate(Save Spart Experiment Result) that the state can be changed toInProgress - A patient after 15 minutes gets notified about the Spart Recall Task
- When the patient finishes the Recall experiment the state is changed to
Completedalong with the final results - A
MaybeCompleteTaskscommand is published to complete related open tasks
TODO:
- Make the
Spart Aggregateaware of the expiration so Recall experiments can be failed when related tasks are expired and failed

