SamanthaStorm commited on
Commit
27f8305
Β·
verified Β·
1 Parent(s): e743e48

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -10
app.py CHANGED
@@ -747,17 +747,22 @@ def analyze_composite(msg1, date1, msg2, date2, msg3, date3, *answers_and_none):
747
  pattern_escalation_risk = "Moderate"
748
 
749
  # --- Step 2: Checklist escalation logic ---
750
- if none_selected:
751
- escalation_score = None
752
- checklist_escalation_risk = None
 
753
  else:
754
- escalation_score = sum(w for (_, w), a in zip(ESCALATION_QUESTIONS, answers_and_none[:-1]) if a)
755
- checklist_escalation_risk = (
756
- "Critical" if escalation_score >= 8 else
757
- "High" if escalation_score >= 5 else
758
- "Moderate" if escalation_score >= 2 else
759
- "Low"
760
- )
 
 
 
 
761
 
762
  # --- Step 3: Escalation bump from DARVO, tone, abuse score, etc.
763
  escalation_bump = 0
 
747
  pattern_escalation_risk = "Moderate"
748
 
749
  # --- Step 2: Checklist escalation logic ---
750
+ if escalation_score is None:
751
+ escalation_text = "🚫 **Escalation Potential: Unknown** (Checklist not completed)\n"
752
+ escalation_text += "⚠️ This section was not completed. Escalation potential cannot be calculated.\n"
753
+ hybrid_score = 0
754
  else:
755
+ hybrid_score = escalation_score + escalation_bump
756
+ risk_level = (
757
+ "πŸ”΄ High" if hybrid_score >= 16 else
758
+ "🟠 Moderate" if hybrid_score >= 8 else
759
+ "🟒 Low"
760
+ )
761
+
762
+ escalation_text = f"πŸ“ˆ **Escalation Potential: {risk_level} ({hybrid_score}/29)**\n"
763
+ escalation_text += "πŸ“‹ This score comes from your checklist *and* detected high-risk patterns.\n"
764
+ escalation_text += "🧠 It reflects both situational risk and behavioral red flags."
765
+ )
766
 
767
  # --- Step 3: Escalation bump from DARVO, tone, abuse score, etc.
768
  escalation_bump = 0