scheduler

package
v0.0.0-...-5578c0f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const BlockLength int = 28

BlockLength is the length of a residency block in days

Variables

This section is empty.

Functions

This section is empty.

Types

type Day

type Day struct {
	ID    int
	Date  date.Date
	Oak   *Resident
	Maple *Resident
}

Day is the day's number in a given block, the date, and the residents assigned to that Day

func BlockDates

func BlockDates(start string) []Day

BlockDates returns a slice of days for a block given the block's start date

func (Day) Filled

func (d Day) Filled() bool

Filled returns true if both call slots have been filled

type Resident

type Resident struct {
	Name          string
	PreferredWeek int
}

Resident is a resident's full name and their preferred week on call

func Residents

func Residents(path string) []Resident

Residents parses a csv of resident names and preferred weeks on call

func (Resident) Calls

func (r Resident) Calls(block []Day) []Day

Calls produces a list of days that a resident is on call for the provided block

type Solution

type Solution struct {
	Filled  []Day // List of days with slots filled
	Pending []Day // List of days with slots not yet filled
}

Solution is the 'node' in the tree we are searching for our optimal solution

func FillSchedule

func FillSchedule(startDate string, residents []Resident) Solution

FillSchedule produces a []Day with all of the call slots filled

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL