medicafe 0.250725.1__py3-none-any.whl → 0.250725.4__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
2
+ import subprocess, os, tempfile, traceback, re, sys, time, msvcrt, ctypes
3
3
  from collections import OrderedDict
4
4
  import MediBot_dataformat_library
5
5
  import MediBot_Preprocessor
@@ -12,6 +12,47 @@ 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
+
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 reads from stdin and discards leading newlines,
37
+ then puts back the first non-newline character for the real input() call.
38
+ """
39
+ if sys.platform != "win32":
40
+ return # no-op on non-Windows
41
+
42
+ try:
43
+ while True:
44
+ ch = sys.stdin.read(1)
45
+ if ch not in ('\r', '\n'):
46
+ # put it back for the real input() call
47
+ msvcrt.ungetch(ch.encode())
48
+ break
49
+ elif not ch: # EOF
50
+ break
51
+ except Exception:
52
+ # If stdin.read fails, fall back to msvcrt approach
53
+ while msvcrt.kbhit():
54
+ msvcrt.getch()
55
+
15
56
  try:
16
57
  from MediBot_Crosswalk_Library import crosswalk_update
17
58
  except ImportError:
@@ -400,22 +441,24 @@ if __name__ == "__main__":
400
441
  sys.stdout.flush()
401
442
  time.sleep(0.2) # Increased delay for Windows XP
402
443
 
403
- # Try raw_input first (Python 2.x compatibility), fall back to input
404
- try:
405
- proceed = raw_input().lower().strip() in ['yes', 'y']
406
- except NameError:
407
- proceed = input().lower().strip() in ['yes', 'y']
444
+ # Flush console input buffer to remove any stray CR/LF
445
+ flush_console_input_buffer()
446
+ discard_leading_blank()
447
+
448
+ # Use sys.stdin.readline() for more reliable input on Windows XP
449
+ proceed = sys.stdin.readline().lower().strip() in ['yes', 'y']
408
450
  else:
409
451
  print("\nDo you want to proceed with the {} remaining patient(s)? (yes/no): ".format(len(patients_to_process)), end='', flush=True)
410
452
  # Force flush and wait for Windows XP console buffer synchronization
411
453
  sys.stdout.flush()
412
454
  time.sleep(0.2) # Increased delay for Windows XP
413
455
 
414
- # Try raw_input first (Python 2.x compatibility), fall back to input
415
- try:
416
- proceed = raw_input().lower().strip() in ['yes', 'y']
417
- except NameError:
418
- proceed = input().lower().strip() in ['yes', 'y']
456
+ # Flush console input buffer to remove any stray CR/LF
457
+ flush_console_input_buffer()
458
+ discard_leading_blank()
459
+
460
+ # Use sys.stdin.readline() for more reliable input on Windows XP
461
+ proceed = sys.stdin.readline().lower().strip() in ['yes', 'y']
419
462
 
420
463
  # TODO: Here is where we need to add the step where we move to MediBot_Charges.
421
464
  # The return is an enriched dataset to be picked up by MediBot which means we need to return:
MediBot/MediBot_UI.py CHANGED
@@ -1,5 +1,5 @@
1
1
  #MediBot_UI.py
2
- import ctypes, time, re, os, sys
2
+ import ctypes, time, re, os, sys, msvcrt
3
3
  from ctypes import wintypes
4
4
  from sys import exit
5
5
  project_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
@@ -18,6 +18,47 @@ 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
+ try:
31
+ kernel32 = ctypes.WinDLL('kernel32', use_last_error=True)
32
+ STD_INPUT_HANDLE = -10
33
+ h_stdin = kernel32.GetStdHandle(STD_INPUT_HANDLE)
34
+ kernel32.FlushConsoleInputBuffer(h_stdin)
35
+ except Exception:
36
+ # Fallback: drain any leading newlines manually
37
+ while msvcrt.kbhit():
38
+ msvcrt.getch()
39
+
40
+ def discard_leading_blank():
41
+ """
42
+ Alternative fallback that reads from stdin and discards leading newlines,
43
+ then puts back the first non-newline character for the real input() call.
44
+ """
45
+ if sys.platform != "win32":
46
+ return # no-op on non-Windows
47
+
48
+ try:
49
+ while True:
50
+ ch = sys.stdin.read(1)
51
+ if ch not in ('\r', '\n'):
52
+ # put it back for the real input() call
53
+ msvcrt.ungetch(ch.encode())
54
+ break
55
+ elif not ch: # EOF
56
+ break
57
+ except Exception:
58
+ # If stdin.read fails, fall back to msvcrt approach
59
+ while msvcrt.kbhit():
60
+ msvcrt.getch()
61
+
21
62
  class AppControl:
22
63
  def __init__(self):
23
64
  self.script_paused = False
@@ -152,11 +193,12 @@ def display_patient_selection_menu(csv_data, reverse_mapping, proceed_as_medicar
152
193
  sys.stdout.flush()
153
194
  time.sleep(0.2) # Increased delay for Windows XP
154
195
 
155
- # Try raw_input first (Python 2.x compatibility), fall back to input
156
- try:
157
- proceed = raw_input().lower().strip() in ['yes', 'y']
158
- except NameError:
159
- proceed = input().lower().strip() in ['yes', 'y']
196
+ # Flush console input buffer to remove any stray CR/LF
197
+ flush_console_input_buffer()
198
+ discard_leading_blank()
199
+
200
+ # Use sys.stdin.readline() for more reliable input on Windows XP
201
+ proceed = sys.stdin.readline().lower().strip() in ['yes', 'y']
160
202
 
161
203
  if not proceed:
162
204
  display_menu_header("Patient Selection for Today's Data Entry")
@@ -170,11 +212,12 @@ def display_patient_selection_menu(csv_data, reverse_mapping, proceed_as_medicar
170
212
  sys.stdout.flush()
171
213
  time.sleep(0.2) # Increased delay for Windows XP
172
214
 
173
- # Try raw_input first (Python 2.x compatibility), fall back to input
174
- try:
175
- selection = raw_input().strip()
176
- except NameError:
177
- selection = input().strip()
215
+ # Flush console input buffer to remove any stray CR/LF
216
+ flush_console_input_buffer()
217
+ discard_leading_blank()
218
+
219
+ # Use sys.stdin.readline() for more reliable input on Windows XP
220
+ selection = sys.stdin.readline().strip()
178
221
  if not selection:
179
222
  print("Invalid entry. Please provide at least one number.")
180
223
  continue
@@ -253,11 +296,12 @@ def handle_user_interaction(interaction_mode, error_message):
253
296
  sys.stdout.flush()
254
297
  time.sleep(0.2) # Increased delay for Windows XP
255
298
 
256
- # Try raw_input first (Python 2.x compatibility), fall back to input
257
- try:
258
- choice = raw_input().strip()
259
- except NameError:
260
- choice = input().strip()
299
+ # Flush console input buffer to remove any stray CR/LF
300
+ flush_console_input_buffer()
301
+ discard_leading_blank()
302
+
303
+ # Use sys.stdin.readline() for more reliable input on Windows XP
304
+ choice = sys.stdin.readline().strip()
261
305
 
262
306
  if choice == '1':
263
307
  print("Selected: 'Retry last entry'. Please press 'F12' to continue.")
@@ -286,6 +330,10 @@ def user_interaction(csv_data, interaction_mode, error_message, reverse_mapping)
286
330
 
287
331
  # Force flush for Windows XP compatibility
288
332
  sys.stdout.flush()
333
+
334
+ # Flush console input buffer to remove any stray CR/LF from script launch
335
+ flush_console_input_buffer()
336
+ discard_leading_blank()
289
337
 
290
338
  while True:
291
339
  try:
@@ -295,11 +343,8 @@ def user_interaction(csv_data, interaction_mode, error_message, reverse_mapping)
295
343
  sys.stdout.flush()
296
344
  time.sleep(0.2) # Increased delay for Windows XP
297
345
 
298
- # Try raw_input first (Python 2.x compatibility), fall back to input
299
- try:
300
- response = raw_input().lower().strip()
301
- except NameError:
302
- response = input().lower().strip()
346
+ # Use sys.stdin.readline() for more reliable input on Windows XP
347
+ response = sys.stdin.readline().lower().strip()
303
348
 
304
349
  if response:
305
350
  if response in ['yes', 'y']:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: medicafe
3
- Version: 0.250725.1
3
+ Version: 0.250725.4
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=6jCmJZJtclmVwvsBupBnZiyHYd0I9xmvxreLklX19iw,25147
2
+ MediBot/MediBot.py,sha256=FhkGkwb3mgaODNKsxC3kGW-mXVBPchXyrxv3Bb8WAA0,26680
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=0I8aS3iA0U9H-bGsXocS9gkBXS0pHAzfqHhWS8k-0qA,14599
8
+ MediBot/MediBot_UI.py,sha256=lNgBpKf8hknyyygdLl9pRtVN92B1xU3oLFXCiLmE4EE,16253
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.1.dist-info/LICENSE,sha256=65lb-vVujdQK7uMH3RRJSMwUW-WMrMEsc5sOaUn2xUk,1096
53
- medicafe-0.250725.1.dist-info/METADATA,sha256=Cgk6b8lwljE1d4foXQ3N4Is-Iq5i8fH06CIWCWV1aZI,5501
54
- medicafe-0.250725.1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
55
- medicafe-0.250725.1.dist-info/top_level.txt,sha256=3uOwR4q_SP8Gufk2uCHoKngAgbtdOwQC6Qjl7ViBa_c,17
56
- medicafe-0.250725.1.dist-info/RECORD,,
52
+ medicafe-0.250725.4.dist-info/LICENSE,sha256=65lb-vVujdQK7uMH3RRJSMwUW-WMrMEsc5sOaUn2xUk,1096
53
+ medicafe-0.250725.4.dist-info/METADATA,sha256=k4oOKjaFQ9pQ4w6Q1s1gByoCQhDKFd7lGbUdrUPEgAI,5501
54
+ medicafe-0.250725.4.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
55
+ medicafe-0.250725.4.dist-info/top_level.txt,sha256=3uOwR4q_SP8Gufk2uCHoKngAgbtdOwQC6Qjl7ViBa_c,17
56
+ medicafe-0.250725.4.dist-info/RECORD,,