"+ r +" | ")
FULL_ROSTER[r]={}
#if r == REGISTRAR[0]:
# #rosterout.write(" ")
for d in range(1,85):
#If first registrar then write roster otherwise write rotated roster
if r == REGISTRAR[0]:
#print d
current_shift = ROSTER[d-1]
else:
current_shift= what_doing(r,d-1,ORDER,ROSTER)#call function here
#Write color code
#if d == night_start:
# rosterout.write(" ")
if current_shift =='A':
rosterout.write("")
elif current_shift=='B':
rosterout.write(" | ")
elif current_shift=='N':
rosterout.write(" | ")
elif current_shift=='P' or current_shift=='X' or current_shift=='Z':
rosterout.write(" | ")
else:
rosterout.write(" | ")
#Write shift to html and dictionary and end cell tag
rosterout.write(current_shift)
FULL_ROSTER[r][d-1]=current_shift
rosterout.write(" | ")
#if d == night_finish:
# rosterout.write("
| ")
rosterout.write(" ")
i+=1
rosterout.write(" ")
rosterout.close()
return (ROSTER, FULL_ROSTER)
"""
# patient_nums
# function to determine number of patients in each ward based on the schedule
# Inputs:
# WARD_NUMBERS: dictionary with initial patient numbers
# REGISTRAR: List of registrars
# FULL_ROSTER: Dictionary of which shift each registrar is doing each day
# PATIENT_DATA: list of number of patients admitted to GM each day
# WEIGHTS: Fraction of patients that get alloctaed to each shift
# DISCHARGE_RATE: Fraction of patients that are discharged each day
# SHIFTS: List of shifts
Outputs:
# WARD_NUMBERS: Full dictionary over registrar, Day for patient numbers
"""
def patient_nums(WARD_NUMBERS, patientVars):
for d in range(1,85):
WARD_NUMBERS[('W', d)]=patientVars[('W',d)].varValue
WARD_NUMBERS[('B', d)]=patientVars[('B',d)].varValue
WARD_NUMBERS[('R', d)]=patientVars[('R',d)].varValue
WARD_NUMBERS[('G', d)]=patientVars[('G',d)].varValue
return WARD_NUMBERS
"""
# plot_patients
# Function to plot ward numbers
# uses matplotlib see https://matplotlib.sourceforge.net/
# Inputs:
# WARD_NUMBERS: Full dictionary over registrar, Day for patient numbers
# REGISTRAR: List of registrars
# Outputs:
# Plots patient numbers for each ward
"""
def plot_patients(WARDS, WARD_NUMBERS):
totals_W=[]
totals_B=[]
totals_R=[]
totals_G=[]
for d in range(0,85):
totals_W.append(WARD_NUMBERS[('W',d)])
totals_R.append(WARD_NUMBERS[('R',d)])
totals_G.append(WARD_NUMBERS[('G',d)])
totals_B.append(WARD_NUMBERS[('B',d)])
#print totals_W
# Make plot
plt.subplot(111, axisbg='lightslategray')
#for w in
#Plot colours for each ward
plt.plot(range(0,85),totals_W,'w',label='White')
plt.plot(range(0,85),totals_B,'k',label='Black')
plt.plot(range(0,85),totals_G,'y',label='Gold')
plt.plot(range(0,85),totals_R,'r',label='Red')
# Plot commands to make pretty
plt.xlabel('Day')
plt.ylabel('Number of Patients')
plt.title('Estimate of Patient numbers across wards')
plt.legend(('White','Black','Gold','Red'),loc='best')
plt.xlim([0,21])
plt.ylim([0,55])
plt.grid(True)
# Make legend have a grey background
leg = plt.gca().get_legend()
frame = leg.get_frame()
frame.set_facecolor('0.80')
# Show plot
plt.show()
|