Work on fixing bugs and reformat

This commit is contained in:
2026-02-16 16:01:17 +00:00
parent 8ca1695fab
commit 3f82c27ab9
32 changed files with 1100 additions and 442 deletions

View File

@@ -147,8 +147,7 @@ INSIGHT_METRICS = {
"group": "stability",
"history_field": "stability_score",
"calculation": (
"0.35*reciprocity + 0.25*continuity + 0.20*response + "
"0.20*volatility."
"0.35*reciprocity + 0.25*continuity + 0.20*response + " "0.20*volatility."
),
"psychology": (
"Higher values suggest consistent mutual engagement patterns; falling "
@@ -176,9 +175,7 @@ INSIGHT_METRICS = {
"100 * min(1, distinct_sample_days / span_days). Higher means steadier "
"day-to-day continuity."
),
"psychology": (
"Drops can signal communication becoming episodic or reactive."
),
"psychology": ("Drops can signal communication becoming episodic or reactive."),
},
"response_score": {
"title": "Response Component",
@@ -232,8 +229,7 @@ INSIGHT_METRICS = {
"history_field": "stability_sample_days",
"calculation": "Count of distinct calendar days represented in the sample.",
"psychology": (
"Coverage across days better captures rhythm, not just intensity "
"bursts."
"Coverage across days better captures rhythm, not just intensity " "bursts."
),
},
"stability_computed": {
@@ -250,9 +246,7 @@ INSIGHT_METRICS = {
"title": "Commit In",
"group": "commitment",
"history_field": "commitment_inbound_score",
"calculation": (
"0.60*inbound_response_score + 0.40*inbound_balance_score."
),
"calculation": ("0.60*inbound_response_score + 0.40*inbound_balance_score."),
"psychology": (
"Estimates counterpart follow-through and reciprocity toward the user."
),
@@ -261,9 +255,7 @@ INSIGHT_METRICS = {
"title": "Commit Out",
"group": "commitment",
"history_field": "commitment_outbound_score",
"calculation": (
"0.60*outbound_response_score + 0.40*outbound_balance_score."
),
"calculation": ("0.60*outbound_response_score + 0.40*outbound_balance_score."),
"psychology": (
"Estimates user follow-through and consistency toward the counterpart."
),
@@ -931,16 +923,22 @@ def _metric_psychological_read(metric_slug, conversation):
if score is None:
return "Calibrating: collect more interaction data before interpreting."
if score >= 70:
return "Pattern suggests low relational friction and resilient repair cycles."
return (
"Pattern suggests low relational friction and resilient repair cycles."
)
if score >= 50:
return "Pattern suggests moderate strain; monitor for repeated escalation loops."
return "Pattern suggests high friction risk; prioritise safety and repair pacing."
return (
"Pattern suggests high friction risk; prioritise safety and repair pacing."
)
if metric_slug == "stability_confidence":
conf = conversation.stability_confidence or 0.0
if conf < 0.25:
return "Low certainty: treat this as a weak signal, not a conclusion."
if conf < 0.6:
return "Moderate certainty: useful directional cue, still context-dependent."
return (
"Moderate certainty: useful directional cue, still context-dependent."
)
return "High certainty: trend interpretation is likely reliable."
if metric_slug in {"commitment_inbound", "commitment_outbound"}:
inbound = conversation.commitment_inbound_score
@@ -3119,7 +3117,7 @@ def _ai_detect_violations(user, plan, person, recent_rows, metric_context=None):
"clarification": "proactive correction mapped to an artifact",
"severity": "low|medium|high",
}
]
],
},
}
prompt = [
@@ -3673,7 +3671,9 @@ class AIWorkspaceInformation(LoginRequiredMixin, View):
latest_snapshot = conversation.metric_snapshots.first()
directionality = _commitment_directionality_payload(conversation)
commitment_graph_cards = [
card for card in _all_graph_payload(conversation) if card["group"] == "commitment"
card
for card in _all_graph_payload(conversation)
if card["group"] == "commitment"
]
graph_refs = []