medicafe 0.250822.3__py3-none-any.whl → 0.250909.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.
@@ -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
- return patient_data
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
@@ -19,7 +19,7 @@ Smart Import Integration:
19
19
  medibot_main = get_components('medibot_main')
20
20
  """
21
21
 
22
- __version__ = "0.250822.3"
22
+ __version__ = "0.250909.0"
23
23
  __author__ = "Daniel Vidaud"
24
24
  __email__ = "daniel@personalizedtransformation.com"
25
25
 
@@ -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
@@ -27,7 +27,7 @@ Smart Import System:
27
27
  api_suite = get_api_access()
28
28
  """
29
29
 
30
- __version__ = "0.250822.3"
30
+ __version__ = "0.250909.0"
31
31
  __author__ = "Daniel Vidaud"
32
32
  __email__ = "daniel@personalizedtransformation.com"
33
33
 
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