medicafe 0.250725.17__py3-none-any.whl → 0.250728.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.

MediLink/MediLink_Up.py CHANGED
@@ -7,6 +7,14 @@ from MediLink_ConfigLoader import log, load_configuration
7
7
  from MediLink_DataMgmt import operate_winscp
8
8
  import MediLink_API_v3
9
9
 
10
+ # Pre-compile regex patterns for better performance
11
+ GS_PATTERN = re.compile(r'GS\*HC\*[^*]*\*[^*]*\*([0-9]{8})\*([0-9]{4})')
12
+ SE_PATTERN = re.compile(r'SE\*\d+\*\d{4}~')
13
+ NM1_IL_PATTERN = re.compile(r'NM1\*IL\*1\*([^*]+)\*([^*]+)\*([^*]*)')
14
+ DTP_472_PATTERN = re.compile(r'DTP\*472\D*8\*([0-9]{8})')
15
+ CLM_PATTERN = re.compile(r'CLM\*[^\*]*\*([0-9]+\.?[0-9]*)')
16
+ NM1_PR_PATTERN = re.compile(r'NM1\*PR\*2\*([^*]+)\*')
17
+
10
18
  # Internet Connectivity Check
11
19
  def check_internet_connection():
12
20
  """
@@ -88,6 +96,7 @@ def submit_claims(detailed_patient_data_grouped_by_endpoint, config, crosswalk):
88
96
  api_responses = []
89
97
  for file_path in converted_files:
90
98
  with open(file_path, 'r') as file:
99
+ # Optimize string operations by doing replacements in one pass
91
100
  x12_request_data = file.read().replace('\n', '').replace('\r', '').strip()
92
101
  response = MediLink_API_v3.submit_uhc_claim(client, x12_request_data)
93
102
  api_responses.append((file_path, response))
@@ -156,8 +165,10 @@ def handle_transmission_result(transmission_result, config, operation_type, meth
156
165
  # Process the last few lines of the log file for transfer status
157
166
  last_lines = log_contents[-35:]
158
167
  for file_path in transmission_result:
168
+ # Pre-format success messages to avoid repeated string formatting
159
169
  success_message = "Transfer done: '{}'".format(file_path)
160
170
  additional_success_message = "Upload of file '{}' was successful, but error occurred while setting the permissions and/or timestamp.".format(file_path)
171
+ # Use any() with generator expression for better performance
161
172
  success = any(success_message in line or additional_success_message in line for line in last_lines)
162
173
  message = "Success" if success else "Transfer incomplete or error occurred"
163
174
  success_dict[file_path] = (success, message)
@@ -311,7 +322,7 @@ def parse_837p_file(file_path):
311
322
  log("Parsing submitted 837p...")
312
323
 
313
324
  # Extract the submission date from the GS segment
314
- gs_match = re.search(r'GS\*HC\*[^*]*\*[^*]*\*([0-9]{8})\*([0-9]{4})', content)
325
+ gs_match = GS_PATTERN.search(content)
315
326
  if gs_match:
316
327
  date = gs_match.group(1)
317
328
  time = gs_match.group(2)
@@ -321,28 +332,32 @@ def parse_837p_file(file_path):
321
332
  date_of_submission = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
322
333
 
323
334
  # Split content using 'SE*{count}*{control_number}~' as delimiter
324
- patient_records = re.split(r'SE\*\d+\*\d{4}~', content)
335
+ patient_records = SE_PATTERN.split(content)
325
336
 
326
337
  # Remove any empty strings from list that may have been added from split
327
338
  patient_records = [record for record in patient_records if record.strip()]
328
339
 
329
340
  for record in patient_records:
330
341
  # Extract patient name
331
- name_match = re.search(r'NM1\*IL\*1\*([^*]+)\*([^*]+)\*([^*]*)', record)
342
+ name_match = NM1_IL_PATTERN.search(record)
332
343
  # Extract service date
333
- service_date_match = re.search(r'DTP\*472\D*8\*([0-9]{8})', record)
344
+ service_date_match = DTP_472_PATTERN.search(record)
334
345
  # Extract claim amount
335
- amount_match = re.search(r'CLM\*[^\*]*\*([0-9]+\.?[0-9]*)', record)
346
+ amount_match = CLM_PATTERN.search(record)
336
347
  # Extract insurance name (payer_name)
337
- insurance_name_match = re.search(r'NM1\*PR\*2\*([^*]+)\*', record)
348
+ insurance_name_match = NM1_PR_PATTERN.search(record)
338
349
 
339
350
  if name_match and service_date_match and amount_match:
340
351
  # Handle optional middle name
341
352
  middle_name = name_match.group(3).strip() if name_match.group(3) else ""
342
353
  patient_name = "{} {} {}".format(name_match.group(2), middle_name, name_match.group(1)).strip()
343
- service_date = "{}-{}-{}".format(service_date_match.group(1)[:4], service_date_match.group(1)[4:6], service_date_match.group(1)[6:])
354
+
355
+ # Optimize date formatting
356
+ service_date_raw = service_date_match.group(1)
357
+ service_date = "{}-{}-{}".format(service_date_raw[:4], service_date_raw[4:6], service_date_raw[6:])
358
+
344
359
  amount_billed = float(amount_match.group(1))
345
- insurance_name = insurance_name_match.group(1)
360
+ insurance_name = insurance_name_match.group(1) if insurance_name_match else ""
346
361
 
347
362
  patient_details.append({
348
363
  "name": patient_name,
@@ -377,17 +392,17 @@ def build_receipt_content(receipt_data):
377
392
  receipt_lines.append(table_header)
378
393
  receipt_lines.append("-" * len(table_header))
379
394
 
380
- # Adding patient information in a tabular format
395
+ # Pre-format the status display to avoid repeated conditional checks
381
396
  for patient in data["patients"]:
382
- # Use the message as the status if the submission failed
383
397
  status_display = "SUCCESS" if patient['status'] else patient['message']
384
- patient_info = "{:<20} | {:<15} | ${:<14} | {:<20} | {:<10}".format(
385
- patient['name'],
386
- patient['service_date'],
387
- patient['amount_billed'],
388
- patient['insurance_name'],
389
- status_display
390
- )
398
+ # Use join for better performance than multiple format calls
399
+ patient_info = " | ".join([
400
+ "{:<20}".format(patient['name']),
401
+ "{:<15}".format(patient['service_date']),
402
+ "${:<14}".format(patient['amount_billed']),
403
+ "{:<20}".format(patient['insurance_name']),
404
+ "{:<10}".format(status_display)
405
+ ])
391
406
  receipt_lines.append(patient_info)
392
407
 
393
408
  receipt_lines.append("") # Blank line for separation
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: medicafe
3
- Version: 0.250725.17
3
+ Version: 0.250728.0
4
4
  Summary: MediCafe
5
5
  Home-page: https://github.com/katanada2
6
6
  Author: Daniel Vidaud
@@ -1,32 +1,32 @@
1
- MediBot/MediBot.bat,sha256=anz5i-Td1k3HhRUvkCqHsw9lBLVmO6q9bt5kLTfr1Iw,13282
2
- MediBot/MediBot.py,sha256=596LWAKHFUswkhQa8s6CVBXsbuZUXyh6qUcU3KtneIY,24907
1
+ MediBot/MediBot.bat,sha256=BzmSIf_wnt1gEQyNSRiyOOlgVkkKYdaovrdhO7BdGoM,14837
2
+ MediBot/MediBot.py,sha256=rtNNquSU8tbDXgxHJSppJB2DvXIxzImGe4QpE-KtbQQ,25154
3
3
  MediBot/MediBot_Charges.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
- MediBot/MediBot_Crosswalk_Library.py,sha256=Z03tTj2_ebX85D0UWUWnFnqqDSznXPmX-tT3_QGVdHw,51441
4
+ MediBot/MediBot_Crosswalk_Library.py,sha256=CAC1upqFu37fTWD3hFD5Djiy7yDAcV4SRkcbutdaeeY,53012
5
5
  MediBot/MediBot_Post.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  MediBot/MediBot_Preprocessor.py,sha256=Lc9uQnE5SAa0dQTOREdPV1QUB2cywXTHJ1h2w-fyeeQ,13331
7
- MediBot/MediBot_Preprocessor_lib.py,sha256=LXzV85uq7YoAWbZi88HzAs_GObl7vP8mhFbWZQbd0M8,45687
8
- MediBot/MediBot_UI.py,sha256=0LcBY5NtUQv2aGpcMucSafjEjAho9CyuhfMvqpu-dOk,13808
7
+ MediBot/MediBot_Preprocessor_lib.py,sha256=pTXtaREJdj0kupzCR_QsHLUlPHYFZ2lUzSLm4IBoHKY,49081
8
+ MediBot/MediBot_UI.py,sha256=js2DVzr5KV4IRckv_O0ZgvV488M3NcFjkLim9Dk0W5M,14992
9
9
  MediBot/MediBot_dataformat_library.py,sha256=XNyeiOC6uJUp15UXP_rhtB3rMTPus9ZXDnz5zHNoRYM,8586
10
10
  MediBot/MediBot_docx_decoder.py,sha256=GbhX58pMAsWNhBF7B8AtWiNpUOB4bU0zAM81moXYkkE,27370
11
11
  MediBot/MediPost.py,sha256=C1hZJFr65rN6F_dckjdBxFC0vL2CoqY9W3YFqU5HXtE,336
12
12
  MediBot/PDF_to_CSV_Cleaner.py,sha256=ZZphmq-5K04DkrZNlcwNAIoZPOD_ROWvS3PMkKFxeiM,8799
13
13
  MediBot/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
14
  MediBot/update_json.py,sha256=9FJZb-32EujpKuSoCjyCbdTdthOIuhcMoN4Wchuzn8A,2508
15
- MediBot/update_medicafe.py,sha256=rx1zUvCI99JRdr8c1csMGI2uJBl3pqusvX-xr3KhmR4,11881
16
- MediLink/MediLink.py,sha256=O3VSLm2s5viCRBL1is7Loj_nSaLMMcFZ-weXAmVp_20,21588
15
+ MediBot/update_medicafe.py,sha256=OE93jLefdPWObJvJUg9KMGZpGcJnKnrU9IQ7Kzn2q_M,12704
16
+ MediLink/MediLink.py,sha256=tWJG_zHqJJfk2L2YifwHGpqH5bKhfVKuP_XYr8i4DU0,28546
17
17
  MediLink/MediLink_277_decoder.py,sha256=Z3hQK2j-YzdXjov6aDlDRc7M_auFBnl3se4OF5q6_04,4358
18
18
  MediLink/MediLink_837p_cob_library.py,sha256=pWWd03yXTamNJKDbPCdOCkfglW4OLXQtIN3eiMSdfAA,29934
19
- MediLink/MediLink_837p_encoder.py,sha256=ODdDl_hBDYCf3f683qB3I51FGCKxrMeKL3gfT0wNAFM,28073
20
- MediLink/MediLink_837p_encoder_library.py,sha256=aQsPblTO43l8Km7oNAVt92Kb9SEmF1a4IVXmzuwgfhQ,55505
19
+ MediLink/MediLink_837p_encoder.py,sha256=2YcbIi3G3AETLDITWJIcMh2kBM62IgwR0W_lCVVLO0w,28816
20
+ MediLink/MediLink_837p_encoder_library.py,sha256=flRGNiQfMY3668ZIwyOMYFD1p96WArcR_WjYjhZmNP4,55812
21
21
  MediLink/MediLink_837p_utilities.py,sha256=Bi91S1aJbsEOpWXp_IOUgCQ76IPiOJNkOfXXtcirzmI,10416
22
22
  MediLink/MediLink_API_Generator.py,sha256=vBZ8moR9tvv7mb200HlZnJrk1y-bQi8E16I2r41vgVM,10345
23
23
  MediLink/MediLink_API_v2.py,sha256=mcIgLnXPS_NaUBrkKJ8mxCUaQ0AuQUeU1vG6DoplbVY,7733
24
- MediLink/MediLink_API_v3.py,sha256=rB1Aw3JzAQdquWvRwhoJD10nN-cTRqva-6-9E2K7wH4,41281
24
+ MediLink/MediLink_API_v3.py,sha256=cOxqXA_NK-O7iVaojnXhmyUg3CC5iS1TanEvA1XEV_o,44808
25
25
  MediLink/MediLink_APIs.py,sha256=jm3f9T034MJKH8A_CIootULoeuk7H8s7PazpFZRCbKI,6222
26
26
  MediLink/MediLink_Azure.py,sha256=Ow70jctiHFIylskBExN7WUoRgrKOvBR6jNTnQMk6lJA,210
27
27
  MediLink/MediLink_ClaimStatus.py,sha256=kXIDidxSGuqTwjFNMQIKms42jqIu5Qmnet-7Ohe8zjE,11645
28
28
  MediLink/MediLink_ConfigLoader.py,sha256=u9ecB0SIN7zuJAo8KcoQys95BtyAo-8S2n4mRd0S3XU,4356
29
- MediLink/MediLink_DataMgmt.py,sha256=MjCF1L-4RkQnz_vBULPB-DVsEtv0X1WHT1o9YjCGQ7s,33280
29
+ MediLink/MediLink_DataMgmt.py,sha256=AVkiQ3kMmOZHaZ3Q-I2QyCZdfcU-45mIapSoZ2rdW5M,33374
30
30
  MediLink/MediLink_Decoder.py,sha256=lKWiOcRClz8F5P3jrvFTq_hW9XF4OrPfA4LFz2zLSLg,14013
31
31
  MediLink/MediLink_Deductible.py,sha256=els8CQMK3pRzlqzs12HDgqx42WLXuHFU-nfXiA4y0Js,39426
32
32
  MediLink/MediLink_Deductible_Validator.py,sha256=2g-lZd-Y5fJ1mfP87vM6oABg0t5Om-7EkEkilVvDWYY,22888
@@ -39,8 +39,8 @@ MediLink/MediLink_Parser.py,sha256=w2ZD4minjwkaMz7nzP_r8v_Ow_uM5KHjpPSY8mIHcdE,9
39
39
  MediLink/MediLink_Scan.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
40
40
  MediLink/MediLink_Scheduler.py,sha256=UJvxhDvHraqra2_TlQVlGeh5jRFrrfK6nCVUHnKOEMY,38
41
41
  MediLink/MediLink_StatusCheck.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
42
- MediLink/MediLink_UI.py,sha256=2ngUg02qrE25IG8GG1cdbx8mbn71BF27r9zujHdnpNo,7575
43
- MediLink/MediLink_Up.py,sha256=kkBxXl1xiKiblwF4uj3r_-keLlSzNNWnu4ZbY2ipNcs,23206
42
+ MediLink/MediLink_UI.py,sha256=I9nIZsHJhIVRUPqj0xHoorgEbZUIWO7fn-l7yg2HU1g,7862
43
+ MediLink/MediLink_Up.py,sha256=mA6Z1PeuydqW7ufUd5BBOstQgBAm1Wh6sf5YvORk0Us,23981
44
44
  MediLink/MediLink_batch.bat,sha256=nqL5QwCLyRQFSPdv6kgtcV_cpky7FXSOWVl6OxjRXb4,118
45
45
  MediLink/Soumit_api.py,sha256=5JfOecK98ZC6NpZklZW2AkOzkjvrbYxpJpZNH3rFxDw,497
46
46
  MediLink/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -49,8 +49,8 @@ MediLink/test.py,sha256=kSvvJRL_3fWuNS3_x4hToOnUljGLoeEw6SUTHQWQRJk,3108
49
49
  MediLink/test_cob_library.py,sha256=wUMv0-Y6fNsKcAs8Z9LwfmEBRO7oBzBAfWmmzwoNd1g,13841
50
50
  MediLink/test_validation.py,sha256=FJrfdUFK--xRScIzrHCg1JeGdm0uJEoRnq6CgkP2lwM,4154
51
51
  MediLink/webapp.html,sha256=JPKT559aFVBi1r42Hz7C77Jj0teZZRumPhBev8eSOLk,19806
52
- medicafe-0.250725.17.dist-info/LICENSE,sha256=65lb-vVujdQK7uMH3RRJSMwUW-WMrMEsc5sOaUn2xUk,1096
53
- medicafe-0.250725.17.dist-info/METADATA,sha256=iL0DOww2D3dQpvUKzGGNoCGKpC6Ls-ls_N2lLRzWiaQ,5502
54
- medicafe-0.250725.17.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
55
- medicafe-0.250725.17.dist-info/top_level.txt,sha256=3uOwR4q_SP8Gufk2uCHoKngAgbtdOwQC6Qjl7ViBa_c,17
56
- medicafe-0.250725.17.dist-info/RECORD,,
52
+ medicafe-0.250728.0.dist-info/LICENSE,sha256=65lb-vVujdQK7uMH3RRJSMwUW-WMrMEsc5sOaUn2xUk,1096
53
+ medicafe-0.250728.0.dist-info/METADATA,sha256=dX0QCSVHDbtSSI3-UK0JoTD_2wvNnFd3Xn5aJjHPMAc,5501
54
+ medicafe-0.250728.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
55
+ medicafe-0.250728.0.dist-info/top_level.txt,sha256=3uOwR4q_SP8Gufk2uCHoKngAgbtdOwQC6Qjl7ViBa_c,17
56
+ medicafe-0.250728.0.dist-info/RECORD,,