medicafe 0.250920.0__py3-none-any.whl → 0.250930.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/__init__.py +1 -1
- MediCafe/__init__.py +1 -1
- MediCafe/api_core.py +151 -10
- MediLink/MediLink_837p_encoder_library.py +18 -15
- MediLink/__init__.py +1 -1
- {medicafe-0.250920.0.dist-info → medicafe-0.250930.0.dist-info}/METADATA +1 -1
- {medicafe-0.250920.0.dist-info → medicafe-0.250930.0.dist-info}/RECORD +11 -11
- {medicafe-0.250920.0.dist-info → medicafe-0.250930.0.dist-info}/LICENSE +0 -0
- {medicafe-0.250920.0.dist-info → medicafe-0.250930.0.dist-info}/WHEEL +0 -0
- {medicafe-0.250920.0.dist-info → medicafe-0.250930.0.dist-info}/entry_points.txt +0 -0
- {medicafe-0.250920.0.dist-info → medicafe-0.250930.0.dist-info}/top_level.txt +0 -0
MediBot/__init__.py
CHANGED
MediCafe/__init__.py
CHANGED
MediCafe/api_core.py
CHANGED
@@ -6,7 +6,7 @@ Moved from MediLink to centralize shared API operations.
|
|
6
6
|
COMPATIBILITY: Python 3.4.4 and Windows XP compatible
|
7
7
|
"""
|
8
8
|
|
9
|
-
import time, json, os, traceback, sys
|
9
|
+
import time, json, os, traceback, sys
|
10
10
|
|
11
11
|
# Import centralized logging configuration
|
12
12
|
try:
|
@@ -689,21 +689,61 @@ class APIClient(BaseAPIClient):
|
|
689
689
|
MediLink_ConfigLoader.log(log_message, level="ERROR")
|
690
690
|
raise
|
691
691
|
|
692
|
-
def fetch_payer_name_from_api(
|
692
|
+
def fetch_payer_name_from_api(*args, **kwargs):
|
693
693
|
"""
|
694
|
-
|
694
|
+
Fetch payer name by Payer ID with backward-compatible calling styles.
|
695
695
|
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
696
|
+
Supported call signatures:
|
697
|
+
- fetch_payer_name_from_api(client, payer_id, config, primary_endpoint='AVAILITY')
|
698
|
+
- fetch_payer_name_from_api(payer_id, config, primary_endpoint='AVAILITY') # client inferred via factory
|
699
|
+
- fetch_payer_name_from_api(payer_id=payer_id, config=config, client=client, primary_endpoint='AVAILITY')
|
700
700
|
"""
|
701
|
-
#
|
701
|
+
# Normalize arguments
|
702
|
+
client = None
|
703
|
+
payer_id = None
|
704
|
+
config = None
|
705
|
+
primary_endpoint = kwargs.get('primary_endpoint', 'AVAILITY')
|
706
|
+
|
707
|
+
if 'client' in kwargs:
|
708
|
+
client = kwargs.get('client')
|
709
|
+
if 'payer_id' in kwargs:
|
710
|
+
payer_id = kwargs.get('payer_id')
|
711
|
+
if 'config' in kwargs:
|
712
|
+
config = kwargs.get('config')
|
713
|
+
|
714
|
+
if len(args) >= 3 and isinstance(args[0], APIClient):
|
715
|
+
client = args[0]
|
716
|
+
payer_id = args[1]
|
717
|
+
config = args[2]
|
718
|
+
if len(args) >= 4 and 'primary_endpoint' not in kwargs:
|
719
|
+
primary_endpoint = args[3]
|
720
|
+
elif len(args) >= 2 and isinstance(args[0], str) and client is None:
|
721
|
+
# Called as (payer_id, config, [primary_endpoint])
|
722
|
+
payer_id = args[0]
|
723
|
+
config = args[1]
|
724
|
+
if len(args) >= 3 and 'primary_endpoint' not in kwargs:
|
725
|
+
primary_endpoint = args[2]
|
726
|
+
elif len(args) == 1 and isinstance(args[0], APIClient) and (payer_id is None or config is None):
|
727
|
+
# Partial positional with client first, other params via kwargs
|
728
|
+
client = args[0]
|
729
|
+
|
730
|
+
# Acquire client via factory if not provided
|
731
|
+
if client is None:
|
732
|
+
try:
|
733
|
+
from MediCafe.core_utils import get_api_client
|
734
|
+
client = get_api_client()
|
735
|
+
if client is None:
|
736
|
+
client = APIClient()
|
737
|
+
except Exception:
|
738
|
+
client = APIClient()
|
739
|
+
|
740
|
+
# Basic validation
|
702
741
|
if not isinstance(client, APIClient):
|
703
742
|
error_message = "Invalid client provided. Expected an instance of APIClient."
|
704
|
-
print(error_message)
|
705
743
|
MediLink_ConfigLoader.log(error_message, level="ERROR")
|
706
|
-
|
744
|
+
raise ValueError(error_message)
|
745
|
+
if payer_id is None or config is None:
|
746
|
+
raise ValueError("Missing required arguments: payer_id and config are required")
|
707
747
|
|
708
748
|
# TODO: FUTURE IMPLEMENTATION - Remove AVAILITY default when other endpoints have payer-list APIs
|
709
749
|
# Currently defaulting to AVAILITY as it's the only endpoint with confirmed payer-list functionality
|
@@ -750,6 +790,66 @@ def fetch_payer_name_from_api(client, payer_id, config, primary_endpoint='AVAILI
|
|
750
790
|
# 3. Fall back to endpoints with basic payer lookup if available
|
751
791
|
# 4. Use AVAILITY as final fallback
|
752
792
|
|
793
|
+
# If HTTP client is unavailable or endpoints missing, use offline fallback only when allowed (TestMode or env flag)
|
794
|
+
try:
|
795
|
+
http_unavailable = (requests is None) # type: ignore[name-defined]
|
796
|
+
except Exception:
|
797
|
+
http_unavailable = True
|
798
|
+
# Determine whether offline fallback is permitted
|
799
|
+
# Align with main flow: default True when TestMode key is absent
|
800
|
+
offline_allowed = True
|
801
|
+
try:
|
802
|
+
from MediCafe.core_utils import extract_medilink_config
|
803
|
+
medi_local = extract_medilink_config(config)
|
804
|
+
offline_allowed = bool(medi_local.get('TestMode', True))
|
805
|
+
except Exception:
|
806
|
+
offline_allowed = True
|
807
|
+
try:
|
808
|
+
if os.environ.get('MEDICAFE_OFFLINE_PERMISSIVE', '').strip().lower() in ('1', 'true', 'yes', 'y'):
|
809
|
+
offline_allowed = True
|
810
|
+
except Exception:
|
811
|
+
pass
|
812
|
+
|
813
|
+
if offline_allowed and (http_unavailable or not isinstance(endpoints, dict) or not endpoints):
|
814
|
+
try:
|
815
|
+
# Prefer crosswalk mapping when available
|
816
|
+
try:
|
817
|
+
_, cw = MediLink_ConfigLoader.load_configuration()
|
818
|
+
except Exception:
|
819
|
+
cw = {}
|
820
|
+
payer_mappings = {}
|
821
|
+
try:
|
822
|
+
if isinstance(cw, dict):
|
823
|
+
payer_mappings = cw.get('payer_mappings', {}) or {}
|
824
|
+
except Exception:
|
825
|
+
payer_mappings = {}
|
826
|
+
|
827
|
+
if payer_id in payer_mappings:
|
828
|
+
resolved = payer_mappings.get(payer_id)
|
829
|
+
MediLink_ConfigLoader.log(
|
830
|
+
"Using crosswalk mapping for payer {} -> {} (offline)".format(payer_id, resolved),
|
831
|
+
level="WARNING",
|
832
|
+
console_output=CONSOLE_LOGGING
|
833
|
+
)
|
834
|
+
return resolved
|
835
|
+
# Safe minimal hardcoded map as last resort (test/offline only)
|
836
|
+
fallback_map = {
|
837
|
+
'87726': 'UnitedHealthcare',
|
838
|
+
'06111': 'Aetna',
|
839
|
+
'03432': 'Cigna',
|
840
|
+
'95378': 'Anthem Blue Cross',
|
841
|
+
'95467': 'Blue Shield',
|
842
|
+
}
|
843
|
+
if payer_id in fallback_map:
|
844
|
+
MediLink_ConfigLoader.log(
|
845
|
+
"Using offline fallback for payer {} -> {}".format(payer_id, fallback_map[payer_id]),
|
846
|
+
level="WARNING",
|
847
|
+
console_output=CONSOLE_LOGGING
|
848
|
+
)
|
849
|
+
return fallback_map[payer_id]
|
850
|
+
except Exception:
|
851
|
+
pass
|
852
|
+
|
753
853
|
# Define endpoint rotation logic with payer-list capability detection
|
754
854
|
available_endpoints = []
|
755
855
|
|
@@ -820,6 +920,47 @@ def fetch_payer_name_from_api(client, payer_id, config, primary_endpoint='AVAILI
|
|
820
920
|
error_message = "Error calling {0} for Payer ID {1}. Exception: {2}".format(endpoint_name, payer_id, e)
|
821
921
|
MediLink_ConfigLoader.log(error_message, level="INFO")
|
822
922
|
|
923
|
+
# Offline/local fallback mapping for common payer IDs when API endpoints are unavailable
|
924
|
+
# Only when offline fallback is permitted
|
925
|
+
if offline_allowed:
|
926
|
+
try:
|
927
|
+
# Prefer crosswalk mapping first
|
928
|
+
try:
|
929
|
+
_, cw = MediLink_ConfigLoader.load_configuration()
|
930
|
+
except Exception:
|
931
|
+
cw = {}
|
932
|
+
payer_mappings = {}
|
933
|
+
try:
|
934
|
+
if isinstance(cw, dict):
|
935
|
+
payer_mappings = cw.get('payer_mappings', {}) or {}
|
936
|
+
except Exception:
|
937
|
+
payer_mappings = {}
|
938
|
+
if payer_id in payer_mappings:
|
939
|
+
resolved = payer_mappings.get(payer_id)
|
940
|
+
MediLink_ConfigLoader.log(
|
941
|
+
"Using crosswalk mapping for payer {} -> {} (offline)".format(payer_id, resolved),
|
942
|
+
level="WARNING",
|
943
|
+
console_output=CONSOLE_LOGGING
|
944
|
+
)
|
945
|
+
return resolved
|
946
|
+
# Minimal fallback map if crosswalk has no mapping (still offline-only)
|
947
|
+
fallback_map = {
|
948
|
+
'87726': 'UnitedHealthcare',
|
949
|
+
'06111': 'Aetna',
|
950
|
+
'03432': 'Cigna',
|
951
|
+
'95378': 'Anthem Blue Cross',
|
952
|
+
'95467': 'Blue Shield',
|
953
|
+
}
|
954
|
+
if payer_id in fallback_map:
|
955
|
+
MediLink_ConfigLoader.log(
|
956
|
+
"Using offline fallback for payer {} -> {}".format(payer_id, fallback_map[payer_id]),
|
957
|
+
level="WARNING",
|
958
|
+
console_output=CONSOLE_LOGGING
|
959
|
+
)
|
960
|
+
return fallback_map[payer_id]
|
961
|
+
except Exception:
|
962
|
+
pass
|
963
|
+
|
823
964
|
# If all endpoints fail
|
824
965
|
final_error_message = "All endpoints exhausted for Payer ID {0}.".format(payer_id)
|
825
966
|
print(final_error_message)
|
@@ -87,21 +87,24 @@ except (ImportError, SystemError):
|
|
87
87
|
except ImportError:
|
88
88
|
MediLink_UI = None
|
89
89
|
|
90
|
-
# Import MediBot crosswalk utilities
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
90
|
+
# Import MediBot crosswalk utilities via centralized import helpers
|
91
|
+
from MediCafe.core_utils import import_medibot_module
|
92
|
+
|
93
|
+
# Resolve required functions directly at import-time using centralized helper (Py 3.4.4 friendly)
|
94
|
+
update_crosswalk_with_new_payer_id = (
|
95
|
+
import_medibot_module('MediBot_Crosswalk_Utils', 'update_crosswalk_with_new_payer_id') or
|
96
|
+
import_medibot_module('MediBot_Crosswalk_Library', 'update_crosswalk_with_new_payer_id')
|
97
|
+
)
|
98
|
+
|
99
|
+
update_crosswalk_with_corrected_payer_id = (
|
100
|
+
import_medibot_module('MediBot_Crosswalk_Utils', 'update_crosswalk_with_corrected_payer_id') or
|
101
|
+
import_medibot_module('MediBot_Crosswalk_Library', 'update_crosswalk_with_corrected_payer_id')
|
102
|
+
)
|
103
|
+
|
104
|
+
if not callable(update_crosswalk_with_new_payer_id):
|
105
|
+
raise RuntimeError("Crosswalk update function not available (new payer id). Ensure MediBot_Crosswalk_Utils or MediBot_Crosswalk_Library is importable.")
|
106
|
+
if not callable(update_crosswalk_with_corrected_payer_id):
|
107
|
+
raise RuntimeError("Crosswalk update function not available (corrected payer id). Ensure MediBot_Crosswalk_Utils or MediBot_Crosswalk_Library is importable.")
|
105
108
|
|
106
109
|
# Import enhanced insurance selection with fallback
|
107
110
|
# XP/Python34 Compatibility: Enhanced error handling with verbose output
|
MediLink/__init__.py
CHANGED
@@ -12,7 +12,7 @@ MediBot/MediBot_dataformat_library.py,sha256=D46fdPtxcgfWTzaLBtSvjtozzZBNqNiODgu
|
|
12
12
|
MediBot/MediBot_debug.bat,sha256=F5Lfi3nFEEo4Ddx9EbX94u3fNAMgzMp3wsn-ULyASTM,6017
|
13
13
|
MediBot/MediBot_docx_decoder.py,sha256=9BSjV-kB90VHnqfL_5iX4zl5u0HcHvHuL7YNfx3gXpQ,33143
|
14
14
|
MediBot/MediBot_smart_import.py,sha256=Emvz7NwemHGCHvG5kZcUyXMcCheidbGKaPfOTg-YCEs,6684
|
15
|
-
MediBot/__init__.py,sha256=
|
15
|
+
MediBot/__init__.py,sha256=TD2TjOOLwIklKHXMC7OU3WamrLSJqF8vdQFmdzOhuAg,3192
|
16
16
|
MediBot/clear_cache.bat,sha256=F6-VhETWw6xDdGWG2wUqvtXjCl3lY4sSUFqF90bM8-8,1860
|
17
17
|
MediBot/crash_diagnostic.bat,sha256=j8kUtyBg6NOWbXpeFuEqIRHOkVzgUrLOqO3FBMfNxTo,9268
|
18
18
|
MediBot/f_drive_diagnostic.bat,sha256=4572hZaiwZ5wVAarPcZJQxkOSTwAdDuT_X914noARak,6878
|
@@ -22,9 +22,9 @@ MediBot/process_csvs.bat,sha256=3tI7h1z9eRj8rUUL4wJ7dy-Qrak20lRmpAPtGbUMbVQ,3489
|
|
22
22
|
MediBot/update_json.py,sha256=vvUF4mKCuaVly8MmoadDO59M231fCIInc0KI1EtDtPA,3704
|
23
23
|
MediBot/update_medicafe.py,sha256=G1lyvVOHYuho1d-TJQNN6qaB4HBWaJ2PpXqemBoPlRQ,17937
|
24
24
|
MediCafe/MediLink_ConfigLoader.py,sha256=NoLb2YiJwlkrRYCt2PHvcFJ7yTIRWQCrsvkZIJWreM4,11141
|
25
|
-
MediCafe/__init__.py,sha256=
|
25
|
+
MediCafe/__init__.py,sha256=B2m0aF3q1XVoCTmPK4wgbWtROmUsTwEiuyD7LH9VnOA,5721
|
26
26
|
MediCafe/__main__.py,sha256=mRNyk3D9Ilnu2XhgVI_rut7r5Ro7UIKtwV871giAHI8,12992
|
27
|
-
MediCafe/api_core.py,sha256=
|
27
|
+
MediCafe/api_core.py,sha256=tzCMB1fO7aLpfzlGxbU0qmhd9nD26YoIUohgDkXzNgA,84383
|
28
28
|
MediCafe/api_factory.py,sha256=I5AeJoyu6m7oCrjc2OvVvO_4KSBRutTsR1riiWhTZV0,12086
|
29
29
|
MediCafe/api_utils.py,sha256=KWQB0q1k5E6frOFFlKWcFpHNcqfrS7KJ_82672wbupw,14041
|
30
30
|
MediCafe/core_utils.py,sha256=XKUpyv7yKjIQ8iNrhD76PIURyt6GZxb98v0daiI7aaw,27303
|
@@ -39,7 +39,7 @@ MediCafe/submission_index.py,sha256=35gz8Anx1dIqG1I14GvuLY0nTO4dSBr2YsZwof9aIQg,
|
|
39
39
|
MediLink/InsuranceTypeService.py,sha256=FKWC1nRfKV_OtCDUtZustauXNhmCYDFiY9jsAGHPPUM,2178
|
40
40
|
MediLink/MediLink_837p_cob_library.py,sha256=glc7SJBDx0taCGmwmCs81GFJJcvA_D7nycIkTfmIuwE,30650
|
41
41
|
MediLink/MediLink_837p_encoder.py,sha256=lJnly96LsSBnzEgF8Ne-nQTL7cmRhoFL2fJajtpvOcU,32209
|
42
|
-
MediLink/MediLink_837p_encoder_library.py,sha256=
|
42
|
+
MediLink/MediLink_837p_encoder_library.py,sha256=zQDoIjyezmPlv0uR_IUoLqdsVdc6Dy5n-yv51yeT44g,92093
|
43
43
|
MediLink/MediLink_837p_utilities.py,sha256=AJ0F22LoF8du20zPBH4TZXgsdXCD-1qYKBnHJM-mXl0,16260
|
44
44
|
MediLink/MediLink_API_Generator.py,sha256=VZBL9W8yFTMJ4ikSwbUI8ANtaJCLnUyqoF8xQEJQn_E,11176
|
45
45
|
MediLink/MediLink_Azure.py,sha256=Ow70jctiHFIylskBExN7WUoRgrKOvBR6jNTnQMk6lJA,210
|
@@ -63,15 +63,15 @@ MediLink/MediLink_insurance_utils.py,sha256=g741Fj2K26cMy0JX5d_XavMw9LgkK6hjaUJY
|
|
63
63
|
MediLink/MediLink_main.py,sha256=CAXu0IRzhra3ppIFDcCppFNAZp7kCuN6gPtJSdFqGzs,24857
|
64
64
|
MediLink/MediLink_smart_import.py,sha256=B5SfBn_4bYEWJJDolXbjnwKx_-MaqGZ76LyXQwWDV80,9838
|
65
65
|
MediLink/Soumit_api.py,sha256=5JfOecK98ZC6NpZklZW2AkOzkjvrbYxpJpZNH3rFxDw,497
|
66
|
-
MediLink/__init__.py,sha256=
|
66
|
+
MediLink/__init__.py,sha256=rSHkkkTfid24CUGEFtuMAh8ebWQ41_Tew1vYYlb9hfo,3888
|
67
67
|
MediLink/gmail_http_utils.py,sha256=gtqCCrzJC7e8JFQzMNrf7EbK8na2h4sfTu-NMaZ_UHc,4006
|
68
68
|
MediLink/gmail_oauth_utils.py,sha256=Ugr-DEqs4_RddRMSCJ_dbgA3TVeaxpbAor-dktcTIgY,3713
|
69
69
|
MediLink/openssl.cnf,sha256=76VdcGCykf0Typyiv8Wd1mMVKixrQ5RraG6HnfKFqTo,887
|
70
70
|
MediLink/test.py,sha256=DM_E8gEbhbVfTAm3wTMiNnK2GCD1e5eH6gwTk89QIc4,3116
|
71
71
|
MediLink/webapp.html,sha256=MI9zZ4y1_h5Ji3nz2fmm6Q29AsPunks-wR-R8Ct73-w,19856
|
72
|
-
medicafe-0.
|
73
|
-
medicafe-0.
|
74
|
-
medicafe-0.
|
75
|
-
medicafe-0.
|
76
|
-
medicafe-0.
|
77
|
-
medicafe-0.
|
72
|
+
medicafe-0.250930.0.dist-info/LICENSE,sha256=65lb-vVujdQK7uMH3RRJSMwUW-WMrMEsc5sOaUn2xUk,1096
|
73
|
+
medicafe-0.250930.0.dist-info/METADATA,sha256=FAUuG1PCF_01NP77xNySzjfAvSMLtppmiLmlqANYTdw,3414
|
74
|
+
medicafe-0.250930.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
75
|
+
medicafe-0.250930.0.dist-info/entry_points.txt,sha256=m3RBUBjr-xRwEkKJ5W4a7NlqHZP_1rllGtjZnrRqKe8,52
|
76
|
+
medicafe-0.250930.0.dist-info/top_level.txt,sha256=U6-WBJ9RCEjyIs0BlzbQq_PwedCp_IV9n1616NNV5zA,26
|
77
|
+
medicafe-0.250930.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|