"use strict";
/**
 * NICE Evidence Standards Framework for Digital Health Technologies
 * Compliance Pack
 *
 * Framework: NICE (National Institute for Health and Care Excellence)
 *   Evidence Standards Framework for Digital Health Technologies (ESF
 *   for DHT). Originally published 2018; updated 2022 + 2024 to address
 *   AI-driven digital health technologies. Used by NHS England,
 *   Department of Health and Social Care, integrated care systems, and
 *   commissioners as the de-facto UK reimbursement evidence bar for
 *   digital health technologies, including AI-based products.
 *
 * Jurisdiction: GB — England-led; equivalent practice in Scotland (SHTG
 *   Scottish Health Technologies Group), Wales, and Northern Ireland
 *   under their devolved health-technology-assessment bodies.
 * Authority: NICE + NHS England (commissioning) + DHSC (policy) +
 *   integrated care systems (commissioners)
 *
 * Why this pack:
 *   - The UK healthcare-AI assessment stack has FOUR distinct layers:
 *     1. **Regulatory approval** — MHRA UKCA / SaMD (separate pack:
 *        `mhra-samd-ukca`)
 *     2. **Clinical safety case** — DCB0129/0160 (separate pack:
 *        `nhs-clinical-safety`)
 *     3. **Data security baseline** — DSPT (separate pack: `nhs-dspt`)
 *     4. **HTA / reimbursement evidence** — this pack
 *   - NICE ESF for DHT is the "is this AI product worth NHS funding?"
 *     gate. Distinct from MHRA's "is it safe to sell?" gate.
 *   - Replaces Australian TGA slot in Thomas's UK-16 list (UK doesn't
 *     have a TGA — TGA is the Australian Therapeutic Goods Admin; the
 *     UK equivalent regulatory body is MHRA, already covered. The
 *     missing piece in the UK healthcare-AI stack is HTA evidence).
 *   - Pairs with `mhra-samd-ukca` (regulatory approval), `nhs-clinical-
 *     safety` (clinical safety case), `nhs-dspt` (data security),
 *     `nhs-dtac` (composite assessment).
 *
 * NICE ESF for DHT three evidence tiers (current 2024 framework):
 *   - **Tier A**: digital tools with no measurable user benefit (e.g.,
 *     system services). Minimal evidence required.
 *   - **Tier B**: products that inform users (e.g., information apps,
 *     diagnostic aids). Functional evidence + accuracy.
 *   - **Tier C**: products that drive behaviour change or treatment
 *     decisions. Highest evidence bar — clinical effectiveness +
 *     economic impact + real-world data.
 *
 * Evidence categories per NICE ESF:
 *   - **Effectiveness evidence** — clinical outcomes; AI accuracy +
 *     calibration metrics; comparator data
 *   - **Economic impact evidence** — cost-effectiveness analysis;
 *     budget impact; QALY gain
 *   - **Real-world performance** — post-deployment monitoring;
 *     equity-of-access metrics; subgroup performance
 *   - **Health inequalities impact** — Equality Act 2010 protected-
 *     characteristic subgroup analysis
 *   - **Data and analytics** — model lineage; training data
 *     provenance; UK-applicability evidence
 *
 * Out of scope:
 *   - MHRA UKCA / SaMD regulatory approval (separate pack)
 *   - DCB0129/0160 clinical safety case (separate pack)
 *   - SHTG Scotland equivalent (devolved, separate pack to follow)
 *   - General clinical-trial regulation (separate regime)
 *
 * @connexum/ai-governance
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.NICE_ESF_DHT_PACK = exports.NICE_ESF_DHT_CATEGORY_CLASSIFIERS = void 0;
exports.NICE_ESF_DHT_CATEGORY_CLASSIFIERS = {
    ESF_TIER_DESIGNATION: {
        references: [
            'NICE ESF for DHT (2024) — three-tier evidence framework',
        ],
        classifier: (input) => {
            if (/\b(?:nice\s+esf\s+(?:tier\s*[abc]|designation)|esf\s+dht\s+tier|tier\s+[abc]\s+digital\s+health)\b/i.test(input))
                return true;
            if (/\b(?:nice\s+evidence\s+standards\s+framework|nice\s+digital\s+health\s+evidence)\b/i.test(input))
                return true;
            return false;
        },
    },
    EFFECTIVENESS_EVIDENCE: {
        references: [
            'NICE ESF for DHT — clinical effectiveness + AI accuracy / calibration metrics',
        ],
        classifier: (input) => {
            if (/\b(?:clinical\s+effectiveness|clinical\s+outcome\s+study|ai\s+(?:accuracy|calibration|sensitivity|specificity)\s+report)\b/i.test(input))
                return true;
            if (/\b(?:auc\s+roc\s+(?:report|nice|clinical)|comparator\s+study\s+nice|head[\s-]?to[\s-]?head\s+evaluation)\b/i.test(input))
                return true;
            return false;
        },
    },
    ECONOMIC_IMPACT_EVIDENCE: {
        references: [
            'NICE ESF for DHT — cost-effectiveness, budget impact, QALY gain',
        ],
        classifier: (input) => {
            if (/\b(?:cost[\s-]?effectiveness\s+(?:analysis|model)|qaly\s+(?:gain|analysis)|budget\s+impact\s+model)\b/i.test(input))
                return true;
            if (/\b(?:icer\s+nice|incremental\s+cost\s+effectiveness\s+ratio|hta\s+economic\s+model)\b/i.test(input))
                return true;
            return false;
        },
    },
    REAL_WORLD_PERFORMANCE: {
        references: [
            'NICE ESF for DHT — post-deployment real-world performance monitoring',
        ],
        classifier: (input) => {
            if (/\b(?:real[\s-]?world\s+(?:evidence|performance|data\s+nice|monitoring\s+nice)|rwe\s+nice)\b/i.test(input))
                return true;
            if (/\b(?:post[\s-]?deployment\s+(?:monitoring|evaluation\s+nice)|rwd\s+report\s+nice)\b/i.test(input))
                return true;
            return false;
        },
    },
    HEALTH_INEQUALITIES_IMPACT: {
        references: [
            'NICE ESF for DHT — health inequalities + subgroup performance; Equality Act 2010 overlay',
        ],
        classifier: (input) => {
            if (/\b(?:health\s+inequalities\s+(?:impact|assessment|nice)|core20plus5)\b/i.test(input))
                return true;
            if (/\b(?:subgroup\s+performance\s+(?:nice|esf)|equity\s+of\s+access\s+(?:nice|esf))\b/i.test(input))
                return true;
            if (/\b(?:protected\s+characteristic\s+subgroup\s+nice|imd\s+decile\s+(?:nice|esf))\b/i.test(input))
                return true;
            return false;
        },
    },
    MODEL_PROVENANCE_RECORD: {
        references: [
            'NICE ESF for DHT — model lineage + training data provenance + UK applicability',
        ],
        classifier: (input) => {
            if (/\b(?:model\s+(?:lineage|provenance|card)\s+nice|training\s+data\s+(?:provenance|origin)\s+esf)\b/i.test(input))
                return true;
            if (/\b(?:uk\s+applicability\s+evidence|uk\s+population\s+representativeness|domain\s+shift\s+nice)\b/i.test(input))
                return true;
            return false;
        },
    },
    CREDENTIALS: {
        references: ['Cross-pack secrets safety; NICE ESF artefacts must not embed credentials'],
        classifier: (input) => {
            if (/\b(?:api[_-]?key|apikey)\s*[=:]\s*["']?[A-Za-z0-9_\-\/+]{16,}["']?/i.test(input))
                return true;
            if (/\bpassword\s*[=:]\s*["']?[A-Za-z0-9!@#$%^&*_\-]{8,}["']?/i.test(input))
                return true;
            if (/-----BEGIN\s+(?:RSA\s+)?PRIVATE\s+KEY-----/.test(input))
                return true;
            return false;
        },
    },
};
exports.NICE_ESF_DHT_PACK = {
    categoryClassifiers: exports.NICE_ESF_DHT_CATEGORY_CLASSIFIERS,
    id: 'nice-esf-dht',
    aliases: [
        'nice-esf',
        'nice-evidence-standards-framework',
        'nice-dht',
        'esf-dht',
        'nice-digital-health',
        'uk-hta-dht',
    ],
    name: 'NICE Evidence Standards Framework for Digital Health Technologies',
    version: '1.0.0',
    description: 'NICE Evidence Standards Framework for Digital Health Technologies (2018; updated 2022 + 2024). The UK\'s de-facto reimbursement evidence bar for digital health technologies, including AI-based products. Three-tier framework: Tier A (no measurable user benefit, minimal evidence), Tier B (informs users, functional + accuracy evidence), Tier C (drives behaviour change or treatment decisions, full clinical effectiveness + economic + real-world evidence). Evidence categories: effectiveness, economic impact, real-world performance, health inequalities impact, model provenance / UK applicability. Replaces "TGA" slot in Thomas\'s UK-16 list — UK has no TGA equivalent (MHRA covers regulatory approval, this pack covers HTA / reimbursement).',
    authority: 'NICE (National Institute for Health and Care Excellence) + NHS England (commissioning) + DHSC + integrated care systems',
    industries: ['healthcare', 'pharma', 'digital-health', 'medical-devices', 'public-sector', 'clinical-research'],
    requiredModules: [
        {
            name: 'attestation-manager',
            required: true,
            reason: 'NICE ESF tier designation (A / B / C) recorded with rationale; per-tier evidence bundle attestation; UK-applicability declaration; model-card publication.',
            reference: 'NICE ESF for DHT 2024',
        },
        {
            name: 'governance-runtime',
            required: true,
            reason: 'Default-deny on commissioning / reimbursement claims where the required-tier evidence bundle is incomplete; tier-aware gate (Tier C requires the highest evidence bar).',
            reference: 'NICE ESF tier evidence requirements',
        },
        {
            name: 'audit-integrity',
            required: true,
            reason: 'Tamper-evident audit chain for evidence-bundle revisions, NICE submission revisions, real-world performance reports, model-update events — required for NICE assessment + commissioner due-diligence.',
            reference: 'NICE submission evidentiary integrity',
        },
        {
            name: 'event-bus',
            required: true,
            reason: 'Real-world performance drift alerts; subgroup performance disparity alerts; model-update events that may shift evidence bundle; NICE re-assessment cycle reminders.',
            reference: 'NICE ESF real-world performance monitoring',
        },
        {
            name: 'data-classifier',
            required: true,
            reason: 'Surface ESF-specific evidence categories for the audit chain and the dashboard (tier designation, effectiveness, economic, real-world, health inequalities, model provenance).',
            reference: 'NICE ESF evidence categorisation',
        },
        {
            name: 'attestation-manager',
            required: true,
            reason: 'Per-evidence-category bundle status (collected / submitted / accepted) tracked for NICE submission state machine.',
            reference: 'NICE submission lifecycle',
        },
        {
            name: 'session-persistence',
            required: true,
            reason: 'Evidence retained for the product lifecycle plus 6 years (Limitation Act 1980 baseline; NICE may request historic evidence in re-assessment cycles).',
            reference: 'Limitation Act 1980; NICE re-assessment practice',
        },
        {
            name: 'bias-monitor',
            required: true,
            reason: 'Subgroup performance monitoring across protected characteristics (Equality Act 2010 overlap); IMD-decile and Core20PLUS5 subgroup analysis for health inequalities impact evidence.',
            reference: 'NICE ESF health inequalities; Equality Act 2010',
        },
        {
            name: 'transparency-injector',
            required: true,
            reason: 'Public-facing model card; commissioner-facing evidence summary; clinician-facing decision-support uncertainty display.',
            reference: 'NICE ESF transparency expectations',
        },
        {
            name: 'supply-chain',
            required: true,
            reason: 'Sub-supplier model / component evidence chain; training-data provenance flow-down; UK-applicability cascade.',
            reference: 'NICE ESF model provenance',
        },
    ],
    moduleConfig: {
        'attestation-manager': {
            esfTierDesignationRequired: true,
            perTierEvidenceBundleAttestationRequired: true,
            ukApplicabilityDeclarationRequired: true,
            modelCardPublicationRequired: true,
            perEvidenceCategoryBundleStatusTracked: true,
        },
        'governance-runtime': {
            tierAwareEvidenceGateRequired: true,
            defaultDenyOnIncompleteEvidenceBundle: true,
        },
        'audit-integrity': {
            niceSubmissionEvidenceTrackingRequired: true,
        },
        'event-bus': {
            realWorldPerformanceDriftAlertsRequired: true,
            subgroupDisparityAlertsRequired: true,
            modelUpdateEventsRequired: true,
            niceReassessmentRemindersRequired: true,
        },
        'data-classifier': {
            enabledCategories: [
                'ESF_TIER_DESIGNATION',
                'EFFECTIVENESS_EVIDENCE',
                'ECONOMIC_IMPACT_EVIDENCE',
                'REAL_WORLD_PERFORMANCE',
                'HEALTH_INEQUALITIES_IMPACT',
                'MODEL_PROVENANCE_RECORD',
                'CREDENTIALS',
            ],
            credentialsAction: 'BLOCK',
        },
        'session-persistence': {
            retentionDaysAfterProductEol: 2190, // 6 years
        },
        'bias-monitor': {
            subgroupCoverageRequired: true,
            protectedCharacteristicSubgroupAnalysisRequired: true,
            core20Plus5OverlayRequired: true,
            imdDecileSubgroupRequired: true,
        },
        'transparency-injector': {
            modelCardPublicationRequired: true,
            commissionerEvidenceSummaryRequired: true,
            clinicianUncertaintyDisplayRequired: true,
        },
        'supply-chain': {
            subSupplierEvidenceChainRequired: true,
            trainingDataProvenanceFlowDownRequired: true,
        },
    },
    providerPolicy: {
        blockedProviders: ['deepseek', 'baidu', 'alibaba'],
        requiredCapabilities: ['DATA-RESIDENCY-UK-OR-EU', 'PROCESSOR-CONTRACT', 'MODEL-CARD-PUBLICATION', 'UK-APPLICABILITY-EVIDENCE'],
        blockReasons: {
            deepseek: 'PRC jurisdiction. NICE ESF requires UK-applicability evidence + data-residency that excludes PRC routing for digital health technologies.',
            baidu: 'PRC jurisdiction. Inadequate UK-applicability evidence chain.',
            alibaba: 'PRC jurisdiction. Inadequate UK-applicability evidence chain.',
        },
    },
    dataPolicy: {
        scanCategories: [
            'ESF_TIER_DESIGNATION',
            'EFFECTIVENESS_EVIDENCE',
            'ECONOMIC_IMPACT_EVIDENCE',
            'REAL_WORLD_PERFORMANCE',
            'HEALTH_INEQUALITIES_IMPACT',
            'MODEL_PROVENANCE_RECORD',
            'CREDENTIALS',
        ],
        categoryActions: {
            ESF_TIER_DESIGNATION: 'WARN',
            EFFECTIVENESS_EVIDENCE: 'WARN',
            ECONOMIC_IMPACT_EVIDENCE: 'WARN',
            REAL_WORLD_PERFORMANCE: 'WARN',
            HEALTH_INEQUALITIES_IMPACT: 'WARN',
            MODEL_PROVENANCE_RECORD: 'WARN',
            CREDENTIALS: 'BLOCK',
        },
        encryptionRequired: true,
        encryptionStandard: 'AES-256-GCM',
        minimumClassification: 'RESTRICTED',
    },
    retentionPolicy: {
        auditLogRetentionDays: 2190, // 6 years
        sessionRetentionDays: 2190,
        incidentRetentionDays: 2190,
        reference: 'NICE re-assessment practice; Limitation Act 1980',
        forceDelete: false,
        requiresLegalHoldSupport: true,
        sovereignty: ['gb', 'eu'],
    },
    incidentPolicy: {
        notificationDeadlineHours: 168, // 7-day baseline; NICE practical timing
        reference: 'NICE re-assessment cooperation; commissioner due-diligence cadence',
        requiredRecipients: ['commissioner-sponsor', 'clinical-safety-officer', 'medical-director', 'data-protection-officer'],
        formalNotificationRequired: false,
    },
    validators: [
        {
            id: 'nice-esf-tier-designation',
            description: 'NICE ESF tier (A / B / C) designated with rationale documented; per-tier evidence bundle expectation set.',
            reference: 'NICE ESF for DHT 2024 three-tier framework',
            check: 'attestation_active',
            failSeverity: 'CRITICAL',
        },
        {
            id: 'nice-esf-effectiveness-evidence',
            description: 'Clinical effectiveness evidence captured at the tier-required depth (clinical outcomes, AI accuracy + calibration, comparator).',
            reference: 'NICE ESF effectiveness evidence',
            check: 'attestation_active',
            failSeverity: 'CRITICAL',
        },
        {
            id: 'nice-esf-economic-impact',
            description: 'Economic impact evidence captured (cost-effectiveness, budget impact, QALY) at the tier-required depth.',
            reference: 'NICE ESF economic impact',
            check: 'attestation_active',
            failSeverity: 'HIGH',
        },
        {
            id: 'nice-esf-real-world-performance',
            description: 'Post-deployment real-world performance monitoring active; NICE re-assessment cycle reminders configured.',
            reference: 'NICE ESF real-world performance',
            check: 'monitoring_active',
            failSeverity: 'HIGH',
        },
        {
            id: 'nice-esf-health-inequalities',
            description: 'Subgroup analysis across protected characteristics (Equality Act overlay), IMD deciles, and Core20PLUS5 captured.',
            reference: 'NICE ESF health inequalities; Equality Act 2010',
            check: 'bias_monitor_active',
            failSeverity: 'HIGH',
        },
        {
            id: 'nice-esf-model-provenance',
            description: 'Model lineage + training-data provenance + UK-applicability evidence captured; model card published.',
            reference: 'NICE ESF model provenance',
            check: 'attestation_active',
            failSeverity: 'HIGH',
        },
        {
            id: 'nice-esf-evidence-gate',
            description: 'Default-deny on commissioning / reimbursement claims when required-tier evidence bundle is incomplete.',
            reference: 'NICE ESF evidence-gate practice',
            check: 'governance_active',
            failSeverity: 'CRITICAL',
        },
        {
            id: 'nice-esf-evidence-audit-trail',
            description: 'Tamper-evident audit chain covers evidence-bundle revisions, NICE submission revisions, real-world performance reports, model-update events.',
            reference: 'NICE submission evidentiary integrity',
            check: 'audit_trail_exists',
            failSeverity: 'HIGH',
        },
        {
            id: 'nice-esf-supplier-flow-down',
            description: 'Sub-supplier evidence chain captured; training-data provenance flow-down recorded.',
            reference: 'NICE ESF model provenance flow-down',
            check: 'subservice_registry_active',
            failSeverity: 'MEDIUM',
        },
        {
            id: 'nice-esf-credential-block',
            description: 'Plaintext credentials blocked from NICE ESF evidence artefacts and audit chain entries.',
            reference: 'NICE ESF evidence integrity',
            check: 'data_classifier_active',
            failSeverity: 'CRITICAL',
        },
    ],
};
//# sourceMappingURL=nice-esf-dht.js.map