medicafe 0.250728.8__py3-none-any.whl → 0.250805.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.

Potentially problematic release.


This version of medicafe might be problematic. Click here for more details.

Files changed (58) hide show
  1. MediBot/MediBot.bat +233 -19
  2. MediBot/MediBot.py +138 -46
  3. MediBot/MediBot_Crosswalk_Library.py +127 -623
  4. MediBot/MediBot_Crosswalk_Utils.py +618 -0
  5. MediBot/MediBot_Preprocessor.py +72 -17
  6. MediBot/MediBot_Preprocessor_lib.py +470 -76
  7. MediBot/MediBot_UI.py +32 -17
  8. MediBot/MediBot_dataformat_library.py +68 -20
  9. MediBot/MediBot_docx_decoder.py +120 -19
  10. MediBot/MediBot_smart_import.py +180 -0
  11. MediBot/__init__.py +89 -0
  12. MediBot/get_medicafe_version.py +25 -0
  13. MediBot/update_json.py +35 -6
  14. MediBot/update_medicafe.py +19 -1
  15. MediCafe/MediLink_ConfigLoader.py +160 -0
  16. MediCafe/__init__.py +171 -0
  17. MediCafe/__main__.py +222 -0
  18. MediCafe/api_core.py +1098 -0
  19. MediCafe/api_core_backup.py +427 -0
  20. MediCafe/api_factory.py +306 -0
  21. MediCafe/api_utils.py +356 -0
  22. MediCafe/core_utils.py +450 -0
  23. MediCafe/graphql_utils.py +445 -0
  24. MediCafe/logging_config.py +123 -0
  25. MediCafe/logging_demo.py +61 -0
  26. MediCafe/migration_helpers.py +463 -0
  27. MediCafe/smart_import.py +436 -0
  28. MediLink/MediLink.py +66 -26
  29. MediLink/MediLink_837p_cob_library.py +28 -28
  30. MediLink/MediLink_837p_encoder.py +33 -34
  31. MediLink/MediLink_837p_encoder_library.py +243 -151
  32. MediLink/MediLink_837p_utilities.py +129 -5
  33. MediLink/MediLink_API_Generator.py +83 -60
  34. MediLink/MediLink_API_v3.py +1 -1
  35. MediLink/MediLink_ClaimStatus.py +177 -31
  36. MediLink/MediLink_DataMgmt.py +405 -72
  37. MediLink/MediLink_Decoder.py +20 -1
  38. MediLink/MediLink_Deductible.py +155 -28
  39. MediLink/MediLink_Display_Utils.py +72 -0
  40. MediLink/MediLink_Down.py +127 -5
  41. MediLink/MediLink_Gmail.py +712 -653
  42. MediLink/MediLink_PatientProcessor.py +257 -0
  43. MediLink/MediLink_UI.py +85 -61
  44. MediLink/MediLink_Up.py +28 -4
  45. MediLink/MediLink_insurance_utils.py +227 -264
  46. MediLink/MediLink_main.py +248 -0
  47. MediLink/MediLink_smart_import.py +264 -0
  48. MediLink/__init__.py +93 -0
  49. MediLink/insurance_type_integration_test.py +66 -76
  50. MediLink/test.py +1 -1
  51. MediLink/test_timing.py +59 -0
  52. {medicafe-0.250728.8.dist-info → medicafe-0.250805.0.dist-info}/METADATA +1 -1
  53. medicafe-0.250805.0.dist-info/RECORD +81 -0
  54. medicafe-0.250805.0.dist-info/entry_points.txt +2 -0
  55. {medicafe-0.250728.8.dist-info → medicafe-0.250805.0.dist-info}/top_level.txt +1 -0
  56. medicafe-0.250728.8.dist-info/RECORD +0 -59
  57. {medicafe-0.250728.8.dist-info → medicafe-0.250805.0.dist-info}/LICENSE +0 -0
  58. {medicafe-0.250728.8.dist-info → medicafe-0.250805.0.dist-info}/WHEEL +0 -0
@@ -32,8 +32,8 @@ Key Implementation Notes:
32
32
  SEGMENT ORDER CONSTRAINTS:
33
33
  - 1000A: Submitter
34
34
  - 1000B: Receiver
35
- - 2000A2010AA: Billing provider
36
- - 2000B2010BA/BB: Subscriber and payer
35
+ - 2000A?2010AA: Billing provider
36
+ - 2000B?2010BA/BB: Subscriber and payer
37
37
  - 2300: Claim
38
38
  - 2320: Other subscriber info (COB)
39
39
  - 2330B: Prior payer
