Evolution of scheduling tasks
- Status: not accepted
- Proposition by: Artur Wojnar
- Approved by: Artur Wojnar, Andres Lamont
- Date: 2024-05-14
See the story.
Context and Problem Statement
We want to be able to:
- Schedule tasks for a patient on specific date (not immediately as currently)
- Schedule tasks for a patient when they complete a specific experiment
- Schedule given experiment more than once
Decision Outcome
See the diagrams.
- Right now User Service handles, on AddPatientHandler, scheduling experiment features
- So that means for us the direct scheduling (immediate)
- The evolution here is about decoupling of the scheduling part off the User Service. Experiment Service is taking over as it already "talks" with the Scheduler
- To keep the current model we have to make the User Service sending a command like ScheduleDirectly that'd be handled by the Experiment Service
- User Service can, besides the ScheduleDirectly command, send also other two: ScheduleByStartDate and ScheduleByExperimentCompletion
- Handling the start date option consists of scheduling an one-off message fired on that date. The message will be ScheduleDirectly command
- Handling the ScheduleByExperimentCompletion consists of saving the fact that completion of experiment X by patient Y should result in executing ScheduleDirectly command. So that part has to take care off checking completed experiments (ExperimentAdded event) and react accordingly on them if stored infiormation match.
- Scheduling a given experiment many times is possible with the current architecure. All that has to be done is changing the frontend.