forked from shams-sam/MedicalContextualHighlighter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
icd_wrapper.py
28 lines (25 loc) · 904 Bytes
/
icd_wrapper.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import sys
sys.path.append('/data/Discharge_Summary/Diagnosis_ICD/icd_lstm/')
sys.path.append('/data/Discharge_Summary/Diagnosis_ICD/app/')
sys.path.append('/data/Discharge_Summary/Diagnosis_ICD/logic-lab/TextPreprocessing/')
from lstm_stack import lstm_stack
class icd_wrapper:
def init(self):
self.lstm = lstm_stack()
self.lstm.load_models()
def get_icd(self, document):
codes = self.lstm.get_predictions(document)
accuracy = 1
code = ''
for e in codes[:2]:
code += e[0]
accuracy *= float(e[1])
return code + ":" + str(round(accuracy, 2))
def get_icd_and_score(self, document):
codes = self.lstm.get_predictions(document)
accuracy = 1
code = ''
for e in codes[:2]:
code += e[0]
accuracy *= float(e[1])
return code, str(round(accuracy, 2))