carisackc commited on
Commit
23c3992
β€’
1 Parent(s): 75dc831

Delete pages

Browse files
pages/1_πŸ₯_Admission.py DELETED
@@ -1,174 +0,0 @@
1
- import streamlit as st
2
- import pandas as pd
3
- import numpy as np
4
- from math import ceil
5
- from collections import Counter
6
- from string import punctuation
7
- import spacy
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"
43
- st.session_state.disabled = False
44
-
45
- #nlp = en_core_web_lg.load()
46
- nlp = spacy.load("en_ner_bc5cdr_md")
47
-
48
- st.set_page_config(page_title ='πŸ₯ Admission',
49
- #page_icon= "Notes",
50
- layout='wide')
51
- st.title('Clinical Note Summarization - Admission')
52
- st.markdown(
53
- """
54
- <style>
55
- [data-testid="stSidebar"][aria-expanded="true"] > div:first-child {
56
- width: 400px;
57
- }
58
- [data-testid="stSidebar"][aria-expanded="false"] > div:first-child {
59
- width: 400px;
60
- margin-left: -230px;
61
- }
62
- </style>
63
- """,
64
- unsafe_allow_html=True,
65
- )
66
- st.sidebar.markdown('Using transformer model')
67
-
68
- ## Loading in dataset
69
- #df = pd.read_csv('mtsamples_small.csv',index_col=0)
70
- df = pd.read_csv('shpi_w_rouge21Nov.csv')
71
- df['HADM_ID'] = df['HADM_ID'].astype(str).apply(lambda x: x.replace('.0',''))
72
-
73
- #Renaming column
74
- df.rename(columns={'SUBJECT_ID':'Patient_ID',
75
- 'HADM_ID':'Admission_ID',
76
- 'hpi_input_text':'Original_Text',
77
- 'hpi_reference_summary':'Reference_text'}, inplace = True)
78
-
79
- #data.rename(columns={'gdp':'log(gdp)'}, inplace=True)
80
-
81
- #Filter selection
82
- st.sidebar.header("Search for Patient:")
83
-
84
- patientid = df['Patient_ID']
85
- patient = st.sidebar.selectbox('Select Patient ID:', patientid)
86
- admissionid = df['Admission_ID'].loc[df['Patient_ID'] == patient]
87
- HospitalAdmission = st.sidebar.selectbox('', admissionid)
88
-
89
- # List of Model available
90
- model = st.sidebar.selectbox('Select Model', ('BertSummarizer','BertGPT2','t5seq2eq','t5','gensim','pysummarizer'))
91
-
92
- col3,col4 = st.columns(2)
93
- patientid = col3.write(f"Patient ID: {patient} ")
94
- admissionid =col4.write(f"Admission ID: {HospitalAdmission} ")
95
-
96
-
97
- ##========= Buttons to the 4 tabs ========
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
- # Query out relevant Clinical notes
117
- original_text = df.query(
118
- "Patient_ID == @patient & Admission_ID == @HospitalAdmission"
119
- )
120
-
121
- original_text2 = original_text['Original_Text'].values
122
-
123
- runtext =st.text_area('Input Clinical Note here:', str(original_text2), height=300)
124
-
125
- reference_text = original_text['Reference_text'].values
126
-
127
- def run_model(input_text):
128
-
129
- if model == "BertSummarizer":
130
- output = original_text['BertSummarizer'].values
131
- st.write('Summary')
132
- st.success(output[0])
133
-
134
- elif model == "BertGPT2":
135
- output = original_text['BertGPT2'].values
136
- st.write('Summary')
137
- st.success(output[0])
138
-
139
-
140
- elif model == "t5seq2eq":
141
- output = original_text['t5seq2eq'].values
142
- st.write('Summary')
143
- st.success(output)
144
-
145
- elif model == "t5":
146
- output = original_text['t5'].values
147
- st.write('Summary')
148
- st.success(output)
149
-
150
- elif model == "gensim":
151
- output = original_text['gensim'].values
152
- st.write('Summary')
153
- st.success(output)
154
-
155
- elif model == "pysummarizer":
156
- output = original_text['pysummarizer'].values
157
- st.write('Summary')
158
- st.success(output)
159
-
160
- col1, col2 = st.columns([1,1])
161
-
162
- with col1:
163
- st.button('Summarize')
164
- run_model(runtext)
165
- sentences=runtext.split('.')
166
- st.text_area('Reference text', str(reference_text))#,label_visibility="hidden")
167
- with col2:
168
- st.button('NER')
169
- doc = nlp(str(original_text2))
170
- colors = { "DISEASE": "pink","CHEMICAL": "orange"}
171
- options = {"ents": [ "DISEASE", "CHEMICAL"],"colors": colors}
172
- ent_html = displacy.render(doc, style="ent", options=options)
173
- st.markdown(ent_html, unsafe_allow_html=True)
174
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pages/2_πŸ“†_Daily Narrative.py DELETED
@@ -1,174 +0,0 @@
1
- import streamlit as st
2
- import pandas as pd
3
- import numpy as np
4
- from math import ceil
5
- from collections import Counter
6
- from string import punctuation
7
- import spacy
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"
43
- st.session_state.disabled = False
44
-
45
- #nlp = en_core_web_lg.load()
46
- nlp = spacy.load("en_ner_bc5cdr_md")
47
-
48
- st.set_page_config(page_title ='πŸ“†Daily Narrative',
49
- #page_icon= "Notes",
50
- layout='wide')
51
- st.title('Clinical Note Summarization - πŸ“†Daily Narrative')
52
- st.markdown(
53
- """
54
- <style>
55
- [data-testid="stSidebar"][aria-expanded="true"] > div:first-child {
56
- width: 400px;
57
- }
58
- [data-testid="stSidebar"][aria-expanded="false"] > div:first-child {
59
- width: 400px;
60
- margin-left: -230px;
61
- }
62
- </style>
63
- """,
64
- unsafe_allow_html=True,
65
- )
66
- st.sidebar.markdown('Using transformer model')
67
-
68
- ## Loading in dataset
69
- #df = pd.read_csv('mtsamples_small.csv',index_col=0)
70
- df = pd.read_csv('shpi_w_rouge21Nov.csv')
71
- df['HADM_ID'] = df['HADM_ID'].astype(str).apply(lambda x: x.replace('.0',''))
72
-
73
- #Renaming column
74
- df.rename(columns={'SUBJECT_ID':'Patient_ID',
75
- 'HADM_ID':'Admission_ID',
76
- 'hpi_input_text':'Original_Text',
77
- 'hpi_reference_summary':'Reference_text'}, inplace = True)
78
-
79
- #data.rename(columns={'gdp':'log(gdp)'}, inplace=True)
80
-
81
- #Filter selection
82
- st.sidebar.header("Search for Patient:")
83
-
84
- patientid = df['Patient_ID']
85
- patient = st.sidebar.selectbox('Select Patient ID:', patientid)
86
- admissionid = df['Admission_ID'].loc[df['Patient_ID'] == patient]
87
- HospitalAdmission = st.sidebar.selectbox('', admissionid)
88
-
89
- # List of Model available
90
- model = st.sidebar.selectbox('Select Model', ('BertSummarizer','BertGPT2','t5seq2eq','t5','gensim','pysummarizer'))
91
-
92
- col3,col4 = st.columns(2)
93
- patientid = col3.write(f"Patient ID: {patient} ")
94
- admissionid =col4.write(f"Admission ID: {HospitalAdmission} ")
95
-
96
-
97
- ##========= Buttons to the 4 tabs ========
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
- # Query out relevant Clinical notes
117
- original_text = df.query(
118
- "Patient_ID == @patient & Admission_ID == @HospitalAdmission"
119
- )
120
-
121
- original_text2 = original_text['Original_Text'].values
122
-
123
- runtext =st.text_area('Input Clinical Note here:', str(original_text2), height=300)
124
-
125
- reference_text = original_text['Reference_text'].values
126
-
127
- def run_model(input_text):
128
-
129
- if model == "BertSummarizer":
130
- output = original_text['BertSummarizer'].values
131
- st.write('Summary')
132
- st.success(output[0])
133
-
134
- elif model == "BertGPT2":
135
- output = original_text['BertGPT2'].values
136
- st.write('Summary')
137
- st.success(output[0])
138
-
139
-
140
- elif model == "t5seq2eq":
141
- output = original_text['t5seq2eq'].values
142
- st.write('Summary')
143
- st.success(output)
144
-
145
- elif model == "t5":
146
- output = original_text['t5'].values
147
- st.write('Summary')
148
- st.success(output)
149
-
150
- elif model == "gensim":
151
- output = original_text['gensim'].values
152
- st.write('Summary')
153
- st.success(output)
154
-
155
- elif model == "pysummarizer":
156
- output = original_text['pysummarizer'].values
157
- st.write('Summary')
158
- st.success(output)
159
-
160
- col1, col2 = st.columns([1,1])
161
-
162
- with col1:
163
- if st.button('Summarize'):
164
- run_model(runtext)
165
- sentences=runtext.split('.')
166
- st.text_area('Reference text', str(reference_text))#,label_visibility="hidden")
167
- with col2:
168
- if st.button('NER'):
169
- doc = nlp(str(original_text2))
170
- colors = { "DISEASE": "pink","CHEMICAL": "orange"}
171
- options = {"ents": [ "DISEASE", "CHEMICAL"],"colors": colors}
172
- ent_html = displacy.render(doc, style="ent", options=options)
173
- st.markdown(ent_html, unsafe_allow_html=True)
174
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pages/3_πŸ—’οΈ_Discharge Plan.py DELETED
@@ -1,175 +0,0 @@
1
- import streamlit as st
2
- import pandas as pd
3
- import numpy as np
4
- from math import ceil
5
- from collections import Counter
6
- from string import punctuation
7
- import spacy
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"
43
- st.session_state.disabled = False
44
-
45
- #nlp = en_core_web_lg.load()
46
- nlp = spacy.load("en_ner_bc5cdr_md")
47
-
48
- st.set_page_config(page_title ='Discharge Plan',
49
- layout='wide')
50
-
51
- st.title('Clinical Note Summarization - Discharge Plan')
52
- st.markdown(
53
- """
54
- <style>
55
- [data-testid="stSidebar"][aria-expanded="true"] > div:first-child {
56
- width: 400px;
57
- }
58
- [data-testid="stSidebar"][aria-expanded="false"] > div:first-child {
59
- width: 400px;
60
- margin-left: -230px;
61
- }
62
- </style>
63
- """,
64
- unsafe_allow_html=True,
65
- )
66
- st.sidebar.markdown('Using transformer model')
67
-
68
- ## Loading in dataset
69
- #df = pd.read_csv('mtsamples_small.csv',index_col=0)
70
- df = pd.read_csv('shpi_w_rouge21Nov.csv')
71
- df['HADM_ID'] = df['HADM_ID'].astype(str).apply(lambda x: x.replace('.0',''))
72
-
73
- #Renaming column
74
- df.rename(columns={'SUBJECT_ID':'Patient_ID',
75
- 'HADM_ID':'Admission_ID',
76
- 'hpi_input_text':'Original_Text',
77
- 'hpi_reference_summary':'Reference_text'}, inplace = True)
78
-
79
- #data.rename(columns={'gdp':'log(gdp)'}, inplace=True)
80
-
81
- #Filter selection
82
- st.sidebar.header("Search for Patient:")
83
-
84
- patientid = df['Patient_ID']
85
- patient = st.sidebar.selectbox('Select Patient ID:', patientid)
86
- admissionid = df['Admission_ID'].loc[df['Patient_ID'] == patient]
87
- HospitalAdmission = st.sidebar.selectbox('', admissionid)
88
-
89
- # List of Model available
90
- model = st.sidebar.selectbox('Select Model', ('BertSummarizer','BertGPT2','t5seq2eq','t5','gensim','pysummarizer'))
91
-
92
- col3,col4 = st.columns(2)
93
- patientid = col3.write(f"Patient ID: {patient} ")
94
- admissionid =col4.write(f"Admission ID: {HospitalAdmission} ")
95
-
96
-
97
-
98
- ##========= Buttons to the 4 tabs ========
99
- col1, col2, col3, col4 = st.columns(4)
100
- with col1:
101
- # st.button('Admission')
102
- if st.button("πŸ₯ Admission"):
103
- nav_page('Admission')
104
-
105
- with col2:
106
- if st.button('πŸ“†Daily Narrative'):
107
- nav_page('Daily Narrative')
108
-
109
- with col3:
110
- if st.button('Discharge Plan'):
111
- nav_page('Discharge Plan')
112
- with col4:
113
- if st.button('πŸ“Social Notes'):
114
- nav_page('Social Notes')
115
-
116
-
117
- # Query out relevant Clinical notes
118
- original_text = df.query(
119
- "Patient_ID == @patient & Admission_ID == @HospitalAdmission"
120
- )
121
-
122
- original_text2 = original_text['Original_Text'].values
123
-
124
- runtext =st.text_area('Input Clinical Note here:', str(original_text2), height=300)
125
-
126
- reference_text = original_text['Reference_text'].values
127
-
128
- def run_model(input_text):
129
-
130
- if model == "BertSummarizer":
131
- output = original_text['BertSummarizer'].values
132
- st.write('Summary')
133
- st.success(output[0])
134
-
135
- elif model == "BertGPT2":
136
- output = original_text['BertGPT2'].values
137
- st.write('Summary')
138
- st.success(output[0])
139
-
140
-
141
- elif model == "t5seq2eq":
142
- output = original_text['t5seq2eq'].values
143
- st.write('Summary')
144
- st.success(output)
145
-
146
- elif model == "t5":
147
- output = original_text['t5'].values
148
- st.write('Summary')
149
- st.success(output)
150
-
151
- elif model == "gensim":
152
- output = original_text['gensim'].values
153
- st.write('Summary')
154
- st.success(output)
155
-
156
- elif model == "pysummarizer":
157
- output = original_text['pysummarizer'].values
158
- st.write('Summary')
159
- st.success(output)
160
-
161
- col1, col2 = st.columns([1,1])
162
-
163
- with col1:
164
- st.button('Summarize')
165
- run_model(runtext)
166
- sentences=runtext.split('.')
167
- st.text_area('Reference text', str(reference_text))#,label_visibility="hidden")
168
- with col2:
169
- st.button('NER')
170
- doc = nlp(str(original_text2))
171
- colors = { "DISEASE": "pink","CHEMICAL": "orange"}
172
- options = {"ents": [ "DISEASE", "CHEMICAL"],"colors": colors}
173
- ent_html = displacy.render(doc, style="ent", options=options)
174
- st.markdown(ent_html, unsafe_allow_html=True)
175
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
pages/4_πŸ“_Social Notes.py DELETED
@@ -1,175 +0,0 @@
1
- import streamlit as st
2
- import pandas as pd
3
- import numpy as np
4
- from math import ceil
5
- from collections import Counter
6
- from string import punctuation
7
- import spacy
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"
43
- st.session_state.disabled = False
44
-
45
- #nlp = en_core_web_lg.load()
46
- nlp = spacy.load("en_ner_bc5cdr_md")
47
-
48
- st.set_page_config(page_title ='πŸ“Social Notes',
49
- layout='wide')
50
-
51
- st.title('Clinical Note Summarization - πŸ“Social Notes')
52
- st.markdown(
53
- """
54
- <style>
55
- [data-testid="stSidebar"][aria-expanded="true"] > div:first-child {
56
- width: 400px;
57
- }
58
- [data-testid="stSidebar"][aria-expanded="false"] > div:first-child {
59
- width: 400px;
60
- margin-left: -230px;
61
- }
62
- </style>
63
- """,
64
- unsafe_allow_html=True,
65
- )
66
- st.sidebar.markdown('Using transformer model')
67
-
68
- ## Loading in dataset
69
- #df = pd.read_csv('mtsamples_small.csv',index_col=0)
70
- df = pd.read_csv('shpi_w_rouge21Nov.csv')
71
- df['HADM_ID'] = df['HADM_ID'].astype(str).apply(lambda x: x.replace('.0',''))
72
-
73
- #Renaming column
74
- df.rename(columns={'SUBJECT_ID':'Patient_ID',
75
- 'HADM_ID':'Admission_ID',
76
- 'hpi_input_text':'Original_Text',
77
- 'hpi_reference_summary':'Reference_text'}, inplace = True)
78
-
79
- #data.rename(columns={'gdp':'log(gdp)'}, inplace=True)
80
-
81
- #Filter selection
82
- st.sidebar.header("Search for Patient:")
83
-
84
- patientid = df['Patient_ID']
85
- patient = st.sidebar.selectbox('Select Patient ID:', patientid)
86
- admissionid = df['Admission_ID'].loc[df['Patient_ID'] == patient]
87
- HospitalAdmission = st.sidebar.selectbox('', admissionid)
88
-
89
- # List of Model available
90
- model = st.sidebar.selectbox('Select Model', ('BertSummarizer','BertGPT2','t5seq2eq','t5','gensim','pysummarizer'))
91
-
92
- col3,col4 = st.columns(2)
93
- patientid = col3.write(f"Patient ID: {patient} ")
94
- admissionid =col4.write(f"Admission ID: {HospitalAdmission} ")
95
-
96
-
97
- ##========= Buttons to the 4 tabs ========
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
118
- original_text = df.query(
119
- "Patient_ID == @patient & Admission_ID == @HospitalAdmission"
120
- )
121
-
122
- original_text2 = original_text['Original_Text'].values
123
-
124
- runtext =st.text_area('Input Clinical Note here:', str(original_text2), height=300)
125
-
126
- reference_text = original_text['Reference_text'].values
127
-
128
- def run_model(input_text):
129
-
130
- if model == "BertSummarizer":
131
- output = original_text['BertSummarizer'].values
132
- st.write('Summary')
133
- st.success(output[0])
134
-
135
- elif model == "BertGPT2":
136
- output = original_text['BertGPT2'].values
137
- st.write('Summary')
138
- st.success(output[0])
139
-
140
-
141
- elif model == "t5seq2eq":
142
- output = original_text['t5seq2eq'].values
143
- st.write('Summary')
144
- st.success(output)
145
-
146
- elif model == "t5":
147
- output = original_text['t5'].values
148
- st.write('Summary')
149
- st.success(output)
150
-
151
- elif model == "gensim":
152
- output = original_text['gensim'].values
153
- st.write('Summary')
154
- st.success(output)
155
-
156
- elif model == "pysummarizer":
157
- output = original_text['pysummarizer'].values
158
- st.write('Summary')
159
- st.success(output)
160
-
161
- col1, col2 = st.columns([1,1])
162
-
163
- with col1:
164
- st.button('Summarize')
165
- run_model(runtext)
166
- sentences=runtext.split('.')
167
- st.text_area('Reference text', str(reference_text))#,label_visibility="hidden")
168
- with col2:
169
- st.button('NER')
170
- doc = nlp(str(original_text2))
171
- colors = { "DISEASE": "pink","CHEMICAL": "orange"}
172
- options = {"ents": [ "DISEASE", "CHEMICAL"],"colors": colors}
173
- ent_html = displacy.render(doc, style="ent", options=options)
174
- st.markdown(ent_html, unsafe_allow_html=True)
175
-