medicafe 0.250822.3__py3-none-any.whl → 0.250912.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- MediBot/MediBot.py +11 -4
- MediBot/MediBot_Crosswalk_Library.py +15 -2
- MediBot/MediBot_Crosswalk_Utils.py +12 -2
- MediBot/MediBot_Preprocessor_lib.py +1821 -1728
- MediBot/MediBot_docx_decoder.py +14 -3
- MediBot/__init__.py +1 -1
- MediCafe/MediLink_ConfigLoader.py +12 -1
- MediCafe/__init__.py +1 -1
- MediCafe/core_utils.py +8 -1
- MediCafe/deductible_utils.py +1233 -0
- MediLink/MediLink_837p_encoder_library.py +123 -39
- MediLink/MediLink_Deductible.py +524 -649
- MediLink/MediLink_Deductible_Validator.py +9 -3
- MediLink/MediLink_Display_Utils.py +44 -6
- MediLink/MediLink_Gmail.py +53 -1
- MediLink/MediLink_UI.py +20 -2
- MediLink/__init__.py +1 -1
- MediLink/webapp.html +1 -0
- {medicafe-0.250822.3.dist-info → medicafe-0.250912.0.dist-info}/METADATA +1 -1
- {medicafe-0.250822.3.dist-info → medicafe-0.250912.0.dist-info}/RECORD +24 -23
- {medicafe-0.250822.3.dist-info → medicafe-0.250912.0.dist-info}/LICENSE +0 -0
- {medicafe-0.250822.3.dist-info → medicafe-0.250912.0.dist-info}/WHEEL +0 -0
- {medicafe-0.250822.3.dist-info → medicafe-0.250912.0.dist-info}/entry_points.txt +0 -0
- {medicafe-0.250822.3.dist-info → medicafe-0.250912.0.dist-info}/top_level.txt +0 -0
MediBot/MediBot_docx_decoder.py
CHANGED
@@ -80,7 +80,7 @@ _DAY_MAP = {
|
|
80
80
|
}
|
81
81
|
|
82
82
|
|
83
|
-
def parse_docx(filepath, surgery_dates): # Accept surgery_dates as a parameter
|
83
|
+
def parse_docx(filepath, surgery_dates, capture_schedule_positions=False): # Accept surgery_dates as a parameter
|
84
84
|
if Document is None:
|
85
85
|
MediLink_ConfigLoader.log("docx module not available, cannot parse .docx files", level="WARNING")
|
86
86
|
return {}
|
@@ -99,6 +99,7 @@ def parse_docx(filepath, surgery_dates): # Accept surgery_dates as a parameter
|
|
99
99
|
return {}
|
100
100
|
|
101
101
|
patient_data = OrderedDict() # Initialize OrderedDict to store data
|
102
|
+
schedule_positions = {} # NEW: Track patient order in schedule
|
102
103
|
MediLink_ConfigLoader.log("Extracting Date of Service from {}".format(filepath), level="DEBUG")
|
103
104
|
|
104
105
|
# TIMING: Start date extraction
|
@@ -134,7 +135,7 @@ def parse_docx(filepath, surgery_dates): # Accept surgery_dates as a parameter
|
|
134
135
|
|
135
136
|
for table in doc.tables: # Iterate over tables in the document
|
136
137
|
tables_processed += 1
|
137
|
-
for row in table.rows:
|
138
|
+
for row_idx, row in enumerate(table.rows):
|
138
139
|
rows_processed += 1
|
139
140
|
cells = [cell.text.strip() for cell in row.cells]
|
140
141
|
if len(cells) > 4 and cells[3].startswith('#'):
|
@@ -152,6 +153,12 @@ def parse_docx(filepath, surgery_dates): # Accept surgery_dates as a parameter
|
|
152
153
|
MediLink_ConfigLoader.log("Duplicate entry for patient ID {} on date {}. Skipping.".format(patient_id, date_of_service), level="WARNING")
|
153
154
|
else:
|
154
155
|
patient_data[patient_id][date_of_service] = [diagnosis_code, left_or_right_eye, femto_yes_or_no]
|
156
|
+
|
157
|
+
# NEW: Store schedule position if requested
|
158
|
+
if capture_schedule_positions:
|
159
|
+
if patient_id not in schedule_positions:
|
160
|
+
schedule_positions[patient_id] = {}
|
161
|
+
schedule_positions[patient_id][date_of_service] = row_idx
|
155
162
|
except Exception as e:
|
156
163
|
MediLink_ConfigLoader.log("Error processing row: {}. Error: {}".format(cells, e), level="ERROR")
|
157
164
|
|
@@ -183,7 +190,11 @@ def parse_docx(filepath, surgery_dates): # Accept surgery_dates as a parameter
|
|
183
190
|
print(" * Validation: {:.3f}s".format(validation_duration))
|
184
191
|
print(" * Total: {:.3f}s".format(total_duration))
|
185
192
|
|
186
|
-
|
193
|
+
# Return both data structures if schedule positions were captured
|
194
|
+
if capture_schedule_positions:
|
195
|
+
return patient_data, schedule_positions
|
196
|
+
else:
|
197
|
+
return patient_data
|
187
198
|
|
188
199
|
|
189
200
|
def validate_unknown_entries(patient_data):
|
MediBot/__init__.py
CHANGED
@@ -32,7 +32,18 @@ def get_default_config():
|
|
32
32
|
'logging': {
|
33
33
|
'level': 'INFO',
|
34
34
|
'console_output': True
|
35
|
-
}
|
35
|
+
},
|
36
|
+
# STRATEGIC NOTE (COB Configuration): COB library is fully implemented and ready
|
37
|
+
# To enable COB functionality, add the following configuration:
|
38
|
+
# 'cob_settings': {
|
39
|
+
# 'enabled': False, # Set to True to activate COB processing
|
40
|
+
# 'medicare_payer_ids': ['00850', 'MEDICARE', 'CMS', 'MCARE'],
|
41
|
+
# 'cob_mode': 'single_payer_only', # or 'multi_payer_supported'
|
42
|
+
# 'validation_level': 3, # SNIP level 3+ recommended for COB
|
43
|
+
# 'medicare_advantage_identifiers': ['MA', 'MC'],
|
44
|
+
# 'default_medicare_type': 'MB',
|
45
|
+
# 'require_835_validation': False # Set True for production
|
46
|
+
# }
|
36
47
|
}
|
37
48
|
}
|
38
49
|
|
MediCafe/__init__.py
CHANGED
MediCafe/core_utils.py
CHANGED
@@ -726,4 +726,11 @@ def check_ascii_files(paths):
|
|
726
726
|
except Exception:
|
727
727
|
# If a failure occurs mid-scan, return what we have so far
|
728
728
|
return problematic
|
729
|
-
return problematic
|
729
|
+
return problematic
|
730
|
+
|
731
|
+
def sanitize_log(message):
|
732
|
+
# Simple masking: replace DOB-like with ****-**-**, IDs with last4
|
733
|
+
import re
|
734
|
+
message = re.sub(r'\d{4}-\d{2}-\d{2}', '****-**-**', message) # DOB
|
735
|
+
message = re.sub(r'\d{9,}', lambda m: '***' + m.group(0)[-4:], message) # IDs
|
736
|
+
return message
|