medicafe 0.250401.0__py3-none-any.whl → 0.250421.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.

@@ -84,6 +84,11 @@ def preprocess_csv_data(csv_data, crosswalk):
84
84
  # Enrich the procedure code column based on the diagnosis code for each patient.
85
85
  # MediLink_ConfigLoader.log("CSV Pre-processor: Populating 'Procedure Code' based on Crosswalk...", level="INFO")
86
86
  # MediBot_Preprocessor_lib.update_procedure_codes(csv_data, crosswalk)
87
+
88
+ # Convert all text fields to uppercase
89
+ MediLink_ConfigLoader.log("CSV Pre-processor: Converting all text fields to uppercase...", level="INFO")
90
+ print("Converting all text fields to uppercase...")
91
+ MediBot_Preprocessor_lib.capitalize_all_fields(csv_data)
87
92
 
88
93
  except Exception as e:
89
94
  message = "An error occurred while pre-processing CSV data. Please repair the CSV directly and try again: {}".format(e)
@@ -436,12 +436,17 @@ def update_diagnosis_codes(csv_data):
436
436
  min_surgery_date = min(surgery_dates)
437
437
  max_surgery_date = max(surgery_dates)
438
438
 
439
- # Apply a ±5-day margin to the surgery dates
440
- margin = timedelta(days=5)
439
+ # Apply a ±8-day margin to the surgery dates... Increased from 5 days.
440
+ margin = timedelta(days=8)
441
441
  threshold_start = min_surgery_date - margin
442
442
  threshold_end = max_surgery_date + margin
443
443
 
444
- MediLink_ConfigLoader.log("Processing DOCX files modified between {} and {}.".format(threshold_start, threshold_end), level="INFO")
444
+ # TODO (Low) This is a bad idea. We need a better way to handle this because it leaves
445
+ # us with a situation where if we take 'too long' to download the DOCX files, it will presume that the DOCX files are out of range because
446
+ # the modfied date is a bad proxy for the date of the surgery which would be contained inside the DOCX file. The processing overhead for extracting the
447
+ # date of the surgery from the DOCX file is non-trivial and computationally expensive so we need a smarter way to handle this.
448
+
449
+ MediLink_ConfigLoader.log("BAD IDEA: Processing DOCX files modified between {} and {}.".format(threshold_start, threshold_end), level="INFO")
445
450
 
446
451
  # Gather all relevant DOCX files in the specified directory
