// evaluation-iso42001-engine.jsx — Verigo Global: ISO 42001 readiness evaluation engine
// Questions, scoring, quiz + results components, and a results-PDF generator.
// Exposes window.EVAL42
const { V: G2V, MAXW: G2MW, FONT: G2FT } = window;
/* ── QUESTION BANK — 5 themes × statements ───────────────── */
const QUESTIONS42 = [
{ theme: 'Policy & Organization', icon: 'briefcase', controls: 8,
docs: ['AI Management Policy', 'AI Roles & Responsibilities Policy'],
q: [
'An approved, top-level AI Management Policy is in place and reviewed at least annually.',
'AI governance roles and responsibilities are formally defined and assigned.',
'Staff know how and where to report AI-related concerns or incidents.',
] },
{ theme: 'Impact Assessment', icon: 'target', controls: 3,
docs: ['AI System Impact Assessment Policy', 'AI System Impact Assessment Procedure'],
q: [
'A documented impact assessment process runs before any AI system reaches production.',
'Impact assessments consider effects on individuals, groups, and society, not just technical risk.',
] },
{ theme: 'AI System Life Cycle', icon: 'layers', controls: 10,
docs: ['AI System Lifecycle Policy', 'Model Validation & Verification Procedure'],
q: [
'AI systems follow a defined life cycle from requirements through deployment and retirement.',
'Models are verified and validated for accuracy and robustness before release.',
'AI system operation is monitored and events are logged for review.',
] },
{ theme: 'Data & Transparency', icon: 'doc', controls: 9,
docs: ['Data Governance Policy for AI', 'Data Quality & Provenance Procedure'],
q: [
'Data used to train and operate AI systems has documented quality and provenance controls.',
'Interested parties receive appropriate transparency about AI system use and limitations.',
'AI incidents and malfunctions are communicated to affected parties in a defined way.',
] },
{ theme: 'Use & Relationships', icon: 'compass', controls: 8,
docs: ['Responsible AI Use Policy', 'AI Supplier & Third-Party Policy'],
q: [
'Intended use and prohibited use cases are documented for each AI system.',
'Responsibilities between your organization and AI suppliers or customers are clearly allocated.',
] },
];
const OPTIONS42 = [
['Not started', 0],
['Partial', 1],
['Largely', 2],
['Fully', 3],
];
const BANDS42 = [
[0, 'Initial', G2V.orange, 'Foundations are largely missing — start with the core policy and risk set.'],
[40, 'Developing', G2V.orange, 'Key pieces exist, but real gaps remain before certification is viable.'],
[60, 'Established', G2V.purple, 'A working AIMS is in place — focus on closing the weaker themes.'],
[80, 'Optimized', G2V.purple, 'Strong posture — fine-tune evidence and keep it continuous.'],
];
const bandFor42 = (pct) => { let b = BANDS42[0]; BANDS42.forEach((x) => { if (pct >= x[0]) b = x; }); return b; };
function computeResults42(answers) {
const themes = QUESTIONS42.map((t, ti) => {
const max = t.q.length * 3;
let sum = 0;
t.q.forEach((_, qi) => { sum += (answers[ti + '-' + qi] || 0); });
const pct = Math.round((sum / max) * 100);
return { theme: t.theme, icon: t.icon, docs: t.docs, controls: t.controls, pct, gaps: Math.round((1 - pct / 100) * t.controls) };
});
const totSum = themes.reduce((a, t) => a + (t.pct), 0);
const overall = Math.round(totSum / themes.length);
const gaps = themes.reduce((a, t) => a + t.gaps, 0);
return { themes, overall, gaps, band: bandFor42(overall) };
}
/* ── SEGMENTED MATURITY CONTROL ──────────────────────────── */
const Segmented42 = ({ value, onChange }) => (
{OPTIONS42.map(([label, val]) => {
const on = value === val;
return (
);
})}
{overall >= 80 ? 'You\u2019re close to audit-ready.' : overall >= 60 ? 'A solid base, with clear gaps to close.' : 'There\u2019s real groundwork to do first.'}
{bandDesc} We estimate ~{gaps} of 38 controls need attention before a Stage 2 audit.
{user && user.company ? ` Prepared for ${user.company}.` : ''}