def get_patient_value(ID, var):
    test_patient = patient(ID)
    observation = test_patient.convert_to_time_value()
    if len(observation[var]) == 0:
        return 0

    average_list = []

    for n in range(0, len(observation[var])):
        value = float(observation[var][n][1])

        if value < 0:
            continue
        else:
            average_list.append(value)

    if len(average_list) == 0:
        return 0

    average = sum(average_list) / float(len(average_list))
    return average
		survival_list.append(n)

random_list =[]
random_list.append(random.sample(dead_list,1)[0])

for j in range(0,7):
	random_list.append(random.sample(survival_list,7)[j])  

# Plot the line graph showing time and temperature of 7 random survival patients and 1 dead one
output_file("color_scatter.html", title="patient_Temp_time.py example")
p = figure(width=800, height=250, x_axis_type="datetime", title="Temperature and Timeseries")
p.xaxis.axis_label = "Time"
p.yaxis.axis_label = "Temp"

for i in random_list:
	test_patient = patient(RecordIDs[i])
	observation = test_patient.convert_to_time_value()
	data=[]
	
	# Dead in hospital is marked by red line
	# Survival is marked by navy line
	if(outcomes[i].rstrip().split(',')[5]=='1'):
		linecolor = 'red'
		linelegend = 'dead'
	else:
		linecolor = 'navy'
		linelegend = 'survival'

	for n in range(0,len(observation['Temp'])):
		observe_time = timeconvert(observation['Temp'][n][0])
		observe_temp = float(observation['Temp'][n][1])