carisackc commited on
Commit
65cf7da
1 Parent(s): b02e093

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -2
app.py CHANGED
@@ -91,6 +91,7 @@ df3["CHARTDATE_HADM_ID"] = df3["CHARTDATE"].astype(str) +' ('+ df3["HADM_ID"] +'
91
  df3["DIAGNOSIS"] = df3["DIAGNOSIS"].str.capitalize()
92
  df3["DISCHARGE_LOCATION"] = df3["DISCHARGE_LOCATION"].str.capitalize()
93
 
 
94
  df3["TEXT"] =df3["TEXT"].replace(r'\n',' \n ', regex=True)
95
  df3["TEXT"] =df3["TEXT"].replace(r'#',' ', regex=True)
96
  df3["BertSummarizer"] =df3["BertSummarizer"].replace(r'#',' ', regex=True)
@@ -461,18 +462,30 @@ def DailyNarrative():
461
 
462
  #st.table(dailyNoteChange) # testing to see if data calculate correctly
463
 
 
 
 
 
 
 
 
 
 
 
464
  with st.expander("See in detail"):
465
 
466
 
467
  ls = []
468
 
469
- for sent in dailyNarrativeText_split:
470
  if sent in changeNote_split:
471
  sent = sent.replace(str(sent),str(annotation(sent)))
472
  ls.append(sent)
473
  else:
474
  ls.append(sent)
475
- highlight = ' '.join(ls)
 
 
476
  st.markdown(highlight, unsafe_allow_html=True)
477
 
478
 
 
91
  df3["DIAGNOSIS"] = df3["DIAGNOSIS"].str.capitalize()
92
  df3["DISCHARGE_LOCATION"] = df3["DISCHARGE_LOCATION"].str.capitalize()
93
 
94
+ df3["Diagnosis_Description"] =df3["Diagnosis_Description"].replace(r'\n',' \n ', regex=True)
95
  df3["TEXT"] =df3["TEXT"].replace(r'\n',' \n ', regex=True)
96
  df3["TEXT"] =df3["TEXT"].replace(r'#',' ', regex=True)
97
  df3["BertSummarizer"] =df3["BertSummarizer"].replace(r'#',' ', regex=True)
 
462
 
463
  #st.table(dailyNoteChange) # testing to see if data calculate correctly
464
 
465
+ annt_ls = []
466
+ for sent in dailyNarrativeText_split:
467
+ if '<br><br>' in sent:
468
+ break # one item didn't complete the condition, get out of this loop
469
+ else:
470
+ end_index = dailyNarrativeText_split.index(sent) + 1
471
+ annt_ls.append(sent)
472
+
473
+ non_annt_ls = dailyNarrativeText_split[end_index:]
474
+
475
  with st.expander("See in detail"):
476
 
477
 
478
  ls = []
479
 
480
+ for sent in annt_ls:
481
  if sent in changeNote_split:
482
  sent = sent.replace(str(sent),str(annotation(sent)))
483
  ls.append(sent)
484
  else:
485
  ls.append(sent)
486
+
487
+ ls2 = ls + non_annt_ls
488
+ highlight = ' '.join(ls2)
489
  st.markdown(highlight, unsafe_allow_html=True)
490
 
491