medicafe 0.250816.0__py3-none-any.whl → 0.250818.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 CHANGED
@@ -735,7 +735,7 @@ if __name__ == "__main__":
735
735
  print(msg)
736
736
  print("-" * 60)
737
737
 
738
- proceed, selected_patient_ids, selected_indices, fixed_values = user_interaction(csv_data, interaction_mode, error_message, reverse_mapping)
738
+ proceed, selected_patient_ids, selected_indices, fixed_values, is_medicare = user_interaction(csv_data, interaction_mode, error_message, reverse_mapping)
739
739
 
740
740
  if proceed:
741
741
  # Filter csv_data for selected patients from Triage mode
@@ -767,9 +767,10 @@ if __name__ == "__main__":
767
767
  patient_info.append(('Unknown Date', patient_name, patient_id, 'N/A', None)) # Append with 'Unknown Date' if there's an error
768
768
 
769
769
  # Display existing patients table using the enhanced display function
770
+ patient_type = "MEDICARE" if is_medicare else "PRIVATE"
770
771
  MediBot_UI.display_enhanced_patient_table(
771
772
  patient_info,
772
- "NOTE: The following patient(s) already EXIST in the system but may have new dates of service.\n Their diagnosis codes may need to be updated manually by the user to the following list:",
773
+ "{} PATIENTS - EXISTING: The following patient(s) already EXIST in the system but may have new dates of service.\n Their diagnosis codes may need to be updated manually by the user to the following list:".format(patient_type),
773
774
  show_line_numbers=False
774
775
  )
775
776
 
@@ -787,9 +788,10 @@ if __name__ == "__main__":
787
788
  new_patient_info.extend(patient_entries)
788
789
 
789
790
  # Display new patients table using the enhanced display function
791
+ patient_type = "MEDICARE" if is_medicare else "PRIVATE"
790
792
  MediBot_UI.display_enhanced_patient_table(
791
793
  new_patient_info,
792
- "NOTE: The following NEW patient(s) will be automatically entered into Medisoft:",
794
+ "{} PATIENTS - NEW: The following patient(s) will be automatically entered into Medisoft:".format(patient_type),
793
795
  show_line_numbers=True
794
796
  )
795
797
 
@@ -1378,6 +1378,35 @@ def map_payer_ids_to_insurance_ids(patient_id_to_insurance_id, payer_id_to_patie
1378
1378
  }
1379
1379
  return payer_id_to_details
1380
1380
 
1381
+ def _display_mains_file_error(mains_path):
1382
+ """
1383
+ Helper function to display the critical MAINS file error message.
1384
+
1385
+ Args:
1386
+ mains_path (str): The path where the MAINS file was expected to be found.
1387
+ """
1388
+ error_msg = "CRITICAL: MAINS file not found at: {}. This file is required for insurance name to Medisoft ID mapping.".format(mains_path)
1389
+ if hasattr(MediLink_ConfigLoader, 'log'):
1390
+ MediLink_ConfigLoader.log(error_msg, level="CRITICAL")
1391
+ print("\n" + "="*80)
1392
+ print("CRITICAL ERROR: MAINS FILE MISSING")
1393
+ print("="*80)
1394
+ print("\nThe MAINS file is required for the following critical functions:")
1395
+ print("* Mapping insurance company names to Medisoft IDs")
1396
+ print("* Converting insurance names to payer IDs for claim submission")
1397
+ print("* Creating properly formatted 837p claim files")
1398
+ print("\nWithout this file, claim submission will fail because:")
1399
+ print("* Insurance names cannot be converted to payer IDs")
1400
+ print("* 837p claim files cannot be generated")
1401
+ print("* Claims cannot be submitted to insurance companies")
1402
+ print("\nTO FIX THIS:")
1403
+ print("1. Ensure the MAINS file exists at: {}".format(mains_path))
1404
+ print("2. If the file is missing, llamar a Dani")
1405
+ print("3. The file should contain insurance company data from your Medisoft system")
1406
+ print("="*80)
1407
+ time.sleep(3) # 3 second pause to allow user to read critical error message
1408
+
1409
+
1381
1410
  def load_insurance_data_from_mains(config):
