feat: instrument analysis
This commit is contained in:
@@ -60,6 +60,8 @@ interface CausalAnalysis {
|
||||
activation_score: number | null
|
||||
analyzed_at: string
|
||||
prediction_json: Record<string, number>
|
||||
actual_json: Record<string, number>
|
||||
graph_json?: { nodes: GraphNode[]; edges: GraphEdge[] }
|
||||
}
|
||||
|
||||
interface TemplateRef {
|
||||
@@ -410,9 +412,18 @@ function EventDetail({
|
||||
if (r.ok) {
|
||||
const data: CausalAnalysis[] = await r.json()
|
||||
setAnalyses(data)
|
||||
// Pre-select the most recent analysis's template so the form isn't blank on re-open
|
||||
if (data.length > 0 && data[0].template_id) {
|
||||
setSelTmpl(data[0].template_id)
|
||||
if (data.length > 0) {
|
||||
const latest = data[0]
|
||||
if (latest.template_id) setSelTmpl(latest.template_id)
|
||||
// Reconstruct graph state from stored analysis so it's always visible on reopen
|
||||
setAnResult({
|
||||
score: latest.activation_score,
|
||||
preds: latest.prediction_json || {},
|
||||
actuals: latest.actual_json || {},
|
||||
})
|
||||
if (latest.graph_json?.nodes?.length) {
|
||||
setGraphData(latest.graph_json as GraphData)
|
||||
}
|
||||
}
|
||||
}
|
||||
}, [event.id])
|
||||
|
||||
Reference in New Issue
Block a user