Files

14 lines
1.4 KiB
Python
Raw Permalink Normal View History

"""BR79 observable card influence; no fabricated probability contribution."""
def explain(run,view):
stages={d['id']:d for d in view.get('dimension_results',[])}
rows=[]
for group in ('skills','rules'):
for card in run.get('components',{}).get(group,[]):
own=[s for s in run.get('steps',[]) if (s.get('skill') or {}).get('id')==card['id']]
codes={card.get('code')}|{c.get('code') for c in card.get('conditions',[])}
checks=[f for s in run.get('steps',[]) for f in s.get('findings',[]) if s in own or f.get('code') in codes]
stage=stages.get(card['id'],{})
rows.append({'id':card['id'],'name':card['name'],'version':card['version'],'kind':'skill' if group=='skills' else 'rule_set','effect':card.get('effect','advisory'),'stage':stage.get('stage'),'state':stage.get('state','unknown'),'origin':card.get('origin','system'),'checks':[{'code':f.get('code'),'title':f.get('title') or f.get('code'),'result':f.get('result') or f.get('machine_result'),'suggestion':f.get('suggested_action') or f.get('suggestion') or '核对来源材料并补充证据','evidence_count':len(f.get('evidence_ids') or [])} for f in checks]})
return {'items':rows,'probability_contributions':None,'note':'卡片解释本次核查依据,不代表已估计的概率贡献。模拟值来自完整情景组合表,真实审批概率待历史校准。','snapshot_id':run.get('input_snapshot_id')}