1382
1411
  """
1383
1412
  Loads insurance data from MAINS and creates a mapping from insurance names to their respective IDs.
@@ -1421,25 +1450,7 @@ def load_insurance_data_from_mains(config):
1421
1450
  try:
1422
1451
  # Check if MAINS file exists before attempting to read
1423
1452
  if not os.path.exists(mains_path):
1424
- error_msg = "CRITICAL: MAINS file not found at: {}. This file is required for insurance name to Medisoft ID mapping.".format(mains_path)
1425
- if hasattr(MediLink_ConfigLoader, 'log'):
1426
- MediLink_ConfigLoader.log(error_msg, level="CRITICAL")
1427
- print("\n" + "="*80)
1428
- print("CRITICAL ERROR: MAINS FILE MISSING")
1429
- print("="*80)
1430
- print("\nThe MAINS file is required for the following critical functions:")
1431
- print("* Mapping insurance company names to Medisoft IDs")
1432
- print("* Converting insurance names to payer IDs for claim submission")
1433
- print("* Creating properly formatted 837p claim files")
1434
- print("\nWithout this file, claim submission will fail because:")
1435
- print("* Insurance names cannot be converted to payer IDs")
1436
- print("* 837p claim files cannot be generated")
1437
- print("* Claims cannot be submitted to insurance companies")
1438
- print("\nTO FIX THIS:")
1439
- print("1. Ensure the MAINS file exists at: {}".format(mains_path))
1440
- print("2. If the file is missing, llamar a Dani")
1441
- print("3. The file should contain insurance company data from your Medisoft system")
1442
- print("="*80)
1453
+ _display_mains_file_error(mains_path)
1443
1454
  return insurance_to_id
1444
1455
 
1445
1456
  # XP Compatibility: Check if MediLink_DataMgmt has the required function
@@ -1459,25 +1470,7 @@ def load_insurance_data_from_mains(config):
1459
1470
  print("Successfully loaded {} insurance records from MAINS".format(len(insurance_to_id)))
1460
1471
 
1461
1472
  except FileNotFoundError:
1462
- error_msg = "CRITICAL: MAINS file not found: {}. This file is required for insurance name to Medisoft ID mapping.".format(mains_path)
1463
- if hasattr(MediLink_ConfigLoader, 'log'):
1464
- MediLink_ConfigLoader.log(error_msg, level="CRITICAL")
1465
- print("\n" + "="*80)
1466
- print("CRITICAL ERROR: MAINS FILE MISSING")
1467
- print("="*80)
1468
- print("\nThe MAINS file is required for the following critical functions:")
1469
- print("* Mapping insurance company names to Medisoft IDs")
1470
- print("* Converting insurance names to payer IDs for claim submission")
1471
- print("* Creating properly formatted 837p claim files")
1472
- print("\nWithout this file, claim submission will fail because:")
1473
- print("* Insurance names cannot be converted to payer IDs")
1474
- print("* 837p claim files cannot be generated")
1475
- print("* Claims cannot be submitted to insurance companies")
1476
- print("\nTO FIX THIS:")
1477
- print("1. Ensure the MAINS file exists at: {}".format(mains_path))
1478
- print("2. If the file is missing, llamar a Dani")
1479
- print("3. The file should contain insurance company data from your Medisoft system")
1480
- print("="*80)
1473
+ _display_mains_file_error(mains_path)
1481
1474
  except Exception as e:
1482
1475
  error_msg = "Error loading MAINS data: {}. Continuing without MAINS data.".format(str(e))
1483
1476
  if hasattr(MediLink_ConfigLoader, 'log'):
MediBot/MediBot_UI.py CHANGED
@@ -316,6 +316,10 @@ def display_patient_selection_menu(csv_data, reverse_mapping, proceed_as_medicar
316
316
  selected_patient_ids = []
317
317
  selected_indices = []
318
318
 
319
+ # TODO: Future enhancement - make this configurable via config file
320
+ # Example: config.get('silent_initial_selection', True)
321
+ SILENT_INITIAL_SELECTION = True # Set to False to restore original interactive behavior
322
+
319
323
  def display_menu_header(title):
320
324
  print("\n" + "-" * 60)
321
325
  print(title)
@@ -348,7 +352,10 @@ def display_patient_selection_menu(csv_data, reverse_mapping, proceed_as_medicar
348
352
  formatted_date = surgery_date.strftime('%m-%d')
349
353
  except Exception:
350
354
  formatted_date = str(surgery_date)
351
- print("{0:03d}: {3} (ID: {2}) {1} ".format(index+1, patient_name, patient_id, formatted_date))
355
+
356
+ # Only display if not in silent mode
357
+ if not SILENT_INITIAL_SELECTION:
358
+ print("{0:03d}: {3} (ID: {2}) {1} ".format(index+1, patient_name, patient_id, formatted_date))
352
359
 
353
360
  displayed_indices.append(index)
354
361
  displayed_patient_ids.append(patient_id)
@@ -356,23 +363,44 @@ def display_patient_selection_menu(csv_data, reverse_mapping, proceed_as_medicar
356
363
  return displayed_indices, displayed_patient_ids
357
364
 
358
365
  if proceed_as_medicare:
359
- display_menu_header("MEDICARE Patient Selection for Today's Data Entry")
366
+ if not SILENT_INITIAL_SELECTION:
367
+ display_menu_header("MEDICARE Patient Selection for Today's Data Entry")
360
368
  selected_indices, selected_patient_ids = display_patient_list(csv_data, reverse_mapping, medicare_filter=True)
361
369
  else:
362
- display_menu_header("PRIVATE Patient Selection for Today's Data Entry")
370
+ if not SILENT_INITIAL_SELECTION:
371
+ display_menu_header("PRIVATE Patient Selection for Today's Data Entry")
363
372
  selected_indices, selected_patient_ids = display_patient_list(csv_data, reverse_mapping, exclude_medicare=True)
364
373
 
365
- print("-" * 60)
366
- proceed = input("\nDo you want to proceed with the selected patients? (yes/no): ").lower().strip() in ['yes', 'y']
374
+ if not SILENT_INITIAL_SELECTION:
375
+ print("-" * 60)
376
+ proceed = input("\nDo you want to proceed with the selected patients? (yes/no): ").lower().strip() in ['yes', 'y']
377
+ else:
378
+ # Auto-confirm in silent mode
379
+ proceed = True
367
380
 
368
381
  if not proceed:
369
- display_menu_header("Patient Selection for Today's Data Entry")
370
- selected_indices, selected_patient_ids = display_patient_list(csv_data, reverse_mapping)
371
- print("-" * 60)
372
-
373
- while True:
382
+ if not SILENT_INITIAL_SELECTION:
383
+ display_menu_header("Patient Selection for Today's Data Entry")
384
+ selected_indices, selected_patient_ids = display_patient_list(csv_data, reverse_mapping)
385
+ print("-" * 60)
386
+
374
387
  while True:
375
- selection = input("\nEnter the number(s) of the patients you wish to proceed with\n(e.g., 1, 3, 5): ").strip()
388
+ while True:
389
+ selection = input("\nEnter the number(s) of the patients you wish to proceed with\n(e.g., 1, 3, 5): ").strip()
390
+ if not selection:
391
+ print("Invalid entry. Please provide at least one number.")
392
+ continue
393
+
394
+ selection = selection.replace('.', ',') # Replace '.' with ',' in the user input just in case
395
+ selected_indices = [int(x.strip()) - 1 for x in selection.split(',') if x.strip().isdigit()]
396
+
397
+ if not selected_indices:
398
+ print("Invalid entry. Please provide at least one integer.")
399
+ continue
400
+
401
+ proceed = True
402
+ break
403
+
376
404
  if not selection:
377
405
  print("Invalid entry. Please provide at least one number.")
378
406
  continue
@@ -386,20 +414,6 @@ def display_patient_selection_menu(csv_data, reverse_mapping, proceed_as_medicar
386
414
 
387
415
  proceed = True
388
416
  break
389
-
390
- if not selection:
391
- print("Invalid entry. Please provide at least one number.")
392
- continue
393
-
394
- selection = selection.replace('.', ',') # Replace '.' with ',' in the user input just in case
395
- selected_indices = [int(x.strip()) - 1 for x in selection.split(',') if x.strip().isdigit()]
396
-
397
- if not selected_indices:
398
- print("Invalid entry. Please provide at least one integer.")
399
- continue
400
-
401
- proceed = True
402
- break
403
417
 
404
418
  patient_id_header = reverse_mapping['Patient ID #2']
405
419
  selected_patient_ids = [csv_data[i][patient_id_header] for i in selected_indices if i < len(csv_data)]
@@ -498,6 +512,15 @@ def user_interaction(csv_data, interaction_mode, error_message, reverse_mapping)
498
512
  fixed_values.update(medicare_added_fixed_values) # Add any medicare-specific fixed values from config
499
513
 
500
514
  proceed, selected_patient_ids, selected_indices = display_patient_selection_menu(csv_data, reverse_mapping, response in ['yes', 'y'])
501
- return proceed, selected_patient_ids, selected_indices, fixed_values
502
-
503
- return handle_user_interaction(interaction_mode, error_message)
515
+ is_medicare = response in ['yes', 'y']
516
+ return proceed, selected_patient_ids, selected_indices, fixed_values, is_medicare
517
+
518
+ # For non-triage modes (error, normal), return a compatible structure
519
+ # The is_medicare value is not relevant in these modes, so we'll use a default
520
+ result = handle_user_interaction(interaction_mode, error_message)
521
+ if isinstance(result, int):
522
+ # This is a control value (-1, 1, -2), return with default values
523
+ return False, [], [], {}, False # proceed=False, empty lists, empty dict, is_medicare=False
524
+ else:
525
+ # Unexpected return type, handle gracefully
526
+ return False, [], [], {}, False
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.250816.0"
22
+ __version__ = "0.250818.0"
23
23
  __author__ = "Daniel Vidaud"
24
24
  __email__ = "daniel@personalizedtransformation.com"
25
25