Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -485,8 +485,19 @@ def analyze_composite(msg1, date1, msg2, date2, msg3, date3, *answers_and_none):
|
|
485 |
darvo_scores = [r[0][5] for r in results]
|
486 |
dates_used = [r[1] or "Undated" for r in results] # Store dates for future mapping
|
487 |
|
488 |
-
|
489 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
490 |
|
491 |
most_common_stage = max(set(stages), key=stages.count)
|
492 |
stage_text = RISK_STAGE_LABELS[most_common_stage]
|
|
|
485 |
darvo_scores = [r[0][5] for r in results]
|
486 |
dates_used = [r[1] or "Undated" for r in results] # Store dates for future mapping
|
487 |
|
488 |
+
# Use weighted pattern scoring
|
489 |
+
composite_abuse_scores = []
|
490 |
+
for score_dict in results:
|
491 |
+
weighted_score = 0
|
492 |
+
for label, score in score_dict["pattern_scores"].items():
|
493 |
+
if label == "aggression":
|
494 |
+
weighted_score += score * 1.5
|
495 |
+
else:
|
496 |
+
weighted_score += score
|
497 |
+
composite_abuse_scores.append(weighted_score)
|
498 |
+
|
499 |
+
# Average across all messages
|
500 |
+
composite_abuse = int(round(sum(composite_abuse_scores) / len(composite_abuse_scores) * 100))
|
501 |
|
502 |
most_common_stage = max(set(stages), key=stages.count)
|
503 |
stage_text = RISK_STAGE_LABELS[most_common_stage]
|