Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -34,13 +34,15 @@ def load_icd_codes_from_files():
|
|
34 |
file_path = os.path.join(directory_path, file_name)
|
35 |
with open(file_path, "r", encoding="utf-8") as file:
|
36 |
for line in file:
|
37 |
-
|
38 |
-
|
|
|
39 |
code = parts[0].strip()
|
40 |
description = parts[1].strip()
|
41 |
icd_codes[code] = description
|
42 |
else:
|
43 |
print(f"Directory {directory_path} does not exist!")
|
|
|
44 |
return icd_codes
|
45 |
|
46 |
# Load CPT codes from files
|
@@ -54,13 +56,15 @@ def load_cpt_codes_from_files():
|
|
54 |
file_path = os.path.join(directory_path, file_name)
|
55 |
with open(file_path, "r", encoding="utf-8") as file:
|
56 |
for line in file:
|
57 |
-
|
58 |
-
|
|
|
59 |
code = parts[0].strip()
|
60 |
description = parts[1].strip()
|
61 |
cpt_codes[code] = description
|
62 |
else:
|
63 |
print(f"Directory {directory_path} does not exist!")
|
|
|
64 |
return cpt_codes
|
65 |
|
66 |
# Load ICD and CPT codes dynamically
|
|
|
34 |
file_path = os.path.join(directory_path, file_name)
|
35 |
with open(file_path, "r", encoding="utf-8") as file:
|
36 |
for line in file:
|
37 |
+
# Split the line into code and description
|
38 |
+
parts = line.strip().split(maxsplit=1)
|
39 |
+
if len(parts) == 2:
|
40 |
code = parts[0].strip()
|
41 |
description = parts[1].strip()
|
42 |
icd_codes[code] = description
|
43 |
else:
|
44 |
print(f"Directory {directory_path} does not exist!")
|
45 |
+
|
46 |
return icd_codes
|
47 |
|
48 |
# Load CPT codes from files
|
|
|
56 |
file_path = os.path.join(directory_path, file_name)
|
57 |
with open(file_path, "r", encoding="utf-8") as file:
|
58 |
for line in file:
|
59 |
+
# Split the line into code and description
|
60 |
+
parts = line.strip().split(maxsplit=1)
|
61 |
+
if len(parts) == 2:
|
62 |
code = parts[0].strip()
|
63 |
description = parts[1].strip()
|
64 |
cpt_codes[code] = description
|
65 |
else:
|
66 |
print(f"Directory {directory_path} does not exist!")
|
67 |
+
|
68 |
return cpt_codes
|
69 |
|
70 |
# Load ICD and CPT codes dynamically
|