fix(kpi): single source of truth for REVERSE_INDICATORS + drop F_FACTORY_REBATE_RATE from reverse set
P-6 (M2 gate 2, FIN-CE-REVIEW-20260915-01): kpis.REVERSE_INDICATORS is now the only authoritative direction definition; dashboard.py imports it instead of carrying a literal copy; bot_kpis.py derives REVERSE_BOT_INDICATORS from it (dead import removed). F_FACTORY_REBATE_RATE (upstream factory rebate rate, higher=better) was wrongly treated as reverse: 278.7% vs target 80 scored 1/danger, now 5/success and workbench three-color red -> green. No DB write, no scoring-engine logic change, no data_level/frontend touch.
This commit is contained in:
@@ -14,8 +14,17 @@ router = APIRouter(prefix="/api/cma/bot-kpis", tags=["Bot KPI管理"],
|
||||
dependencies=[Depends(require_auth)],
|
||||
)
|
||||
|
||||
# 反向指标编码(值越低越好)
|
||||
REVERSE_BOT_INDICATORS = ['FB_RESPONSE_TIME']
|
||||
# 反向指标编码(值越低越好)。
|
||||
# 方向权威源 = app.api.kpis.REVERSE_INDICATORS(2026-09-15 M2 准入2 收口):
|
||||
# 本文件原 import 了权威表却未使用、另立字面量 ['FB_RESPONSE_TIME'],会让同一 kpi_code
|
||||
# 在「能力评分」(取权威表=反向) 与「Bot 自评」(取本表=正向) 方向打架
|
||||
# (实测同一宇宙内 F_COST_RATIO / F_AR_DAYS / F_REBATE_RATE 三码即为此类)。
|
||||
# 现改为派生:权威表 ∪ Bot 专有反向指标(零漂移)。
|
||||
from app.api.kpis import REVERSE_INDICATORS as _AUTHORITATIVE_REVERSE_INDICATORS
|
||||
|
||||
BOT_ONLY_REVERSE_INDICATORS = ['FB_RESPONSE_TIME']
|
||||
REVERSE_BOT_INDICATORS = list(_AUTHORITATIVE_REVERSE_INDICATORS) + [
|
||||
c for c in BOT_ONLY_REVERSE_INDICATORS if c not in _AUTHORITATIVE_REVERSE_INDICATORS]
|
||||
|
||||
|
||||
def _calc_bot_kpi_score(current_value, target_value, is_reverse=False):
|
||||
@@ -68,8 +77,6 @@ def list_bot_kpis(
|
||||
"overall": None,
|
||||
}
|
||||
|
||||
from app.api.kpis import REVERSE_INDICATORS as _ri
|
||||
|
||||
result_kpis = []
|
||||
for k in kpis:
|
||||
# 取最新实际值
|
||||
|
||||
Reference in New Issue
Block a user