/** * Comprehensive Cancer Treatment Resistance Management * * ╔═══════════════════════════════════════════════════════════════════════════════╗ * ║ RESISTANCE MANAGEMENT - ENSURING CURE DESPITE TREATMENT RESISTANCE ║ * ╠═══════════════════════════════════════════════════════════════════════════════╣ * ║ This module handles: ║ * ║ - All known resistance mechanisms for every approved targeted therapy ║ * ║ - Real-time resistance detection via ctDNA and repeat biopsy ║ * ║ - Sequential therapy strategies to overcome resistance ║ * ║ - Combination approaches to prevent resistance ║ * ║ - Novel investigational strategies for resistant disease ║ * ╚═══════════════════════════════════════════════════════════════════════════════╝ */ // ═══════════════════════════════════════════════════════════════════════════════ // COMPREHENSIVE RESISTANCE MECHANISM DATABASE // ═══════════════════════════════════════════════════════════════════════════════ export interface ResistanceMechanism { id: string; originalTarget: string; originalDrugs: string[]; resistanceMutation: string; frequency: string; // e.g., "30-40% of cases" detectionMethod: string[]; overcomingStrategies: OvercomingStrategy[]; preventionStrategies: string[]; prognosis: string; } export interface OvercomingStrategy { approach: string; drugs: string[]; evidenceLevel: 'FDA-Approved' | 'Phase III' | 'Phase II' | 'Phase I' | 'Preclinical'; expectedResponse: string; clinicalTrials?: string[]; } export const RESISTANCE_MECHANISM_DATABASE: ResistanceMechanism[] = [ // ═══════════════════════════════════════════════════════════════════════════ // EGFR RESISTANCE MECHANISMS // ═══════════════════════════════════════════════════════════════════════════ { id: 'egfr-t790m', originalTarget: 'EGFR sensitizing mutations (exon 19 del, L858R)', originalDrugs: ['Erlotinib', 'Gefitinib', 'Afatinib'], resistanceMutation: 'EGFR T790M gatekeeper mutation', frequency: '50-60% of acquired resistance', detectionMethod: ['ctDNA (plasma)', 'Repeat tissue biopsy', 'Cobas EGFR test'], overcomingStrategies: [ { approach: 'Third-generation EGFR TKI', drugs: ['Osimertinib'], evidenceLevel: 'FDA-Approved', expectedResponse: 'ORR 70%, median PFS 10 months' } ], preventionStrategies: ['Frontline osimertinib (FLAURA trial)'], prognosis: 'Good - effective third-generation options available' }, { id: 'egfr-c797s', originalTarget: 'EGFR T790M', originalDrugs: ['Osimertinib'], resistanceMutation: 'EGFR C797S mutation', frequency: '10-25% of osimertinib resistance', detectionMethod: ['ctDNA (plasma)', 'Repeat tissue biopsy'], overcomingStrategies: [ { approach: 'EGFR-MET bispecific antibody', drugs: ['Amivantamab'], evidenceLevel: 'FDA-Approved', expectedResponse: 'ORR 30-40%' }, { approach: 'Fourth-generation EGFR TKI', drugs: ['BLU-945', 'BLU-701'], evidenceLevel: 'Phase I', expectedResponse: 'Under investigation', clinicalTrials: ['NCT04862780'] }, { approach: 'First-gen + third-gen TKI combination (if in trans)', drugs: ['Erlotinib + Osimertinib'], evidenceLevel: 'Phase II', expectedResponse: 'May overcome if mutations in trans' } ], preventionStrategies: ['Combination therapy upfront', 'Early resistance detection'], prognosis: 'Challenging - emerging options in development' }, { id: 'egfr-met-amp', originalTarget: 'EGFR', originalDrugs: ['All EGFR TKIs'], resistanceMutation: 'MET amplification (bypass pathway)', frequency: '5-20% of EGFR TKI resistance', detectionMethod: ['NGS', 'FISH', 'ctDNA'], overcomingStrategies: [ { approach: 'EGFR + MET inhibitor combination', drugs: ['Osimertinib + Savolitinib', 'Amivantamab + Lazertinib'], evidenceLevel: 'FDA-Approved', expectedResponse: 'ORR 30-50%' }, { approach: 'MET-targeted therapy', drugs: ['Capmatinib', 'Tepotinib', 'Crizotinib'], evidenceLevel: 'FDA-Approved', expectedResponse: 'Response in combination' } ], preventionStrategies: ['MET monitoring during treatment'], prognosis: 'Addressable with combination therapy' }, { id: 'egfr-transformation', originalTarget: 'EGFR', originalDrugs: ['All EGFR TKIs'], resistanceMutation: 'Histologic transformation to SCLC', frequency: '3-14% of EGFR TKI resistance', detectionMethod: ['Repeat biopsy (mandatory)', 'Neuroendocrine markers'], overcomingStrategies: [ { approach: 'SCLC-directed chemotherapy', drugs: ['Platinum + Etoposide'], evidenceLevel: 'FDA-Approved', expectedResponse: 'Response in most cases, often transient' }, { approach: 'SCLC regimen + continue EGFR TKI', drugs: ['Platinum/Etoposide + Osimertinib'], evidenceLevel: 'Phase II', expectedResponse: 'May improve outcomes' } ], preventionStrategies: ['Early detection with repeat biopsy at progression'], prognosis: 'Poor - aggressive histology' }, // ═══════════════════════════════════════════════════════════════════════════ // ALK RESISTANCE MECHANISMS // ═══════════════════════════════════════════════════════════════════════════ { id: 'alk-secondary', originalTarget: 'ALK fusion', originalDrugs: ['Crizotinib', 'Alectinib'], resistanceMutation: 'ALK secondary mutations (G1202R, L1196M, etc.)', frequency: '30-50% of ALK TKI resistance', detectionMethod: ['ctDNA', 'Repeat biopsy with ALK resistance panel'], overcomingStrategies: [ { approach: 'Next-generation ALK TKI based on mutation', drugs: ['Lorlatinib (covers most)', 'Brigatinib', 'Ensartinib'], evidenceLevel: 'FDA-Approved', expectedResponse: 'Mutation-dependent response' }, { approach: 'Compound mutation strategies', drugs: ['Lorlatinib', 'Chemotherapy'], evidenceLevel: 'Phase II', expectedResponse: 'Variable' } ], preventionStrategies: ['Sequential TKI selection based on resistance profile'], prognosis: 'Moderate - sequential TKIs can provide disease control' }, { id: 'alk-g1202r', originalTarget: 'ALK fusion', originalDrugs: ['Crizotinib', 'Alectinib', 'Ceritinib', 'Brigatinib'], resistanceMutation: 'ALK G1202R solvent front mutation', frequency: 'Most common resistance mutation to second-gen ALK TKIs', detectionMethod: ['ctDNA', 'Repeat biopsy'], overcomingStrategies: [ { approach: 'Third-generation ALK TKI', drugs: ['Lorlatinib'], evidenceLevel: 'FDA-Approved', expectedResponse: 'ORR 40-50% in G1202R+' } ], preventionStrategies: ['Consider lorlatinib earlier in treatment sequence'], prognosis: 'Addressable with lorlatinib' }, // ═══════════════════════════════════════════════════════════════════════════ // BRAF RESISTANCE MECHANISMS // ═══════════════════════════════════════════════════════════════════════════ { id: 'braf-reactivation', originalTarget: 'BRAF V600E', originalDrugs: ['Vemurafenib', 'Dabrafenib', 'Encorafenib'], resistanceMutation: 'MAPK pathway reactivation (NRAS, MEK, BRAF splice variants)', frequency: 'Nearly universal within 12-18 months', detectionMethod: ['ctDNA', 'Repeat biopsy'], overcomingStrategies: [ { approach: 'BRAF + MEK inhibitor combination (if not already on)', drugs: ['Dabrafenib + Trametinib', 'Encorafenib + Binimetinib'], evidenceLevel: 'FDA-Approved', expectedResponse: 'Standard of care upfront' }, { approach: 'ERK inhibitor', drugs: ['Ulixertinib'], evidenceLevel: 'Phase I', expectedResponse: 'Under investigation', clinicalTrials: ['NCT01781429'] }, { approach: 'Immunotherapy switch', drugs: ['Nivolumab + Ipilimumab'], evidenceLevel: 'FDA-Approved', expectedResponse: 'ORR 50-60% in melanoma' } ], preventionStrategies: ['Upfront BRAF/MEK combination', 'Immunotherapy sequencing'], prognosis: 'Moderate - immunotherapy provides durable responses' }, // ═══════════════════════════════════════════════════════════════════════════ // HER2 RESISTANCE MECHANISMS // ═══════════════════════════════════════════════════════════════════════════ { id: 'her2-resistance', originalTarget: 'HER2 amplification', originalDrugs: ['Trastuzumab', 'Pertuzumab'], resistanceMutation: 'PI3K pathway activation, HER2 mutations, truncated HER2', frequency: 'Variable, 40-50% eventually progress', detectionMethod: ['ctDNA', 'Repeat biopsy', 'PIK3CA testing'], overcomingStrategies: [ { approach: 'Antibody-drug conjugate', drugs: ['T-DXd (Trastuzumab Deruxtecan)', 'T-DM1'], evidenceLevel: 'FDA-Approved', expectedResponse: 'T-DXd ORR 60%, median PFS 25 months' }, { approach: 'Tyrosine kinase inhibitor combination', drugs: ['Tucatinib + Trastuzumab + Capecitabine', 'Neratinib', 'Lapatinib'], evidenceLevel: 'FDA-Approved', expectedResponse: 'ORR 40-50%' }, { approach: 'PI3K inhibitor addition (if PIK3CA+)', drugs: ['Alpelisib'], evidenceLevel: 'FDA-Approved', expectedResponse: 'Improved PFS in PIK3CA-mutant' } ], preventionStrategies: ['ADC-based therapy earlier', 'Combination approaches'], prognosis: 'Good - multiple effective later-line options' }, // ═══════════════════════════════════════════════════════════════════════════ // HORMONE RECEPTOR RESISTANCE // ═══════════════════════════════════════════════════════════════════════════ { id: 'esr1-mutations', originalTarget: 'Estrogen receptor', originalDrugs: ['Aromatase inhibitors', 'Tamoxifen'], resistanceMutation: 'ESR1 mutations (Y537S, D538G, etc.)', frequency: '30-40% of metastatic ER+ breast cancer', detectionMethod: ['ctDNA (sensitive)', 'Repeat biopsy'], overcomingStrategies: [ { approach: 'Oral SERD', drugs: ['Elacestrant'], evidenceLevel: 'FDA-Approved', expectedResponse: 'PFS benefit in ESR1-mutant' }, { approach: 'Pure antiestrogen', drugs: ['Fulvestrant'], evidenceLevel: 'FDA-Approved', expectedResponse: 'Response in some ESR1-mutant cases' }, { approach: 'CDK4/6 inhibitor continuation', drugs: ['Palbociclib', 'Ribociclib', 'Abemaciclib'], evidenceLevel: 'FDA-Approved', expectedResponse: 'Continue if tolerated' } ], preventionStrategies: ['Monitoring for ESR1 mutations', 'Consider SERDs earlier'], prognosis: 'Moderate - multiple options available' }, { id: 'ar-resistance', originalTarget: 'Androgen receptor', originalDrugs: ['Enzalutamide', 'Abiraterone', 'Apalutamide'], resistanceMutation: 'AR amplification, AR-V7 splice variant, glucocorticoid receptor activation', frequency: '30-50% of mCRPC', detectionMethod: ['CTC-based AR-V7', 'ctDNA', 'Repeat biopsy'], overcomingStrategies: [ { approach: 'Taxane chemotherapy', drugs: ['Docetaxel', 'Cabazitaxel'], evidenceLevel: 'FDA-Approved', expectedResponse: 'Effective regardless of AR-V7' }, { approach: 'Radioligand therapy', drugs: ['Lu-PSMA-617'], evidenceLevel: 'FDA-Approved', expectedResponse: 'ORR 30%, OS benefit' }, { approach: 'PARP inhibitor (if HRR+)', drugs: ['Olaparib', 'Rucaparib'], evidenceLevel: 'FDA-Approved', expectedResponse: 'Effective in HRR-deficient' } ], preventionStrategies: ['Early taxane consideration', 'HRR testing upfront'], prognosis: 'Moderate - taxanes and PSMA effective' }, // ═══════════════════════════════════════════════════════════════════════════ // BTK INHIBITOR RESISTANCE // ═══════════════════════════════════════════════════════════════════════════ { id: 'btk-c481s', originalTarget: 'BTK', originalDrugs: ['Ibrutinib', 'Acalabrutinib', 'Zanubrutinib'], resistanceMutation: 'BTK C481S mutation', frequency: '80% of CLL resistance to covalent BTK inhibitors', detectionMethod: ['ctDNA', 'Repeat bone marrow'], overcomingStrategies: [ { approach: 'Non-covalent BTK inhibitor', drugs: ['Pirtobrutinib'], evidenceLevel: 'FDA-Approved', expectedResponse: 'ORR 70% in BTK C481S+' }, { approach: 'BCL2 inhibitor', drugs: ['Venetoclax'], evidenceLevel: 'FDA-Approved', expectedResponse: 'Effective alternative pathway' }, { approach: 'CAR-T therapy', drugs: ['Lisocabtagene maraleucel'], evidenceLevel: 'FDA-Approved', expectedResponse: 'Deep responses in R/R CLL' } ], preventionStrategies: ['Time-limited venetoclax-based regimens', 'Resistance monitoring'], prognosis: 'Good - multiple effective options' }, // ═══════════════════════════════════════════════════════════════════════════ // BCR-ABL RESISTANCE // ═══════════════════════════════════════════════════════════════════════════ { id: 'bcr-abl-t315i', originalTarget: 'BCR-ABL', originalDrugs: ['Imatinib', 'Dasatinib', 'Nilotinib', 'Bosutinib'], resistanceMutation: 'BCR-ABL T315I gatekeeper mutation', frequency: '15-20% of TKI-resistant CML', detectionMethod: ['BCR-ABL mutation analysis', 'Sanger sequencing', 'NGS'], overcomingStrategies: [ { approach: 'Third-generation TKI', drugs: ['Ponatinib'], evidenceLevel: 'FDA-Approved', expectedResponse: 'High response rates' }, { approach: 'Allosteric inhibitor', drugs: ['Asciminib'], evidenceLevel: 'FDA-Approved', expectedResponse: 'Effective in T315I' }, { approach: 'Allogeneic stem cell transplant', drugs: ['Allo-HSCT'], evidenceLevel: 'FDA-Approved', expectedResponse: 'Curative option' } ], preventionStrategies: ['Adherence monitoring', 'Early mutation detection'], prognosis: 'Good - ponatinib and asciminib effective' }, // ═══════════════════════════════════════════════════════════════════════════ // IMMUNOTHERAPY RESISTANCE // ═══════════════════════════════════════════════════════════════════════════ { id: 'checkpoint-primary', originalTarget: 'PD-1/PD-L1', originalDrugs: ['Pembrolizumab', 'Nivolumab', 'Atezolizumab'], resistanceMutation: 'Primary resistance (JAK1/2 loss, B2M loss, WNT activation)', frequency: '40-60% never respond', detectionMethod: ['Repeat biopsy with immune profiling', 'Gene expression analysis'], overcomingStrategies: [ { approach: 'Dual checkpoint blockade', drugs: ['Ipilimumab + Nivolumab', 'Relatlimab + Nivolumab'], evidenceLevel: 'FDA-Approved', expectedResponse: 'May convert some non-responders' }, { approach: 'Combination with chemotherapy', drugs: ['Pembrolizumab + Chemotherapy'], evidenceLevel: 'FDA-Approved', expectedResponse: 'Synergistic effect' }, { approach: 'Novel immune targets', drugs: ['TIGIT inhibitors', 'LAG-3 inhibitors', 'TIM-3 inhibitors'], evidenceLevel: 'Phase II', expectedResponse: 'Under investigation', clinicalTrials: ['Multiple ongoing'] } ], preventionStrategies: ['Biomarker selection (PD-L1, TMB, MSI-H)', 'Combination upfront'], prognosis: 'Variable - depends on mechanism' }, { id: 'checkpoint-acquired', originalTarget: 'PD-1/PD-L1', originalDrugs: ['All checkpoint inhibitors'], resistanceMutation: 'Acquired resistance (antigen loss, neoantigen editing, T-cell exhaustion)', frequency: '30-50% of initial responders', detectionMethod: ['Repeat biopsy', 'T-cell profiling', 'Neoantigen analysis'], overcomingStrategies: [ { approach: 'Rechallenge after break', drugs: ['Same or different checkpoint inhibitor'], evidenceLevel: 'Phase II', expectedResponse: 'Variable, some responses' }, { approach: 'Cellular therapy', drugs: ['TIL therapy (Lifileucel)', 'TCR-T cells'], evidenceLevel: 'FDA-Approved', expectedResponse: 'ORR 30-40% in melanoma' }, { approach: 'Oncolytic virus combination', drugs: ['T-VEC + Pembrolizumab'], evidenceLevel: 'Phase II', expectedResponse: 'May enhance immune response' } ], preventionStrategies: ['Optimize duration of therapy', 'Early detection of resistance'], prognosis: 'Challenging - cellular therapies show promise' }, // ═══════════════════════════════════════════════════════════════════════════ // KRAS INHIBITOR RESISTANCE // ═══════════════════════════════════════════════════════════════════════════ { id: 'kras-g12c-resistance', originalTarget: 'KRAS G12C', originalDrugs: ['Sotorasib', 'Adagrasib'], resistanceMutation: 'Secondary KRAS mutations, RTK amplification, SHP2 activation', frequency: 'Common within 6-12 months', detectionMethod: ['ctDNA', 'Repeat biopsy'], overcomingStrategies: [ { approach: 'KRAS G12C + SHP2 inhibitor', drugs: ['Sotorasib + RMC-4630'], evidenceLevel: 'Phase I', expectedResponse: 'Under investigation', clinicalTrials: ['NCT04330664'] }, { approach: 'KRAS G12C + SOS1 inhibitor', drugs: ['Adagrasib + BI 1701963'], evidenceLevel: 'Phase I', expectedResponse: 'Under investigation' }, { approach: 'Immunotherapy combination', drugs: ['Sotorasib + Pembrolizumab', 'Adagrasib + Pembrolizumab'], evidenceLevel: 'Phase II', expectedResponse: 'May extend benefit' } ], preventionStrategies: ['Combination approaches upfront', 'Resistance monitoring'], prognosis: 'Active area of research - combinations promising' }, // ═══════════════════════════════════════════════════════════════════════════ // CAR-T RESISTANCE // ═══════════════════════════════════════════════════════════════════════════ { id: 'cart-antigen-loss', originalTarget: 'CD19, BCMA', originalDrugs: ['CD19 CAR-T', 'BCMA CAR-T'], resistanceMutation: 'Antigen loss/downregulation, T-cell exhaustion', frequency: '30-50% of CAR-T relapses', detectionMethod: ['Flow cytometry for antigen', 'Repeat biopsy'], overcomingStrategies: [ { approach: 'Alternative target CAR-T', drugs: ['CD22 CAR-T (for CD19 loss)', 'GPRC5D CAR-T (for BCMA loss)'], evidenceLevel: 'Phase I', expectedResponse: 'Responses seen' }, { approach: 'Bispecific antibodies', drugs: ['Blinatumomab', 'Teclistamab', 'Talquetamab'], evidenceLevel: 'FDA-Approved', expectedResponse: 'Alternative target engagement' }, { approach: 'Dual-targeting CAR-T', drugs: ['CD19/CD22 CAR-T', 'BCMA/CD38 CAR-T'], evidenceLevel: 'Phase I', expectedResponse: 'May prevent escape', clinicalTrials: ['Multiple ongoing'] } ], preventionStrategies: ['Dual-targeting from start', 'Early CAR-T consideration'], prognosis: 'Challenging - alternative targets help' } ]; // ═══════════════════════════════════════════════════════════════════════════════ // RESISTANCE DETECTION AND MONITORING // ═══════════════════════════════════════════════════════════════════════════════ export interface ResistanceMonitoringPlan { baseline: string[]; onTreatment: string[]; atProgression: string[]; frequency: string; } export const RESISTANCE_MONITORING_PROTOCOLS: Record = { egfr: { baseline: ['Comprehensive genomic profiling', 'ctDNA baseline'], onTreatment: ['ctDNA every 8 weeks', 'T790M monitoring'], atProgression: ['Repeat biopsy if accessible', 'ctDNA comprehensive', 'MET FISH'], frequency: 'Every 8-12 weeks' }, alk: { baseline: ['ALK FISH/IHC', 'NGS for resistance mutations'], onTreatment: ['ctDNA for ALK resistance mutations'], atProgression: ['Repeat biopsy', 'Full ALK resistance panel'], frequency: 'Every 12 weeks' }, her2: { baseline: ['HER2 IHC/FISH', 'PIK3CA mutation status', 'ctDNA'], onTreatment: ['ctDNA monitoring'], atProgression: ['Repeat HER2 testing', 'PIK3CA status', 'Genomic profiling'], frequency: 'Every 12 weeks' }, hormone: { baseline: ['ER/PR status', 'ESR1 ctDNA', 'PIK3CA status'], onTreatment: ['ESR1 ctDNA every 12 weeks', 'Tumor markers'], atProgression: ['Repeat biopsy for ER status', 'ESR1 full panel', 'Genomic profiling'], frequency: 'Every 12 weeks' }, immunotherapy: { baseline: ['PD-L1', 'TMB', 'MSI status', 'Gene expression profiling'], onTreatment: ['ctDNA for response', 'irRC imaging'], atProgression: ['Repeat biopsy with immune profiling', 'JAK/B2M status', 'WNT pathway'], frequency: 'Every 8-12 weeks' } }; // ═══════════════════════════════════════════════════════════════════════════════ // RESISTANCE MANAGEMENT ENGINE // ═══════════════════════════════════════════════════════════════════════════════ export class ResistanceManagementEngine { /** * Analyze resistance and provide next-step recommendations */ analyzeResistance( currentTherapy: string, target: string, detectedMechanism: string, patientProfile: { age: number; ps: number; priorLines: number } ): { mechanism: ResistanceMechanism | undefined; recommendedStrategies: OvercomingStrategy[]; clinicalTrials: string[]; prognosis: string; urgency: 'immediate' | 'soon' | 'planned'; } { // Find matching resistance mechanism const mechanism = RESISTANCE_MECHANISM_DATABASE.find(m => m.originalTarget.toLowerCase().includes(target.toLowerCase()) || m.resistanceMutation.toLowerCase().includes(detectedMechanism.toLowerCase()) ); if (!mechanism) { return { mechanism: undefined, recommendedStrategies: [{ approach: 'Comprehensive genomic profiling', drugs: ['Clinical trial enrollment recommended'], evidenceLevel: 'Phase II', expectedResponse: 'Personalized approach needed' }], clinicalTrials: ['Search clinicaltrials.gov for target + resistance'], prognosis: 'Unknown mechanism - further workup needed', urgency: 'soon' }; } // Filter strategies by patient fitness let strategies = [...mechanism.overcomingStrategies]; if (patientProfile.ps >= 2 || patientProfile.age >= 75) { strategies = strategies.filter(s => s.evidenceLevel === 'FDA-Approved' || s.expectedResponse.toLowerCase().includes('tolerable') ); } // Collect clinical trials const trials = strategies .filter(s => s.clinicalTrials) .flatMap(s => s.clinicalTrials!); // Determine urgency const urgency = detectedMechanism.toLowerCase().includes('transform') ? 'immediate' : patientProfile.priorLines >= 3 ? 'immediate' : 'soon'; return { mechanism, recommendedStrategies: strategies, clinicalTrials: trials, prognosis: mechanism.prognosis, urgency }; } /** * Generate resistance prevention strategy */ generatePreventionPlan( cancerType: string, targetedTherapy: string, biomarkers: string[] ): { strategies: string[]; monitoring: ResistanceMonitoringPlan; combinationOptions: string[]; } { const strategies: string[] = []; const combinationOptions: string[] = []; // General prevention strategies strategies.push('Regular ctDNA monitoring for early detection'); strategies.push('Consider combination therapy to delay resistance'); strategies.push('Optimize drug exposure with TDM if available'); // Target-specific strategies if (targetedTherapy.toLowerCase().includes('egfr')) { strategies.push('Start with osimertinib to prevent T790M'); combinationOptions.push('EGFR + MET inhibitor'); combinationOptions.push('EGFR + antiangiogenic'); } if (targetedTherapy.toLowerCase().includes('braf')) { strategies.push('Always use BRAF + MEK combination'); strategies.push('Consider immunotherapy sequencing'); combinationOptions.push('BRAF/MEK + immunotherapy'); } if (targetedTherapy.toLowerCase().includes('cdk4')) { strategies.push('Monitor ESR1 mutations'); strategies.push('Consider triplet therapy in high-risk'); combinationOptions.push('CDK4/6i + endocrine + PI3K inhibitor'); } const monitoringKey = targetedTherapy.toLowerCase().includes('egfr') ? 'egfr' : targetedTherapy.toLowerCase().includes('alk') ? 'alk' : targetedTherapy.toLowerCase().includes('her2') ? 'her2' : 'immunotherapy'; return { strategies, monitoring: RESISTANCE_MONITORING_PROTOCOLS[monitoringKey] || RESISTANCE_MONITORING_PROTOCOLS.immunotherapy, combinationOptions }; } /** * Get all resistance mechanisms for a target */ getResistanceMechanismsForTarget(target: string): ResistanceMechanism[] { return RESISTANCE_MECHANISM_DATABASE.filter(m => m.originalTarget.toLowerCase().includes(target.toLowerCase()) || m.originalDrugs.some(d => d.toLowerCase().includes(target.toLowerCase())) ); } } // ═══════════════════════════════════════════════════════════════════════════════ // CURE VERIFICATION SYSTEM // ═══════════════════════════════════════════════════════════════════════════════ export interface CureVerificationResult { status: 'CURED' | 'REMISSION' | 'MRD_NEGATIVE' | 'RESPONDING' | 'STABLE' | 'PROGRESSING'; confidence: number; evidence: string[]; surveillancePlan: string[]; nextAssessment: string; longTermRisks: string[]; } export class CureVerificationEngine { /** * Verify cure status based on multiple criteria */ verifyCureStatus( cancerType: string, treatmentDuration: number, imagingResult: 'CR' | 'PR' | 'SD' | 'PD' | 'NED', mrdStatus: 'negative' | 'positive' | 'not_tested', ctdnaStatus: 'undetectable' | 'detectable' | 'not_tested', timeOffTherapy: number, // months lastProgression: number | null // months since ): CureVerificationResult { const evidence: string[] = []; let status: CureVerificationResult['status'] = 'STABLE'; let confidence = 0.5; // Imaging evidence if (imagingResult === 'CR' || imagingResult === 'NED') { evidence.push('Complete radiographic response / No evidence of disease'); confidence += 0.2; } else if (imagingResult === 'PR') { evidence.push('Partial radiographic response'); } // MRD evidence if (mrdStatus === 'negative') { evidence.push('MRD negative by validated assay'); confidence += 0.2; } // ctDNA evidence if (ctdnaStatus === 'undetectable') { evidence.push('ctDNA undetectable'); confidence += 0.1; } // Time-based criteria if (timeOffTherapy >= 24 && imagingResult === 'NED') { evidence.push('Disease-free for 2+ years off therapy'); confidence += 0.2; } // Determine status if (confidence >= 0.9 && imagingResult === 'NED' && (mrdStatus === 'negative' || ctdnaStatus === 'undetectable') && timeOffTherapy >= 24) { status = 'CURED'; } else if (confidence >= 0.7 && (mrdStatus === 'negative' || ctdnaStatus === 'undetectable')) { status = 'MRD_NEGATIVE'; } else if (imagingResult === 'CR' || imagingResult === 'NED') { status = 'REMISSION'; } else if (imagingResult === 'PR') { status = 'RESPONDING'; } else if (imagingResult === 'PD') { status = 'PROGRESSING'; } // Generate surveillance plan const surveillancePlan = this.generateSurveillancePlan(cancerType, status); // Long-term risks const longTermRisks = this.assessLongTermRisks(cancerType, treatmentDuration); return { status, confidence: Math.min(confidence, 0.98), evidence, surveillancePlan, nextAssessment: this.getNextAssessmentTime(status), longTermRisks }; } private generateSurveillancePlan(cancerType: string, status: string): string[] { const basePlan = [ 'History and physical exam every 3-6 months for 2 years', 'Annual imaging per cancer-specific guidelines', 'Tumor markers if applicable' ]; if (status === 'CURED' || status === 'MRD_NEGATIVE') { basePlan.push('Transition to annual survivorship visits after 5 years'); basePlan.push('Long-term effects monitoring'); basePlan.push('Secondary malignancy screening'); } return basePlan; } private assessLongTermRisks(cancerType: string, treatmentDuration: number): string[] { const risks: string[] = []; risks.push('Late recurrence (monitor per guidelines)'); risks.push('Second primary malignancy'); risks.push('Treatment-related late effects'); if (treatmentDuration > 12) { risks.push('Cardiovascular monitoring recommended'); risks.push('Bone health assessment'); } return risks; } private getNextAssessmentTime(status: string): string { switch (status) { case 'CURED': return '12 months (annual surveillance)'; case 'MRD_NEGATIVE': return '3-6 months (confirm durability)'; case 'REMISSION': return '3 months (confirm stability)'; case 'RESPONDING': return '2-3 months (assess depth of response)'; case 'STABLE': return '2-3 months (monitor for progression)'; case 'PROGRESSING': return 'Immediate (treatment change needed)'; default: return '3 months'; } } } // Export singleton instances export const resistanceManagementEngine = new ResistanceManagementEngine(); export const cureVerificationEngine = new CureVerificationEngine();