medicafe 0.240716.2__py3-none-any.whl → 0.240809.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.py +13 -2
- MediBot/MediBot_Preprocessor_lib.py +14 -2
- MediLink/MediLink.py +4 -4
- MediLink/MediLink_837p_encoder.py +64 -47
- MediLink/MediLink_837p_encoder_library.py +20 -8
- MediLink/MediLink_API_v3.py +109 -5
- MediLink/MediLink_ConfigLoader.py +1 -1
- MediLink/MediLink_DataMgmt.py +4 -4
- MediLink/MediLink_Deductible.py +57 -50
- MediLink/MediLink_Down.py +29 -30
- MediLink/MediLink_UI.py +9 -1
- MediLink/MediLink_Up.py +179 -110
- {medicafe-0.240716.2.dist-info → medicafe-0.240809.0.dist-info}/METADATA +1 -1
- {medicafe-0.240716.2.dist-info → medicafe-0.240809.0.dist-info}/RECORD +17 -17
- {medicafe-0.240716.2.dist-info → medicafe-0.240809.0.dist-info}/WHEEL +1 -1
- {medicafe-0.240716.2.dist-info → medicafe-0.240809.0.dist-info}/LICENSE +0 -0
- {medicafe-0.240716.2.dist-info → medicafe-0.240809.0.dist-info}/top_level.txt +0 -0
MediLink/MediLink_Deductible.py
CHANGED
|
@@ -68,8 +68,12 @@ config, _ = MediLink_ConfigLoader.load_configuration()
|
|
|
68
68
|
client = MediLink_API_v3.APIClient()
|
|
69
69
|
|
|
70
70
|
# Get provider_last_name and npi from configuration
|
|
71
|
-
provider_last_name = config['MediLink_Config'].get('default_billing_provider_last_name')
|
|
72
|
-
npi = config['MediLink_Config'].get('default_billing_provider_npi')
|
|
71
|
+
provider_last_name = config['MediLink_Config'].get('default_billing_provider_last_name', 'Unknown')
|
|
72
|
+
npi = config['MediLink_Config'].get('default_billing_provider_npi', 'Unknown')
|
|
73
|
+
|
|
74
|
+
# Check if the provider_last_name is still 'Unknown'
|
|
75
|
+
if provider_last_name == 'Unknown':
|
|
76
|
+
MediLink_ConfigLoader.log("Warning: provider_last_name was not found in the configuration.", level="WARNING")
|
|
73
77
|
|
|
74
78
|
# Define the list of payer_id's to iterate over
|
|
75
79
|
payer_ids = ['87726', '03432', '96385', '95467', '86050', '86047', '95378', '06111', '37602']
|
|
@@ -101,12 +105,12 @@ patients = [
|
|
|
101
105
|
def get_eligibility_info(client, payer_id, provider_last_name, date_of_birth, member_id, npi):
|
|
102
106
|
try:
|
|
103
107
|
# Log the parameters being sent to the function
|
|
104
|
-
MediLink_ConfigLoader.log("Calling get_eligibility_v3 with parameters:", level="
|
|
105
|
-
MediLink_ConfigLoader.log("payer_id: {}".format(payer_id), level="
|
|
106
|
-
MediLink_ConfigLoader.log("provider_last_name: {}".format(provider_last_name), level="
|
|
107
|
-
MediLink_ConfigLoader.log("date_of_birth: {}".format(date_of_birth), level="
|
|
108
|
-
MediLink_ConfigLoader.log("member_id: {}".format(member_id), level="
|
|
109
|
-
MediLink_ConfigLoader.log("npi: {}".format(npi), level="
|
|
108
|
+
MediLink_ConfigLoader.log("Calling get_eligibility_v3 with parameters:", level="DEBUG")
|
|
109
|
+
MediLink_ConfigLoader.log("payer_id: {}".format(payer_id), level="DEBUG")
|
|
110
|
+
MediLink_ConfigLoader.log("provider_last_name: {}".format(provider_last_name), level="DEBUG")
|
|
111
|
+
MediLink_ConfigLoader.log("date_of_birth: {}".format(date_of_birth), level="DEBUG")
|
|
112
|
+
MediLink_ConfigLoader.log("member_id: {}".format(member_id), level="DEBUG")
|
|
113
|
+
MediLink_ConfigLoader.log("npi: {}".format(npi), level="DEBUG")
|
|
110
114
|
|
|
111
115
|
# Call the get_eligibility_v3 function
|
|
112
116
|
eligibility = MediLink_API_v3.get_eligibility_v3(
|
|
@@ -114,7 +118,7 @@ def get_eligibility_info(client, payer_id, provider_last_name, date_of_birth, me
|
|
|
114
118
|
)
|
|
115
119
|
|
|
116
120
|
# Log the response
|
|
117
|
-
MediLink_ConfigLoader.log("Eligibility response: {}".format(json.dumps(eligibility, indent=4)), level="
|
|
121
|
+
MediLink_ConfigLoader.log("Eligibility response: {}".format(json.dumps(eligibility, indent=4)), level="DEBUG")
|
|
118
122
|
|
|
119
123
|
return eligibility
|
|
120
124
|
except requests.exceptions.HTTPError as e:
|
|
@@ -127,7 +131,7 @@ def get_eligibility_info(client, payer_id, provider_last_name, date_of_birth, me
|
|
|
127
131
|
return None
|
|
128
132
|
|
|
129
133
|
# Function to extract required fields and display in a tabular format
|
|
130
|
-
def display_eligibility_info(data, dob, member_id):
|
|
134
|
+
def display_eligibility_info(data, dob, member_id, output_file):
|
|
131
135
|
if data is None:
|
|
132
136
|
return
|
|
133
137
|
|
|
@@ -154,50 +158,53 @@ def display_eligibility_info(data, dob, member_id):
|
|
|
154
158
|
ins_payerID = insurance_info.get("payerId", "")
|
|
155
159
|
|
|
156
160
|
policy_info = policy["policyInfo"]
|
|
157
|
-
eligibilityDates = policy_info.get("eligibilityDates", "")
|
|
158
161
|
policy_status = policy_info.get("policyStatus", "")
|
|
159
162
|
|
|
160
163
|
patient_name = "{} {} {}".format(firstName, middleName, lastName).strip()[:20]
|
|
161
164
|
|
|
162
165
|
# Display patient information in a table row format
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
print(table_row)
|
|
167
|
-
table_row_details = "{:<20} | {:<10} | {:<5} | {:<15} | {:<8} | {:<15} | {:<20}".format(
|
|
168
|
-
"", "", "", ins_insuranceTypeCode, eligibility_end_date[-10:], policy_status, remaining_amount)
|
|
169
|
-
print(table_row_details)
|
|
166
|
+
table_row = "{:<20} | {:<10} | {:<40} | {:<5} | {:<15} | {:<15}".format(
|
|
167
|
+
patient_name, dob, ins_insuranceType, ins_payerID, policy_status, remaining_amount)
|
|
168
|
+
output_file.write(table_row + "\n")
|
|
169
|
+
print(table_row) # Print to console for progressive display
|
|
170
170
|
|
|
171
171
|
# Print the table header once before entering the loop
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
""
|
|
178
|
-
print(
|
|
179
|
-
print("-" * len(
|
|
180
|
-
|
|
181
|
-
# Set to keep track of processed patients
|
|
182
|
-
processed_patients = set()
|
|
183
|
-
|
|
184
|
-
# Loop through each payer_id and patient to call the API, then display the eligibility information
|
|
185
|
-
errors = []
|
|
186
|
-
for payer_id in payer_ids:
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
# Display errors if any
|
|
200
|
-
if errors:
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
print(
|
|
172
|
+
output_file_path = os.path.join(os.getenv('TEMP'), 'eligibility_report.txt')
|
|
173
|
+
with open(output_file_path, 'w') as output_file:
|
|
174
|
+
table_header = "{:<20} | {:<10} | {:<40} | {:<5} | {:<15} | {:<15}".format(
|
|
175
|
+
"Patient Name", "DOB", "Insurance Type", "PayID", "Policy Status", "Remaining Amt")
|
|
176
|
+
output_file.write(table_header + "\n")
|
|
177
|
+
output_file.write("-" * len(table_header) + "\n")
|
|
178
|
+
print(table_header)
|
|
179
|
+
print("-" * len(table_header))
|
|
180
|
+
|
|
181
|
+
# Set to keep track of processed patients
|
|
182
|
+
processed_patients = set()
|
|
183
|
+
|
|
184
|
+
# Loop through each payer_id and patient to call the API, then display the eligibility information
|
|
185
|
+
errors = []
|
|
186
|
+
for payer_id in payer_ids:
|
|
187
|
+
for dob, member_id in patients:
|
|
188
|
+
# Skip if this patient has already been processed
|
|
189
|
+
if (dob, member_id) in processed_patients:
|
|
190
|
+
continue
|
|
191
|
+
try:
|
|
192
|
+
eligibility_data = get_eligibility_info(client, payer_id, provider_last_name, dob, member_id, npi)
|
|
193
|
+
if eligibility_data is not None:
|
|
194
|
+
display_eligibility_info(eligibility_data, dob, member_id, output_file) # Display as we get the result
|
|
195
|
+
processed_patients.add((dob, member_id)) # Mark this patient as processed
|
|
196
|
+
except Exception as e:
|
|
197
|
+
errors.append((dob, member_id, str(e)))
|
|
198
|
+
|
|
199
|
+
# Display errors if any
|
|
200
|
+
if errors:
|
|
201
|
+
error_msg = "\nErrors encountered during API calls:\n"
|
|
202
|
+
output_file.write(error_msg)
|
|
203
|
+
print(error_msg)
|
|
204
|
+
for error in errors:
|
|
205
|
+
error_details = "DOB: {}, Member ID: {}, Error: {}\n".format(error[0], error[1], error[2])
|
|
206
|
+
output_file.write(error_details)
|
|
207
|
+
print(error_details)
|
|
208
|
+
|
|
209
|
+
# Open the generated file in Notepad
|
|
210
|
+
os.system('notepad.exe {}'.format(output_file_path))
|
MediLink/MediLink_Down.py
CHANGED
|
@@ -15,7 +15,7 @@ def move_downloaded_files(local_storage_path, config):
|
|
|
15
15
|
os.makedirs(local_response_directory)
|
|
16
16
|
|
|
17
17
|
download_dir = config['MediLink_Config']['local_storage_path']
|
|
18
|
-
file_extensions = ['.era', '.277', '.277ibr', '.277ebr', '.dpt', '.ebt', '.ibt'] # Extendable list of file extensions
|
|
18
|
+
file_extensions = ['.era', '.277', '.277ibr', '.277ebr', '.dpt', '.ebt', '.ibt', '.txt'] # Extendable list of file extensions
|
|
19
19
|
|
|
20
20
|
for ext in file_extensions:
|
|
21
21
|
downloaded_files = [f for f in os.listdir(download_dir) if f.endswith(ext)]
|
|
@@ -38,7 +38,7 @@ def find_files(file_path_pattern):
|
|
|
38
38
|
def translate_files(files, output_directory):
|
|
39
39
|
translated_files = []
|
|
40
40
|
consolidated_records = []
|
|
41
|
-
file_counts = {'.era': 0, '.277': 0, '.277ibr': 0, '.277ebr': 0, '.dpt': 0, '.ebt': 0, '.ibt': 0}
|
|
41
|
+
file_counts = {'.era': 0, '.277': 0, '.277ibr': 0, '.277ebr': 0, '.dpt': 0, '.ebt': 0, '.ibt': 0, '.txt': 0}
|
|
42
42
|
|
|
43
43
|
for file in files:
|
|
44
44
|
ext = os.path.splitext(file)[1]
|
|
@@ -72,46 +72,45 @@ def main():
|
|
|
72
72
|
parser.add_argument('--config_path', type=str, help='Path to the configuration JSON file', default="json/config.json")
|
|
73
73
|
parser.add_argument('--file_path_pattern', type=str, help='Path pattern or directory for files to process.', default=None)
|
|
74
74
|
args = parser.parse_args()
|
|
75
|
-
|
|
75
|
+
|
|
76
76
|
config, _ = load_configuration(args.config_path)
|
|
77
|
+
|
|
77
78
|
local_storage_path = config['MediLink_Config']['local_storage_path']
|
|
78
79
|
output_directory = os.path.join(local_storage_path, "translated_csvs")
|
|
79
80
|
|
|
80
|
-
# If a file path pattern is provided, process those files directly
|
|
81
81
|
if args.file_path_pattern:
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
log("Translating files: {}".format(files_str), level="INFO")
|
|
86
|
-
consolidated_records, translated_files = translate_files(files, output_directory)
|
|
87
|
-
log("Translation completed.", level="INFO")
|
|
88
|
-
if consolidated_records:
|
|
89
|
-
display_consolidated_records(consolidated_records)
|
|
90
|
-
prompt_csv_export(consolidated_records, output_directory)
|
|
91
|
-
return
|
|
92
|
-
else:
|
|
93
|
-
log("No files found matching: {}".format(args.file_path_pattern), level="WARNING")
|
|
94
|
-
return
|
|
95
|
-
|
|
96
|
-
# Handle downloading files via WinSCP
|
|
97
|
-
endpoint_key = 'AVAILITY'
|
|
98
|
-
if endpoint_key not in config['MediLink_Config']['endpoints']:
|
|
99
|
-
log("Endpoint '{}' not found in configuration. Using default 'AVAILITY'.".format(endpoint_key), level="WARNING")
|
|
100
|
-
endpoint_key = 'AVAILITY'
|
|
101
|
-
|
|
102
|
-
endpoint_configs = [config['MediLink_Config']['endpoints'][key] for key in config['MediLink_Config']['endpoints']]
|
|
103
|
-
downloaded_files = []
|
|
82
|
+
process_files_by_pattern(args.file_path_pattern, output_directory)
|
|
83
|
+
else:
|
|
84
|
+
download_and_process_files(config, local_storage_path, output_directory)
|
|
104
85
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
86
|
+
def process_files_by_pattern(file_path_pattern, output_directory):
|
|
87
|
+
files = find_files(file_path_pattern)
|
|
88
|
+
if files:
|
|
89
|
+
files_str = ', '.join(files)
|
|
90
|
+
log("Translating files: {}".format(files_str), level="INFO")
|
|
91
|
+
consolidated_records, translated_files = translate_files(files, output_directory)
|
|
92
|
+
log("Translation completed.", level="INFO")
|
|
93
|
+
if consolidated_records:
|
|
94
|
+
display_consolidated_records(consolidated_records)
|
|
95
|
+
prompt_csv_export(consolidated_records, output_directory)
|
|
96
|
+
else:
|
|
97
|
+
log("No files found matching: {}".format(file_path_pattern), level="WARNING")
|
|
98
|
+
|
|
99
|
+
def download_and_process_files(config, local_storage_path, output_directory):
|
|
100
|
+
downloaded_files = download_files_from_endpoints(config, local_storage_path)
|
|
108
101
|
move_downloaded_files(local_storage_path, config)
|
|
109
|
-
|
|
110
102
|
consolidated_records, translated_files = translate_files(downloaded_files, output_directory)
|
|
111
103
|
if consolidated_records:
|
|
112
104
|
display_consolidated_records(consolidated_records)
|
|
113
105
|
prompt_csv_export(consolidated_records, output_directory)
|
|
114
106
|
|
|
107
|
+
def download_files_from_endpoints(config, local_storage_path):
|
|
108
|
+
endpoint_configs = config['MediLink_Config']['endpoints'].values()
|
|
109
|
+
downloaded_files = []
|
|
110
|
+
for endpoint_config in endpoint_configs:
|
|
111
|
+
downloaded_files += operate_winscp("download", None, endpoint_config, local_storage_path, config)
|
|
112
|
+
return downloaded_files
|
|
113
|
+
|
|
115
114
|
def display_consolidated_records(records):
|
|
116
115
|
# Define the new fieldnames and their respective widths
|
|
117
116
|
new_fieldnames = ['Claim #', 'Status', 'Patient', 'Proc.', 'Serv.', 'Allowed', 'Paid', 'Pt Resp', 'Charged']
|
MediLink/MediLink_UI.py
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
from datetime import datetime
|
|
2
2
|
import os
|
|
3
|
-
import
|
|
3
|
+
import sys
|
|
4
|
+
|
|
5
|
+
project_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
|
|
6
|
+
sys.path.append(project_dir)
|
|
7
|
+
|
|
8
|
+
try:
|
|
9
|
+
import MediLink_ConfigLoader
|
|
10
|
+
except ImportError:
|
|
11
|
+
from MediLink import MediLink_ConfigLoader
|
|
4
12
|
|
|
5
13
|
def display_welcome():
|
|
6
14
|
print("\n" + "-" * 60)
|