Git Product home page Git Product logo

govuk-rota-generators's Introduction

govuk-rota-generators

It does what it says on the tin.

$ python3 src
Usage:
  cli.py <file> [--num-weeks=<n>] [--max-in-hours-shifts=<n>] [--max-on-call-shifts=<n>]
  cli.py (-h | --help)

$ time python3 src demo.csv
week,primary,secondary,shadow,primary_oncall,secondary_oncall
1,Neil Hockenberry,Aubrey Staiger,Sharleen Woltz,Oswaldo Bonham,Jarrett Hord
2,Deloris Baldon,Rocco Morra,,Martin Ashby,Robin Hoose
3,Emanuel Leinen,Vernon Minelli,,Lou Meidinger,Renae Paton
4,Floyd Olsson,Irwin Capehart,,Dewey Burgett,Jerold Bayes
5,Pierre Paulhus,Sammie Shew,,Lou Meidinger,Wilson Friesen
6,Jerome Silveria,Benita Kunz,Glynda Laubscher,Oswaldo Bonham,Temeka Lowy
7,Jame Truss,Nyla Drozd,,Annalisa Harrow,Renae Paton
8,Ryan Averett,Jerald Vangundy,,Jeannine Demos,Jerold Bayes
9,Theodore Calvery,Temeka Lowy,Chas Stucky,Dave Allred,Grant Kornfeld
10,Martin Ashby,Lacy Auyeung,Ramon Haddock,Annalisa Harrow,Oswaldo Bonham
11,Bessie Engebretson,Wilson Friesen,,Jeannine Demos,Jerold Bayes
12,Dave Allred,Lou Meidinger,,Annalisa Harrow,Santiago Raine

real    0m24.531s
user    0m24.408s
sys     0m0.121s

See the docs directory for explanations of how the rotas are defined and generated.

Dependencies

You need Cbc (Coin-or branch and cut) installed and in your $PATH. Other dependencies are listed in requirements-freeze.txt and can be installed with pip.

Running in Docker

Rather than install dependencies to your host machine, you can generate a rota in a Docker container:

$ docker run -it --rm -v $(pwd):/src -w /src python:3.9 bash
$ apt-get update && apt-get install -y coinor-cbc
$ pip install -r requirements-freeze.txt
$ python3 src demo.csv

Mathematical background

This uses an approach called integer linear programming (ILP), via the PuLP library. A reasonable introduction to ILP for solving scheduling problems like this is the PyCon conference-scheduler docs.

I wrote a memo going into some detail about how it all works.

govuk-rota-generators's People

Contributors

barrucadu avatar deborahchua avatar dependabot[bot] avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.