447
452
  docx_files = [
@@ -714,4 +719,25 @@ def load_historical_payer_to_patient_mappings(config):
714
719
  if not payer_to_patient_ids:
715
720
  print("No historical mappings were generated.")
716
721
 
717
- return dict(payer_to_patient_ids)
722
+ return dict(payer_to_patient_ids)
723
+
724
+ def capitalize_all_fields(csv_data):
725
+ """
726
+ Converts all text fields in the CSV data to uppercase.
727
+
728
+ Parameters:
729
+ csv_data (list of dict): The CSV data where each row is represented as a dictionary.
730
+
731
+ Returns:
732
+ None: The function modifies the csv_data in place.
733
+ """
734
+ for row in csv_data:
735
+ for key, value in row.items():
736
+ if isinstance(value, str):
737
+ row[key] = value.upper()
738
+ elif isinstance(value, datetime):
739
+ # Keep datetime objects as they are
740
+ pass
741
+ elif value is not None:
742
+ # Convert any other non-None values to string and then uppercase
743
+ row[key] = str(value).upper()
@@ -289,7 +289,7 @@ def resolve_payer_name(payer_id, config, primary_endpoint, insurance_name, parse
289
289
  MediLink_ConfigLoader.log("API Resolved to standard insurance name: {} for corrected payer ID: {}".format(resolved_name, corrected_payer_id), config, level="INFO")
290
290
 
291
291
  # Step 7: Ask for user confirmation using the helper
292
- confirmation_prompt = "Is the standard insurance name '{}' correct? (yes/no): ".format(resolved_name)
292
+ confirmation_prompt = "Proceed with updating the Payer ID for '{}'? (yes/no): ".format(resolved_name)
293
293
  if get_user_confirmation(confirmation_prompt):
294
294
  # Step 8: Load crosswalk
295
295
  try:
@@ -310,7 +310,31 @@ def resolve_payer_name(payer_id, config, primary_endpoint, insurance_name, parse
310
310
  # Step 10: Handle rejection
311
311
  print("User did not confirm the standard insurance name. Manual intervention is required.")
312
312
  MediLink_ConfigLoader.log("User did not confirm the standard insurance name. Manual intervention is required.", config, level="CRITICAL")
313
- exit(1) # Consider handling differently.
313
+
314
+ # TODO: CRITICAL ISSUE - Current rejection handling is incorrect
315
+ # The current implementation exits the program when a user rejects the standard insurance name,
316
+ # which is an overly aggressive approach. Instead, we should:
317
+ # 1. Prompt the user to manually enter the correct insurance name
318
+ # 2. Use that manually entered name to proceed with the claim processing
319
+ # 3. Update the crosswalk with the corrected payer name (requires a new function to be implemented)
320
+ # 4. Log the correction for future reference
321
+ #
322
+ # The insurance name confirmation is primarily a sanity check to verify the API recognizes the payer ID,
323
+ # not a critical validation for claim processing. The payer name is not used in the crosswalk or in the
324
+ # actual claims once they are built. The current implementation unnecessarily halts the entire process
325
+ # when this check fails, rather than providing a recovery path.
326
+ #
327
+ # When revisiting this code, the entire flow of interdependent functions should be reconsidered to
328
+ # ensure proper error handling and recovery mechanisms are in place throughout the process.
329
+
330
+ # Placeholder for future implementation:
331
+ # corrected_name = input("Please enter the correct insurance name: ")
332
+ # MediLink_ConfigLoader.log(f"User provided corrected insurance name: {corrected_name}", config, level="INFO")
333
+ # print(f"Using manually entered insurance name: {corrected_name}")
334
+ # TODO: Implement update_crosswalk_with_corrected_payer_name(corrected_name, payer_id, config, crosswalk)
335
+ # return corrected_name
336
+
337
+ exit(1)
314
338
  except Exception as e:
315
339
  # Step 11: Handle exceptions during resolution
316
340
  print("Failed to resolve corrected payer ID to standard insurance name: {}".format(e))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: medicafe
3
- Version: 0.250401.0
3
+ Version: 0.250421.0
4
4
  Summary: MediCafe
5
5
  Home-page: https://github.com/katanada2
6
6
  Author: Daniel Vidaud
@@ -3,8 +3,8 @@ MediBot/MediBot.py,sha256=KNR3Pj46W9dQaE3OH3fFAHoa6P-hS8pjJ9xB5STEqOU,19513
3
3
  MediBot/MediBot_Charges.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  MediBot/MediBot_Crosswalk_Library.py,sha256=dOUn9mh4TDu3FK42n_xyPLJn9_m5WyIrfEKeX9dVdaQ,44390
5
5
  MediBot/MediBot_Post.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- MediBot/MediBot_Preprocessor.py,sha256=KoFLdU-bvVh-ESVN9fntIDPIsOUCZGU6erDPu3DVrco,12711
7
- MediBot/MediBot_Preprocessor_lib.py,sha256=w7Bc4F-rpz-jwBc1mSzQCLdgh5TeXr8tWVMt-rF8gjE,36863
6
+ MediBot/MediBot_Preprocessor.py,sha256=uPGj0OwlHi0CByvNy9gKnfwfK7Y6lzQ7sLchwJw3l7g,13010
7
+ MediBot/MediBot_Preprocessor_lib.py,sha256=MubZpI8bOt-P9FEk65zQZrI_0y1map1wzPWGeMUkQOs,38187
8
8
  MediBot/MediBot_UI.py,sha256=tdTXLQ_nUVbtpkxUGSuKbEgYv6CFk6EsmEMAVMLL4_A,11165
9
9
  MediBot/MediBot_dataformat_library.py,sha256=6AFGyiaUcFMVUNbudGKoBqAZuMnLf2EIWaypOq6-ZCw,7867
10
10
  MediBot/MediBot_docx_decoder.py,sha256=z-_oVrSocu4-CenDGDHOkDeqPcKqZqm6Ao9mABgqxJU,23561
@@ -16,7 +16,7 @@ MediBot/update_medicafe.py,sha256=rx1zUvCI99JRdr8c1csMGI2uJBl3pqusvX-xr3KhmR4,11
16
16
  MediLink/MediLink.py,sha256=G1xuHUKnCrEsKdY4RjHm7a472lShtv_gZC6rffEYzCk,21581
17
17
  MediLink/MediLink_277_decoder.py,sha256=Z3hQK2j-YzdXjov6aDlDRc7M_auFBnl3se4OF5q6_04,4358
18
18
  MediLink/MediLink_837p_encoder.py,sha256=id2qhKUYq_raKcDr5pAY1xF0V_UR5KBC8SXDAeh6QpU,24807
19
- MediLink/MediLink_837p_encoder_library.py,sha256=tn3UPyyBEEn_7vvu2sNft6rzWcQ0B61dWvtpKHhnh00,47792
19
+ MediLink/MediLink_837p_encoder_library.py,sha256=HN_HBN02fJIiUyC5cJzY_5eEJiup-fRPtKuaoZWUtHk,49841
20
20
  MediLink/MediLink_API_Generator.py,sha256=vBZ8moR9tvv7mb200HlZnJrk1y-bQi8E16I2r41vgVM,10345
21
21
  MediLink/MediLink_API_v2.py,sha256=mcIgLnXPS_NaUBrkKJ8mxCUaQ0AuQUeU1vG6DoplbVY,7733
22
22
  MediLink/MediLink_API_v3.py,sha256=b8Qo7tRGzdCyixYrfOqaGFiOtot3sXG4dwsWn4uiDW0,32288
@@ -41,8 +41,8 @@ MediLink/MediLink_batch.bat,sha256=nqL5QwCLyRQFSPdv6kgtcV_cpky7FXSOWVl6OxjRXb4,1
41
41
  MediLink/Soumit_api.py,sha256=5JfOecK98ZC6NpZklZW2AkOzkjvrbYxpJpZNH3rFxDw,497
42
42
  MediLink/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
43
  MediLink/test.py,sha256=kSvvJRL_3fWuNS3_x4hToOnUljGLoeEw6SUTHQWQRJk,3108
44
- medicafe-0.250401.0.dist-info/LICENSE,sha256=65lb-vVujdQK7uMH3RRJSMwUW-WMrMEsc5sOaUn2xUk,1096
45
- medicafe-0.250401.0.dist-info/METADATA,sha256=VomIGuTgq7YoupslYFwyDShSmwlCEjw2nqtT6awVd08,5501
46
- medicafe-0.250401.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
47
- medicafe-0.250401.0.dist-info/top_level.txt,sha256=3uOwR4q_SP8Gufk2uCHoKngAgbtdOwQC6Qjl7ViBa_c,17
48
- medicafe-0.250401.0.dist-info/RECORD,,
44
+ medicafe-0.250421.0.dist-info/LICENSE,sha256=65lb-vVujdQK7uMH3RRJSMwUW-WMrMEsc5sOaUn2xUk,1096
45
+ medicafe-0.250421.0.dist-info/METADATA,sha256=1BeCn3lm7ve4vopixnSA8aorMC7ciMg-kG-rZqUGHwI,5501
46
+ medicafe-0.250421.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
47
+ medicafe-0.250421.0.dist-info/top_level.txt,sha256=3uOwR4q_SP8Gufk2uCHoKngAgbtdOwQC6Qjl7ViBa_c,17
48
+ medicafe-0.250421.0.dist-info/RECORD,,