From ce7f89cf2a744477281c72d9d9129381b0d85121 Mon Sep 17 00:00:00 2001 From: OpenSquared Date: Tue, 30 Jun 2026 11:45:55 +0200 Subject: [PATCH] fix: graphe calculation --- backend/routers/causal_lab.py | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/backend/routers/causal_lab.py b/backend/routers/causal_lab.py index 9407d3c..372b4a1 100644 --- a/backend/routers/causal_lab.py +++ b/backend/routers/causal_lab.py @@ -906,14 +906,9 @@ def analyze_event(body: AnalyzeRequest): node_range = cfg.get("range") if node_range and len(node_range) == 2: lo, hi = float(node_range[0]), float(node_range[1]) - bound = max(abs(lo), abs(hi)) - if bound <= 10: - # Plage type z-score : normalise surprise_pct → [-bound, +bound] - inputs[input_id] = round(max(lo, min(hi, raw / 100 * bound)), 4) - else: - inputs[input_id] = round(max(lo, min(hi, raw)), 4) + inputs[input_id] = round(max(lo, min(hi, raw)), 4) else: - inputs[input_id] = round(raw / 100, 4) # fractional par défaut + inputs[input_id] = round(raw, 4) elif src == "impact_score_scaled" and event.get("impact_score") is not None: inputs[input_id] = float(event["impact_score"]) / 10.0 elif src == "impact_score_pct" and event.get("impact_score") is not None: @@ -1239,13 +1234,9 @@ def _run_auto_analysis(event: dict, template_id: int) -> dict: else: if node_range and len(node_range) == 2: lo, hi = float(node_range[0]), float(node_range[1]) - bound = max(abs(lo), abs(hi)) - if bound <= 10: - inputs[input_id] = round(max(lo, min(hi, raw / 100 * bound)), 4) - else: - inputs[input_id] = round(max(lo, min(hi, raw)), 4) + inputs[input_id] = round(max(lo, min(hi, raw)), 4) else: - inputs[input_id] = round(raw / 100, 4) + inputs[input_id] = round(raw, 4) elif src == "impact_score_scaled" and event.get("impact_score") is not None: inputs[input_id] = float(event["impact_score"]) / 10.0