medicafe 0.250810.6__py3-none-any.whl → 0.250810.7__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.
MediBot/MediBot.bat CHANGED
@@ -335,7 +335,7 @@ if exist "%upgrade_medicafe_local%" (
335
335
  cls
336
336
  echo Version: %medicafe_version%
337
337
  echo --------------------------------------------------------------
338
- echo .//* Welcome to MediBot *\\.
338
+ echo .//* Welcome to MediCafe *\\.
339
339
  echo --------------------------------------------------------------
340
340
  echo.
341
341
 
@@ -83,15 +83,44 @@ def check_crosswalk_health(crosswalk):
83
83
 
84
84
  def prompt_user_for_api_calls(crosswalk, config):
85
85
  """
86
- Prompts user with a 3-second timeout to skip API calls if crosswalk looks healthy.
87
- Windows XP compatible version using threading instead of select.
88
-
86
+ Prompt user with a short timeout to optionally run API validation when the crosswalk looks healthy.
87
+
88
+ Implementation notes and rationale
89
+ ----------------------------------
90
+ A previous implementation attempted to capture a quick ENTER press using a background thread that
91
+ called ``input()`` and then ``join(timeout=...)``. When the timeout elapsed, the thread often
92
+ remained blocked inside ``input()``. That stray, still-waiting ``input()`` subsequently consumed
93
+ the next ENTER the user typed at a later prompt (e.g., the Medicare question), producing a blank,
94
+ unlabeled input step before the real prompt. This manifested as “press Enter once to get the next
95
+ prompt,” which is undesirable and confusing.
96
+
97
+ To avoid leaving a pending console read, this implementation uses Windows' non-blocking console
98
+ polling (``msvcrt.kbhit()/getwch()``) for up to ~2 seconds to detect an ENTER press without ever
99
+ invoking ``input()``. Non-ENTER keys are discarded to avoid leaking keystrokes into subsequent
100
+ prompts. If ENTER is not pressed during the window, we skip API validation with no lingering input
101
+ state.
102
+
103
+ If threading must be used in future
104
+ -----------------------------------
105
+ Do not call ``input()`` in a background thread and leave it running after a timeout. Instead:
106
+ - Use a worker thread that performs non-blocking polling (e.g., ``msvcrt.kbhit()/getwch()``) and
107
+ sets a threading.Event when ENTER is detected.
108
+ - The main thread waits on the Event with a timeout. On timeout, signal the worker to stop.
109
+ - Before returning, drain any buffered keystrokes with a short loop while ``msvcrt.kbhit()`` to
110
+ ensure no characters (including ENTER) carry over to the next prompt.
111
+ - This avoids dangling reads and preserves a clean console state.
112
+
113
+ Compatibility
114
+ -------------
115
+ - Targets Python 3.4.4 / Windows XP constraints; avoids ``selectors``/``select`` on stdin and
116
+ avoids advanced console APIs. Falls back to a non-interactive skip on non-Windows platforms.
117
+
89
118
  Args:
90
119
  crosswalk (dict): The crosswalk dictionary to check.
91
120
  config (dict): Configuration settings for logging.
92
-
121
+
93
122
  Returns:
94
- bool: True if should proceed with API calls, False if should skip
123
+ bool: True to proceed with API calls; False to skip
95
124
  """
96
125
 
97
126
  is_healthy, missing_names, missing_medisoft_ids, missing_names_list, missing_medisoft_ids_list = check_crosswalk_health(crosswalk)
@@ -103,31 +132,47 @@ def prompt_user_for_api_calls(crosswalk, config):
103
132
  print(" - All payers have names")
104
133
  print(" - All payers have medisoft IDs")
105
134
  print("\nPress ENTER to run API validation, or wait 2 seconds to skip...")
106
-
107
- # Use threading for timeout on Windows
108
- user_input = [None] # Use list to store result from thread
109
-
110
- def get_input():
111
- try:
112
- user_input[0] = input()
113
- except (EOFError, KeyboardInterrupt):
114
- user_input[0] = ""
115
-
116
- # Start input thread
117
- input_thread = threading.Thread(target=get_input)
118
- input_thread.daemon = True
119
- input_thread.start()
120
-
121
- # Wait for 2 seconds or until input is received
122
- input_thread.join(timeout=2.0)
123
-
124
- if user_input[0] is not None:
125
- print("Running API validation calls...")
126
- MediLink_ConfigLoader.log("User pressed ENTER - proceeding with API calls", config, level="INFO")
127
- return True
128
- else:
129
- print("Timed out - skipping API calls")
130
- MediLink_ConfigLoader.log("Timeout - skipping API calls", config, level="INFO")
135
+
136
+ # Windows-safe, non-blocking ENTER detection without leaving a stray input() pending
137
+ try:
138
+ import os, time
139
+ msvcrt = None
140
+ if os.name == 'nt':
141
+ try:
142
+ import msvcrt # Windows-only
143
+ except ImportError:
144
+ msvcrt = None
145
+
146
+ if msvcrt is not None:
147
+ start_time = time.time()
148
+ pressed_enter = False
149
+ # Consume keys for up to 2 seconds, act only if ENTER is hit
150
+ while time.time() - start_time < 2.0:
151
+ if msvcrt.kbhit():
152
+ ch = msvcrt.getwch()
153
+ if ch in ('\r', '\n'):
154
+ pressed_enter = True
155
+ break
156
+ # Discard any other keys so they don't leak into later prompts
157
+ time.sleep(0.01)
158
+
159
+ if pressed_enter:
160
+ print("Running API validation calls...")
161
+ MediLink_ConfigLoader.log("User pressed ENTER - proceeding with API calls", config, level="INFO")
162
+ return True
163
+ else:
164
+ print("Timed out - skipping API calls")
165
+ MediLink_ConfigLoader.log("Timeout - skipping API calls", config, level="INFO")
166
+ return False
167
+ else:
168
+ # Fallback for non-Windows: avoid interactive wait to prevent stdin conflicts
169
+ print("(Skipping interactive API validation prompt on this platform)")
170
+ MediLink_ConfigLoader.log("Skipped interactive API validation prompt (unsupported platform)", config, level="INFO")
171
+ return False
172
+ except Exception:
173
+ # On any error, default to skipping to avoid dangling input states
174
+ print("(Error during prompt; skipping API validation)")
175
+ MediLink_ConfigLoader.log("Error during API validation prompt; skipping", config, level="WARNING")
131
176
  return False
132
177
  else:
133
178
  print("\nCrosswalk needs attention:")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: medicafe
3
- Version: 0.250810.6
3
+ Version: 0.250810.7
4
4
  Summary: MediCafe
5
5
  Home-page: https://github.com/katanada2
6
6
  Author: Daniel Vidaud
@@ -1,8 +1,8 @@
1
- MediBot/MediBot.bat,sha256=kWhQVJPIJ51w6pPsf9tQlw2mCoZU6VysiI9R-k4xmfk,25281
1
+ MediBot/MediBot.bat,sha256=GUmRX7D02jkR0Jiqckj4jE-P0fzJsgEe9KXKPigHEwU,25282
2
2
  MediBot/MediBot.py,sha256=G3QuSgyEizas4plYez1n-u8xigbbtYEgl1x6ZSTWsAw,34306
3
3
  MediBot/MediBot_Charges.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  MediBot/MediBot_Crosswalk_Library.py,sha256=HZHbjKHhjLW2jERmLS6pEZOl-MUxUu1YwA6oUltfdkE,24693
5
- MediBot/MediBot_Crosswalk_Utils.py,sha256=Qf3O9Wh1cbfGbYqObK5rVh99qRCboWnmVUpubEZeN3A,35763
5
+ MediBot/MediBot_Crosswalk_Utils.py,sha256=HQXZUWDZF_LvOMLsdjlsDQ79Yi_IiqNVRKX2Cd0A6x8,38762
6
6
  MediBot/MediBot_Post.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  MediBot/MediBot_Preprocessor.py,sha256=zAcfyuE8wl9JRzLGsUnnXiHxAr-hbCCIB2M-Jb3LUqI,16203
8
8
  MediBot/MediBot_Preprocessor_lib.py,sha256=L5VkBoSWuvvKNs0YoHz_-KQ5Z2hnqLJyM_j7yeKb9CM,72423
@@ -73,9 +73,9 @@ MediLink/test_cob_library.py,sha256=wUMv0-Y6fNsKcAs8Z9LwfmEBRO7oBzBAfWmmzwoNd1g,
73
73
  MediLink/test_timing.py,sha256=yH2b8QPLDlp1Zy5AhgtjzjnDHNGhAD16ZtXtZzzESZw,2042
74
74
  MediLink/test_validation.py,sha256=FJrfdUFK--xRScIzrHCg1JeGdm0uJEoRnq6CgkP2lwM,4154
75
75
  MediLink/webapp.html,sha256=JPKT559aFVBi1r42Hz7C77Jj0teZZRumPhBev8eSOLk,19806
76
- medicafe-0.250810.6.dist-info/LICENSE,sha256=65lb-vVujdQK7uMH3RRJSMwUW-WMrMEsc5sOaUn2xUk,1096
77
- medicafe-0.250810.6.dist-info/METADATA,sha256=XznXEduQaqqFfkpxn116G1icQgQtCNDeXgk8Pn5cbwM,5501
78
- medicafe-0.250810.6.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
79
- medicafe-0.250810.6.dist-info/entry_points.txt,sha256=m3RBUBjr-xRwEkKJ5W4a7NlqHZP_1rllGtjZnrRqKe8,52
80
- medicafe-0.250810.6.dist-info/top_level.txt,sha256=U6-WBJ9RCEjyIs0BlzbQq_PwedCp_IV9n1616NNV5zA,26
81
- medicafe-0.250810.6.dist-info/RECORD,,
76
+ medicafe-0.250810.7.dist-info/LICENSE,sha256=65lb-vVujdQK7uMH3RRJSMwUW-WMrMEsc5sOaUn2xUk,1096
77
+ medicafe-0.250810.7.dist-info/METADATA,sha256=5UlQ0WF3yu07a8mS6d-MZI_uCayxQ2-O43P6vii4Cjw,5501
78
+ medicafe-0.250810.7.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
79
+ medicafe-0.250810.7.dist-info/entry_points.txt,sha256=m3RBUBjr-xRwEkKJ5W4a7NlqHZP_1rllGtjZnrRqKe8,52
80
+ medicafe-0.250810.7.dist-info/top_level.txt,sha256=U6-WBJ9RCEjyIs0BlzbQq_PwedCp_IV9n1616NNV5zA,26
81
+ medicafe-0.250810.7.dist-info/RECORD,,