medicafe 0.240716.2__py3-none-any.whl → 0.240925.9__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.

@@ -1,9 +1,6 @@
1
- import os
2
- import re
1
+ #MediBot_Preprocessor.py
2
+ import os, re, sys, argparse
3
3
  from collections import OrderedDict # so that the field_mapping stays in order.
4
- import re
5
- import sys
6
- import argparse
7
4
  import MediBot_Crosswalk_Library
8
5
 
9
6
  # Add parent directory of the project to the Python path
@@ -20,6 +17,12 @@ try:
20
17
  except ImportError:
21
18
  from MediBot import MediBot_Preprocessor_lib
22
19
 
20
+ try:
21
+ from MediLink.MediLink_API_v3 import APIClient
22
+ except ImportError as e:
23
+ raise ImportError("Failed to import APIClient from MediLink.MediLink_API_v3. "
24
+ "Ensure the MediLink_API_v3 module is installed and accessible.") from e
25
+
23
26
  # Load configuration
24
27
  # Should this also take args? Path for ./MediLink needed to be added for this to resolve
25
28
  config, crosswalk = MediLink_ConfigLoader.load_configuration()
@@ -69,17 +72,18 @@ def preprocess_csv_data(csv_data, crosswalk):
69
72
  # Update the "Ins1 Insurance ID" column based on the crosswalk and the "Ins1 Payer ID" column for each row.
70
73
  # If the Payer ID is not found in the crosswalk, create a placeholder entry in the crosswalk and mark the row for review.
71
74
  MediLink_ConfigLoader.log("CSV Pre-processor: Populating 'Ins1 Insurance ID' based on Crosswalk...", level="INFO")
72
- MediBot_Preprocessor_lib.update_insurance_ids(csv_data, crosswalk)
75
+ MediBot_Preprocessor_lib.update_insurance_ids(csv_data, config, crosswalk)
73
76
 
74
77
  # Enrich the "Default Diagnosis #1" column based on the parsed docx for each row.
75
78
  # This needs to handle the different patient dates correctly so we get the right diagnosis code assigned to the right patient on the right date of service.
76
79
  # Currently, we've deleted all the second date entries for patients. As long as they exist in the system, they're just deleted.
77
80
  MediLink_ConfigLoader.log("CSV Pre-processor: Populating 'Default Diagnosis #1' based on Surgery Schedule and Crosswalk...", level="INFO")
81
+ print("Parsing Surgery Schedules...") # This step takes a while.
78
82
  MediBot_Preprocessor_lib.update_diagnosis_codes(csv_data)
79
83
 
80
84
  # Enrich the procedure code column based on the diagnosis code for each patient.
81
- MediLink_ConfigLoader.log("CSV Pre-processor: Populating 'Procedure Code' based on Crosswalk...", level="INFO")
82
- MediBot_Preprocessor_lib.update_procedure_codes(csv_data)
85
+ # MediLink_ConfigLoader.log("CSV Pre-processor: Populating 'Procedure Code' based on Crosswalk...", level="INFO")
86
+ # MediBot_Preprocessor_lib.update_procedure_codes(csv_data, crosswalk)
83
87
 
84
88
  except Exception as e:
85
89
  message = "An error occurred while pre-processing CSV data. Please repair the CSV directly and try again: {}".format(e)
@@ -117,8 +121,8 @@ def intake_scan(csv_headers, field_mapping):
117
121
  missing_fields_warnings = []
118
122
  required_fields = config["required_fields"]
119
123
 
120
- # MediLink_ConfigLoader.log("Intake Scan - Field Mapping: {}".format(field_mapping))
121
- # MediLink_ConfigLoader.log("Intake Scan - CSV Headers: {}".format(csv_headers))
124
+ MediLink_ConfigLoader.log("Intake Scan - Field Mapping: {}".format(field_mapping), level="DEBUG")
125
+ MediLink_ConfigLoader.log("Intake Scan - CSV Headers: {}".format(csv_headers), level="DEBUG")
122
126
 
123
127
  # Iterate over the Medisoft fields defined in field_mapping
124
128
  for medisoft_field in field_mapping.keys():
@@ -150,14 +154,16 @@ def intake_scan(csv_headers, field_mapping):
150
154
  # Insurance Policy Numbers should be all alphanumeric with no other characters.
151
155
  if 'Insurance Policy Number' in field:
152
156
  policy_number = identified_fields.get(header)
157
+ MediLink_ConfigLoader.log("Checking Insurance Policy Number '{}' for alphanumeric characters.".format(policy_number), level="DEBUG")
153
158
  if not bool(re.match("^[a-zA-Z0-9]*$", policy_number)):
154
159
  missing_fields_warnings.append("WARNING: Insurance Policy Number '{}' contains invalid characters.".format(policy_number))
160
+ MediLink_ConfigLoader.log("Insurance Policy Number '{}' contains invalid characters.".format(policy_number), level="WARNING")
155
161
  # Additional checks can be added as needed for other fields
156
162
 
157
163
  if missing_fields_warnings:
158
- MediLink_ConfigLoader.log("\nSome required fields could not be matched:")
164
+ MediLink_ConfigLoader.log("\nSome required fields could not be matched:", level="INFO")
159
165
  for warning in missing_fields_warnings:
160
- MediLink_ConfigLoader.log(warning)
166
+ MediLink_ConfigLoader.log(warning, level="WARNING")
161
167
 
162
168
  return identified_fields
163
169
 
@@ -178,6 +184,8 @@ def main():
178
184
 
179
185
  config, crosswalk = MediLink_ConfigLoader.load_configuration()
180
186
 
187
+ client = APIClient()
188
+
181
189
  # If no arguments provided, print usage instructions
182
190
  if not any(vars(args).values()):
183
191
  parser.print_help()
@@ -185,10 +193,10 @@ def main():
185
193
 
186
194
  if args.update_crosswalk:
187
195
  print("Updating the crosswalk...")
188
- MediBot_Crosswalk_Library.crosswalk_update(config, crosswalk)
196
+ MediBot_Crosswalk_Library.crosswalk_update(client, config, crosswalk)
189
197
 
190
198
  if args.init_crosswalk:
191
- MediBot_Crosswalk_Library.initialize_crosswalk_from_mapat()
199
+ MediBot_Crosswalk_Library.initialize_crosswalk_from_mapat(client)
192
200
 
193
201
  if args.load_csv:
194
202
  print("Loading CSV data...")