medicafe 0.240419.2__py3-none-any.whl → 0.240613.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 +174 -38
- MediBot/MediBot.py +80 -77
- MediBot/MediBot_Charges.py +0 -28
- MediBot/MediBot_Crosswalk_Library.py +281 -0
- MediBot/MediBot_Post.py +0 -0
- MediBot/MediBot_Preprocessor.py +138 -211
- MediBot/MediBot_Preprocessor_lib.py +496 -0
- MediBot/MediBot_UI.py +80 -35
- MediBot/MediBot_dataformat_library.py +79 -35
- MediBot/MediBot_docx_decoder.py +295 -0
- MediBot/update_medicafe.py +46 -8
- MediLink/MediLink.py +207 -108
- MediLink/MediLink_837p_encoder.py +299 -214
- MediLink/MediLink_837p_encoder_library.py +445 -245
- MediLink/MediLink_API_v2.py +174 -0
- MediLink/MediLink_APIs.py +139 -0
- MediLink/MediLink_ConfigLoader.py +44 -32
- MediLink/MediLink_DataMgmt.py +297 -89
- MediLink/MediLink_Decoder.py +63 -0
- MediLink/MediLink_Down.py +73 -102
- MediLink/MediLink_ERA_decoder.py +4 -4
- MediLink/MediLink_Gmail.py +479 -4
- MediLink/MediLink_Mailer.py +0 -0
- MediLink/MediLink_Parser.py +111 -0
- MediLink/MediLink_Scan.py +0 -0
- MediLink/MediLink_Scheduler.py +2 -131
- MediLink/MediLink_StatusCheck.py +0 -4
- MediLink/MediLink_UI.py +87 -27
- MediLink/MediLink_Up.py +301 -45
- MediLink/MediLink_batch.bat +1 -1
- MediLink/test.py +74 -0
- medicafe-0.240613.0.dist-info/METADATA +55 -0
- medicafe-0.240613.0.dist-info/RECORD +43 -0
- {medicafe-0.240419.2.dist-info → medicafe-0.240613.0.dist-info}/WHEEL +5 -5
- medicafe-0.240419.2.dist-info/METADATA +0 -19
- medicafe-0.240419.2.dist-info/RECORD +0 -32
- {medicafe-0.240419.2.dist-info → medicafe-0.240613.0.dist-info}/LICENSE +0 -0
- {medicafe-0.240419.2.dist-info → medicafe-0.240613.0.dist-info}/top_level.txt +0 -0
MediLink/MediLink_Down.py
CHANGED
|
@@ -1,146 +1,117 @@
|
|
|
1
|
+
# MediLink_Down.py
|
|
1
2
|
import os
|
|
2
|
-
import logging
|
|
3
3
|
import argparse
|
|
4
4
|
import shutil
|
|
5
|
-
from datetime import datetime
|
|
6
5
|
import glob
|
|
7
|
-
import
|
|
8
|
-
from MediLink_DataMgmt import operate_winscp
|
|
6
|
+
from MediLink_Decoder import process_file
|
|
7
|
+
from MediLink_DataMgmt import operate_winscp, consolidate_csvs
|
|
9
8
|
import MediLink_ConfigLoader
|
|
9
|
+
# Import decoders for other file types
|
|
10
10
|
|
|
11
11
|
"""
|
|
12
|
-
|
|
12
|
+
Main triaging function for handling report downloads and processing from various endpoints. This function
|
|
13
|
+
handles downloading reports, moving files, and decoding them into a readable format. The goal is to
|
|
14
|
+
provide detailed receipt and troubleshooting information for the claims.
|
|
13
15
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
6. Automated Endpoint Processing: Integrate automated looping through configured endpoints for ERA file retrieval, maximizing efficiency and reducing manual oversight.
|
|
20
|
-
7. Configuration Key Accuracy: Audit the script to correct any inaccuracies in configuration key references, ensuring seamless configuration data retrieval.
|
|
16
|
+
Key Enhancements:
|
|
17
|
+
- Handle multiple file types (ERA, 277, etc.) and integrate respective decoders.
|
|
18
|
+
- Support multi-endpoint processing.
|
|
19
|
+
- Implement progress tracking for long-running operations.
|
|
20
|
+
- Provide both consolidated CSV output and in-memory parsed data for real-time display.
|
|
21
21
|
"""
|
|
22
|
-
|
|
23
|
-
# Setup basic logging
|
|
24
|
-
def setup_logger(local_storage_path):
|
|
25
|
-
# Define a reasonable name for the log file, e.g., "MediLink_Down_Process.log"
|
|
26
|
-
log_filename = datetime.now().strftime("MediLink_Down_Process_%m%d%Y.log")
|
|
27
|
-
log_filepath = os.path.join(local_storage_path, log_filename)
|
|
28
|
-
|
|
29
|
-
for handler in logging.root.handlers[:]:
|
|
30
|
-
logging.root.removeHandler(handler)
|
|
31
|
-
|
|
32
|
-
# Setup logging to file
|
|
33
|
-
logging.basicConfig(level=logging.INFO,
|
|
34
|
-
format='%(asctime)s - %(levelname)s - %(message)s',
|
|
35
|
-
filename=log_filepath, # Direct logging to a file in local_storage_path
|
|
36
|
-
filemode='a') # Append mode
|
|
37
|
-
|
|
38
|
-
# If you also want to see the logs in the console, add a StreamHandler
|
|
39
|
-
#console_handler = logging.StreamHandler()
|
|
40
|
-
#console_handler.setLevel(logging.INFO)
|
|
41
|
-
#formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
|
|
42
|
-
#console_handler.setFormatter(formatter)
|
|
43
|
-
#logging.getLogger('').addHandler(console_handler)
|
|
44
|
-
|
|
45
|
-
# Because I can't figure out how to get it to work directly in the WinSCP command.
|
|
46
|
-
# And on the Windows XP machine apparently the default path is C:\\ ...
|
|
47
|
-
# This needs to get fixed. Ugh.
|
|
48
|
-
def move_downloaded_files(local_storage_path):
|
|
49
|
-
# Define the target directory for storing downloaded files
|
|
22
|
+
def move_downloaded_files(local_storage_path, config):
|
|
50
23
|
local_response_directory = os.path.join(local_storage_path, "responses")
|
|
51
24
|
|
|
52
25
|
if not os.path.exists(local_response_directory):
|
|
53
26
|
os.makedirs(local_response_directory)
|
|
54
27
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
downloaded_files = [f for f in os.listdir('C:\\Users\\danie\\OneDrive\\Documents') if f.endswith('.era')]
|
|
28
|
+
download_dir = config['MediLink_Config']['local_storage_path']
|
|
29
|
+
file_extensions = ['.era', '.277'] # Extendable list of file extensions
|
|
58
30
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
31
|
+
for ext in file_extensions:
|
|
32
|
+
downloaded_files = [f for f in os.listdir(download_dir) if f.endswith(ext)]
|
|
33
|
+
for file in downloaded_files:
|
|
34
|
+
source_path = os.path.join(download_dir, file)
|
|
35
|
+
destination_path = os.path.join(local_response_directory, file)
|
|
36
|
+
shutil.move(source_path, destination_path)
|
|
37
|
+
MediLink_ConfigLoader.log("Moved '{}' to '{}'".format(file, local_response_directory))
|
|
66
38
|
|
|
67
|
-
def
|
|
68
|
-
|
|
69
|
-
Find all files matching the era_file_path pattern.
|
|
70
|
-
This function normalizes the path and supports wildcard patterns.
|
|
71
|
-
"""
|
|
72
|
-
# Normalize the path to handle slashes correctly
|
|
73
|
-
normalized_path = os.path.normpath(era_file_path)
|
|
39
|
+
def find_files(file_path_pattern):
|
|
40
|
+
normalized_path = os.path.normpath(file_path_pattern)
|
|
74
41
|
|
|
75
|
-
# Handling different wildcard scenarios
|
|
76
42
|
if "*" in normalized_path:
|
|
77
|
-
# Use glob to find all files matching the pattern
|
|
78
43
|
matching_files = glob.glob(normalized_path)
|
|
79
|
-
# Normalize paths in the resulting list
|
|
80
44
|
return [os.path.normpath(file) for file in matching_files]
|
|
81
45
|
else:
|
|
82
|
-
# Single file specified, return it in a list if it exists
|
|
83
46
|
return [normalized_path] if os.path.exists(normalized_path) else []
|
|
84
47
|
|
|
48
|
+
def translate_files(files, output_directory):
|
|
49
|
+
translated_files = []
|
|
50
|
+
for file in files:
|
|
51
|
+
try:
|
|
52
|
+
process_file(file, output_directory)
|
|
53
|
+
csv_file_path = os.path.join(output_directory, os.path.basename(file) + '_decoded.csv')
|
|
54
|
+
MediLink_ConfigLoader.log("Translated file to CSV: {}".format(csv_file_path), level="INFO")
|
|
55
|
+
translated_files.append(csv_file_path)
|
|
56
|
+
except ValueError as ve:
|
|
57
|
+
MediLink_ConfigLoader.log("Unsupported file type: {}".format(file), level="WARNING")
|
|
58
|
+
except Exception as e:
|
|
59
|
+
MediLink_ConfigLoader.log("Error processing file {}: {}".format(file, e), level="ERROR")
|
|
60
|
+
|
|
61
|
+
consolidate_csv_path = consolidate_csvs(output_directory, file_prefix="Consolidated", interactive=True)
|
|
62
|
+
MediLink_ConfigLoader.log("Consolidated CSV path: {}".format(consolidate_csv_path), level="INFO")
|
|
63
|
+
return consolidate_csv_path, translated_files
|
|
64
|
+
|
|
65
|
+
def display_translated_files(translated_files):
|
|
66
|
+
print("\nTranslated Files Summary:")
|
|
67
|
+
for file in translated_files:
|
|
68
|
+
print(" - {}",format(file))
|
|
69
|
+
|
|
85
70
|
def main(desired_endpoint='AVAILITY'):
|
|
86
|
-
parser = argparse.ArgumentParser(description="Process
|
|
87
|
-
parser.add_argument('--config_path', type=str, help='Path to the configuration JSON file', default="json
|
|
71
|
+
parser = argparse.ArgumentParser(description="Process files and convert them to CSV format.")
|
|
72
|
+
parser.add_argument('--config_path', type=str, help='Path to the configuration JSON file', default="json/config.json")
|
|
88
73
|
parser.add_argument('--desired_endpoint', type=str, help='The desired endpoint key from the configuration.', default=desired_endpoint)
|
|
89
|
-
parser.add_argument('--
|
|
74
|
+
parser.add_argument('--file_path_pattern', type=str, help='Optional: Specify a path pattern for files for direct translation.', default=None)
|
|
90
75
|
args = parser.parse_args()
|
|
91
76
|
|
|
92
|
-
# Setup Logger, Load configuration and output directory
|
|
93
77
|
config, _ = MediLink_ConfigLoader.load_configuration(args.config_path)
|
|
94
78
|
local_storage_path = config['MediLink_Config']['local_storage_path']
|
|
95
|
-
setup_logger(local_storage_path)
|
|
96
79
|
output_directory = os.path.join(local_storage_path, "translated_csvs")
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
consolidate_csv_path = MediLink_ERA_decoder.consolidate_csvs(output_directory)
|
|
107
|
-
logging.info("Translation and consolidation completed.")
|
|
80
|
+
|
|
81
|
+
if args.file_path_pattern:
|
|
82
|
+
files = find_files(args.file_path_pattern)
|
|
83
|
+
if files:
|
|
84
|
+
files_str = ', '.join(files)
|
|
85
|
+
MediLink_ConfigLoader.log("Translating files: {}".format(files_str), level="INFO")
|
|
86
|
+
consolidate_csv_path, translated_files = translate_files(files, output_directory)
|
|
87
|
+
MediLink_ConfigLoader.log("Translation and consolidation completed.", level="INFO")
|
|
88
|
+
display_translated_files(translated_files)
|
|
108
89
|
return consolidate_csv_path
|
|
109
90
|
else:
|
|
110
|
-
|
|
91
|
+
MediLink_ConfigLoader.log("No files found matching: {}".format(args.file_path_pattern), level="WARNING")
|
|
111
92
|
return
|
|
112
93
|
|
|
113
|
-
# TODO This probably needs to be built into a loop that cycles through all 3 endpoints.
|
|
114
|
-
# The loop should use the tdqa or whatever the progress bar is called.
|
|
115
|
-
print("Please wait...\n")
|
|
116
|
-
|
|
117
|
-
# Validate endpoint key
|
|
118
94
|
endpoint_key = args.desired_endpoint
|
|
119
95
|
if endpoint_key not in config['MediLink_Config']['endpoints']:
|
|
120
|
-
|
|
96
|
+
MediLink_ConfigLoader.log("Endpoint '{}' not found in configuration. Using default 'AVAILITY'.".format(endpoint_key), level="WARNING")
|
|
121
97
|
endpoint_key = 'AVAILITY'
|
|
122
98
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
99
|
+
endpoint_configs = [config['MediLink_Config']['endpoints'][key] for key in config['MediLink_Config']['endpoints']]
|
|
100
|
+
downloaded_files = []
|
|
101
|
+
|
|
102
|
+
for endpoint_config in endpoint_configs:
|
|
103
|
+
downloaded_files += operate_winscp("download", None, endpoint_config, local_storage_path, config)
|
|
104
|
+
|
|
105
|
+
move_downloaded_files(local_storage_path, config)
|
|
129
106
|
|
|
130
|
-
#
|
|
131
|
-
|
|
132
|
-
for file in downloaded_files:
|
|
133
|
-
|
|
134
|
-
# whatever else might be included in the download folders.
|
|
135
|
-
MediLink_ERA_decoder.translate_era_to_csv([file], output_directory)
|
|
136
|
-
csv_file_path = os.path.join(output_directory, os.path.basename(file) + '.csv')
|
|
137
|
-
translated_csv_paths.append(csv_file_path)
|
|
138
|
-
logging.info("Translated ERA to CSV: {}".format(csv_file_path))
|
|
107
|
+
# Implement progress tracking
|
|
108
|
+
# from tqdm import tqdm
|
|
109
|
+
# for file in tqdm(downloaded_files, desc="Translating files"):
|
|
110
|
+
# translate_files([file], output_directory)
|
|
139
111
|
|
|
140
|
-
|
|
141
|
-
|
|
112
|
+
consolidate_csv_path, translated_files = translate_files(downloaded_files, output_directory)
|
|
113
|
+
display_translated_files(translated_files)
|
|
142
114
|
|
|
143
|
-
# Return the list of translated CSV file paths
|
|
144
115
|
return consolidate_csv_path
|
|
145
116
|
|
|
146
117
|
if __name__ == "__main__":
|
MediLink/MediLink_ERA_decoder.py
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import os
|
|
2
|
-
import logging
|
|
3
2
|
import sys
|
|
4
|
-
|
|
3
|
+
import csv
|
|
4
|
+
from MediLink_ConfigLoader import load_configuration, log
|
|
5
5
|
from MediLink_DataMgmt import consolidate_csvs
|
|
6
6
|
|
|
7
|
+
|
|
7
8
|
"""
|
|
8
9
|
1. ERA File Processing: Implement robust mechanisms for reading and parsing ERA files, addressing potential file integrity issues and accommodating scenarios with multiple payer addresses within a single ERA.
|
|
9
10
|
2. Wildcard File Processing: Enable effective batch processing of ERA files using wildcard patterns in the `--era_file_path` argument, resulting in a unified CSV output.
|
|
@@ -170,7 +171,6 @@ if __name__ == "__main__":
|
|
|
170
171
|
|
|
171
172
|
# Setup logger
|
|
172
173
|
local_storage_path = config['MediLink_Config']['local_storage_path']
|
|
173
|
-
setup_logger(local_storage_path)
|
|
174
174
|
|
|
175
175
|
# Define output directory
|
|
176
176
|
output_directory = os.path.join(local_storage_path, "translated_csvs")
|
|
@@ -178,7 +178,7 @@ if __name__ == "__main__":
|
|
|
178
178
|
# Retrieve ERA files from command line arguments
|
|
179
179
|
files = sys.argv[1:] # Exclude the script name
|
|
180
180
|
if not files:
|
|
181
|
-
|
|
181
|
+
log("No ERA files provided as arguments.")
|
|
182
182
|
sys.exit(1)
|
|
183
183
|
|
|
184
184
|
# Translate ERA files to CSV format
|