medicafe 0.250725.9__py3-none-any.whl → 0.250725.11__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 CHANGED
@@ -1,5 +1,5 @@
1
1
  #MediBot.py
2
- import subprocess, os, tempfile, traceback, re, sys, time, msvcrt, ctypes
2
+ import subprocess, os, tempfile, traceback, re, sys, time, msvcrt
3
3
  from collections import OrderedDict
4
4
  import MediBot_dataformat_library
5
5
  import MediBot_Preprocessor
@@ -12,35 +12,7 @@ sys.path.append(project_dir)
12
12
 
13
13
  from MediLink import MediLink_ConfigLoader
14
14
 
15
- def flush_console_input_buffer():
16
- """
17
- Remove any keystrokes already sitting in the console input buffer.
18
- Necessary on Windows XP where a stray CR/LF can remain after the
19
- script is launched.
20
- """
21
- if sys.platform != "win32":
22
- return # no-op on non-Windows
23
15
 
24
- try:
25
- kernel32 = ctypes.WinDLL('kernel32', use_last_error=True)
26
- STD_INPUT_HANDLE = -10
27
- h_stdin = kernel32.GetStdHandle(STD_INPUT_HANDLE)
28
- kernel32.FlushConsoleInputBuffer(h_stdin)
29
- except Exception:
30
- # Fallback: drain any leading newlines manually
31
- while msvcrt.kbhit():
32
- msvcrt.getch()
33
-
34
- def discard_leading_blank():
35
- """
36
- Alternative fallback that uses non-blocking msvcrt to drain any available input.
37
- """
38
- if sys.platform != "win32":
39
- return # no-op on non-Windows
40
-
41
- # Use non-blocking msvcrt approach to drain any available input
42
- while msvcrt.kbhit():
43
- msvcrt.getch()
44
16
 
45
17
  try:
46
18
  from MediBot_Crosswalk_Library import crosswalk_update
@@ -426,23 +398,21 @@ if __name__ == "__main__":
426
398
  # Check if there are patients left to process
427
399
  if len(patients_to_process) == 0:
428
400
  print("\nAll patients have been processed. Continue anyway?: ", end='', flush=True)
429
- # Force flush and wait for Windows XP console buffer synchronization
430
- sys.stdout.flush()
431
- time.sleep(0.2) # Increased delay for Windows XP
401
+ time.sleep(0.1) # Reduced delay for Windows XP compatibility
432
402
 
433
- # Flush console input buffer to remove any stray CR/LF
434
- flush_console_input_buffer()
403
+ # Clear any leftover input
404
+ while msvcrt.kbhit():
405
+ msvcrt.getch()
435
406
 
436
407
  # Use input() for more reliable input on Windows XP
437
408
  proceed = input().lower().strip() in ['yes', 'y']
438
409
  else:
439
410
  print("\nDo you want to proceed with the {} remaining patient(s)? (yes/no): ".format(len(patients_to_process)), end='', flush=True)
440
- # Force flush and wait for Windows XP console buffer synchronization
441
- sys.stdout.flush()
442
- time.sleep(0.2) # Increased delay for Windows XP
411
+ time.sleep(0.1) # Reduced delay for Windows XP compatibility
443
412
 
444
- # Flush console input buffer to remove any stray CR/LF
445
- flush_console_input_buffer()
413
+ # Clear any leftover input
414
+ while msvcrt.kbhit():
415
+ msvcrt.getch()
446
416
 
447
417
  # Use input() for more reliable input on Windows XP
448
418
  proceed = input().lower().strip() in ['yes', 'y']
MediBot/MediBot_UI.py CHANGED
@@ -18,88 +18,26 @@ config, crosswalk = MediLink_ConfigLoader.load_configuration()
18
18
  VK_END = int(config.get('VK_END', ""), 16) # Try F12 (7B). Virtual key code for 'End' (23)
19
19
  VK_PAUSE = int(config.get('VK_PAUSE', ""), 16) # Try F11 (7A). Virtual-key code for 'Home' (24)
20
20
 
