Dineshpopuri commited on
Commit
92b9c84
·
verified ·
1 Parent(s): 80665aa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -3
app.py CHANGED
@@ -245,14 +245,30 @@ def evaluate_readiness(logs, qa_report, punch_list_text):
245
  punch_list_text = sanitize_input(punch_list_text)
246
 
247
  # Process Project Logs (30% weight)
248
- # Use word boundaries to ensure "complete" isn't matched within "incomplete"
249
- log_keywords = r"\b(complete|handover done|finished|closed|successful)\b"
250
  logs_pass = logs and re.search(log_keywords, logs.lower())
251
  if logs_pass:
252
  score += LOGS_WEIGHT
253
  checklist_details.append("Logs: Completed")
254
  else:
255
- missing_items.append("Project Logs Incomplete")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
256
  checklist_details.append("Logs: Pending")
257
  logging.info(f"Logs Check: {'Pass' if logs_pass else 'Fail'}, Score so far: {score}%")
258
 
 
245
  punch_list_text = sanitize_input(punch_list_text)
246
 
247
  # Process Project Logs (30% weight)
248
+ log_keywords = r"\b(completed|handover done|finished|closed|successful)\b"
 
249
  logs_pass = logs and re.search(log_keywords, logs.lower())
250
  if logs_pass:
251
  score += LOGS_WEIGHT
252
  checklist_details.append("Logs: Completed")
253
  else:
254
+ # Determine the specific reason for the logs failing
255
+ logs_lower = logs.lower()
256
+ if not logs or "invalid" in logs_lower:
257
+ missing_items.append("invalid")
258
+ elif "not finished" in logs_lower:
259
+ missing_items.append("not finished")
260
+ elif "not done" in logs_lower:
261
+ missing_items.append("not done")
262
+ elif "handover done" in logs_lower and ("mistake" in logs_lower or "error" in logs_lower):
263
+ missing_items.append("handover done found some mistakes are found")
264
+ elif "to do" in logs_lower:
265
+ missing_items.append("to do")
266
+ elif "yet to start" in logs_lower or "not started" in logs_lower:
267
+ missing_items.append("yet to start")
268
+ elif "inprogress" in logs_lower or "in progress" in logs_lower:
269
+ missing_items.append("inprogress")
270
+ else:
271
+ missing_items.append("project logs incomplete")
272
  checklist_details.append("Logs: Pending")
273
  logging.info(f"Logs Check: {'Pass' if logs_pass else 'Fail'}, Score so far: {score}%")
274