Spaces:
Running
Running
meghanaraok
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -74,10 +74,10 @@ def predict_icd(text_input, model_name, label_count):
|
|
74 |
labels = []
|
75 |
values = []
|
76 |
if label_count == "50":
|
77 |
-
labels = ['38.9', '244.9', '250', '272', '272.4', '276.1', '276.2', '285.1', '285.9', '287.5', '305.1', '311', '33.24', '36.15', '37.22', '38.91', '38.93', '39.61', '39.95', '401.9', '403.
|
78 |
values = [0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0]
|
79 |
if label_count == "5":
|
80 |
-
labels = ['38.93', '401.
|
81 |
values = [1, 0, 0, 0, 0]
|
82 |
label_map = {i: label for i, label in enumerate(labels)}
|
83 |
data_dict = {label: [] for label in labels}
|
@@ -162,10 +162,8 @@ def predict_icd(text_input, model_name, label_count):
|
|
162 |
y_pred = "\n".join(y_pred)
|
163 |
label_dict_df = pd.read_csv("data/mimic3/"+label_count+"/labels_dictionary_"+label_count+"_level_1.csv")
|
164 |
|
165 |
-
label_dict_df['icd9_code'] = label_dict_df['icd9_code'].astype(float)
|
166 |
label_dict = label_dict_df.set_index('icd9_code')['long_title'].to_dict()
|
167 |
-
|
168 |
-
predicted_labels_with_titles = [(label, label_dict.get(str(label), "Not Found")) for label in predicted_labels_float]
|
169 |
|
170 |
html_output ="<h2>ICD Codes</h2>"
|
171 |
# for label, title in predicted_labels_with_titles:
|
|
|
74 |
labels = []
|
75 |
values = []
|
76 |
if label_count == "50":
|
77 |
+
labels = ['38.9', '244.9', '250.00', '272.0', '272.4', '276.1', '276.2', '285.1', '285.9', '287.5', '305.1', '311', '33.24', '36.15', '37.22', '38.91', '38.93', '39.61', '39.95', '401.9', '403.90', '410.71', '412', '414.01', '424.0', '427.31', '428.0', '45.13', '486', '496', '507.0', '511.9', '518.81', '530.81', '584.9', '585.9', '599.0', '88.56', '88.72', '93.9', '96.04', '96.6', '96.71', '96.72', '99.04', '99.15', '995.92', 'V15.82', 'V45.81', 'V58.61']
|
78 |
values = [0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0]
|
79 |
if label_count == "5":
|
80 |
+
labels = ['38.93', '401.90', '414.01', '427.31', '428.00']
|
81 |
values = [1, 0, 0, 0, 0]
|
82 |
label_map = {i: label for i, label in enumerate(labels)}
|
83 |
data_dict = {label: [] for label in labels}
|
|
|
162 |
y_pred = "\n".join(y_pred)
|
163 |
label_dict_df = pd.read_csv("data/mimic3/"+label_count+"/labels_dictionary_"+label_count+"_level_1.csv")
|
164 |
|
|
|
165 |
label_dict = label_dict_df.set_index('icd9_code')['long_title'].to_dict()
|
166 |
+
predicted_labels_with_titles = [(label, label_dict.get(str(label), "Not Found")) for label in predicted_labels]
|
|
|
167 |
|
168 |
html_output ="<h2>ICD Codes</h2>"
|
169 |
# for label, title in predicted_labels_with_titles:
|