Spaces:
Build error
Build error
Update pages/1_Admission.py
Browse files- pages/1_Admission.py +40 -5
pages/1_Admission.py
CHANGED
@@ -8,6 +8,35 @@ import spacy
|
|
8 |
from spacy import displacy
|
9 |
import en_ner_bc5cdr_md
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
# Store the initial value of widgets in session state
|
12 |
if "visibility" not in st.session_state:
|
13 |
st.session_state.visibility = "visible"
|
@@ -69,14 +98,20 @@ admissionid =col4.write(f"Admission ID: {HospitalAdmission} ")
|
|
69 |
col1, col2, col3, col4 = st.columns(4)
|
70 |
with col1:
|
71 |
# st.button('Admission')
|
72 |
-
st.button("🏥 Admission")
|
|
|
|
|
73 |
with col2:
|
74 |
-
st.button('📆Daily Narrative')
|
|
|
|
|
75 |
with col3:
|
76 |
-
st.button('Discharge Plan')
|
|
|
77 |
with col4:
|
78 |
-
st.button('📝Social Notes')
|
79 |
-
|
|
|
80 |
|
81 |
# Query out relevant Clinical notes
|
82 |
original_text = df.query(
|
|
|
8 |
from spacy import displacy
|
9 |
import en_ner_bc5cdr_md
|
10 |
|
11 |
+
|
12 |
+
from streamlit.components.v1 import html
|
13 |
+
|
14 |
+
def nav_page(page_name, timeout_secs=3):
|
15 |
+
nav_script = """
|
16 |
+
<script type="text/javascript">
|
17 |
+
function attempt_nav_page(page_name, start_time, timeout_secs) {
|
18 |
+
var links = window.parent.document.getElementsByTagName("a");
|
19 |
+
for (var i = 0; i < links.length; i++) {
|
20 |
+
if (links[i].href.toLowerCase().endsWith("/" + page_name.toLowerCase())) {
|
21 |
+
links[i].click();
|
22 |
+
return;
|
23 |
+
}
|
24 |
+
}
|
25 |
+
var elasped = new Date() - start_time;
|
26 |
+
if (elasped < timeout_secs * 1000) {
|
27 |
+
setTimeout(attempt_nav_page, 100, page_name, start_time, timeout_secs);
|
28 |
+
} else {
|
29 |
+
alert("Unable to navigate to page '" + page_name + "' after " + timeout_secs + " second(s).");
|
30 |
+
}
|
31 |
+
}
|
32 |
+
window.addEventListener("load", function() {
|
33 |
+
attempt_nav_page("%s", new Date(), %d);
|
34 |
+
});
|
35 |
+
</script>
|
36 |
+
""" % (page_name, timeout_secs)
|
37 |
+
html(nav_script)
|
38 |
+
|
39 |
+
|
40 |
# Store the initial value of widgets in session state
|
41 |
if "visibility" not in st.session_state:
|
42 |
st.session_state.visibility = "visible"
|
|
|
98 |
col1, col2, col3, col4 = st.columns(4)
|
99 |
with col1:
|
100 |
# st.button('Admission')
|
101 |
+
if st.button("🏥 Admission"):
|
102 |
+
nav_page('Admission')
|
103 |
+
|
104 |
with col2:
|
105 |
+
if st.button('📆Daily Narrative'):
|
106 |
+
nav_page('Daily Narrative')
|
107 |
+
|
108 |
with col3:
|
109 |
+
if st.button('Discharge Plan'):
|
110 |
+
nav_pages('Discharge Plan')
|
111 |
with col4:
|
112 |
+
if st.button('📝Social Notes'):
|
113 |
+
nav_page('Social Notes')
|
114 |
+
|
115 |
|
116 |
# Query out relevant Clinical notes
|
117 |
original_text = df.query(
|