Files
model-platform/frontend/app/features/operations/governanceData.ts
T

102 lines
7.4 KiB
TypeScript
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.
import type { AbnormalLevel, ModelCategoryId, ModelGrade } from "./modelData";
export type MonitoringRule = {
id: number;
ranking: "相符" | "不符";
ksBand: string;
psiBand: string;
dropBand: string;
abnormal: AbnormalLevel;
grade: ModelGrade;
reason: string;
action: string;
};
export type ThresholdConfig = {
ks: number;
psiLow: number;
psiHigh: number;
ksDrop: number;
interventionKs: number;
interventionPsi: number;
};
export const BASE_THRESHOLDS: ThresholdConfig = {
ks: 40,
psiLow: 10,
psiHigh: 25,
ksDrop: 20,
interventionKs: 30,
interventionPsi: 50,
};
export const CATEGORY_THRESHOLDS: Record<ModelCategoryId, ThresholdConfig | null> = {
std: null,
bai: null,
big: null,
afd: null,
};
export const MONITORING_RULES: MonitoringRule[] = [
{ id: 1, ranking: "不符", ksBand: "<40%", psiBand: ">10%", dropBand: "无条件", abnormal: "三级", grade: "C", reason: "排序性不符 + KS 偏低 + PSI 偏移", action: "诊断报告,评估模型微调或重构必要性" },
{ id: 2, ranking: "相符", ksBand: "<40%", psiBand: ">25%", dropBand: "无条件", abnormal: "三级", grade: "C", reason: "KS 偏低 + PSI 明显偏移", action: "诊断报告,评估模型微调或重构必要性" },
{ id: 3, ranking: "不符", ksBand: ">=40%", psiBand: ">25%", dropBand: "无条件", abnormal: "二级", grade: "B", reason: "排序性不符、PSI 高", action: "诊断报告;累计升级后评估微调或重构" },
{ id: 4, ranking: "不符", ksBand: ">=40%", psiBand: "10%-25%", dropBand: ">20%", abnormal: "二级", grade: "B", reason: "排序性不符、PSI 中、KS 环比降幅高", action: "诊断报告;累计升级后评估微调或重构" },
{ id: 5, ranking: "不符", ksBand: "<40%", psiBand: "<=10%", dropBand: "无条件", abnormal: "二级", grade: "B", reason: "排序性不符、KS 低", action: "诊断报告;累计升级后评估微调或重构" },
{ id: 6, ranking: "相符", ksBand: "<40%", psiBand: "<=25%", dropBand: "无条件", abnormal: "二级", grade: "B", reason: "KS 低", action: "诊断报告;累计升级后评估微调或重构" },
{ id: 7, ranking: "相符", ksBand: ">=40%", psiBand: ">25%", dropBand: ">20%", abnormal: "二级", grade: "B", reason: "PSI 高、KS 环比降幅高", action: "诊断报告;累计升级后评估微调或重构" },
{ id: 8, ranking: "不符", ksBand: ">=40%", psiBand: "10%-25%", dropBand: "<=20%", abnormal: "一级", grade: "B", reason: "排序性不符 + PSI 轻度偏移", action: "诊断报告" },
{ id: 9, ranking: "不符", ksBand: ">=40%", psiBand: "<=10%", dropBand: "无条件", abnormal: "一级", grade: "B", reason: "排序性不符", action: "诊断报告" },
{ id: 10, ranking: "相符", ksBand: ">=40%", psiBand: ">25%", dropBand: "<=20%", abnormal: "一级", grade: "B", reason: "PSI 明显偏移", action: "诊断报告" },
{ id: 11, ranking: "相符", ksBand: ">=40%", psiBand: "10%-25%", dropBand: "无条件", abnormal: "一级", grade: "B", reason: "PSI 轻度偏移", action: "诊断报告" },
{ id: 12, ranking: "相符", ksBand: ">=40%", psiBand: "<=10%", dropBand: ">20%", abnormal: "一级", grade: "B", reason: "KS 环比下滑明显", action: "诊断报告" },
{ id: 13, ranking: "相符", ksBand: ">=40%", psiBand: "<=10%", dropBand: "<=20%", abnormal: "正常", grade: "A", reason: "各项指标均在阈值内", action: "监控报告" },
];
export const RULE_VERSIONS = [
{ version: "V3", category: "全部大类", author: "管理员 王芳", createdAt: "2026-07-02 10:24", current: true, note: "新增 KS 环比降幅维度" },
{ version: "V2", category: "全部大类", author: "管理员 王芳", createdAt: "2026-03-15 14:08", current: false, note: "PSI 分档由两档改三档" },
{ version: "V1", category: "全部大类", author: "管理员 王芳", createdAt: "2025-11-20 09:41", current: false, note: "初版" },
];
export const PROMPTS = {
A: {
name: "监控报告模板(A 等级)",
text: `你是一名信贷风险模型分析师。请依据平台程序取数的指标,撰写月度模型监控报告。\n\n【硬性要求】\n1. 所有数值只使用给定值,禁止自行计算。\n2. 正文不得出现 A/B/C 等级、判级或评级字样。\n3. 仅撰写监控结论、排序性、KS、PSI 四节。\n4. 语气客观,不做超出数据的推断。\n\n【平台注入变量】\n银行:{{bank}}\n模型名称:{{model_name}}\n模型版本:{{model_ver}}\n模型ID{{model_id}}\n报告周期:{{period}}\n排序性:{{rank_result}}\nKS{{ks}}%\nKS 环比降幅:{{ks_drop}}%\nPSI(滚动基准期):{{psi_roll}}%\n近 6 期趋势:{{trend_6m}}`,
},
BC: {
name: "诊断报告模板(B / C 等级)",
text: `你是一名信贷风险模型分析师。请依据平台程序取数的指标,撰写月度模型诊断报告。\n\n【硬性要求】\n1. 所有数值只使用给定值,禁止自行计算。\n2. 正文不得出现 A/B/C 等级、判级或评级字样。\n3. 结构包含监控结论、排序性、KS、PSI、IV、CSI、归因与建议。\n4. 归因只能基于命中规则与特征级指标,不得臆测业务原因。\n\n【平台注入变量】\n银行:{{bank}}\n模型名称:{{model_name}}\n模型版本:{{model_ver}}\n模型ID{{model_id}}\n报告周期:{{period}}\n排序性:{{rank_result}}\nKS{{ks}}%\nKS 环比降幅:{{ks_drop}}%\nPSI(滚动):{{psi_roll}}%\n命中规则:{{hit_rule}}\n异常等级:{{ab_level}}\n近 6 个月二级次数:{{lv2_6m}}\n特征级 IV{{iv_by_feature}}\n特征级 CSI{{csi_by_feature}}\n各特征分布变化:{{dist_shift}}`,
},
} as const;
export const PROMPT_VERSIONS = [
{ version: "P5", author: "模型团队 李伟", createdAt: "2026-08-02 15:20", current: true, note: "加入禁止自行计算硬约束" },
{ version: "P4", author: "模型团队 李伟", createdAt: "2026-06-11 10:05", current: false, note: "正文禁止出现等级字样" },
{ version: "P3", author: "模型团队 王芳", createdAt: "2026-04-08 16:48", current: false, note: "归因段落收敛,禁止臆测业务原因" },
];
export const PROMPT_REGRESSION = [
{ sample: "2026-06 江城银行 标准A卡", result: "通过", detail: "数值一致,无等级字样" },
{ sample: "2026-06 通汇银行 标准A卡", result: "通过", detail: "数值一致,归因引用命中规则" },
{ sample: "2026-05 华东银行 反欺诈评分", result: "通过", detail: "—" },
{ sample: "2026-05 南岭银行 白户A卡", result: "待复核", detail: "CSI 表述偏笼统" },
{ sample: "2026-04 云岭银行 标准A卡", result: "通过", detail: "—" },
];
export const TEMPLATE_VERSIONS = [
{ version: "T4", author: "管理员 王芳", createdAt: "2026-08-01 16:30", current: true, note: "诊断报告增加 IV / CSI 段落" },
{ version: "T3", author: "管理员 王芳", createdAt: "2026-05-18 11:12", current: false, note: "隐藏监控结果等级字样" },
{ version: "T2", author: "管理员 王芳", createdAt: "2026-02-09 09:55", current: false, note: "调整排序性图表位置" },
];
export const BANK_REPORT_CONFIG: Record<string, { frequency: string; day: number }> = {
江城银行: { frequency: "月度", day: 15 },
滨海银行: { frequency: "月度", day: 15 },
华东银行: { frequency: "月度", day: 18 },
南岭银行: { frequency: "季度", day: 15 },
云岭银行: { frequency: "月度", day: 20 },
通汇银行: { frequency: "半年度", day: 15 },
北岸银行: { frequency: "年度", day: 15 },
};