@@ -50,32 +50,32 @@ VALIDATION REQUIREMENTS:
50
50
 
51
51
  from datetime import datetime
52
52
  import sys, os
53
- from MediLink import MediLink_ConfigLoader
53
+
54
+ # Use core utilities for standardized imports
55
+ from MediCafe.core_utils import get_shared_config_loader
56
+ MediLink_ConfigLoader = get_shared_config_loader()
54
57
 
55
58
  project_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
56
59
  if project_dir not in sys.path:
57
60
  sys.path.append(project_dir)
58
61
 
59
- # Safe import for utility functions - works in multiple contexts
62
+ # Import utility functions - absolute imports only
60
63
  try:
61
- from .MediLink_837p_utilities import convert_date_format
62
- except (ImportError, SystemError):
63
- try:
64
- from MediLink_837p_utilities import convert_date_format
65
- except ImportError as e:
66
- # Fallback implementation for convert_date_format if utilities module is not available
67
- MediLink_ConfigLoader.log("Warning: Could not import utilities functions: {}".format(e), level="WARNING")
68
- def convert_date_format(date_str):
69
- """Fallback date format conversion function"""
70
- try:
71
- # Parse the input date string into a datetime object
72
- input_format = "%m-%d-%Y" if len(date_str) == 10 else "%m-%d-%y"
73
- date_obj = datetime.strptime(date_str, input_format)
74
- # Format the datetime object into the desired output format
75
- return date_obj.strftime("%Y%m%d")
76
- except (ValueError, TypeError):
77
- # Return original string if conversion fails
78
- return date_str
64
+ from MediLink_837p_utilities import convert_date_format
65
+ except ImportError as e:
66
+ # Fallback implementation for convert_date_format if utilities module is not available
67
+ MediLink_ConfigLoader.log("Warning: Could not import utilities functions: {}".format(e), level="WARNING")
68
+ def convert_date_format(date_str):
69
+ """Fallback date format conversion function"""
70
+ try:
71
+ # Parse the input date string into a datetime object
72
+ input_format = "%m-%d-%Y" if len(date_str) == 10 else "%m-%d-%y"
73
+ date_obj = datetime.strptime(date_str, input_format)
74
+ # Format the datetime object into the desired output format
75
+ return date_obj.strftime("%Y%m%d")
76
+ except (ValueError, TypeError):
77
+ # Return original string if conversion fails
78
+ return date_str
79
79
 
80
80
  def create_2320_other_subscriber_segments(patient_data, config, crosswalk):
