Improve tasks and backdate insights
This commit is contained in:
@@ -1228,7 +1228,7 @@ def _trend_meta(current, previous, higher_is_better=True):
|
||||
}
|
||||
|
||||
|
||||
def _emotion_meta(metric_kind, value):
|
||||
def _emotion_meta(metric_kind, value, metric_key=None):
|
||||
score = _to_float(value)
|
||||
if score is None:
|
||||
return {
|
||||
@@ -1239,6 +1239,25 @@ def _emotion_meta(metric_kind, value):
|
||||
if metric_kind == "confidence":
|
||||
score = score * 100.0
|
||||
if metric_kind == "count":
|
||||
key = str(metric_key or "").strip().lower()
|
||||
if key == "sample_days":
|
||||
if score >= 14:
|
||||
return {
|
||||
"icon": "fa-solid fa-calendar-check",
|
||||
"class_name": "has-text-success",
|
||||
"label": "Broad Coverage",
|
||||
}
|
||||
if score >= 5:
|
||||
return {
|
||||
"icon": "fa-solid fa-calendar-days",
|
||||
"class_name": "has-text-warning",
|
||||
"label": "Adequate Coverage",
|
||||
}
|
||||
return {
|
||||
"icon": "fa-solid fa-calendar-xmark",
|
||||
"class_name": "has-text-danger",
|
||||
"label": "Narrow Coverage",
|
||||
}
|
||||
if score >= 80:
|
||||
return {
|
||||
"icon": "fa-solid fa-chart-column",
|
||||
@@ -1433,7 +1452,7 @@ def _quick_insights_rows(conversation):
|
||||
point_count = conversation.metric_snapshots.exclude(
|
||||
**{f"{field_name}__isnull": True}
|
||||
).count()
|
||||
emotion = _emotion_meta(spec["kind"], current)
|
||||
emotion = _emotion_meta(spec["kind"], current, spec["key"])
|
||||
rows.append(
|
||||
{
|
||||
"key": spec["key"],
|
||||
@@ -4035,6 +4054,7 @@ class ComposeQuickInsights(LoginRequiredMixin, View):
|
||||
"Arrow color indicates improving or risk direction for that metric.",
|
||||
"State uses participant feedback (Withdrawing/Overextending/Balanced) when available.",
|
||||
"Values are computed from all linked platform messages for this person.",
|
||||
"Data labels are metric-specific (for example, day coverage is rated separately from message volume).",
|
||||
"Face indicator maps value range to positive, mixed, or strained climate.",
|
||||
"Use this card for fast triage; open AI Workspace for full graphs and details.",
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user