carisackc commited on
Commit
3e41a45
·
1 Parent(s): c00882a

Update pages/4_Social Notes.py

Browse files
Files changed (1) hide show
  1. pages/4_Social Notes.py +40 -4
pages/4_Social Notes.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,13 +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
 
8
  from spacy import displacy
9
  import en_ner_bc5cdr_md
10
 
11
+ from streamlit.components.v1 import html
12
+
13
+ def nav_page(page_name, timeout_secs=3):
14
+ nav_script = """
15
+ <script type="text/javascript">
16
+ function attempt_nav_page(page_name, start_time, timeout_secs) {
17
+ var links = window.parent.document.getElementsByTagName("a");
18
+ for (var i = 0; i < links.length; i++) {
19
+ if (links[i].href.toLowerCase().endsWith("/" + page_name.toLowerCase())) {
20
+ links[i].click();
21
+ return;
22
+ }
23
+ }
24
+ var elasped = new Date() - start_time;
25
+ if (elasped < timeout_secs * 1000) {
26
+ setTimeout(attempt_nav_page, 100, page_name, start_time, timeout_secs);
27
+ } else {
28
+ alert("Unable to navigate to page '" + page_name + "' after " + timeout_secs + " second(s).");
29
+ }
30
+ }
31
+ window.addEventListener("load", function() {
32
+ attempt_nav_page("%s", new Date(), %d);
33
+ });
34
+ </script>
35
+ """ % (page_name, timeout_secs)
36
+ html(nav_script)
37
+
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_page('Discharge Plan')
111
  with col4:
112
+ if st.button('📝Social Notes'):
113
+ nav_page('Social Notes')
114
+
115
 
116
 
117
  # Query out relevant Clinical notes