Spaces:
Build error
Build error
Update app.py
Browse files
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 =
|
| 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
|
| 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,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
|
| 338 |
-
|
|
|
|
| 339 |
st.session_state["past_button_clicked"] = False
|
| 340 |
-
st.session_state["button_clicked"] = True
|
| 341 |
-
|
| 342 |
-
|
| 343 |
-
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
st.
|
| 366 |
-
|
|
|
|
|
|
|
|
|
|
| 367 |
|
| 368 |
-
elif btnDailyNarrative
|
| 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']))
|