21
- def flush_console_input_buffer():
22
- """
23
- Remove any keystrokes already sitting in the console input buffer.
24
- Necessary on Windows XP where a stray CR/LF can remain after the
25
- script is launched.
26
- """
27
- if sys.platform != "win32":
28
- return # no-op on non-Windows
29
-
30
- print("DEBUG_FLUSH: Starting flush_console_input_buffer()")
31
-
32
- # Check what's in the buffer before flushing
33
- chars_in_buffer = []
34
- while msvcrt.kbhit():
35
- ch = msvcrt.getch()
36
- chars_in_buffer.append(ch)
37
-
38
- if chars_in_buffer:
39
- print("DEBUG_FLUSH: Found {} chars in buffer before flush: {}".format(len(chars_in_buffer), chars_in_buffer))
40
- else:
41
- print("DEBUG_FLUSH: No chars found in buffer before flush")
42
21
 
43
- try:
44
- kernel32 = ctypes.WinDLL('kernel32', use_last_error=True)
45
- STD_INPUT_HANDLE = -10
46
- h_stdin = kernel32.GetStdHandle(STD_INPUT_HANDLE)
47
- result = kernel32.FlushConsoleInputBuffer(h_stdin)
48
- print("DEBUG_FLUSH: FlushConsoleInputBuffer API call result: {}".format(result))
49
- except Exception as e:
50
- print("DEBUG_FLUSH: FlushConsoleInputBuffer API failed: {}".format(e))
51
- # Fallback: drain any leading newlines manually
52
- fallback_chars = []
53
- while msvcrt.kbhit():
54
- ch = msvcrt.getch()
55
- fallback_chars.append(ch)
56
- if fallback_chars:
57
- print("DEBUG_FLUSH: Fallback removed {} chars: {}".format(len(fallback_chars), fallback_chars))
58
- else:
59
- print("DEBUG_FLUSH: Fallback found no chars to remove")
60
-
61
- print("DEBUG_FLUSH: flush_console_input_buffer() completed")
62
22
 
63
23
  def robust_input(prompt="", max_retries=3):
64
24
  """
65
- Robust input function that handles Windows XP console timing issues.
66
- Automatically retries if the first input returns empty.
25
+ Simple input function with retry logic for Windows XP console issues.
67
26
  """
68
- print("DEBUG_ROBUST: Starting robust_input with prompt: '{}'".format(prompt))
69
-
70
27
  for attempt in range(max_retries):
71
28
  if attempt > 0:
72
- print("DEBUG_ROBUST: Retry attempt {} for input".format(attempt + 1))
73
- flush_console_input_buffer()
74
-
75
- # Print prompt only on first attempt, or if it's a retry
76
- if attempt == 0:
77
- print("DEBUG_ROBUST: First attempt - calling input(prompt)")
78
- response = input(prompt).strip()
79
- else:
80
- print("DEBUG_ROBUST: Retry attempt - calling input() without prompt")
81
- response = input().strip()
29
+ # Clear any leftover input on retry
30
+ while msvcrt.kbhit():
31
+ msvcrt.getch()
82
32
 
83
- print("DEBUG_ROBUST: Attempt {} got: '{}' (length: {})".format(attempt + 1, response, len(response)))
33
+ response = input(prompt if attempt == 0 else "").strip()
84
34
 
85
35
  if response:
86
- print("DEBUG_ROBUST: Success! Returning: '{}'".format(response))
87
36
  return response
88
37
 
89
- # If all attempts failed, return empty string
90
- print("DEBUG_ROBUST: All {} attempts failed, returning empty string".format(max_retries))
91
38
  return ""
92
39
 
93
- def discard_leading_blank():
94
- """
95
- Alternative fallback that uses non-blocking msvcrt to drain any available input.
96
- """
97
- if sys.platform != "win32":
98
- return # no-op on non-Windows
99
-
100
- # Use non-blocking msvcrt approach to drain any available input
101
- while msvcrt.kbhit():
102
- msvcrt.getch()
40
+
103
41
 
104
42
  class AppControl:
105
43
  def __init__(self):
