[Tutor] facing a new project

mikalzet@libero.it mikalzet@libero.it
Wed, 16 Jan 2002 00:18:18 +0100 (CET)


On Mon, 14 Jan 2002, glidedon wrote:

> I'm new to programming, new to Python and need tutoring :-) ( I also am an
> old dog trying to learn new tricks )

Sounds like we've got a lot in common. At least; I'm a babe to
programming, but I am an old dog ... probably a bit past the age were most
people take programming up.

> # this program will calculate hours on duty last 7 days, hours avalible
> tomorrow ,hours on duty last 8 days
> # for a truck drivers log book

Well, if I ever become a good python programmer, do you know what is the
program I would like to write ? Something which doesn't exist in the GPL
world - a good program for creating, managing, checking and printing
working schedules for departments with really complex scheduling ... like
mine. I haven't even found any really satisfying commercial programs
to this purpose. The only thing close is phpSched to be found on Sourceforge,
the one and only author doesn't want to develop further on the same lines,
seems like he's trying to redo it in perl ... but I haven't seen any progress
on the new perl site either.

So what should this program do ?
I am one of a group of 14 - 17 ER doctors; shifts cover 24 hours a day,
but there are various types of shifts - for example shift type 'A' covers
24 hours 365 days a year (one doctor between 22.00 and 8.00 and the
day hours covered by two doctors e.g. one shift 8-14, another 14-21, one
9-16, another 16-22 ... times may vary on holidays and the days
immediately preceding holidays); shift type 'B' covers 8 to 20.00
(actually 8-14 + 14-20) every day except holidays; shift type 'C' covers
365 nights a year in a geographically detached location ( 20 to 8 );
shift type 'D' covers 365 days a year in this same location (8-14, 14-20).
For the moment we've got rid of shift type 'E' ( 365 days from 9 to 17 )
and shift type 'F' ( one night a week) but they may come back ...
Just to keep things simple, all ER doctors are equal, but some are more
equal than others ... one can only do 'B' type shifts; another only 'C'
and 'D'; others will do anything but 'D' and so forth (for various
reasons, can't go into them now). In theory we should work 38 hour weeks
(ha, ha), a couple however have reduced time contracts (with different
times each, of course), and so will not tolerate extra hours. Furthermore,
some will not do shifts on certain days and times (for reasons which go
from academic involvement to political involvement; it also happens that
people do have personal lives as well).
So you say, so what. One big spreadsheet and you've done it. Right. We
have that. The excel sheet we use even does some basic checks. So why
write a new python program to print a big spreadsheet ? Because
notwithstanding double checking done by two people, every month we get
situations like Tom finds he's supposed to be on duty
contemporaneously in two different places or Bob finds he's supposed to
end a 12 hour shift ( 6 hour shifts are often attributed two by two) and
immediately start another 12 hour shift elsewhere, whereas Tim gets mad
because he finds out he's doing six night shifts in one month whereas
everybody else is doing four or five, while mike points out he can't keep
on doing 78 hour weeks every damn week etc. etc. etc. etc.
Besides, the colleague who writes the shifts (not me, luckily) spends
hours and hours of his free time every month to do this.

The ideal program therefore should: allow input of special
conditions and desiderata, different types of days and different types of
shifts; GENERATE one or more possible schedule sheets complying with these
desiderata, or if it is not possible offer a range of solutions, indicating
for each of these which conditions and desiderata are violated;
allow manual correction of the generated schedules; do a
series of checks of these to avoid requiring people to do impossible
things, and finally print a neat, legible schedule. Note: schedules of
individual people are not required to have any fixed order - no 'Tom does all
the B mornings this week and James next week' stuff, unless explicitly
requested. The program owuld also keep track of hours worked etc. etc.
A program like this would be extremely useful to thousands of
people who work in hospitals all over the world.

To strive in this direction I suppose I should concentrate on Python;
Tkinter (will have to have a GUI); a database (I don't suppose
dictionaries and lists would be sufficient) present on linux and windows
(I use linux but the program would have to run on windows) - postgresql ?;
whatever method python makes available for printing. The thing that seems
most difficult is the 'generating' schedules bit ...

If I ever wished to seriously face a new project of this sort, what is the
best way to go about it ? First make a gross design of the whole thing
( database schema, classes etc. ) and then start tackling it, or start with
small bits of code like the truck drivers log book and then just try to extend
it bit by bit ? Not that I'm yet really convinced I mean to do this ...

--
Michele Alzetta