carisackc commited on
Commit
8a1a51e
·
1 Parent(s): bb83119

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +54 -50
app.py CHANGED
@@ -17,11 +17,11 @@ from streamlit.components.v1 import html
17
  if "load_state" not in st.session_state:
18
  st.session_state.load_state = False
19
 
20
- if "button_clicked" not in st.session_state:
21
- st.session_state.button_clicked = False
22
-
23
- if "daily_button_clicked" not in st.session_state:
24
- st.session_state.daily_button_clicked = False
25
 
26
  if "past_button_clicked" not in st.session_state:
27
  st.session_state.past_button_clicked = False
@@ -272,8 +272,8 @@ def run_model(input_text):
272
  ##========= on Past History Tab =========
273
 
274
  if btnPastHistory or st.session_state["past_button_clicked"]:
275
- st.session_state["button_clicked"] = False
276
- st.session_state["daily_button_clicked"] = False
277
  st.session_state["past_button_clicked"] = True
278
 
279
  with st.container():
@@ -298,16 +298,16 @@ if btnPastHistory or st.session_state["past_button_clicked"]:
298
  #runtext = historyAdmission['hospital_course_processed'].values[0]
299
  runtext = historyAdmission['hospital_course_processed'].values[0]
300
 
301
- if btnAdmission or st.session_state["button_clicked"]:
302
- st.session_state["daily_button_clicked"] = False
303
- st.session_state["past_button_clicked"] = False
304
- st.session_state["button_clicked"] = True
305
- runtext =st.text_area(inputNote, str(original_text2)[1:-1], height=300)
306
 
307
- if btnDailyNarrative or st.session_state["daily_button_clicked"]:
308
- st.session_state["button_clicked"] = False
309
- st.session_state["past_button_clicked"] = False
310
- st.session_state["daily_button_clicked"] = True
311
 
312
 
313
 
@@ -334,41 +334,45 @@ ent_html = displacy.render(doc0, style='ent', options=options)
334
  col1, col2 = st.columns([1,1])
335
 
336
  #to not show summary and references text for Past History and Daily Narrative
337
- if btnAdmission or st.session_state["button_clicked"]:
338
- st.session_state["daily_button_clicked"] = False
 
339
  st.session_state["past_button_clicked"] = False
340
- st.session_state["button_clicked"] = True
341
- with col1:
342
- st.button('Summarize')
343
- run_model(runtext)
344
- #sentences=runtext.split('.')
345
- st.text_area('Reference text', str(reference_text), height=150)
346
- with col2:
347
- st.button('NER')
348
- # ===== Adding the Disease/Chemical into a list =====
349
- problem_entities = list(dedupe([t for t in doc0.ents if t.label_ == 'DISEASE']))
350
- medication_entities = list(dedupe([t for t in doc0.ents if t.label_ == 'CHEMICAL']))
351
- st.markdown('**CHIEF COMPLAINT:**')
352
- st.write(str(AdmissionChiefCom)[1:-1])
353
- st.markdown('**ADMISSION DIAGNOSIS:**')
354
- st.markdown(str(diagnosis)[1:-1].capitalize())
355
- st.markdown('**PROBLEM/ISSUE**')
356
- #st.markdown(problem_entities)
357
- st.markdown(f'<p style="background-color:PINK;color:#080808;font-size:16px;">{str(problem_entities)[1:-1]}</p>', unsafe_allow_html=True)
358
- #genEntities(trans_df, 'DISEASE')
359
- st.markdown('**MEDICATION**')
360
- st.markdown(f'<p style="background-color:orange;color:#080808;font-size:16px;">{str(medication_entities)[1:-1]}</p>', unsafe_allow_html=True)
361
- #genEntities(trans_df, 'CHEMICAL')
362
- #st.table(trans_df)
363
- st.markdown('**NER**')
364
- with st.expander("See NER Details"):
365
- st.markdown(ent_html, unsafe_allow_html=True)
366
-
 
 
 
367
 
368
- elif btnDailyNarrative or st.session_state["daily_button_clicked"]:
369
- st.session_state["daily_button_clicked"] = True
370
  st.session_state["past_button_clicked"] = False
371
- st.session_state["button_clicked"] = False
372
 
373
  with st.container():
374
  st.markdown('Daily Progress Note (24 hour event only):')
@@ -383,8 +387,8 @@ elif btnDailyNarrative or st.session_state["daily_button_clicked"]:
383
  #else:
384
  elif btnPastHistory or st.session_state["past_button_clicked"]:
385
  st.session_state["past_button_clicked"] = True
386
- st.session_state["button_clicked"] = False
387
- st.session_state["daily_button_clicked"] = False
388
  # ===== Adding the Disease/Chemical into a list =====