@@ -231,12 +169,11 @@ def display_patient_selection_menu(csv_data, reverse_mapping, proceed_as_medicar
231
169
 
232
170
  print("-" * 60)
233
171
  print("\nDo you want to proceed with the selected patients? (yes/no): ", end='', flush=True)
234
- # Force flush and wait for Windows XP console buffer synchronization
235
- sys.stdout.flush()
236
- time.sleep(0.2) # Increased delay for Windows XP
172
+ time.sleep(0.1) # Reduced delay for Windows XP compatibility
237
173
 
238
- # Flush console input buffer to remove any stray CR/LF
239
- flush_console_input_buffer()
174
+ # Clear any leftover input
175
+ while msvcrt.kbhit():
176
+ msvcrt.getch()
240
177
 
241
178
  # Use input() for more reliable input on Windows XP
242
179
  proceed = input().lower().strip() in ['yes', 'y']
@@ -249,12 +186,11 @@ def display_patient_selection_menu(csv_data, reverse_mapping, proceed_as_medicar
249
186
  while True:
250
187
  while True:
251
188
  print("\nEnter the number(s) of the patients you wish to proceed with \n(e.g., 1,3,5): ", end='', flush=True)
252
- # Force flush and wait for Windows XP console buffer synchronization
253
- sys.stdout.flush()
254
- time.sleep(0.2) # Increased delay for Windows XP
189
+ time.sleep(0.1) # Reduced delay for Windows XP compatibility
255
190
 
256
- # Flush console input buffer to remove any stray CR/LF
257
- flush_console_input_buffer()
191
+ # Clear any leftover input
192
+ while msvcrt.kbhit():
193
+ msvcrt.getch()
258
194
 
259
195
  # Use input() for more reliable input on Windows XP
260
196
  selection = input().strip()
@@ -332,12 +268,11 @@ def handle_user_interaction(interaction_mode, error_message):
332
268
  print("4: Exit script")
333
269
  print("-" * 60)
334
270
  print("Enter your choice (1/2/3/4): ", end='', flush=True)
335
- # Force flush and wait for Windows XP console buffer synchronization
336
- sys.stdout.flush()
337
- time.sleep(0.2) # Increased delay for Windows XP
271
+ time.sleep(0.1) # Reduced delay for Windows XP compatibility
338
272
 
339
- # Flush console input buffer to remove any stray CR/LF
340
- flush_console_input_buffer()
273
+ # Clear any leftover input
274
+ while msvcrt.kbhit():
275
+ msvcrt.getch()
341
276
 
342
277
  # Use input() for more reliable input on Windows XP
343
278
  choice = input().strip()
@@ -367,47 +302,25 @@ def user_interaction(csv_data, interaction_mode, error_message, reverse_mapping)
367
302
  if interaction_mode == 'triage':
368
303
  display_menu_header(" =(^.^)= Welcome to MediBot! =(^.^)=")
369
304
 
370
- # Force flush for Windows XP compatibility
371
- sys.stdout.flush()
305
+ # Clear any leftover input from script launch
306
+ while msvcrt.kbhit():
307
+ msvcrt.getch()
372
308
 
373
- # Flush console input buffer to remove any stray CR/LF from script launch
374
- flush_console_input_buffer()
375
-
376
309
  while True:
377
310
  try:
378
- print("DEBUG_MAIN: About to call robust_input() - waiting for user...")
379
- # Use robust_input() for more reliable input on Windows XP
380
311
  response = robust_input("\nAm I processing Medicare patients? (yes/no): ").lower()
381
312
 
382
- print("DEBUG_MAIN: robust_input() returned, response = '{}'".format(response))
383
- # Debug: Print what we actually got
384
- print("DEBUG_MAIN: Final response: '{}' (length: {})".format(response, len(response)))
385
- print("DEBUG_MAIN: Response type: {}, repr: {}".format(type(response), repr(response)))
386
- print("DEBUG_MAIN: About to check response validity...")
387
-
388
- if response:
389
- print("DEBUG_MAIN: Response is not empty, checking if valid...")
390
- if response in ['yes', 'y']:
391
- print("DEBUG_MAIN: Valid response '{}', loading Medicare config".format(response))
392
- app_control.load_paths_from_config(medicare=True)
393
- break
394
- elif response in ['no', 'n']:
395
- print("DEBUG_MAIN: Valid response '{}', loading Private config".format(response))
396
- app_control.load_paths_from_config(medicare=False)
397
- break
398
- else:
399
- print("DEBUG_MAIN: Invalid response '{}', asking again".format(response))
400
- print("Invalid entry. Please enter 'yes' or 'no'.")
313
+ if response in ['yes', 'y']:
314
+ app_control.load_paths_from_config(medicare=True)
315
+ break
316
+ elif response in ['no', 'n']:
317
+ app_control.load_paths_from_config(medicare=False)
318
+ break
401
319
  else:
402
- print("DEBUG_MAIN: Empty response, asking again")
403
- print("A response is required. Please try again.")
320
+ print("Invalid entry. Please enter 'yes' or 'no'.")
404
321
  except KeyboardInterrupt:
405
322
  print("\nOperation cancelled by user. Exiting script.")
406
323
  exit()
407
- except Exception as e:
408
- print("DEBUG_MAIN: Exception occurred: {}".format(e))
409
- import traceback
410
- traceback.print_exc()
411
324
 
412
325
  fixed_values = config.get('fixed_values', {}) # Get fixed values from config json
413
326
  if response in ['yes', 'y']:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: medicafe
3
- Version: 0.250725.9
3
+ Version: 0.250725.11
4
4
  Summary: MediCafe
5
5
  Home-page: https://github.com/katanada2
6
6
  Author: Daniel Vidaud
@@ -1,11 +1,11 @@
1
1
  MediBot/MediBot.bat,sha256=anz5i-Td1k3HhRUvkCqHsw9lBLVmO6q9bt5kLTfr1Iw,13282
2
- MediBot/MediBot.py,sha256=689_3QojGVLWmiDt7OcmOyW-KdL757jCi2b8EfaRgnU,26163
2
+ MediBot/MediBot.py,sha256=596LWAKHFUswkhQa8s6CVBXsbuZUXyh6qUcU3KtneIY,24907
3
3
  MediBot/MediBot_Charges.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  MediBot/MediBot_Crosswalk_Library.py,sha256=Ix4QlAcg3O9Y6n6ZeSUtbmtV-_n-t0-jnefXDBFlhhI,51441
5
5
  MediBot/MediBot_Post.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
6
  MediBot/MediBot_Preprocessor.py,sha256=Lc9uQnE5SAa0dQTOREdPV1QUB2cywXTHJ1h2w-fyeeQ,13331
7
7
  MediBot/MediBot_Preprocessor_lib.py,sha256=LXzV85uq7YoAWbZi88HzAs_GObl7vP8mhFbWZQbd0M8,45687
8
- MediBot/MediBot_UI.py,sha256=mMl3KHOLijxph8n1-xpULROIVy7wQQYEmadr5CYLV2o,18374
8
+ MediBot/MediBot_UI.py,sha256=thd3pwy7WW69Sf_UBMDe5gtghuMVUNoX-WIt-ITb7XM,13808
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
@@ -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.9.dist-info/LICENSE,sha256=65lb-vVujdQK7uMH3RRJSMwUW-WMrMEsc5sOaUn2xUk,1096
53
- medicafe-0.250725.9.dist-info/METADATA,sha256=mEw7yaBi3lzf-Ez_nC-3yqrYY7HSO-tch3HhVvMjthI,5501
54
- medicafe-0.250725.9.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
55
- medicafe-0.250725.9.dist-info/top_level.txt,sha256=3uOwR4q_SP8Gufk2uCHoKngAgbtdOwQC6Qjl7ViBa_c,17
56
- medicafe-0.250725.9.dist-info/RECORD,,
52
+ medicafe-0.250725.11.dist-info/LICENSE,sha256=65lb-vVujdQK7uMH3RRJSMwUW-WMrMEsc5sOaUn2xUk,1096
53
+ medicafe-0.250725.11.dist-info/METADATA,sha256=1fXL0swHuAtsnU0PcWEWzlFXvqln4OubeSZugTGw5UA,5502
54
+ medicafe-0.250725.11.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
55
+ medicafe-0.250725.11.dist-info/top_level.txt,sha256=3uOwR4q_SP8Gufk2uCHoKngAgbtdOwQC6Qjl7ViBa_c,17
56
+ medicafe-0.250725.11.dist-info/RECORD,,