Flatten every patient's daily visits into one pool, then sort by time-of-day (Morning → Lunch → Tea → Bed).
Morning: 6Lunch: 6Tea: 3Bed: 5Double-up: 7
Patient
Postcode
Slot
Time
Dur
Flags
Margaret Whitfield
#1
TQ3 3LY
Morning
9:45am
45m
F
Dorothy Chambers
#3
TQ1 3HP
Morning
10-11am
45m
2x
Edith Trescothick
#5
TQ1 3AB
Morning
7am
45m
2x
Winifred Atherton
#7
TQ1 3QQ
Morning
7am
45m
Stanley Pemberton
#11
TQ2 8DZ
Morning
9-10am
30m
M
Ethel Rowntree
#14
TQ2 7LR
Morning
8-9am
60m
M
Margaret Whitfield
#1
TQ3 3LY
Lunch
1pm
30m
F
Dorothy Chambers
#3
TQ1 3HP
Lunch
1:30pm
30m
2x
Edith Trescothick
#5
TQ1 3AB
Lunch
11:30am
30m
2x
Winifred Atherton
#7
TQ1 3QQ
Lunch
11:45am
30m
Stanley Pemberton
#11
TQ2 8DZ
Lunch
12-1pm
30m
M
Ethel Rowntree
#14
TQ2 7LR
Lunch
12-1pm
45m
M
Edith Trescothick
#5
TQ1 3AB
Tea
4pm
30m
2x
Winifred Atherton
#7
TQ1 3QQ
Tea
4:30pm
30m
Ethel Rowntree
#14
TQ2 7LR
Tea
4pm
30m
M
Dorothy Chambers
#3
TQ1 3HP
Bed
8pm
30m
2x
Edith Trescothick
#5
TQ1 3AB
Bed
9pm
30m
2x
Winifred Atherton
#7
TQ1 3QQ
Bed
7:30pm
30m
Stanley Pemberton
#11
TQ2 8DZ
Bed
6:30pm
30m
M
Ethel Rowntree
#14
TQ2 7LR
Bed
9:15pm
45m
M
3
Score every carer for every visit
Each (carer, visit) pair gets a score from the four factors below. Carers outside their max-miles radius are dropped.
40%
Distance
Postcode proximity. Hard cap at carer's max miles.
25%
Shift match
Morning = early shift. Tea/Bed = late shift.
20%
Skills
Meds → medication clients. Double-up → 2x visits.
15%
Continuity
Bonus if already visiting this patient today or last week.
Example — Margaret Whitfield (Patient #1), Morning visit:
Carer
Score
Distance
Why
Hilda ← winner
95%
1.2 mi
Closest match (1.2 mi) · Early shift available · Meds qualified
Paul
88%
1.8 mi
Nearby (1.8 mi) · Early shift available · Double-up qualified
Howard
72%
2.1 mi
Moderate distance (2.1 mi) · Early shift available
4
Greedy assignment with conflict resolution
Walk through the pool in time order and assign the top-scoring carer. If the same carer is already booked at an overlapping time, fall back to the next-best candidate. Double-up visits consume two carers.
Patient
Slot
Carer
Score
Miles
Why chosen
Margaret Whitfield
#1
Morning
Hilda
95%
1.2
Closest match (1.2 mi)
Margaret Whitfield
#1
Lunch
Hilda
93%
1.2
Closest (1.2 mi)
Edith Trescothick
#5
Morning
Farah
91%
0.8
Closest (0.8 mi)
Edith Trescothick
#5
Lunch
Farah
89%
0.8
Closest (0.8 mi)
Edith Trescothick
#5
Tea
Chloe
85%
1.1
Closest for late shift (1.1 mi)
Edith Trescothick
#5
Bed
Chloe
84%
1.1
Continuity with tea visit
Stanley Pemberton
#11
Morning
Howard
90%
2
Male carer
Stanley Pemberton
#11
Lunch
Howard
88%
2
Continuity with morning
Stanley Pemberton
#11
Bed
John
85%
2.8
Late shift
5
Sequence each carer's day
For every carer, sort their assigned visits by arrival time and compute the travel leg between each stop. A carer starts at home, drives to each patient, and returns home. Travel is added as a stop between visits.
6
Validation & efficiency check
✓ All carers within max-miles radius
✓ No shift mismatches (early/late)
✓ Double-up visits have 2 carers assigned
✓ No time-off conflicts
✓ Gender preferences respected where specified