In [1]:
from IPython.core.display import HTML
css_file = 'style.css'
HTML(open(css_file, 'r').read())
Out[1]:
* This notebook is for illustrative purposes only. The names and numbers have been altered to ensure anonimity. ** The HTML rendered version is sent to Faculty.
Setup of intial python™ environment
In [2]:
import pandas as pd
#import numpy as np
import matplotlib.pyplot as plt
from matplotlib import cm
%matplotlib inline
#import plotly as py
import seaborn as sns
sns.set_style('whitegrid')
sns.set_context('notebook', font_scale = 1.5)
from scipy.stats import chi2_contingency, ttest_ind, ranksums, bayes_mvs, probplot
import scikits.bootstrap as bs
#from bokeh.plotting import figure, show, output_notebook
from warnings import filterwarnings
filterwarnings('ignore')
In [3]:
data = pd.read_excel('OP_NOTES_1_W.xlsx')
In [4]:
jefferson = pd.read_excel("Jefferson_1_W.xlsx")
In [5]:
mwrat = pd.read_excel("MWRAT_1_W.xlsx")
In [6]:
adm = pd.read_excel("Admissions_Consultation_1_W.xlsx")
In [7]:
accounts = adm.Registrar.value_counts()
accounts
Out[7]:
In [8]:
accounts.plot(kind = "bar", title = "Patients seen per registrar", figsize = (20, 8));
In [9]:
data['Surgeon'].value_counts()
Out[9]:
In [10]:
data['Assistant'].value_counts()
Out[10]:
In [11]:
data.groupby("Nature")["Surgeon"].value_counts()
Out[11]:
In [12]:
data['Procedure'].value_counts()
Out[12]:
In [13]:
data['Nature'].value_counts()
Out[13]:
In [14]:
data['Color'].value_counts()
Out[14]:
In [15]:
data['Anesthesia'].value_counts()
Out[15]:
In [16]:
data.Duration.describe()
Out[16]:
In [17]:
data.Duration.plot(kind = 'kde', figsize = (12, 8), grid = False);
In [18]:
plt.figure(figsize = (20, 30))
sns.boxplot(y = 'Procedure', x = 'Duration', data = data, orient = 'h')
sns.stripplot(y = 'Procedure', x = 'Duration', data = data, orient = 'h', jitter = True, palette = 'Blues_d');
In [19]:
data.groupby('Nature')["Duration"].describe()
Out[19]:
In [20]:
plt.figure(figsize = (20, 100))
sns.boxplot(x = 'Duration', y = "Procedure", hue = 'Surgeon', data = data, orient = 'h', palette = "Set2");
In [21]:
plt.figure(figsize = (20, 20))
sns.boxplot(x = 'Duration', y = "Surgeon", data = data, orient = 'h', palette = "Set2")
sns.stripplot(x = 'Duration', y = "Surgeon", data = data, orient = 'h', jitter = True, palette = 'Blues_d');
In [22]:
efc = jefferson['Emotions_feelings_concerns'].value_counts()
efc.plot(kind = 'bar', figsize = (5, 5), grid = False,
colormap = cm.Oranges,
title = 'The doctor understand my emotions, feeling, and concerns');
In [23]:
mf = jefferson['Me_family'].value_counts()
mf.plot(kind = 'bar', figsize = (5, 5), grid = False,
colormap = cm.Oranges,
title = 'The doctor seems concerned about me and my family');
In [24]:
mf = jefferson['Me_family'].value_counts()
mf.plot(kind = 'bar', figsize = (5, 5), grid = False,
colormap = cm.Oranges,
title = 'The doctor seems concerned about me and my family');
In [25]:
mp = jefferson['My_perspective'].value_counts()
mp.plot(kind = 'bar', figsize = (5, 5), grid = False,
colormap = cm.Oranges,
title = 'The doctor can view things from my perspective');
In [26]:
dl = jefferson['Daily_life'].value_counts()
dl.plot(kind = 'bar', figsize = (5, 5), grid = False,
colormap = cm.Oranges,
title = 'The doctors asks about what is going on in my daily life');
In [27]:
ud = jefferson['Understanding_doctor'].value_counts()
ud.plot(kind = 'bar', figsize = (5, 5), grid = False,
colormap = cm.Oranges,
title = 'The doctor is an understanding doctor');
In [28]:
ch = jefferson['Condition_happen'].value_counts()
ch.plot(kind = 'bar', figsize = (5, 5), grid = False,
colormap = cm.Oranges,
title = 'The doctor explained my condition and what is going to happen to me');
In [29]:
#mwrat.Registrar.value_counts()
In [30]:
mwrat.Ward.value_counts().plot(kind = 'bar', figsize = (5, 5), grid = False,
title = 'Correct ward');
In [31]:
mwrat.Bed.value_counts().plot(kind = 'bar', figsize = (5, 5), grid = False,
title = 'Correct bed');
In [32]:
mwrat.Privacy.value_counts().plot(kind = 'bar', figsize = (5, 5), grid = False,
title = 'Maintain privacy');
In [33]:
mwrat.Infection.value_counts().plot(kind = 'bar', figsize = (5, 5), grid = False,
title = 'Correct infection control');
In [34]:
mwrat.Greeting.value_counts().plot(kind = 'bar', figsize = (5, 5), grid = False,
title = 'Proper greeting');
In [35]:
mwrat.Identity.value_counts()
Out[35]:
In [36]:
mwrat.Diagnosis.value_counts().plot(kind = 'bar', figsize = (5, 5), grid = False,
title = 'Differential diagnoses');
In [37]:
mwrat.Drugs.value_counts().plot(kind = 'bar', figsize = (5, 5), grid = False,
title = 'Correct drug chart');
In [38]:
mwrat.Fluids.value_counts().plot(kind = 'bar', figsize = (5, 5), grid = False,
title = 'Correct fluid chart');
In [39]:
mwrat.Management.value_counts().plot(kind = 'bar', figsize = (5, 5), grid = False,
title = 'Correct management');
In [40]:
#data.Surgeon.value_counts()
In [41]:
data_C = data[data['Surgeon'] == 'C']
jefferson_C = jefferson[jefferson['Registrar'] == 'C']
mwrat_C = mwrat[mwrat['Registrar'] == 'C']
data_D = data[data['Surgeon'] == 'D']
jefferson_D = jefferson[jefferson['Registrar'] == 'D']
mwrat_D = mwrat[mwrat['Registrar'] == 'D']
data_E = data[data['Surgeon'] == 'E']
jefferson_E = jefferson[jefferson['Registrar'] == 'E']
mwrat_E = mwrat[mwrat['Registrar'] == 'E']
data_A = data[data['Surgeon'] == 'A']
jefferson_A = jefferson[jefferson['Registrar'] == 'A']
mwrat_A = mwrat[mwrat['Registrar'] == 'A']
data_B = data[data['Surgeon'] == 'B']
jefferson_B = jefferson[jefferson['Registrar'] == 'B']
mwrat_B = mwrat[mwrat['Registrar'] == 'B']
In [42]:
data_C.Procedure.value_counts()
Out[42]:
In [43]:
plt.figure(figsize = (20, 20))
sns.boxplot(x = 'Duration', y = 'Procedure', data = data_C, orient = 'h', palette = 'Set2')
sns.stripplot(x = 'Duration', y = 'Procedure', data = data_C, orient = 'h', jitter = True, palette = 'Blues_d');
In [44]:
fig = plt.figure(figsize = (20, 6))
fig.add_subplot(1, 2, 1)
jefferson_C['Emotions_feelings_concerns'].value_counts().plot(kind = 'bar', grid = False, title = 'Emotions')
fig.add_subplot(1, 2, 2)
jefferson_C['Me_family'].value_counts().plot(kind = 'bar', grid = False, title = 'Me / family');
In [45]:
fig = plt.figure(figsize = (20, 6))
fig.add_subplot(1, 2, 1)
jefferson_C['My_perspective'].value_counts().plot(kind = 'bar', grid = False, title = 'Perspective')
fig.add_subplot(1, 2, 2)
jefferson_C['Daily_life'].value_counts().plot(kind = 'bar', grid = False, title = 'Daily life');
In [46]:
fig = plt.figure(figsize = (20, 6))
fig.add_subplot(1, 2, 1)
jefferson_C['Understanding_doctor'].value_counts().plot(kind = 'bar', grid = False, title = 'Understanding')
fig.add_subplot(1, 2, 2)
jefferson_C['Condition_happen'].value_counts().plot(kind = 'bar', grid = False, title = 'Explain');
In [47]:
fig = plt.figure(figsize = (20, 6))
fig.add_subplot(1, 5, 1)
mwrat_C['Ward'].value_counts().plot(kind = 'bar', grid = False, title = 'Correct ward')
fig.add_subplot(1, 5, 2)
mwrat_C['Bed'].value_counts().plot(kind = 'bar', grid = False, title = 'Correct bed')
fig.add_subplot(1, 5, 3)
mwrat_C['Privacy'].value_counts().plot(kind = 'bar', grid = False, title = 'Maintains privacy')
fig.add_subplot(1, 5, 4)
mwrat_C['Infection'].value_counts().plot(kind = 'bar', grid = False, title = 'Infection control')
fig.add_subplot(1, 5, 5)
mwrat_C['Greeting'].value_counts().plot(kind = 'bar', grid = False, title = 'Proper greeting');
In [48]:
fig = plt.figure(figsize = (20, 6))
fig.add_subplot(1, 5, 1)
mwrat_C['Identity'].value_counts().plot(kind = 'bar', grid = False, title = 'Patient identity')
fig.add_subplot(1, 5, 2)
mwrat_C['Diagnosis'].value_counts().plot(kind = 'bar', grid = False, title = 'Diff diagnoses')
fig.add_subplot(1, 5, 3)
mwrat_C['Drugs'].value_counts().plot(kind = 'bar', grid = False, title = 'Drugs chart')
fig.add_subplot(1, 5, 4)
mwrat_C['Fluids'].value_counts().plot(kind = 'bar', grid = False, title = 'Fluids chart')
fig.add_subplot(1, 5, 5)
mwrat_C['Management'].value_counts().plot(kind = 'bar', grid = False, title = 'Management');
In [49]:
data_D['Procedure'].value_counts()
Out[49]:
In [50]:
plt.figure(figsize = (20, 20))
sns.boxplot(x = 'Duration', y = 'Procedure', data = data_D, orient = 'h', palette = 'Set2')
sns.stripplot(x = 'Duration', y = 'Procedure', data = data_D, orient = 'h', jitter = True, palette = 'Blues_d');
In [51]:
fig = plt.figure(figsize = (20, 6))
fig.add_subplot(1, 2, 1)
jefferson_D['Emotions_feelings_concerns'].value_counts().plot(kind = 'bar', grid = False, title = 'Emotions')
fig.add_subplot(1, 2, 2)
jefferson_D['Me_family'].value_counts().plot(kind = 'bar', grid = False, title = 'Me / family')
Out[51]:
In [52]:
fig = plt.figure(figsize = (20, 6))
fig.add_subplot(1, 2, 1)
jefferson_D['My_perspective'].value_counts().plot(kind = 'bar', grid = False, title = 'Perspective')
fig.add_subplot(1, 2, 2)
jefferson_D['Daily_life'].value_counts().plot(kind = 'bar', grid = False, title = 'Daily life');
In [53]:
fig = plt.figure(figsize = (20, 6))
fig.add_subplot(1, 2, 1)
jefferson_D['Understanding_doctor'].value_counts().plot(kind = 'bar', grid = False, title = 'Understanding')
fig.add_subplot(1, 2, 2)
jefferson_D['Condition_happen'].value_counts().plot(kind = 'bar', grid = False, title = 'Explain');
In [54]:
fig = plt.figure(figsize = (20, 6))
fig.add_subplot(1, 5, 1)
mwrat_D['Ward'].value_counts().plot(kind = 'bar', grid = False, title = 'Correct ward')
fig.add_subplot(1, 5, 2)
mwrat_D['Bed'].value_counts().plot(kind = 'bar', grid = False, title = 'Correct bed')
fig.add_subplot(1, 5, 3)
mwrat_D['Privacy'].value_counts().plot(kind = 'bar', grid = False, title = 'Maintains privacy')
fig.add_subplot(1, 5, 4)
mwrat_D['Infection'].value_counts().plot(kind = 'bar', grid = False, title = 'Infection control')
fig.add_subplot(1, 5, 5)
mwrat_D['Greeting'].value_counts().plot(kind = 'bar', grid = False, title = 'Proper greeting');
In [55]:
fig = plt.figure(figsize = (20, 6))
fig.add_subplot(1, 5, 1)
mwrat_D['Identity'].value_counts().plot(kind = 'bar', grid = False, title = 'Patient identity')
fig.add_subplot(1, 5, 2)
mwrat_D['Diagnosis'].value_counts().plot(kind = 'bar', grid = False, title = 'Diff diagnoses')
fig.add_subplot(1, 5, 3)
mwrat_D['Drugs'].value_counts().plot(kind = 'bar', grid = False, title = 'Drugs chart')
fig.add_subplot(1, 5, 4)
mwrat_D['Fluids'].value_counts().plot(kind = 'bar', grid = False, title = 'Fluids chart')
fig.add_subplot(1, 5, 5)
mwrat_D['Management'].value_counts().plot(kind = 'bar', grid = False, title = 'Management');
In [56]:
data_E.Procedure.value_counts()
Out[56]:
In [57]:
plt.figure(figsize = (20, 20))
sns.boxplot(x = 'Duration', y = 'Procedure', data = data_E, orient = 'h', palette = 'Set2')
sns.stripplot(x = 'Duration', y = 'Procedure', data = data_E, orient = 'h', jitter = True, palette = 'Blues_d');
In [58]:
fig = plt.figure(figsize = (20, 6))
fig.add_subplot(1, 2, 1)
jefferson_E['Emotions_feelings_concerns'].value_counts().plot(kind = 'bar', grid = False, title = 'Emotions')
fig.add_subplot(1, 2, 2)
jefferson_E['Me_family'].value_counts().plot(kind = 'bar', grid = False, title = 'Me / family');
In [59]:
fig = plt.figure(figsize = (20, 6))
fig.add_subplot(1, 2, 1)
jefferson_E['My_perspective'].value_counts().plot(kind = 'bar', grid = False, title = 'Perspective')
fig.add_subplot(1, 2, 2)
jefferson_E['Daily_life'].value_counts().plot(kind = 'bar', grid = False, title = 'Daily life');
In [60]:
fig = plt.figure(figsize = (20, 6))
fig.add_subplot(1, 2, 1)
jefferson_E['Understanding_doctor'].value_counts().plot(kind = 'bar', grid = False, title = 'Understanding')
fig.add_subplot(1, 2, 2)
jefferson_E['Condition_happen'].value_counts().plot(kind = 'bar', grid = False, title = 'Explain');
In [61]:
fig = plt.figure(figsize = (20, 6))
fig.add_subplot(1, 5, 1)
mwrat_E['Ward'].value_counts().plot(kind = 'bar', grid = False, title = 'Correct ward')
fig.add_subplot(1, 5, 2)
mwrat_E['Bed'].value_counts().plot(kind = 'bar', grid = False, title = 'Correct bed')
fig.add_subplot(1, 5, 3)
mwrat_E['Privacy'].value_counts().plot(kind = 'bar', grid = False, title = 'Maintains privacy')
fig.add_subplot(1, 5, 4)
mwrat_E['Infection'].value_counts().plot(kind = 'bar', grid = False, title = 'Infection control')
fig.add_subplot(1, 5, 5)
mwrat_E['Greeting'].value_counts().plot(kind = 'bar', grid = False, title = 'Proper greeting');
In [62]:
fig = plt.figure(figsize = (20, 6))
fig.add_subplot(1, 5, 1)
mwrat_E['Identity'].value_counts().plot(kind = 'bar', grid = False, title = 'Patient identity')
fig.add_subplot(1, 5, 2)
mwrat_E['Diagnosis'].value_counts().plot(kind = 'bar', grid = False, title = 'Diff diagnoses')
fig.add_subplot(1, 5, 3)
mwrat_E['Drugs'].value_counts().plot(kind = 'bar', grid = False, title = 'Drugs chart')
fig.add_subplot(1, 5, 4)
mwrat_E['Fluids'].value_counts().plot(kind = 'bar', grid = False, title = 'Fluids chart')
fig.add_subplot(1, 5, 5)
mwrat_E['Management'].value_counts().plot(kind = 'bar', grid = False, title = 'Management');
In [63]:
data_A.Procedure.value_counts()
Out[63]:
In [64]:
plt.figure(figsize = (20, 20))
sns.boxplot(x = 'Duration', y = 'Procedure', data = data_A, orient = 'h', palette = 'Set2')
sns.stripplot(x = 'Duration', y = 'Procedure', data = data_A, orient = 'h', jitter = True, palette = 'Blues_d');
In [65]:
fig = plt.figure(figsize = (20, 6))
fig.add_subplot(1, 2, 1)
jefferson_A['Emotions_feelings_concerns'].value_counts().plot(kind = 'bar', grid = False, title = 'Emotions')
fig.add_subplot(1, 2, 2)
jefferson_A['Me_family'].value_counts().plot(kind = 'bar', grid = False, title = 'Me / family');
In [66]:
fig = plt.figure(figsize = (20, 6))
fig.add_subplot(1, 2, 1)
jefferson_A['My_perspective'].value_counts().plot(kind = 'bar', grid = False, title = 'Perspective')
fig.add_subplot(1, 2, 2)
jefferson_A['Daily_life'].value_counts().plot(kind = 'bar', grid = False, title = 'Daily life');
In [67]:
fig = plt.figure(figsize = (20, 6))
fig.add_subplot(1, 2, 1)
jefferson_A['Understanding_doctor'].value_counts().plot(kind = 'bar', grid = False, title = 'Understanding')
fig.add_subplot(1, 2, 2)
jefferson_A['Condition_happen'].value_counts().plot(kind = 'bar', grid = False, title = 'Explain');
In [68]:
fig = plt.figure(figsize = (20, 6))
fig.add_subplot(1, 5, 1)
mwrat_A['Ward'].value_counts().plot(kind = 'bar', grid = False, title = 'Correct ward')
fig.add_subplot(1, 5, 2)
mwrat_A['Bed'].value_counts().plot(kind = 'bar', grid = False, title = 'Correct bed')
fig.add_subplot(1, 5, 3)
mwrat_A['Privacy'].value_counts().plot(kind = 'bar', grid = False, title = 'Maintains privacy')
fig.add_subplot(1, 5, 4)
mwrat_A['Infection'].value_counts().plot(kind = 'bar', grid = False, title = 'Infection control')
fig.add_subplot(1, 5, 5)
mwrat_A['Greeting'].value_counts().plot(kind = 'bar', grid = False, title = 'Proper greeting');
In [69]:
fig = plt.figure(figsize = (20, 6))
fig.add_subplot(1, 5, 1)
mwrat_A['Identity'].value_counts().plot(kind = 'bar', grid = False, title = 'Patient identity')
fig.add_subplot(1, 5, 2)
mwrat_A['Diagnosis'].value_counts().plot(kind = 'bar', grid = False, title = 'Diff diagnoses')
fig.add_subplot(1, 5, 3)
mwrat_A['Drugs'].value_counts().plot(kind = 'bar', grid = False, title = 'Drugs chart')
fig.add_subplot(1, 5, 4)
mwrat_A['Fluids'].value_counts().plot(kind = 'bar', grid = False, title = 'Fluids chart')
fig.add_subplot(1, 5, 5)
mwrat_A['Management'].value_counts().plot(kind = 'bar', grid = False, title = 'Management');
In [70]:
data_B.Procedure.value_counts()
Out[70]:
In [71]:
plt.figure(figsize = (20, 20))
sns.boxplot(x = 'Duration', y = 'Procedure', data = data_B, orient = 'h', palette = 'Set2')
sns.stripplot(x = 'Duration', y = 'Procedure', data = data_B, orient = 'h', jitter = True, palette = 'Blues_d');
In [72]:
fig = plt.figure(figsize = (20, 6))
fig.add_subplot(1, 2, 1)
jefferson_B['Emotions_feelings_concerns'].value_counts().plot(kind = 'bar', grid = False, title = 'Emotions')
fig.add_subplot(1, 2, 2)
jefferson_B['Me_family'].value_counts().plot(kind = 'bar', grid = False, title = 'Me / family');
In [73]:
fig = plt.figure(figsize = (20, 6))
fig.add_subplot(1, 2, 1)
jefferson_B['My_perspective'].value_counts().plot(kind = 'bar', grid = False, title = 'Perspective')
fig.add_subplot(1, 2, 2)
jefferson_B['Daily_life'].value_counts().plot(kind = 'bar', grid = False, title = 'Daily life');
In [74]:
fig = plt.figure(figsize = (20, 6))
fig.add_subplot(1, 2, 1)
jefferson_B['Understanding_doctor'].value_counts().plot(kind = 'bar', grid = False, title = 'Understanding')
fig.add_subplot(1, 2, 2)
jefferson_B['Condition_happen'].value_counts().plot(kind = 'bar', grid = False, title = 'Explain');
In [75]:
fig = plt.figure(figsize = (20, 6))
fig.add_subplot(1, 5, 1)
mwrat_B['Ward'].value_counts().plot(kind = 'bar', grid = False, title = 'Correct ward')
fig.add_subplot(1, 5, 2)
mwrat_B['Bed'].value_counts().plot(kind = 'bar', grid = False, title = 'Correct bed')
fig.add_subplot(1, 5, 3)
mwrat_B['Privacy'].value_counts().plot(kind = 'bar', grid = False, title = 'Maintains privacy')
fig.add_subplot(1, 5, 4)
mwrat_B['Infection'].value_counts().plot(kind = 'bar', grid = False, title = 'Infection control')
fig.add_subplot(1, 5, 5)
mwrat_B['Greeting'].value_counts().plot(kind = 'bar', grid = False, title = 'Proper greeting');
In [76]:
fig = plt.figure(figsize = (20, 6))
fig.add_subplot(1, 5, 1)
mwrat_B['Identity'].value_counts().plot(kind = 'bar', grid = False, title = 'Patient identity')
fig.add_subplot(1, 5, 2)
mwrat_B['Diagnosis'].value_counts().plot(kind = 'bar', grid = False, title = 'Diff diagnoses')
fig.add_subplot(1, 5, 3)
mwrat_B['Drugs'].value_counts().plot(kind = 'bar', grid = False, title = 'Drugs chart')
fig.add_subplot(1, 5, 4)
mwrat_B['Fluids'].value_counts().plot(kind = 'bar', grid = False, title = 'Fluids chart')
fig.add_subplot(1, 5, 5)
mwrat_B['Management'].value_counts().plot(kind = 'bar', grid = False, title = 'Management');
In [ ]: