Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schedule quality backend #338

Merged
merged 18 commits into from
Jan 4, 2023
Merged

Schedule quality backend #338

merged 18 commits into from
Jan 4, 2023

Conversation

vadimkerr
Copy link
Member

@vadimkerr vadimkerr commented Aug 4, 2022

This PR adds an endpoint returning a schedule quality score, overloaded users and comments on the existing issues (e.g. balance issues or gaps).

Limitations

  • Since working hours editor is not implemented yet, there are only two scores taken into account: balance score and a score representing the ratio of time when someone is on-call to the whole time period.
  • Time period is now set to be constant (90 days from today), so in some cases the results will be inaccurate (when rotations don't align with the time period)
  • It only takes primary rotations into account (overrides are ignored)

Usage

GET /api/internal/v1/schedules/<pk>/quality?date=<TOMORROW_DATE>

Note that date should be tomorrow date, because we can only be sure about changing tomorrow's shifts (some of the shifts for current day could be "deleted" but still show up in the UI).

Example response

{
  "total_score": 90,
  "comments": ["Schedule has no gaps", "Schedule is well-balanced, but still can be improved"],
  "overloaded_users": ["USSZ5WRH2CUA9", "U74XJZSSQGBIH"]
}

Issue: #118

@vadimkerr vadimkerr marked this pull request as ready for review September 13, 2022 14:04
@vadimkerr vadimkerr changed the title Schedule quality draft Schedule quality score Sep 13, 2022
Copy link
Contributor

@matiasb matiasb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good. Added a few comments/suggestions, feel free to ignore them if they don't make sense :-)

engine/apps/api/views/schedule.py Outdated Show resolved Hide resolved
engine/apps/schedules/quality.py Outdated Show resolved Hide resolved
engine/apps/schedules/quality.py Outdated Show resolved Hide resolved
engine/apps/schedules/quality.py Outdated Show resolved Hide resolved
engine/apps/schedules/quality.py Outdated Show resolved Hide resolved
@joeyorlando
Copy link
Contributor

@vadimkerr should this PR be merged? (just doing a check on PRs that have been open for a few months 😄 )

@vadimkerr
Copy link
Member Author

This PR needs some front end changes as well, @teodosii could you please take a look at this?

@teodosii
Copy link
Member

It's on my list, I need some more time to finish current work and then I can get on this one.

# Conflicts:
#	engine/apps/api/views/schedule.py
@vadimkerr vadimkerr requested a review from a team January 3, 2023 18:29
@vadimkerr vadimkerr marked this pull request as draft January 3, 2023 18:30
@vadimkerr
Copy link
Member Author

vadimkerr commented Jan 3, 2023

Some additional backend chages are needed to support this design, so converting back to draft PR.

@vadimkerr vadimkerr changed the title Schedule quality score Schedule score backend Jan 4, 2023
@vadimkerr vadimkerr marked this pull request as ready for review January 4, 2023 16:49
@vadimkerr
Copy link
Member Author

Merging the backend part for now, @teodosii let's have a separate PR for the frontend.

@vadimkerr vadimkerr merged commit 7a1f176 into dev Jan 4, 2023
@vadimkerr vadimkerr deleted the vadimkerr/schedule-score branch January 4, 2023 16:49
@vadimkerr vadimkerr changed the title Schedule score backend Schedule quality backend Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants