Files
confidence-engine/lib/map/investigation-map-adapter.js
T

63 lines
2.6 KiB
JavaScript

/**
* Investigation Map Mock Adapter
*
* Provides the Investigation Map with a set of investigation topics and their
* current status (established / current / unknown).
*
* TODO: Replace this mock adapter when the reasoning engine emits real
* investigation data. The eventual contract should provide:
* - `investigationTopics`: [{ title, status, evidenceCount? }]
* - `topicStatus` values: "established" | "current" | "unknown"
* - `topicOrdering`: the reasoning-engine-determined sequence
* - `evidenceCount`: optional count of supporting evidence per topic
*
* Until then, this adapter drives a realistic mock progression across turns.
*/
/** @type {Array<{ title: string }>} */
const TOPICS = [
{ title: "Central situation" },
{ title: "Complaint trend direction" },
{ title: "Measurement basis" },
{ title: "Production volume context" },
{ title: "QA process changes" },
{ title: "Product change log" },
{ title: "Support response patterns" },
{ title: "Prior similar cases" },
];
/**
* Status progression per turn index.
* The reasoning engine will eventually determine these values.
*/
const PROGRESSION = [
// Turn 0 — initial analysis just started
["established", "unknown", "unknown", "unknown", "unknown", "unknown", "unknown", "unknown"],
// Turn 1 — first question answered
["established", "established", "current", "unknown", "unknown", "unknown", "unknown", "unknown"],
// Turn 2 — second question answered
["established", "established", "established", "current", "unknown", "unknown", "unknown", "unknown"],
// Turn 3 — third question answered
["established", "established", "established", "established", "current", "unknown", "unknown", "unknown"],
// Turn 4 — fourth question answered
["established", "established", "established", "established", "established", "current", "unknown", "unknown"],
// Turn 5 — fifth question answered
["established", "established", "established", "established", "established", "established", "current", "unknown"],
// Turn 6+ — final turn
["established", "established", "established", "established", "established", "established", "established", "current"],
];
/**
* Get investigation map topics for a given turn index.
* @param {number} turnIndex - Zero-based turn number (0 = initial analysis).
* @returns {{ title: string, status: 'established' | 'current' | 'unknown' }[]}
*/
export function getInvestigationMapTopics(turnIndex) {
const idx = Math.min(turnIndex, PROGRESSION.length - 1);
return TOPICS.map((topic, i) => ({
title: topic.title,
status: PROGRESSION[idx][i],
}));
}
export default getInvestigationMapTopics;