carisackc commited on
Commit
00bc252
1 Parent(s): efbc7f6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -47,12 +47,14 @@ st.sidebar.markdown('Using transformer model')
47
  ## ======== Loading dataset ========
48
  ## Loading in Admission Dataset
49
  df = pd.read_csv('shpi25nov.csv')
 
50
 
51
  # Loading in Admission chief Complaint and diagnosis
52
  df2 = pd.read_csv('cohort_cc_adm_diag.csv')
53
 
54
  # Loading in Dischare History
55
  df3 = pd.read_csv('cohort_past_history_12072022.csv')
 
56
 
57
  # combining both data into one
58
  df = pd.merge(df, df2, on=['HADM_ID','SUBJECT_ID'])
@@ -69,7 +71,7 @@ df3["DIAGNOSIS"] = df3["DIAGNOSIS"].str.capitalize()
69
  df3["DISCHARGE_LOCATION"] = df3["DISCHARGE_LOCATION"].str.capitalize()
70
 
71
  df3["TEXT"] =df3["TEXT"].replace(r'\n',' \n ', regex=True)
72
-
73
 
74
  #Renaming column
75
  df.rename(columns={'SUBJECT_ID':'Patient_ID',
@@ -84,7 +86,7 @@ df3.rename(columns={'SUBJECT_ID':'Patient_ID',
84
  st.sidebar.header("Search for Patient:")
85
 
86
  # ===== Initial filter for patient and admission id =====
87
- patientid = df['Patient_ID']
88
  patient = st.sidebar.selectbox('Select Patient ID:', patientid) #Filter Patient
89
  admissionid = df['Admission_ID'].loc[df['Patient_ID'] == patient] #Filter available Admission id for patient
90
  HospitalAdmission = st.sidebar.selectbox(' ', admissionid)
@@ -140,9 +142,8 @@ with st.container():
140
  btnPastHistory = st.button('📇Past History (6 Mths)')
141
  if btnPastHistory:
142
  inputNote = "Input History records"
143
-
144
-
145
 
 
146
 
147
  ##========= on Past History Tab =========
148
 
@@ -155,7 +156,7 @@ with st.container():
155
  with col7:
156
  #st.date_input('Select Admission Date') # To replace with a dropdown filter instead
157
  #st.selectbox('Past Episodes',pastHistoryEp)
158
- pastHistory = st.selectbox('Select Past History Admission', pastHistoryEpDate,on_change=None,)
159
 
160
  if btnPastHistory:
161
 
@@ -166,7 +167,7 @@ if btnPastHistory:
166
  runtext = historyAdmission['hospital_course_processed'].values[0]
167
 
168
  else:
169
- runtext =st.text_area(inputNote, str(original_text2), height=300)
170
 
171
 
172
 
@@ -328,7 +329,7 @@ if not(btnPastHistory): #to not show summary and references text for Past Histor
328
  st.markdown('**CHIEF COMPLAINT:**')
329
  st.write(str(AdmissionChiefCom)[1:-1])
330
  st.markdown('**ADMISSION DIAGNOSIS:**')
331
- st.markdown(str(diagnosis)[1:-1])
332
  st.markdown('**PROBLEM/ISSUE**')
333
  #st.markdown(problem_entities)
334
  st.markdown(f'<p style="background-color:PINK;color:#080808;font-size:16px;">{str(problem_entities)[1:-1]}</p>', unsafe_allow_html=True)
 
47
  ## ======== Loading dataset ========
48
  ## Loading in Admission Dataset
49
  df = pd.read_csv('shpi25nov.csv')
50
+ df.sort_values(by='SUBJECT_ID',ascending = True, inplace=True)
51
 
52
  # Loading in Admission chief Complaint and diagnosis
53
  df2 = pd.read_csv('cohort_cc_adm_diag.csv')
54
 
55
  # Loading in Dischare History
56
  df3 = pd.read_csv('cohort_past_history_12072022.csv')
57
+ df3.sort_values(by='CHARTDATE',ascending = False, inplace=True)
58
 
59
  # combining both data into one
60
  df = pd.merge(df, df2, on=['HADM_ID','SUBJECT_ID'])
 
71
  df3["DISCHARGE_LOCATION"] = df3["DISCHARGE_LOCATION"].str.capitalize()
72
 
73
  df3["TEXT"] =df3["TEXT"].replace(r'\n',' \n ', regex=True)
74
+ df3["BertSummarizer"] =df3["BertSummarizer"].replace(r'#',' ', regex=True)
75
 
76
  #Renaming column
77
  df.rename(columns={'SUBJECT_ID':'Patient_ID',
 
86
  st.sidebar.header("Search for Patient:")
87
 
88
  # ===== Initial filter for patient and admission id =====
89
+ patientid = df['Patient_ID'].unique()
90
  patient = st.sidebar.selectbox('Select Patient ID:', patientid) #Filter Patient
91
  admissionid = df['Admission_ID'].loc[df['Patient_ID'] == patient] #Filter available Admission id for patient
92
  HospitalAdmission = st.sidebar.selectbox(' ', admissionid)
 
142
  btnPastHistory = st.button('📇Past History (6 Mths)')
143
  if btnPastHistory:
144
  inputNote = "Input History records"
 
 
145
 
146
+
147
 
148
  ##========= on Past History Tab =========
149
 
 
156
  with col7:
157
  #st.date_input('Select Admission Date') # To replace with a dropdown filter instead
158
  #st.selectbox('Past Episodes',pastHistoryEp)
159
+ pastHistory = st.selectbox('Select Past History Admission', pastHistoryEpDate)
160
 
161
  if btnPastHistory:
162
 
 
167
  runtext = historyAdmission['hospital_course_processed'].values[0]
168
 
169
  else:
170
+ runtext =st.text_area(inputNote, str(original_text2)[1:-1], height=300)
171
 
172
 
173
 
 
329
  st.markdown('**CHIEF COMPLAINT:**')
330
  st.write(str(AdmissionChiefCom)[1:-1])
331
  st.markdown('**ADMISSION DIAGNOSIS:**')
332
+ st.markdown(str(diagnosis)[1:-1].capitalize())
333
  st.markdown('**PROBLEM/ISSUE**')
334
  #st.markdown(problem_entities)
335
  st.markdown(f'<p style="background-color:PINK;color:#080808;font-size:16px;">{str(problem_entities)[1:-1]}</p>', unsafe_allow_html=True)