389
  problem_entities = list(dedupe([t for t in doc0.ents if t.label_ == 'DISEASE']))
390
  medication_entities = list(dedupe([t for t in doc0.ents if t.label_ == 'CHEMICAL']))
 
17
  if "load_state" not in st.session_state:
18
  st.session_state.load_state = False
19
 
20
+ #if "button_clicked" not in st.session_state:
21
+ # st.session_state.button_clicked = True
22
+ #
23
+ #if "daily_button_clicked" not in st.session_state:
24
+ # st.session_state.daily_button_clicked = False
25
 
26
  if "past_button_clicked" not in st.session_state:
27
  st.session_state.past_button_clicked = False
 
272
  ##========= on Past History Tab =========
273
 
274
  if btnPastHistory or st.session_state["past_button_clicked"]:
275
+ #st.session_state["button_clicked"] = False
276
+ #st.session_state["daily_button_clicked"] = False
277
  st.session_state["past_button_clicked"] = True
278
 
279
  with st.container():
 
298
  #runtext = historyAdmission['hospital_course_processed'].values[0]
299
  runtext = historyAdmission['hospital_course_processed'].values[0]
300
 
301
+ if btnAdmission:
302
+ #st.session_state["daily_button_clicked"] = False
303
+ #st.session_state["past_button_clicked"] = False
304
+ #st.session_state["button_clicked"] = True
305
+ runtext =st.text_area(inputNote, str(original_text2)[1:-1], height=300)
306
 
307
+ #if btnDailyNarrative:
308
+ #st.session_state["button_clicked"] = False
309
+ #st.session_state["past_button_clicked"] = False
310
+ #st.session_state["daily_button_clicked"] = True
311
 
312
 
313
 
 
334
  col1, col2 = st.columns([1,1])
335
 
336
  #to not show summary and references text for Past History and Daily Narrative
337
+ if btnAdmission :
338
+
339
+ #st.session_state["daily_button_clicked"] = False
340
  st.session_state["past_button_clicked"] = False
341
+ #st.session_state["button_clicked"] = True
342
+
343
+
344
+ with st.container():
345
+ with col1:
346
+ st.button('Summarize')
347
+ run_model(runtext)
348
+ #sentences=runtext.split('.')
349
+ st.text_area('Reference text', str(reference_text), height=150)
350
+ with col2:
351
+ st.button('NER')
352
+ # ===== Adding the Disease/Chemical into a list =====
353
+ problem_entities = list(dedupe([t for t in doc0.ents if t.label_ == 'DISEASE']))
354
+ medication_entities = list(dedupe([t for t in doc0.ents if t.label_ == 'CHEMICAL']))
355
+ st.markdown('**CHIEF COMPLAINT:**')
356
+ st.write(str(AdmissionChiefCom)[1:-1])
357
+ st.markdown('**ADMISSION DIAGNOSIS:**')
358
+ st.markdown(str(diagnosis)[1:-1].capitalize())
359
+ st.markdown('**PROBLEM/ISSUE**')
360
+ #st.markdown(problem_entities)
361
+ st.markdown(f'<p style="background-color:PINK;color:#080808;font-size:16px;">{str(problem_entities)[1:-1]}</p>', unsafe_allow_html=True)
362
+ #genEntities(trans_df, 'DISEASE')
363
+ st.markdown('**MEDICATION**')
364
+ st.markdown(f'<p style="background-color:orange;color:#080808;font-size:16px;">{str(medication_entities)[1:-1]}</p>', unsafe_allow_html=True)
365
+ #genEntities(trans_df, 'CHEMICAL')
366
+ #st.table(trans_df)
367
+ st.markdown('**NER**')
368
+ with st.expander("See NER Details"):
369
+ st.markdown(ent_html, unsafe_allow_html=True)
370
+
371
 
372
+ elif btnDailyNarrative :
373
+ # st.session_state["daily_button_clicked"] = True
374
  st.session_state["past_button_clicked"] = False
375
+ # st.session_state["button_clicked"] = False
376
 
377
  with st.container():
378
  st.markdown('Daily Progress Note (24 hour event only):')
 
387
  #else:
388
  elif btnPastHistory or st.session_state["past_button_clicked"]:
389
  st.session_state["past_button_clicked"] = True
390
+ # st.session_state["button_clicked"] = False
391
+ # st.session_state["daily_button_clicked"] = False
392
  # ===== Adding the Disease/Chemical into a list =====
393
  problem_entities = list(dedupe([t for t in doc0.ents if t.label_ == 'DISEASE']))
394
  medication_entities = list(dedupe([t for t in doc0.ents if t.label_ == 'CHEMICAL']))