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.
- MediBot/MediBot.bat +233 -19
- MediBot/MediBot.py +138 -46
- MediBot/MediBot_Crosswalk_Library.py +127 -623
- MediBot/MediBot_Crosswalk_Utils.py +618 -0
- MediBot/MediBot_Preprocessor.py +72 -17
- MediBot/MediBot_Preprocessor_lib.py +470 -76
- MediBot/MediBot_UI.py +32 -17
- MediBot/MediBot_dataformat_library.py +68 -20
- MediBot/MediBot_docx_decoder.py +120 -19
- MediBot/MediBot_smart_import.py +180 -0
- MediBot/__init__.py +89 -0
- MediBot/get_medicafe_version.py +25 -0
- MediBot/update_json.py +35 -6
- MediBot/update_medicafe.py +19 -1
- MediCafe/MediLink_ConfigLoader.py +160 -0
- MediCafe/__init__.py +171 -0
- MediCafe/__main__.py +222 -0
- MediCafe/api_core.py +1098 -0
- MediCafe/api_core_backup.py +427 -0
- MediCafe/api_factory.py +306 -0
- MediCafe/api_utils.py +356 -0
- MediCafe/core_utils.py +450 -0
- MediCafe/graphql_utils.py +445 -0
- MediCafe/logging_config.py +123 -0
- MediCafe/logging_demo.py +61 -0
- MediCafe/migration_helpers.py +463 -0
- MediCafe/smart_import.py +436 -0
- MediLink/MediLink.py +66 -26
- MediLink/MediLink_837p_cob_library.py +28 -28
- MediLink/MediLink_837p_encoder.py +33 -34
- MediLink/MediLink_837p_encoder_library.py +243 -151
- MediLink/MediLink_837p_utilities.py +129 -5
- MediLink/MediLink_API_Generator.py +83 -60
- MediLink/MediLink_API_v3.py +1 -1
- MediLink/MediLink_ClaimStatus.py +177 -31
- MediLink/MediLink_DataMgmt.py +405 -72
- MediLink/MediLink_Decoder.py +20 -1
- MediLink/MediLink_Deductible.py +155 -28
- MediLink/MediLink_Display_Utils.py +72 -0
- MediLink/MediLink_Down.py +127 -5
- MediLink/MediLink_Gmail.py +712 -653
- MediLink/MediLink_PatientProcessor.py +257 -0
- MediLink/MediLink_UI.py +85 -61
- MediLink/MediLink_Up.py +28 -4
- MediLink/MediLink_insurance_utils.py +227 -264
- MediLink/MediLink_main.py +248 -0
- MediLink/MediLink_smart_import.py +264 -0
- MediLink/__init__.py +93 -0
- MediLink/insurance_type_integration_test.py +66 -76
- MediLink/test.py +1 -1
- MediLink/test_timing.py +59 -0
- {medicafe-0.250728.8.dist-info → medicafe-0.250805.0.dist-info}/METADATA +1 -1
- medicafe-0.250805.0.dist-info/RECORD +81 -0
- medicafe-0.250805.0.dist-info/entry_points.txt +2 -0
- {medicafe-0.250728.8.dist-info → medicafe-0.250805.0.dist-info}/top_level.txt +1 -0
- medicafe-0.250728.8.dist-info/RECORD +0 -59
- {medicafe-0.250728.8.dist-info → medicafe-0.250805.0.dist-info}/LICENSE +0 -0
- {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
|
-
- 2000A
|
|
36
|
-
- 2000B
|
|
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
|
-
|
|
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
|
-
#
|
|
62
|
+
# Import utility functions - absolute imports only
|
|
60
63
|
try:
|
|
61
|
-
from
|
|
62
|
-
except
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
""
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
|
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
|
|
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
|
|
369
|
-
- CAS segments
|
|
370
|
-
- SVC03
|
|
371
|
-
- DTP segments
|
|
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
|
-
#
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
#
|
|
17
|
+
# Import api_core for API client fallback
|
|
15
18
|
try:
|
|
16
|
-
from
|
|
17
|
-
except
|
|
18
|
-
|
|
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
|
-
#
|
|
23
|
+
# Import DataMgmt functions - absolute imports only
|
|
24
24
|
try:
|
|
25
|
-
from
|
|
26
|
-
except
|
|
27
|
-
|
|
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
|
-
#
|
|
29
|
+
# Import encoder library - absolute imports only
|
|
33
30
|
try:
|
|
34
|
-
|
|
35
|
-
except
|
|
36
|
-
|
|
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
|
-
#
|
|
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'
|
|
301
|
+
('billing_provider_npi', r'^\\d{10}$'),
|
|
308
302
|
('IPOLICY', None),
|
|
309
303
|
('CODEA', None),
|
|
310
|
-
('DATE', r'
|
|
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
|
-
|
|
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.")
|