Skip to content

fireapp-3.119.0-alpha.7766

Compare
Choose a tag to compare
@github-actions github-actions released this 07 Oct 07:34
55f07b1
5oappy/feature/integration testing schedulerv2 (#306)

## Describe your changes
note: merged lindas changes into this branch before Linda's was merged
into main so there may be some inconsistencies that will need to be
manually resolved.
real changes begin at 1ecbfe08a58d8baad160e5cb47070d7895248ec4.

I know its a mess but it works!!

The scheduler works correctly according to this control flow:

1) api is called and..
2) optimiser instance is created
3) optimiser invokes calculator instance
4) calculator instance retrieves all required data
5) optimiser calls calculator methods to assign varaibles
6) minizinc instance created with the model string
7) variables are assigned to minizinc model string
8) minizinc solves the model
9) minizinc returns the posssible assignments
10) possible assignments are returned to api
11) api invokes save result to persist possible assignments to database
and setting relevant flags.
12) api returns {"message": "Optimisation completed successfully",
"result": <minizinc result string>}


Further info on calculator:

- The scheduler will optimise all recently created shifts marked via the
status flag being set to SUBMITTED (as in just submitted).
- The scheduler will allow for users to be assigned to multiple shifts
provided their skills align.
- The scheduler will allow for clashes in scheduling.
- The actual saving of volunteer shift will check for clashes.
- `unavailability_record` is created for each successful user assigned
and saved to the shift (each `shift_request_volunteer` entry added to
the db). This prevents the optimiser from thinking user is available for
subsequent optimisations.

pictures:
before calling optimiser:
<img width="871" alt="Screenshot 2024-10-06 at 11 13 05 PM"
src="https://github.com/user-attachments/assets/e492839f-f0e8-4e9b-9029-a73b304c466c">

after calling optimiser:
<img width="871" alt="Screenshot 2024-10-06 at 11 13 20 PM"
src="https://github.com/user-attachments/assets/f0711a5f-50b9-49e1-ba28-c75facb1e7e0">

logs:
<img width="821" alt="Screenshot 2024-10-06 at 11 56 37 PM"
src="https://github.com/user-attachments/assets/3d0c4c5b-3c4b-4970-b34e-301f6fafbb25">

<img width="186" alt="Screenshot 2024-10-07 at 12 00 01 AM"
src="https://github.com/user-attachments/assets/c52f2c5d-39cd-4b7f-b963-fe5741cf0dfd">
<img width="197" alt="Screenshot 2024-10-07 at 12 01 48 AM"
src="https://github.com/user-attachments/assets/ba65dc65-365e-4c8d-a658-85df00b2e4da">
<img width="193" alt="Screenshot 2024-10-06 at 10 16 14 PM"
src="https://github.com/user-attachments/assets/584080c2-5f41-4a2e-92d0-9f505084e4b7">

note: the second phone has duplicate shifts because of a bug that
allowed 2 shifts to be posted via post man at the same time and got
persisted when the optimiser was not set up to handle clashes yet.


signed:
Steven, Hafizh, Linda. 

## Issue ticket number and link


[FIR-4](https://fireapp-emergiq-2024.atlassian.net/browse/FIR-4)
[FIR-108](https://fireapp-emergiq-2024.atlassian.net/browse/FIR-108)

---------

Co-authored-by: YiranLI <[email protected]>
Co-authored-by: anannnchim <[email protected]>
Co-authored-by: Muhammad Hafizh Hasyim <[email protected]>