const PURPOSES = [ { id: "research", title: "Health Research", blurb: "Scientific knowledge.", refs: [] }, { id: "quality", title: "Quality Improvement", blurb: "Improve your own service.", refs: [] }, { id: "statistics", title: "Statistics / Official", blurb: "Org/regional/national stats.", refs: [] }, { id: "innovation", title: "Innovation / AI", blurb: "Tool/algorithm/model.", refs: [] }, { id: "anon", title: "Exclusively Anonymized Data", blurb: "No reasonable reidentification risk.", refs: [] }, ]; const STEPS = [ { num: 1, key: "classification", title: "Project classification", items: [ { k: "1a", label: "Record purpose, controller(s)/processor(s) roles and identifiability.", req: true, refs: [ { title: "HRA §2 (scope)", url: "https://lovdata.no/lov/2008-06-20-44/%C2%A72" }, { title: "HRA §4 (definitions)", url: "https://lovdata.no/lov/2008-06-20-44/%C2%A74" }, { title: "GDPR Art. 4; Art. 4(7)", url: "https://gdpr-info.eu/art-4-gdpr/" } ], }, { k: "1b", label: "Identify data status: personal / special category (health/genetic/biometric) / anonymized. Pseudonymized data remains personal; genetics falls under biotechnology.", req: true, refs: [ { title: "GDPR Art. 9(1) (special)", url: "https://gdpr-info.eu/art-9-gdpr/" }, { title: "GDPR Recital 26 (anonymized)", url: "https://gdpr-info.eu/recitals/no-26/" }, { title: "GDPR Art. 4(5) (pseudonymized)", url: "https://gdpr-info.eu/art-4-gdpr/" } ], }, { k: "1c", label: "If medical/health research: HRA applies and REK decides scope (before access).", req: true, showFor: ["research"], refs: [ { title: "HRA §2; §4; REK scope", url: "https://lovdata.no/lov/2008-06-20-44" } ], }, { k: "1d", label: "If using health registers: record registry restrictions.", req: false, showFor: ["statistics", "research", "quality", "innovation"], refs: [ { title: "HRL §§8–11 (registers)", url: "https://lovdata.no/dokument/NL/lov/2014-06-20-43" } ], }, { k: "1e", label: "Consult health trusts data protection officer, retain written rationale.", req: true, showFor: ["research", "quality", "statistics", "innovation"], refs: [ { title: "GDPR Art. 5(2) (accountability)", url: "https://gdpr-info.eu/art-5-gdpr/" }, { title: "GDPR Art. 24(1) (responsibility)", url: "https://gdpr-info.eu/art-24-gdpr/" } ], }, { k: "1f", label: "Plan periodic re-review as tech/law evolve (accountability).", req: false, refs: [{ title: "GDPR Art. 5(2)", url: "https://gdpr-info.eu/art-5-gdpr/" }], }, ], }, { num: 2, key: "legal", title: "Legal basis & consent", items: [ { k: "2a", label: "Select legal route ;public interest/official authority ; research/statistics with safeguards; healthcare/management/quality improvment", req: true, refs: [ { title: "GDPR Art. 6(1)(e)", url: "https://gdpr-info.eu/art-6-gdpr/" }, { title: "GDPR Art. 9(2)(h)/(j)", url: "https://gdpr-info.eu/art-9-gdpr/" }, { title: "GDPR Art. 89(1)", url: "https://gdpr-info.eu/art-89-gdpr/" } ], }, { k: "2b", label: "Data protection impact assessment for high-risk projects; document rationale if not.", req: true, refs: [{ title: "GDPR Art. 35 (DPIA)", url: "https://gdpr-info.eu/art-35-gdpr/" }], }, { k: "2c", label: "Health-law confidentiality satisfied via valid consent or dispensation (archival/research/statistics in public interest).", req: true, refs: [ { title: "HPA §21 (confidentiality)", url: "https://lovdata.no/lov/1999-07-02-64/%C2%A721" }, { title: "HPA §29; HRL §19e (dispensation)", url: "https://lovdata.no/dokument/NL/lov/2014-06-20-43" } ], }, { k: "2d", label: "If using consent: GDPR-valid; information duties; withdrawal covered (re-consent if needed).", req: false, refs: [ { title: "GDPR Art. 7 (consent)", url: "https://gdpr-info.eu/art-7-gdpr/" }, { title: "GDPR Arts. 13–14 (information)", url: "https://gdpr-info.eu/art-13-gdpr/" }, { title: "HRA §13 (consent, if HRA)", url: "https://lovdata.no/lov/2008-06-20-44/%C2%A713" } ], }, ], }, { num: 3, key: "ethics", title: "Ethics & regulatory approvals", items: [ { k: "3a", label: "Regional committees for medical and health research ethics (REK) approval or exemption before research access/use.", req: true, showFor: ["research"], refs: [ { title: "HRA §9; §33", url: "https://lovdata.no/lov/2008-06-20-44" } ], }, { k: "3b", label: "Take into account ethics/regulators (REK), DPA (Datatilsynet), registry/data holders (e.g., linkage constraints).", req: true, refs: [ { title: "Datatilsynet — rules/tools", url: "https://www.datatilsynet.no/regelverk-og-verktoy/lover-og-regler/" } ], }, { k: "3c", label: "RoPA & transparency notices ready.", req: true, refs: [ { title: "GDPR Art. 30 (RoPA)", url: "https://gdpr-info.eu/art-30-gdpr/" }, { title: "GDPR Arts. 13–14 (transparency)", url: "https://gdpr-info.eu/art-13-gdpr/" } ], }, { k: "3d", label: "Include AI details in materials where applicable; plan obligations.", req: true, showFor: ["innovation"], refs: [{ title: "AI Act Arts. 9–15", url: "https://ai-act-law.eu/article/9/" }], }, ], }, { num: 4, key: "access", title: "Data access & agreements", items: [ { k: "4a", label: "Obtain data user or data sharing agreement (DUA/DSA or equivalent) with data provider: scope, purpose, duration, security, confidentiality, post-hoc control, return/destruction.", req: true, refs: [ { title: "HPA §21 (confidentiality)", url: "https://lovdata.no/lov/1999-07-02-64/%C2%A721" }, { title: "HPA §29; HRL §19e (dispensation)", url: "https://lovdata.no/dokument/NL/lov/2014-06-20-43" }, { title: "GDPR 28(3)-processor contract)", url: "https://gdpr-info.eu/art-28-gdpr/" }, { title: "GDPR 26- joint controllers", url: "https://gdpr-info.eu/art-26-gdpr/" } ], }, { k: "4b", label: "Security controls for controller/processor incl. access control & logging.", req: true, refs: [ { title: "GDPR Art. 32 (security)", url: "https://gdpr-info.eu/art-32-gdpr/" }, { title: "PRA §22; PRR §14 (logging)", url: "https://lovdata.no/forskrift/2019-03-01-168/%C2%A714" }, { title: "Normen §5.2; §5.4.4", url: "https://www.helsedirektoratet.no/english/the-code-of-conduct-for-information-security-and-data-protection" } ], }, { k: "4c", label: "Team confidentiality/training completed (duty of confidentiality).", req: true, refs: [ { title: "HPA §21", url: "https://lovdata.no/lov/1999-07-02-64/%C2%A721" } ], }, { k: "4d", label: "Use Secure Processing or Secure Analysis Environment(SPE/SAE) (e.g., TSD/HUNT Cloud/SAFE). Transfers via secure channels (logging, access control, encryption).", req: true, refs: [ { title: "GDPR Art. 32", url: "https://gdpr-info.eu/art-32-gdpr/" }, { title: "Normen (logging/encryption)", url: "https://www.helsedirektoratet.no/normen/logging-og-innsyn-i-logg-faktaark-15" } ], }, { k: "4e", label: "Data comes from an external source, obtain data access agreements, processor/joint controller contracts, DSA/DUA signed", req: false, refs: [ { title: "HRL §19e; HPA §29", url: "https://lovdata.no/dokument/NL/lov/2014-06-20-43" }, { title: "GDPR Art. 28(3)", url: "https://gdpr-info.eu/art-28-gdpr/" }, { title: "GDPR Art. 26", url: "https://gdpr-info.eu/art-26-gdpr/" } ], }, // { // k: "4e", // label: // "Data comes from an external source (outside institutions: registries/health trusts).", // req: false, // children: [ // { // k: "4e-1", // label: // "Obtain data access agreements; dispensation where applicable.", // req: false, // refs: [ // { title: "HRL §19e; HPA §29", url: "https://lovdata.no/dokument/NL/lov/2014-06-20-43" } // ], // }, // { // k: "4e-2", // label: // "Processor/joint controller contracts (GDPR 28(3), 26) and DSA/DUA signed (scope, duration, security, destruction/return).", // req: false, // refs: [ // { title: "GDPR Art. 28(3)", url: "https://gdpr-info.eu/art-28-gdpr/" }, // { title: "GDPR Art. 26", url: "https://gdpr-info.eu/art-26-gdpr/" } // ], // }, // ], // }, { k: "4f", label: "Maximum permitted retention/access period set and followed.", req: true, refs: [{ title: "HRL §19f", url: "https://lovdata.no/dokument/NL/lov/2014-06-20-43" }], }, { k: "4g", label: "Agreement aligns with SPE checklists.", req: true, }, { k: "4h", label: "European health data space (EHDS) alignment for cross-border/secondary use (permit; SPE; permitted purposes).", req: false, refs: [ { title: "EHDS Art. 68 (permit); Arts. 73/75 (SPE); Art. 53 (purposes)", url: "https://eur-lex.europa.eu/legal-content/EN/TXT/?uri=OJ:L_202500327" } ], }, ], }, { num: 5, key: "security", title: "Data security & privacy", items: [ { k: "5a", label: "Pseudonymize where possible; keep keys separate.", req: true, refs: [{ title: "GDPR Art. 4(5)", url: "https://gdpr-info.eu/art-4-gdpr/" }], }, { k: "5b", label: "Encrypted storage in transit/at rest, Role-Based access control, multi-factor authentication, network segregation, key mgmt, logging with risk-based review.", req: true, refs: [ { title: "GDPR Art. 32", url: "https://gdpr-info.eu/art-32-gdpr/" }, { title: "PRA §22; PRR §14; Normen factsheets", url: "https://www.helsedirektoratet.no/normen/logging-og-innsyn-i-logg-faktaark-15" } ], }, { k: "5c", label: "Derived datasets with personal data protected equally.", req: true, refs: [{ title: "GDPR Art. 5(1)(f); Art. 32", url: "https://gdpr-info.eu/art-5-gdpr/" }], }, { k: "5d", label: "Data Protection Impact Assessment (DPIA) done before analysis (large-scale health/innovative AI/vulnerable groups) or rationale recorded.", req: true, refs: [{ title: "GDPR Art. 35", url: "https://gdpr-info.eu/art-35-gdpr/" }], }, { k: "5e", label: "Consult Data Protection Officer (DPO) as required; record advice and implement recommendations.", req: false, refs: [{ title: "GDPR Arts. 37–39", url: "https://gdpr-info.eu/chapter-4/" }], }, { k: "5f", label: "Sharing within NO/EU: verify permission, lawful basis/principles; respect IP/licensing/REK terms.", req: false, refs: [ { title: "GDPR Art. 5(1)(b)-(c); Art. 6(1)", url: "https://gdpr-info.eu/art-5-gdpr/" }, { title: "GDPR Arts. 44–49 (transfers)", url: "https://gdpr-info.eu/chapter-5/" }, { title: "HRA §33 (conditions)", url: "https://lovdata.no/lov/2008-06-20-44/%C2%A733" } ], }, { k: "5g", label: "Transfers outside EEA: lawful mechanism (adequacy/Standard Contractual Clauses/derogations); Transfer Impact Assessment (TIA) documented; approvals/logs kept.", req: true, refs: [ { title: "GDPR Arts. 44–46", url: "https://gdpr-info.eu/chapter-5/" }, { title: "GDPR Art. 49", url: "https://gdpr-info.eu/art-49-gdpr/" } ], }, { k: "5h", label: "Third-party tools/vendors: GDPR 28 DPAs; safeguards vetted.", req: true, refs: [{ title: "GDPR Art. 28", url: "https://gdpr-info.eu/art-28-gdpr/" }], }, { k: "5i", label: "Data breach: notify national data protection authority (Datatilsynet) within 72h where required; assess duty to inform subjects.", req: true, refs: [{ title: "GDPR Arts. 33–34", url: "https://gdpr-info.eu/art-33-gdpr/" }], }, { k: "5j", label: "Periodic review of security (incl. SPE/SAE).", req: true }, ], }, { num: 6, key: "quality", title: "Data minimisation & quality", items: [ { k: "6a", label: "Identify & extract only necessary/approved fields (minimisation & purpose limitation).", req: true, refs: [{ title: "GDPR Art. 5(1)(b)-(c)", url: "https://gdpr-info.eu/art-5-gdpr/" }], }, { k: "6b", label: "Post-extraction sweeps for unexpected/disallowed content (free text/images) unless approved.", req: true, refs: [{ title: "GDPR Art. 5(1)(c); Art. 25", url: "https://gdpr-info.eu/art-25-gdpr/" }], }, { k: "6c", label: "Conform to approvals, scope & objectives.", req: true, }, { k: "6d", label: "Periodic data quality review aligned with emerging standards/regulatory updates (accuracy/accountability).", req: true, refs: [{ title: "GDPR Art. 5(1)(d); 5(2)", url: "https://gdpr-info.eu/art-5-gdpr/" }], }, ], }, { num: 7, key: "analysis", title: "Analysis & AI development", items: [ { k: "7a", label: "Analyse strictly within SPE/SAE; validated tools; no re-identification unless legally authorised.", req: true, refs: [{ title: "GDPR Art. 5(1)(a)-(b)", url: "https://gdpr-info.eu/art-5-gdpr/" }], }, { k: "7b", label: "Maintain comprehensive preprocessing documentation (cleaning/transforms/anonymity) & technical documentation.", req: true, refs: [ { title: "AI Act Art. 10; Annex XI–XII", url: "https://ai-act-law.eu/article/10/" }, { title: "GDPR Art. 5(2)", url: "https://gdpr-info.eu/art-5-gdpr/" } ], }, { k: "7c", label: "Perform an AI risk classification assessment; document (classification framework, Annex III categories).", req: true, showFor: ["research","innovation"], refs: [ { title: "AI Act Arts. 6–7; Annex III", url: "https://ai-act-law.eu/article/6/" } ], children: [ { k: "7c-1", label: "High-risk AI: implement risk mgmt & controls; define human oversight; validate performance; manage drift; ensure cybersecurity.", req: true, refs: [{ title: "AI Act Arts. 9–15", url: "https://ai-act-law.eu/article/9/" }], }, { k: "7c-2", label: "High-risk AI: data governance for train/val/test — representative, relevant, accurate; bias assessed.", req: true, refs: [{ title: "AI Act Art. 10(2)", url: "https://ai-act-law.eu/article/10/" }], }, // { // k: "7c-3", // label: // "Non-high-risk AI: adopt good practice on data quality, bias (subgroup eval/mitigation/monitoring), transparency & human oversight; consider voluntary codes.", // req: false, // refs: [{ title: "AI Act Arts. 95–96", url: "https://ai-act-law.eu/article/95/" }], // }, // { // k: "7c-4", // label: // "Maintain technical documentation & record-keeping (model, algorithms, data sources, intended purpose).", // req: true, // refs: [ // { title: "AI Act Art. 11 (tech docs)", url: "https://ai-act-law.eu/article/11/" }, // { title: "AI Act Art. 12 (records)", url: "https://ai-act-law.eu/article/12/" } // ], // }, // { // k: "7c-5", // label: // "For AI projects: ongoing obligations — risk mgmt, data governance, docs, record-keeping, transparency, human oversight, accuracy & cybersecurity.", // req: true, // refs: [{ title: "AI Act Arts. 9–15", url: "https://ai-act-law.eu/article/9/" }], // }, // { // k: "7c-6", // label: // "If developing an AI model: verify permission & GDPR legal basis; remove personal data or ensure vetted/validated use; respect IP/licensing & REK terms.", // req: true, // refs: [ // { title: "AI Act Art. 2(7) (scope)", url: "https://ai-act-law.eu/article/2/" }, // { title: "GDPR Art. 5(1)(b)-(c); Art. 6(1); Arts. 44–49", url: "https://gdpr-info.eu/art-6-gdpr/" } // ], // }, // { // k: "7c-7", // label: // "If deploying on EU market: conformity/CE/registration in EU AI database where required.", // req: false, // refs: [{ title: "AI Act Arts. 30 & 43", url: "https://ai-act-law.eu/article/30/" }], // }, // { // k: "7c-8", // label: // "Risk mgmt & bias mitigation documented for interpretation of results.", // req: true, // refs: [ // { title: "AI Act Art. 9; Art. 10(2)(e)", url: "https://ai-act-law.eu/article/9/" }, // { title: "GDPR Art. 35 (DPIA)", url: "https://gdpr-info.eu/art-35-gdpr/" }, // ], // }, // { // k: "7c-9", // label: // "Exclude malpractice data; run fairness checks (e.g., demographic parity, equalised odds, subgroup analysis); schedule bias audits & compliance reviews; handle subject rights.", // req: true, // refs: [ // { title: "AI Act Arts. 9, 10(2)(e), 15", url: "https://ai-act-law.eu/article/9/" }, // { title: "GDPR Arts. 12–22 (rights)", url: "https://gdpr-info.eu/chapter-3/" } // ], // }, // { // k: "7c-10", // label: // "Plan periodic reassessment & review as tech/regulations evolve.", // req: true, // }, ], }, { k: "7d", label: "Non-high-risk AI: adopt good practice on data quality, bias (subgroup eval/mitigation/monitoring), transparency & human oversight; consider voluntary codes.", req: false, showFor: ["research", "quality","innovation"], refs: [{ title: "AI Act Arts. 95–96", url: "https://ai-act-law.eu/article/95/" }], }, { k: "7e", label: "Maintain technical documentation & record-keeping (model, algorithms, data sources, intended purpose).", req: true, showFor: ["research", "quality","innovation"], refs: [ { title: "AI Act Art. 11 (tech docs)", url: "https://ai-act-law.eu/article/11/" }, { title: "AI Act Art. 12 (records)", url: "https://ai-act-law.eu/article/12/" } ], }, { k: "7f", label: "For AI projects: ongoing obligations — risk mgmt, data governance, docs, record-keeping, transparency, human oversight, accuracy & cybersecurity.", req: false, showFor: ["research", "quality","innovation"], refs: [{ title: "AI Act Arts. 9–15", url: "https://ai-act-law.eu/article/9/" }], }, { k: "7g", label: "If developing an AI model: verify permission & GDPR legal basis; remove personal data or ensure vetted/validated use; respect intelectual propety/licensing & REK terms.", req: true, showFor: ["research", "quality","innovation"], refs: [ { title: "AI Act Art. 2(7) (scope)", url: "https://ai-act-law.eu/article/2/" }, { title: "GDPR Art. 5(1)(b)-(c); Art. 6(1); Arts. 44–49", url: "https://gdpr-info.eu/art-6-gdpr/" } ], }, { k: "7h", label: "If deploying on EU market: conformity/CE marking/registration in EU AI database where required.", req: false, showFor: ["research", "quality","innovation"], refs: [{ title: "AI Act Arts. 30 & 43", url: "https://ai-act-law.eu/article/30/" }], }, { k: "7i", label: "Risk mgmt & bias mitigation documented for interpretation of results.", req: false, showFor: ["research", "quality","innovation"], refs: [ { title: "AI Act Art. 9; Art. 10(2)(e)", url: "https://ai-act-law.eu/article/9/" }, { title: "GDPR Art. 35 (DPIA)", url: "https://gdpr-info.eu/art-35-gdpr/" }, ], }, { k: "7j", label: "Exclude malpractice data; run fairness checks (e.g., demographic parity, equalised odds, subgroup analysis); schedule bias audits & compliance reviews; handle subject rights.", req: false, showFor: ["research", "quality","innovation"], refs: [ { title: "AI Act Arts. 9, 10(2)(e), 15", url: "https://ai-act-law.eu/article/9/" }, { title: "GDPR Arts. 12–22 (rights)", url: "https://gdpr-info.eu/chapter-3/" } ], }, { k: "7k", label: "Plan periodic reassessment & review as tech/regulations evolve.", req: true, showFor: ["research", "quality","innovation"], } ], }, { num: 8, key: "compliance", title: "Compliance monitoring & auditing", items: [ { k: "8a", label: "Internal audit (e.g., by/with health trust); remediate discrepancies.", req: true, refs: [{ title: "GDPR Art. 5(2); Art. 24", url: "https://gdpr-info.eu/art-24-gdpr/" }], }, { k: "8b", label: "Maintain a compliance report (docs/approvals/permits/agreements).", req: true }, { k: "8c", label: "All source-system extractions logged (who/when/what); periodic risk-based log review.", req: true, refs: [{ title: "PRA §22; PRR §14; Normen 5.4.4", url: "https://lovdata.no/forskrift/2019-03-01-168/%C2%A714" }], }, { k: "8d", label: "Use only for approved protocol; seek amendments before new purposes or analyses.", req: true, refs: [{ title: "GDPR Art. 5(1)(b); HRA §33", url: "https://gdpr-info.eu/art-5-gdpr/" }], }, { k: "8e", label: "Review & update audit/compliance process periodically (law & technology changes).", req: true, }, ], }, { num: 9, key: "closeout", title: "Dissemination, close-out, retention & deletion", items: [ { k: "9a", label: "Before releasing results, ensure no individual can be identified in outputs.", req: true, refs: [{ title: "GDPR Art. 5(1)(c); Art. 89(1)", url: "https://gdpr-info.eu/art-89-gdpr/" }], }, { k: "9b", label: "Publications/reports include ethics & data-protection statements (e.g., REK ref., GDPR compliance; Helsinki where applicable).", req: false, }, { k: "9c", label: "If an AI product/service: disclose intended use, limitations, validation status; transparency.", req: false, refs: [{ title: "AI Act Art. 13", url: "https://ai-act-law.eu/article/13/" }], }, { k: "9d", label: "Fulfil reporting obligations (REK/registries/funders; EU AI database if required).", req: false, refs: [{ title: "AI Act Chapter III", url: "https://ai-act-law.eu/chapter/3/" }], }, { k: "9e", label: "Post-project closure actions (expand when ready).", req: false, children: [ { k: "9e-1", label: "Delete/anonymize all personal data at retention end; double-check backups & stray copies; document date & method.", req: true, refs: [{ title: "GDPR Art. 5(1)(e); 5(2)", url: "https://gdpr-info.eu/art-5-gdpr/" }], }, { k: "9e-2", label: "Archive key documentation securely (approvals, consent, scripts, final reports, DPIA), typically 5–10 years without identifiable raw data.", req: true, refs: [{ title: "GDPR Art. 5(1)(e); Art. 89(1)", url: "https://gdpr-info.eu/art-89-gdpr/" }], }, { k: "9e-3", label: "If retaining/reusing data: record new legal basis (renewed consent, extended REK, or lawful data bank/registry/biobank).", req: true, refs: [ { title: "GDPR Art. 6(1); Art. 9(2)", url: "https://gdpr-info.eu/art-6-gdpr/" }, { title: "HRA §§13–14; §33", url: "https://lovdata.no/lov/2008-06-20-44/%C2%A713" }, { title: "HRL rules", url: "https://lovdata.no/dokument/NL/lov/2014-06-20-43" } ], }, { k: "9e-4", label: "Final debrief meeting; note best practices and recommendations.", req: false, }, { k: "9e-5", label: "Notify relevant bodies (e.g., REK) that the study is concluded and data destroyed; update RoPA to mark project finished.", req: true, refs: [{ title: "GDPR Art. 30 (RoPA)", url: "https://gdpr-info.eu/art-30-gdpr/" }], }, { k: "9e-6", label: "If an AI model continues in clinical use: govern under ops protocols (monitoring/maintenance/fallback); if discontinued: purge model artifacts to ensure no personal data persists.", req: false, refs: [{ title: "AI Act Arts. 9–15; 30; 43", url: "https://ai-act-law.eu/article/9/" }], }, ], }, ], }, ]; /* Flow questions*/ const FLOW = { 1: { q: "Project classification complete & documented?", onYes: 2, onNo: 1 }, 2: { q: "Valid legal route and consent completed?", onYes: 3, onNo: 2 }, 3: { q: "All ethical and regulatory approvals in place?", onYes: 4, onNo: 3 }, 4: { q: "Data access route & contracts are ok?", onYes: 5, onNo: 4 }, 5: { q: "Information security & privacy measures and risks controlled?", onYes: 6, onNo: 5, }, 6: { q: "Extract matches necessary data approvals?", onYes: 7, onNo: 6 }, /* Step 7 has several conditional questions */ 7: [ { q: "Any new additional purpose ?", yes: 1, no: "next" }, { q: "Any new approvals needed?", yes: 3, no: "next" }, { q: "Any new access/contracts?", yes: 4, no: 8 }, ], 8: { q: "Any gaps found?", onYes: 4, onNo: 9 }, 9: { q: "Will you retain or reuse data beyond approved plan?", onYes: 1, onNo: "end" }, }; /* ------------ State ------------ */ const STORAGE = "suhr_flow_v2_nested"; const $ = (s) => document.querySelector(s); const $$ = (s) => Array.from(document.querySelectorAll(s)); const state = { purpose: null, checks: {}, savedAt: null, visible: 0, step: 0, subQ: 0, reachedEnd: false, }; /* ------------ Purpose UI ------------ */ function renderPurposes() { const host = $("#purposeList"); host.innerHTML = ""; PURPOSES.forEach((p) => { const el = document.createElement("label"); el.className = "option"; el.innerHTML = `