rajkhanke commited on
Commit
ccf347f
·
verified ·
1 Parent(s): b6aa04e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -13
app.py CHANGED
@@ -324,6 +324,20 @@ def determine_patient_status(original_plan, updated_plan, feedback):
324
  combined_initial_text_lower = feedback_lower + " " + (original_plan_lower if original_plan_lower else "")
325
  combined_initial_text_lower = re.sub(r'\s+', ' ', combined_initial_text_lower).strip() # Clean up spaces
326
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
327
  # 1. Check for EMERGENCY status (Highest Priority)
328
  # Check combined initial text for emergency keywords
329
  is_emergency_initial = check_keywords(combined_initial_text_lower, emergency_keywords)
@@ -337,19 +351,6 @@ def determine_patient_status(original_plan, updated_plan, feedback):
337
  logger.info("Status determined: EMERGENCY (keyword found in feedback/original or final plan).")
338
  return "emergency"
339
 
340
- # 2. Check for DETERIORATING status (Second Priority)
341
- # Check combined initial text for deteriorating keywords (only if not emergency)
342
- is_deteriorating_initial = check_keywords(combined_initial_text_lower, deteriorating_keywords)
343
- if is_deteriorating_initial:
344
- logger.info("Status determined: DETERIORATING (keyword found in feedback/original).")
345
- return "deteriorating"
346
-
347
- # 3. Check for IMPROVING status (Third Priority)
348
- # Check combined initial text for improving keywords (only if not emergency or deteriorating)
349
- is_improving_initial = check_keywords(combined_initial_text_lower, improvement_keywords)
350
- if is_improving_initial:
351
- logger.info("Status determined: IMPROVING (keyword found in feedback/original).")
352
- return "improving"
353
 
354
  # 4. Default to STABLE if no specific status keywords are found
355
  logger.info("Status determined: STABLE (no specific status keywords found).")
 
324
  combined_initial_text_lower = feedback_lower + " " + (original_plan_lower if original_plan_lower else "")
325
  combined_initial_text_lower = re.sub(r'\s+', ' ', combined_initial_text_lower).strip() # Clean up spaces
326
 
327
+ # 2. Check for DETERIORATING status (Second Priority)
328
+ # Check combined initial text for deteriorating keywords (only if not emergency)
329
+ is_deteriorating_initial = check_keywords(combined_initial_text_lower, deteriorating_keywords)
330
+ if is_deteriorating_initial:
331
+ logger.info("Status determined: DETERIORATING (keyword found in feedback/original).")
332
+ return "deteriorating"
333
+
334
+ # 3. Check for IMPROVING status (Third Priority)
335
+ # Check combined initial text for improving keywords (only if not emergency or deteriorating)
336
+ is_improving_initial = check_keywords(combined_initial_text_lower, improvement_keywords)
337
+ if is_improving_initial:
338
+ logger.info("Status determined: IMPROVING (keyword found in feedback/original).")
339
+ return "improving"
340
+
341
  # 1. Check for EMERGENCY status (Highest Priority)
342
  # Check combined initial text for emergency keywords
343
  is_emergency_initial = check_keywords(combined_initial_text_lower, emergency_keywords)
 
351
  logger.info("Status determined: EMERGENCY (keyword found in feedback/original or final plan).")
352
  return "emergency"
353
 
 
 
 
 
 
 
 
 
 
 
 
 
 
354
 
355
  # 4. Default to STABLE if no specific status keywords are found
356
  logger.info("Status determined: STABLE (no specific status keywords found).")