Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -533,10 +533,18 @@ def analyze_composite(msg1, date1, msg2, date2, msg3, date3, *answers_and_none):
|
|
533 |
else:
|
534 |
escalation_score = sum(w for (_, w), a in zip(ESCALATION_QUESTIONS, answers_and_none[:-1]) if a)
|
535 |
escalation_bump = 0 # Will be computed later
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
540 |
if any(score > 70 for score in abuse_scores) or any(stage == 2 for stage in stages):
|
541 |
if risk_level == "Low":
|
542 |
risk_level = "Moderate"
|
|
|
533 |
else:
|
534 |
escalation_score = sum(w for (_, w), a in zip(ESCALATION_QUESTIONS, answers_and_none[:-1]) if a)
|
535 |
escalation_bump = 0 # Will be computed later
|
536 |
+
hybrid_score = escalation_score + escalation_bump
|
537 |
+
risk_level = (
|
538 |
+
"High" if hybrid_score >= 16 else
|
539 |
+
"Moderate" if hybrid_score >= 8 else
|
540 |
+
"Low"
|
541 |
+
)
|
542 |
+
|
543 |
+
# Now it's safe to assign these:
|
544 |
+
abuse_scores = [r[0][0] for r in results]
|
545 |
+
stages = [r[0][4] for r in results]
|
546 |
+
|
547 |
+
# Post-check override to catch hidden risks
|
548 |
if any(score > 70 for score in abuse_scores) or any(stage == 2 for stage in stages):
|
549 |
if risk_level == "Low":
|
550 |
risk_level = "Moderate"
|