Files
iAOP/templates/ti-cl4/impurity-forecast/__init__.py
T
bot_dev1 4dcaf47af6 feat(#72): 预警规则与阈值设定(声明式AlertRule三级severity+SOP联动,PRD 5.3 ③ 场景A)
把行业知识——预警分级(P0/P1/P2)+阈值+处置SOP——外置为模板配置(PRD line 152/171
阈值外置,行业工程师配置台维护),规则引擎零改动。

- alert_rules.py:AlertSeverity(P0/P1/P2) + AlertCondition(6 运算) + AlertRule(AND 语义)
  + AlertRuleEngine(按 severity 降序 + primary_alert) + 零依赖 YAML 解析(flow map)。
- config/alert_rules.template.yaml:6 条规则,特征名对齐 #70 FeatureSpec.name,sop 引用
  异常处置 SOP(供 #11 LLM 报警解释 + 驾驶舱红色告警 + 值班长确认,PRD 场景A)。
- tests/test_alert_rules.py:16 项单测(运算/规则/引擎排序/配置/端到端P0)全通过。
- _sanity_check_rules.py:冒烟(正常无告警 + 急升温P0)。

PRD line 333:关键告警不直接联动执行机构,高利害输出人工确认 → severity 分级支撑。
2026-08-05 02:13:18 +08:00

32 lines
1020 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
"""iAOP-Template-Ti 一期 · 炉层杂质预警规则引擎包(Issue #72)。
导出声明式预警规则引擎(AlertRuleEngine)、预警分级(AlertSeverity)、规则/告警
数据类与模板配置加载。换行业只改模板配置(alert_rules.template.yaml),引擎零改动
(PRD line 152/171:阈值外置,行业工程师在配置台维护)。
注:特征工程(#70)与无监督模型(#71)见各自分支,合入后与本规则引擎组合,
覆盖 PRD 5.3 ③ 场景 A 全链路(采集→特征→评分→规则分级→驾驶舱红色告警→LLM 解释)。
"""
from __future__ import annotations
from .alert_rules import (
Alert,
AlertCondition,
AlertRule,
AlertRuleEngine,
AlertRulesTemplateConfig,
AlertSeverity,
load_alert_rules_config,
)
__all__ = [
"Alert",
"AlertCondition",
"AlertRule",
"AlertRuleEngine",
"AlertRulesTemplateConfig",
"AlertSeverity",
"load_alert_rules_config",
]