81
81
  """
@@ -83,7 +83,7 @@ def create_2320_other_subscriber_segments(patient_data, config, crosswalk):
83
83
 
84
84
  Required segments:
85
85
  - SBR: Secondary payer relationship and responsibility
86
- - AMT: AMT*D Total amount paid by Medicare or other primary
86
+ - AMT: AMT*D ? Total amount paid by Medicare or other primary
87
87
  - CAS: Patient liability (CO/PR adjustments)
88
88
  - OI: Other insurance coverage indicator
89
89
 
@@ -190,7 +190,7 @@ def create_2430_service_line_cob_segments(patient_data, config, crosswalk):
190
190
  Required segments (when service-level adjudication exists):
191
191
  - SVD: Paid amount per service line (from 835 SVC03)
192
192
  - CAS: Line-level adjustments (from 835 CAS segments)
193
- - DTP: DTP*573 Adjudication date per service
193
+ - DTP: DTP*573 ? Adjudication date per service
194
194
 
195
195
  Parameters:
196
196
  - patient_data: Dictionary containing service line and adjudication data
@@ -365,10 +365,10 @@ def extract_835_adjudication_data(patient_data, config):
365
365
  Extracts and validates 835-derived adjudication data for COB embedding.
366
366
 
367
367
  Extracts:
368
- - CLP02 AMT*D (2320)
369
- - CAS segments CAS (2320 and/or 2430)
370
- - SVC03 SVD02 (2430)
371
- - DTP segments DTP*573 (2430)
368
+ - CLP02 ? AMT*D (2320)
369
+ - CAS segments ? CAS (2320 and/or 2430)
370
+ - SVC03 ? SVD02 (2430)
371
+ - DTP segments ? DTP*573 (2430)
372
372
 
373
373
  Parameters:
374
374
  - patient_data: Dictionary containing 835 data
@@ -1,42 +1,36 @@
1
1
  # MediLink_837p_encoder.py
2
- import re, argparse, os
2
+ import re, argparse, os, sys
3
3
  from datetime import datetime
4
4
 
5
- # Safe import for ConfigLoader - works in multiple contexts
6
- try:
7
- from . import MediLink_ConfigLoader
8
- except (ImportError, SystemError):
9
- try:
10
- import MediLink_ConfigLoader
11
- except ImportError:
12
- from MediLink import MediLink_ConfigLoader
5
+ # Add workspace directory to Python path for MediCafe imports
6
+ current_dir = os.path.dirname(os.path.abspath(__file__))
7
+ workspace_dir = os.path.dirname(current_dir)
8
+ if workspace_dir not in sys.path:
9
+ sys.path.insert(0, workspace_dir)
10
+
11
+ # Use core utilities for standardized imports and path setup
12
+ from MediCafe.core_utils import get_shared_config_loader, get_api_client, setup_module_paths
13
+ setup_module_paths(__file__)
14
+
15
+ MediLink_ConfigLoader = get_shared_config_loader()
13
16
 
14
- # Safe import for DataMgmt functions - works in multiple contexts
17
+ # Import api_core for API client fallback
15
18
  try:
16
- from .MediLink_DataMgmt import parse_fixed_width_data, read_fixed_width_data
17
- except (ImportError, SystemError):
18
- try:
19
- from MediLink_DataMgmt import parse_fixed_width_data, read_fixed_width_data
20
- except ImportError:
21
- from MediLink.MediLink_DataMgmt import parse_fixed_width_data, read_fixed_width_data
19
+ from MediCafe import api_core
20
+ except ImportError:
21
+ api_core = None
22
22
 
23
- # Safe import for encoder library - works in multiple contexts
23
+ # Import DataMgmt functions - absolute imports only
24
24
  try:
25
- from . import MediLink_837p_encoder_library
26
- except (ImportError, SystemError):
27
- try:
28
- import MediLink_837p_encoder_library
29
- except ImportError:
30
- from MediLink import MediLink_837p_encoder_library
25
+ from MediLink_DataMgmt import parse_fixed_width_data, read_fixed_width_data
26
+ except ImportError:
27
+ from MediLink.MediLink_DataMgmt import parse_fixed_width_data, read_fixed_width_data
31
28
 
32
- # Safe import for API client - works in multiple contexts
29
+ # Import encoder library - absolute imports only
33
30
  try:
34
- from . import MediLink_API_v3
35
- except (ImportError, SystemError):
36
- try:
37
- import MediLink_API_v3
38
- except ImportError:
39
- from MediLink import MediLink_API_v3
31
+ import MediLink_837p_encoder_library
32
+ except ImportError:
33
+ from MediLink import MediLink_837p_encoder_library
40
34
 
41
35
  # TODO (COB ENHANCEMENT): Import COB library when implementing Medicare and secondary claim support
42
36
  # import MediLink_837p_cob_library
@@ -246,7 +240,7 @@ def read_and_validate_claims(file_path, config):
246
240
 
247
241
  # Iterate over data in the file
248
242
  for personal_info, insurance_info, service_info, service_info_2, service_info_3 in read_fixed_width_data(file_path):
249
- # Parse data into a usable format
243
+ # Process reserved 5-line Medisoft record (currently using 3 lines, 2 reserved)
250
244
  parsed_data = parse_fixed_width_data(personal_info, insurance_info, service_info, service_info_2, service_info_3, config.get('MediLink_Config', config))
251
245
  # Validate the parsed data
252
246
  is_valid, errors = validate_claim_data(parsed_data, config)
@@ -304,10 +298,10 @@ def validate_claim_data(parsed_data, config, required_fields=[]):
304
298
  if required_fields is None:
305
299
  required_fields = [
306
300
  ('CHART', None),
307
- ('billing_provider_npi', r'^\d{10}$'),
301
+ ('billing_provider_npi', r'^\\d{10}$'),
308
302
  ('IPOLICY', None),
309
303
  ('CODEA', None),
310
- ('DATE', r'^\d{8}$'),
304
+ ('DATE', r'^\\d{8}$'),
311
305
  ('AMOUNT', None),
312
306
  ('TOS', None),
313
307
  ('DIAG', None)
@@ -434,7 +428,12 @@ def main():
434
428
  config = config.get('MediLink_Config', config)
435
429
 
436
430
  # Create API client for payer name resolution
437
- client = MediLink_API_v3.APIClient()
431
+ from MediCafe.core_utils import get_api_client
432
+ client = get_api_client()
433
+ if client is None:
434
+ print("Warning: API client not available via factory")
435
+ # Fallback to direct instantiation
436
+ client = api_core.APIClient()
438
437
 
439
438
  process_dat_files(args.path, config, args.endpoint, args.is_directory, crosswalk, client)
440
439
  print("Conversion complete.")