@erosolaraijs/cure 2.3.1 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/README.md +7 -0
  2. package/dist/bin/cure.js +114 -1
  3. package/dist/bin/cure.js.map +1 -1
  4. package/dist/capabilities/clinicalTrialMatchingModule.d.ts +150 -0
  5. package/dist/capabilities/clinicalTrialMatchingModule.d.ts.map +1 -0
  6. package/dist/capabilities/clinicalTrialMatchingModule.js +436 -0
  7. package/dist/capabilities/clinicalTrialMatchingModule.js.map +1 -0
  8. package/dist/capabilities/emergencyOncology.d.ts +97 -0
  9. package/dist/capabilities/emergencyOncology.d.ts.map +1 -0
  10. package/dist/capabilities/emergencyOncology.js +1824 -0
  11. package/dist/capabilities/emergencyOncology.js.map +1 -0
  12. package/dist/capabilities/index.d.ts +10 -0
  13. package/dist/capabilities/index.d.ts.map +1 -1
  14. package/dist/capabilities/index.js +20 -0
  15. package/dist/capabilities/index.js.map +1 -1
  16. package/dist/capabilities/multimodalOncologyModule.d.ts +149 -0
  17. package/dist/capabilities/multimodalOncologyModule.d.ts.map +1 -0
  18. package/dist/capabilities/multimodalOncologyModule.js +701 -0
  19. package/dist/capabilities/multimodalOncologyModule.js.map +1 -0
  20. package/dist/capabilities/palliativeCareModule.d.ts +216 -0
  21. package/dist/capabilities/palliativeCareModule.d.ts.map +1 -0
  22. package/dist/capabilities/palliativeCareModule.js +1160 -0
  23. package/dist/capabilities/palliativeCareModule.js.map +1 -0
  24. package/dist/capabilities/precisionMedicineModule.d.ts +151 -0
  25. package/dist/capabilities/precisionMedicineModule.d.ts.map +1 -0
  26. package/dist/capabilities/precisionMedicineModule.js +758 -0
  27. package/dist/capabilities/precisionMedicineModule.js.map +1 -0
  28. package/dist/capabilities/specialPopulationsModule.d.ts +126 -0
  29. package/dist/capabilities/specialPopulationsModule.d.ts.map +1 -0
  30. package/dist/capabilities/specialPopulationsModule.js +574 -0
  31. package/dist/capabilities/specialPopulationsModule.js.map +1 -0
  32. package/dist/capabilities/survivorshipManagement.d.ts +178 -0
  33. package/dist/capabilities/survivorshipManagement.d.ts.map +1 -0
  34. package/dist/capabilities/survivorshipManagement.js +983 -0
  35. package/dist/capabilities/survivorshipManagement.js.map +1 -0
  36. package/dist/capabilities/treatmentSequencing.d.ts +140 -0
  37. package/dist/capabilities/treatmentSequencing.d.ts.map +1 -0
  38. package/dist/capabilities/treatmentSequencing.js +1689 -0
  39. package/dist/capabilities/treatmentSequencing.js.map +1 -0
  40. package/dist/capabilities/universalHealthFramework.d.ts +108 -0
  41. package/dist/capabilities/universalHealthFramework.d.ts.map +1 -0
  42. package/dist/capabilities/universalHealthFramework.js +615 -0
  43. package/dist/capabilities/universalHealthFramework.js.map +1 -0
  44. package/dist/compliance/hipaa.d.ts.map +1 -1
  45. package/dist/compliance/hipaa.js +7 -16
  46. package/dist/compliance/hipaa.js.map +1 -1
  47. package/dist/tools/index.d.ts +31 -0
  48. package/dist/tools/index.d.ts.map +1 -0
  49. package/dist/tools/index.js +3075 -0
  50. package/dist/tools/index.js.map +1 -0
  51. package/package.json +3 -2
  52. package/src/bin/cure.ts +130 -1
  53. package/src/capabilities/clinicalTrialMatchingModule.ts +600 -0
  54. package/src/capabilities/emergencyOncology.ts +1945 -0
  55. package/src/capabilities/index.ts +181 -0
  56. package/src/capabilities/multimodalOncologyModule.ts +873 -0
  57. package/src/capabilities/palliativeCareModule.ts +1438 -0
  58. package/src/capabilities/precisionMedicineModule.ts +952 -0
  59. package/src/capabilities/specialPopulationsModule.ts +711 -0
  60. package/src/capabilities/survivorshipManagement.ts +1213 -0
  61. package/src/capabilities/treatmentSequencing.ts +1878 -0
  62. package/src/capabilities/universalHealthFramework.ts +739 -0
  63. package/src/compliance/hipaa.ts +7 -15
  64. package/src/tools/index.ts +3501 -0
@@ -0,0 +1,952 @@
1
+ /**
2
+ * Precision Medicine and Genomic Interpretation Module
3
+ *
4
+ * ╔═══════════════════════════════════════════════════════════════════════════════╗
5
+ * ║ PRECISION ONCOLOGY - BIOMARKER-DRIVEN TREATMENT SELECTION ║
6
+ * ╠═══════════════════════════════════════════════════════════════════════════════╣
7
+ * ║ This module provides: ║
8
+ * ║ - Comprehensive genomic interpretation ║
9
+ * ║ - Actionable mutation databases ║
10
+ * ║ - Pharmacogenomics for toxicity prediction ║
11
+ * ║ - Tumor microenvironment analysis ║
12
+ * ║ - ctDNA/liquid biopsy interpretation ║
13
+ * ║ - Variant actionability scoring ║
14
+ * ╚═══════════════════════════════════════════════════════════════════════════════╝
15
+ */
16
+
17
+ // ═══════════════════════════════════════════════════════════════════════════════
18
+ // GENOMIC ALTERATION DEFINITIONS
19
+ // ═══════════════════════════════════════════════════════════════════════════════
20
+
21
+ export interface GenomicAlteration {
22
+ gene: string;
23
+ alteration: string;
24
+ alterationType: AlterationType;
25
+ frequency: string;
26
+ cancerTypes: string[];
27
+ actionability: ActionabilityLevel;
28
+ therapies: TargetedTherapy[];
29
+ clinicalTrials: string[];
30
+ resistance: ResistanceMutation[];
31
+ prognosticValue: PrognosticValue;
32
+ }
33
+
34
+ export type AlterationType =
35
+ | 'Missense Mutation'
36
+ | 'Nonsense Mutation'
37
+ | 'Frameshift'
38
+ | 'In-frame Deletion'
39
+ | 'In-frame Insertion'
40
+ | 'Splice Site'
41
+ | 'Amplification'
42
+ | 'Deletion'
43
+ | 'Fusion'
44
+ | 'Rearrangement'
45
+ | 'Copy Number Gain'
46
+ | 'Copy Number Loss';
47
+
48
+ export interface ActionabilityLevel {
49
+ level: 'Level 1' | 'Level 2' | 'Level 3A' | 'Level 3B' | 'Level 4' | 'Not Actionable';
50
+ description: string;
51
+ source: string;
52
+ }
53
+
54
+ export interface TargetedTherapy {
55
+ drug: string;
56
+ class: string;
57
+ approvalStatus: 'FDA-Approved' | 'EMA-Approved' | 'Off-Label' | 'Clinical Trial';
58
+ indication: string;
59
+ responseRate: string;
60
+ medianPFS: string;
61
+ keyTrial: string;
62
+ }
63
+
64
+ export interface ResistanceMutation {
65
+ mutation: string;
66
+ frequency: string;
67
+ overcomingStrategy: string[];
68
+ }
69
+
70
+ export interface PrognosticValue {
71
+ impact: 'Favorable' | 'Unfavorable' | 'Neutral' | 'Context-Dependent';
72
+ description: string;
73
+ }
74
+
75
+ // ═══════════════════════════════════════════════════════════════════════════════
76
+ // ACTIONABLE GENOMIC DATABASE
77
+ // ═══════════════════════════════════════════════════════════════════════════════
78
+
79
+ export const ACTIONABLE_GENOMIC_DATABASE: GenomicAlteration[] = [
80
+ // EGFR Mutations
81
+ {
82
+ gene: 'EGFR',
83
+ alteration: 'Exon 19 deletion',
84
+ alterationType: 'In-frame Deletion',
85
+ frequency: '45% of EGFR mutations',
86
+ cancerTypes: ['NSCLC Adenocarcinoma'],
87
+ actionability: {
88
+ level: 'Level 1',
89
+ description: 'FDA-approved therapy exists',
90
+ source: 'OncoKB, NCCN'
91
+ },
92
+ therapies: [
93
+ {
94
+ drug: 'Osimertinib',
95
+ class: 'Third-generation EGFR TKI',
96
+ approvalStatus: 'FDA-Approved',
97
+ indication: 'First-line metastatic NSCLC',
98
+ responseRate: '80%',
99
+ medianPFS: '18.9 months',
100
+ keyTrial: 'FLAURA'
101
+ },
102
+ {
103
+ drug: 'Erlotinib',
104
+ class: 'First-generation EGFR TKI',
105
+ approvalStatus: 'FDA-Approved',
106
+ indication: 'First-line (less preferred)',
107
+ responseRate: '65%',
108
+ medianPFS: '10.4 months',
109
+ keyTrial: 'EURTAC'
110
+ }
111
+ ],
112
+ clinicalTrials: ['Amivantamab combinations', 'EGFR-MET bispecifics'],
113
+ resistance: [
114
+ { mutation: 'T790M', frequency: '50-60%', overcomingStrategy: ['Osimertinib'] },
115
+ { mutation: 'C797S', frequency: '10-25%', overcomingStrategy: ['Amivantamab', 'BLU-945 (investigational)'] },
116
+ { mutation: 'MET amplification', frequency: '5-20%', overcomingStrategy: ['EGFR TKI + MET inhibitor'] }
117
+ ],
118
+ prognosticValue: { impact: 'Favorable', description: 'Better outcomes with TKI therapy' }
119
+ },
120
+ {
121
+ gene: 'EGFR',
122
+ alteration: 'L858R',
123
+ alterationType: 'Missense Mutation',
124
+ frequency: '40% of EGFR mutations',
125
+ cancerTypes: ['NSCLC Adenocarcinoma'],
126
+ actionability: {
127
+ level: 'Level 1',
128
+ description: 'FDA-approved therapy exists',
129
+ source: 'OncoKB, NCCN'
130
+ },
131
+ therapies: [
132
+ {
133
+ drug: 'Osimertinib',
134
+ class: 'Third-generation EGFR TKI',
135
+ approvalStatus: 'FDA-Approved',
136
+ indication: 'First-line metastatic NSCLC',
137
+ responseRate: '77%',
138
+ medianPFS: '18.9 months',
139
+ keyTrial: 'FLAURA'
140
+ }
141
+ ],
142
+ clinicalTrials: ['Same as exon 19 del'],
143
+ resistance: [
144
+ { mutation: 'T790M', frequency: '50-60%', overcomingStrategy: ['Osimertinib'] },
145
+ { mutation: 'C797S', frequency: '10-25%', overcomingStrategy: ['Amivantamab'] }
146
+ ],
147
+ prognosticValue: { impact: 'Favorable', description: 'Response to EGFR TKI, slightly less favorable than exon 19 del' }
148
+ },
149
+ {
150
+ gene: 'EGFR',
151
+ alteration: 'Exon 20 insertion',
152
+ alterationType: 'In-frame Insertion',
153
+ frequency: '10% of EGFR mutations',
154
+ cancerTypes: ['NSCLC Adenocarcinoma'],
155
+ actionability: {
156
+ level: 'Level 1',
157
+ description: 'FDA-approved therapy exists',
158
+ source: 'OncoKB'
159
+ },
160
+ therapies: [
161
+ {
162
+ drug: 'Amivantamab',
163
+ class: 'EGFR-MET bispecific antibody',
164
+ approvalStatus: 'FDA-Approved',
165
+ indication: 'After platinum-based chemo',
166
+ responseRate: '40%',
167
+ medianPFS: '8.3 months',
168
+ keyTrial: 'CHRYSALIS'
169
+ },
170
+ {
171
+ drug: 'Mobocertinib',
172
+ class: 'EGFR exon 20-specific TKI',
173
+ approvalStatus: 'FDA-Approved',
174
+ indication: 'After platinum-based chemo',
175
+ responseRate: '28%',
176
+ medianPFS: '7.3 months',
177
+ keyTrial: 'EXCLAIM'
178
+ }
179
+ ],
180
+ clinicalTrials: ['First-line amivantamab + lazertinib'],
181
+ resistance: [],
182
+ prognosticValue: { impact: 'Unfavorable', description: 'Resistant to standard EGFR TKIs, less favorable outcomes' }
183
+ },
184
+ // ALK Fusions
185
+ {
186
+ gene: 'ALK',
187
+ alteration: 'EML4-ALK fusion',
188
+ alterationType: 'Fusion',
189
+ frequency: '3-5% of NSCLC',
190
+ cancerTypes: ['NSCLC Adenocarcinoma'],
191
+ actionability: {
192
+ level: 'Level 1',
193
+ description: 'FDA-approved therapy exists',
194
+ source: 'OncoKB, NCCN'
195
+ },
196
+ therapies: [
197
+ {
198
+ drug: 'Lorlatinib',
199
+ class: 'Third-generation ALK TKI',
200
+ approvalStatus: 'FDA-Approved',
201
+ indication: 'First-line',
202
+ responseRate: '76%',
203
+ medianPFS: 'NR (60% at 3 years)',
204
+ keyTrial: 'CROWN'
205
+ },
206
+ {
207
+ drug: 'Alectinib',
208
+ class: 'Second-generation ALK TKI',
209
+ approvalStatus: 'FDA-Approved',
210
+ indication: 'First-line',
211
+ responseRate: '83%',
212
+ medianPFS: '34.8 months',
213
+ keyTrial: 'ALEX'
214
+ },
215
+ {
216
+ drug: 'Brigatinib',
217
+ class: 'Second-generation ALK TKI',
218
+ approvalStatus: 'FDA-Approved',
219
+ indication: 'First-line',
220
+ responseRate: '74%',
221
+ medianPFS: '24 months',
222
+ keyTrial: 'ALTA-1L'
223
+ }
224
+ ],
225
+ clinicalTrials: ['Next-gen ALK inhibitors'],
226
+ resistance: [
227
+ { mutation: 'G1202R', frequency: '20-30%', overcomingStrategy: ['Lorlatinib'] },
228
+ { mutation: 'L1196M', frequency: '10%', overcomingStrategy: ['Lorlatinib', 'Brigatinib'] },
229
+ { mutation: 'Compound mutations', frequency: '10-15%', overcomingStrategy: ['Lorlatinib (partial)', 'Clinical trial'] }
230
+ ],
231
+ prognosticValue: { impact: 'Favorable', description: 'Excellent response to ALK TKIs, long-term survival possible' }
232
+ },
233
+ // KRAS G12C
234
+ {
235
+ gene: 'KRAS',
236
+ alteration: 'G12C',
237
+ alterationType: 'Missense Mutation',
238
+ frequency: '13% of NSCLC, 3% of CRC',
239
+ cancerTypes: ['NSCLC Adenocarcinoma', 'Colorectal Cancer'],
240
+ actionability: {
241
+ level: 'Level 1',
242
+ description: 'FDA-approved therapy exists',
243
+ source: 'OncoKB'
244
+ },
245
+ therapies: [
246
+ {
247
+ drug: 'Sotorasib',
248
+ class: 'KRAS G12C inhibitor',
249
+ approvalStatus: 'FDA-Approved',
250
+ indication: 'NSCLC after prior therapy',
251
+ responseRate: '37%',
252
+ medianPFS: '6.8 months',
253
+ keyTrial: 'CodeBreaK 100'
254
+ },
255
+ {
256
+ drug: 'Adagrasib',
257
+ class: 'KRAS G12C inhibitor',
258
+ approvalStatus: 'FDA-Approved',
259
+ indication: 'NSCLC after prior therapy',
260
+ responseRate: '43%',
261
+ medianPFS: '6.5 months',
262
+ keyTrial: 'KRYSTAL-1'
263
+ }
264
+ ],
265
+ clinicalTrials: ['Combinations with SHP2 inhibitors', 'First-line combinations'],
266
+ resistance: [
267
+ { mutation: 'Multiple mechanisms', frequency: '50%+ at progression', overcomingStrategy: ['Combination strategies', 'SHP2 inhibitors'] }
268
+ ],
269
+ prognosticValue: { impact: 'Unfavorable', description: 'Historically poor prognosis, now improving with targeted therapy' }
270
+ },
271
+ // BRAF V600E
272
+ {
273
+ gene: 'BRAF',
274
+ alteration: 'V600E',
275
+ alterationType: 'Missense Mutation',
276
+ frequency: '50% melanoma, 8% CRC, 2% NSCLC',
277
+ cancerTypes: ['Melanoma', 'Colorectal Cancer', 'NSCLC', 'Thyroid Cancer'],
278
+ actionability: {
279
+ level: 'Level 1',
280
+ description: 'FDA-approved therapy exists',
281
+ source: 'OncoKB'
282
+ },
283
+ therapies: [
284
+ {
285
+ drug: 'Dabrafenib + Trametinib',
286
+ class: 'BRAF + MEK inhibitor',
287
+ approvalStatus: 'FDA-Approved',
288
+ indication: 'Melanoma, NSCLC, Anaplastic thyroid',
289
+ responseRate: '64-68%',
290
+ medianPFS: '11-14 months',
291
+ keyTrial: 'COMBI-d/v, BRF113928'
292
+ },
293
+ {
294
+ drug: 'Encorafenib + Binimetinib',
295
+ class: 'BRAF + MEK inhibitor',
296
+ approvalStatus: 'FDA-Approved',
297
+ indication: 'Melanoma',
298
+ responseRate: '63%',
299
+ medianPFS: '14.9 months',
300
+ keyTrial: 'COLUMBUS'
301
+ },
302
+ {
303
+ drug: 'Encorafenib + Cetuximab',
304
+ class: 'BRAF + EGFR inhibitor',
305
+ approvalStatus: 'FDA-Approved',
306
+ indication: 'CRC after prior therapy',
307
+ responseRate: '20%',
308
+ medianPFS: '4.3 months',
309
+ keyTrial: 'BEACON'
310
+ }
311
+ ],
312
+ clinicalTrials: ['Triplet combinations', 'Immunotherapy combinations'],
313
+ resistance: [
314
+ { mutation: 'MAPK reactivation', frequency: 'Common', overcomingStrategy: ['Add MEK inhibitor', 'Immunotherapy switch'] }
315
+ ],
316
+ prognosticValue: { impact: 'Unfavorable', description: 'Poor prognosis especially in CRC; targetable' }
317
+ },
318
+ // HER2 Amplification/Mutation
319
+ {
320
+ gene: 'HER2/ERBB2',
321
+ alteration: 'Amplification',
322
+ alterationType: 'Amplification',
323
+ frequency: '15-20% breast, 10-15% gastric',
324
+ cancerTypes: ['Breast Cancer', 'Gastric Cancer', 'Esophageal Cancer'],
325
+ actionability: {
326
+ level: 'Level 1',
327
+ description: 'FDA-approved therapy exists',
328
+ source: 'OncoKB'
329
+ },
330
+ therapies: [
331
+ {
332
+ drug: 'Trastuzumab + Pertuzumab',
333
+ class: 'Anti-HER2 antibodies',
334
+ approvalStatus: 'FDA-Approved',
335
+ indication: 'HER2+ breast (first-line)',
336
+ responseRate: '80%',
337
+ medianPFS: '18.7 months',
338
+ keyTrial: 'CLEOPATRA'
339
+ },
340
+ {
341
+ drug: 'Trastuzumab Deruxtecan (T-DXd)',
342
+ class: 'HER2-directed ADC',
343
+ approvalStatus: 'FDA-Approved',
344
+ indication: 'HER2+ breast (second-line), HER2-low, gastric',
345
+ responseRate: '52-79%',
346
+ medianPFS: '10-29 months',
347
+ keyTrial: 'DESTINY-Breast01/03/04'
348
+ }
349
+ ],
350
+ clinicalTrials: ['T-DXd combinations', 'Novel ADCs'],
351
+ resistance: [
352
+ { mutation: 'Bypass pathways', frequency: 'Variable', overcomingStrategy: ['ADC therapy', 'TKI combinations'] }
353
+ ],
354
+ prognosticValue: { impact: 'Context-Dependent', description: 'Historically poor prognosis, now favorable with anti-HER2 therapy' }
355
+ },
356
+ // PIK3CA Mutations
357
+ {
358
+ gene: 'PIK3CA',
359
+ alteration: 'H1047R/E545K/E542K',
360
+ alterationType: 'Missense Mutation',
361
+ frequency: '40% HR+ breast cancer',
362
+ cancerTypes: ['Breast Cancer'],
363
+ actionability: {
364
+ level: 'Level 1',
365
+ description: 'FDA-approved therapy exists',
366
+ source: 'OncoKB'
367
+ },
368
+ therapies: [
369
+ {
370
+ drug: 'Alpelisib',
371
+ class: 'PI3K alpha inhibitor',
372
+ approvalStatus: 'FDA-Approved',
373
+ indication: 'HR+/HER2- with PIK3CA mutation after prior ET',
374
+ responseRate: '26%',
375
+ medianPFS: '11 months',
376
+ keyTrial: 'SOLAR-1'
377
+ }
378
+ ],
379
+ clinicalTrials: ['Next-gen PI3K inhibitors'],
380
+ resistance: [],
381
+ prognosticValue: { impact: 'Neutral', description: 'Predictive of response to PI3K inhibitor' }
382
+ },
383
+ // ROS1 Fusion
384
+ {
385
+ gene: 'ROS1',
386
+ alteration: 'Various fusions',
387
+ alterationType: 'Fusion',
388
+ frequency: '1-2% of NSCLC',
389
+ cancerTypes: ['NSCLC Adenocarcinoma'],
390
+ actionability: {
391
+ level: 'Level 1',
392
+ description: 'FDA-approved therapy exists',
393
+ source: 'OncoKB'
394
+ },
395
+ therapies: [
396
+ {
397
+ drug: 'Entrectinib',
398
+ class: 'ROS1/TRK inhibitor',
399
+ approvalStatus: 'FDA-Approved',
400
+ indication: 'First-line ROS1+ NSCLC',
401
+ responseRate: '77%',
402
+ medianPFS: '19 months',
403
+ keyTrial: 'STARTRK-2, ALKA-372-001'
404
+ },
405
+ {
406
+ drug: 'Crizotinib',
407
+ class: 'ROS1/ALK/MET inhibitor',
408
+ approvalStatus: 'FDA-Approved',
409
+ indication: 'First-line ROS1+ NSCLC',
410
+ responseRate: '72%',
411
+ medianPFS: '19.3 months',
412
+ keyTrial: 'PROFILE 1001'
413
+ }
414
+ ],
415
+ clinicalTrials: ['Repotrectinib', 'Next-gen ROS1 TKIs'],
416
+ resistance: [
417
+ { mutation: 'G2032R', frequency: '30-40%', overcomingStrategy: ['Repotrectinib (investigational)', 'Lorlatinib'] }
418
+ ],
419
+ prognosticValue: { impact: 'Favorable', description: 'Excellent response to ROS1 inhibitors' }
420
+ },
421
+ // NTRK Fusions (Tissue-agnostic)
422
+ {
423
+ gene: 'NTRK1/2/3',
424
+ alteration: 'Various fusions',
425
+ alterationType: 'Fusion',
426
+ frequency: '<1% of common cancers, higher in rare cancers',
427
+ cancerTypes: ['Tissue-agnostic', 'Infantile Fibrosarcoma', 'Secretory Breast', 'Thyroid'],
428
+ actionability: {
429
+ level: 'Level 1',
430
+ description: 'FDA tissue-agnostic approval',
431
+ source: 'OncoKB'
432
+ },
433
+ therapies: [
434
+ {
435
+ drug: 'Larotrectinib',
436
+ class: 'TRK inhibitor',
437
+ approvalStatus: 'FDA-Approved',
438
+ indication: 'NTRK fusion-positive solid tumors',
439
+ responseRate: '75%',
440
+ medianPFS: '28.3 months',
441
+ keyTrial: 'NAVIGATE, SCOUT, LOXO-TRK-14001'
442
+ },
443
+ {
444
+ drug: 'Entrectinib',
445
+ class: 'TRK/ROS1 inhibitor',
446
+ approvalStatus: 'FDA-Approved',
447
+ indication: 'NTRK fusion-positive solid tumors',
448
+ responseRate: '57%',
449
+ medianPFS: '11.2 months',
450
+ keyTrial: 'STARTRK-1/2, ALKA-372-001'
451
+ }
452
+ ],
453
+ clinicalTrials: ['Next-gen TRK inhibitors for resistance'],
454
+ resistance: [
455
+ { mutation: 'Solvent front mutations', frequency: '10-20%', overcomingStrategy: ['Selitrectinib', 'Repotrectinib'] }
456
+ ],
457
+ prognosticValue: { impact: 'Favorable', description: 'Excellent durable responses across tumor types' }
458
+ },
459
+ // RET Alterations
460
+ {
461
+ gene: 'RET',
462
+ alteration: 'Fusion or Mutation',
463
+ alterationType: 'Fusion',
464
+ frequency: '1-2% NSCLC, 10-20% thyroid',
465
+ cancerTypes: ['NSCLC', 'Thyroid Cancer (MTC, PTC)'],
466
+ actionability: {
467
+ level: 'Level 1',
468
+ description: 'FDA-approved therapy exists',
469
+ source: 'OncoKB'
470
+ },
471
+ therapies: [
472
+ {
473
+ drug: 'Selpercatinib',
474
+ class: 'Selective RET inhibitor',
475
+ approvalStatus: 'FDA-Approved',
476
+ indication: 'RET-altered NSCLC and thyroid',
477
+ responseRate: '64-85%',
478
+ medianPFS: '16.5-24.9 months',
479
+ keyTrial: 'LIBRETTO-001'
480
+ },
481
+ {
482
+ drug: 'Pralsetinib',
483
+ class: 'Selective RET inhibitor',
484
+ approvalStatus: 'FDA-Approved',
485
+ indication: 'RET-altered NSCLC and thyroid',
486
+ responseRate: '57-72%',
487
+ medianPFS: '13-17 months',
488
+ keyTrial: 'ARROW'
489
+ }
490
+ ],
491
+ clinicalTrials: ['Resistance mutation-targeting agents'],
492
+ resistance: [
493
+ { mutation: 'G810X solvent front', frequency: '10-20%', overcomingStrategy: ['Investigational agents'] }
494
+ ],
495
+ prognosticValue: { impact: 'Favorable', description: 'Excellent response to selective RET inhibitors' }
496
+ },
497
+ // MSI-H/dMMR (Tissue-agnostic)
498
+ {
499
+ gene: 'MSI-H/dMMR',
500
+ alteration: 'Microsatellite Instability High',
501
+ alterationType: 'Frameshift',
502
+ frequency: '15% CRC, 20-30% endometrial, variable others',
503
+ cancerTypes: ['Tissue-agnostic'],
504
+ actionability: {
505
+ level: 'Level 1',
506
+ description: 'FDA tissue-agnostic approval',
507
+ source: 'OncoKB'
508
+ },
509
+ therapies: [
510
+ {
511
+ drug: 'Pembrolizumab',
512
+ class: 'Anti-PD-1',
513
+ approvalStatus: 'FDA-Approved',
514
+ indication: 'MSI-H/dMMR solid tumors',
515
+ responseRate: '39-45%',
516
+ medianPFS: '16.5 months (CRC)',
517
+ keyTrial: 'KEYNOTE-158, KEYNOTE-177'
518
+ },
519
+ {
520
+ drug: 'Dostarlimab',
521
+ class: 'Anti-PD-1',
522
+ approvalStatus: 'FDA-Approved',
523
+ indication: 'dMMR solid tumors',
524
+ responseRate: '42%',
525
+ medianPFS: 'Not reached',
526
+ keyTrial: 'GARNET'
527
+ }
528
+ ],
529
+ clinicalTrials: ['Neoadjuvant immunotherapy'],
530
+ resistance: [
531
+ { mutation: 'Beta-2-microglobulin loss', frequency: '5-10%', overcomingStrategy: ['Combination immunotherapy'] }
532
+ ],
533
+ prognosticValue: { impact: 'Favorable', description: 'Excellent response to immunotherapy' }
534
+ },
535
+ // TMB-High
536
+ {
537
+ gene: 'TMB-High',
538
+ alteration: 'Tumor Mutational Burden ≥10 mut/Mb',
539
+ alterationType: 'Missense Mutation',
540
+ frequency: 'Variable by cancer type',
541
+ cancerTypes: ['Tissue-agnostic'],
542
+ actionability: {
543
+ level: 'Level 1',
544
+ description: 'FDA tissue-agnostic approval',
545
+ source: 'OncoKB'
546
+ },
547
+ therapies: [
548
+ {
549
+ drug: 'Pembrolizumab',
550
+ class: 'Anti-PD-1',
551
+ approvalStatus: 'FDA-Approved',
552
+ indication: 'TMB-H (≥10 mut/Mb) solid tumors',
553
+ responseRate: '29%',
554
+ medianPFS: 'Variable',
555
+ keyTrial: 'KEYNOTE-158'
556
+ }
557
+ ],
558
+ clinicalTrials: ['Combination strategies'],
559
+ resistance: [],
560
+ prognosticValue: { impact: 'Context-Dependent', description: 'Predictive of immunotherapy response' }
561
+ }
562
+ ];
563
+
564
+ // ═══════════════════════════════════════════════════════════════════════════════
565
+ // PHARMACOGENOMICS FOR ONCOLOGY
566
+ // ═══════════════════════════════════════════════════════════════════════════════
567
+
568
+ export interface PharmacogenomicMarker {
569
+ gene: string;
570
+ variant: string;
571
+ affectedDrugs: DrugPGx[];
572
+ testingRecommendation: 'Required' | 'Strongly Recommended' | 'Consider' | 'Optional';
573
+ guidelineSource: string;
574
+ }
575
+
576
+ export interface DrugPGx {
577
+ drug: string;
578
+ effect: string;
579
+ recommendation: string;
580
+ doseAdjustment?: string;
581
+ }
582
+
583
+ export const PHARMACOGENOMIC_MARKERS: PharmacogenomicMarker[] = [
584
+ {
585
+ gene: 'DPYD',
586
+ variant: 'DPYD*2A, *13, c.2846A>T, HapB3',
587
+ affectedDrugs: [
588
+ {
589
+ drug: '5-Fluorouracil (5-FU)',
590
+ effect: 'Reduced DPD enzyme activity, increased toxicity risk',
591
+ recommendation: 'Test before initiating fluoropyrimidines',
592
+ doseAdjustment: '*2A/*2A: Avoid; Heterozygous: 50% dose reduction'
593
+ },
594
+ {
595
+ drug: 'Capecitabine',
596
+ effect: 'Same as 5-FU',
597
+ recommendation: 'Same as 5-FU',
598
+ doseAdjustment: 'Same as 5-FU'
599
+ }
600
+ ],
601
+ testingRecommendation: 'Strongly Recommended',
602
+ guidelineSource: 'CPIC, EMA'
603
+ },
604
+ {
605
+ gene: 'UGT1A1',
606
+ variant: 'UGT1A1*28, *6',
607
+ affectedDrugs: [
608
+ {
609
+ drug: 'Irinotecan',
610
+ effect: 'Reduced glucuronidation, increased SN-38 toxicity',
611
+ recommendation: 'Consider testing for high-dose irinotecan',
612
+ doseAdjustment: '*28/*28: Reduce dose 30%; *28/*6 or *6/*6: Reduce dose'
613
+ },
614
+ {
615
+ drug: 'Sacituzumab govitecan',
616
+ effect: 'Contains SN-38, similar toxicity risk',
617
+ recommendation: 'Consider testing',
618
+ doseAdjustment: '*28/*28: Monitor closely, consider dose reduction'
619
+ }
620
+ ],
621
+ testingRecommendation: 'Consider',
622
+ guidelineSource: 'CPIC, FDA label'
623
+ },
624
+ {
625
+ gene: 'TPMT/NUDT15',
626
+ variant: 'TPMT*2, *3A, *3B, *3C; NUDT15*3',
627
+ affectedDrugs: [
628
+ {
629
+ drug: '6-Mercaptopurine',
630
+ effect: 'Reduced thiopurine metabolism, severe myelosuppression',
631
+ recommendation: 'Test before initiating thiopurines',
632
+ doseAdjustment: 'Poor metabolizer: 10% of normal dose'
633
+ },
634
+ {
635
+ drug: 'Azathioprine',
636
+ effect: 'Same as 6-MP',
637
+ recommendation: 'Same',
638
+ doseAdjustment: 'Same'
639
+ }
640
+ ],
641
+ testingRecommendation: 'Required',
642
+ guidelineSource: 'CPIC, FDA label'
643
+ },
644
+ {
645
+ gene: 'G6PD',
646
+ variant: 'G6PD deficiency',
647
+ affectedDrugs: [
648
+ {
649
+ drug: 'Rasburicase',
650
+ effect: 'Hemolytic anemia, methemoglobinemia',
651
+ recommendation: 'Screen before use',
652
+ doseAdjustment: 'Contraindicated in G6PD deficiency'
653
+ }
654
+ ],
655
+ testingRecommendation: 'Required',
656
+ guidelineSource: 'FDA label'
657
+ },
658
+ {
659
+ gene: 'CYP2D6',
660
+ variant: 'Poor metabolizer',
661
+ affectedDrugs: [
662
+ {
663
+ drug: 'Tamoxifen',
664
+ effect: 'Reduced conversion to active metabolite endoxifen',
665
+ recommendation: 'Consider testing, especially if concurrent CYP2D6 inhibitors',
666
+ doseAdjustment: 'PM: Consider alternative (aromatase inhibitor if postmenopausal)'
667
+ }
668
+ ],
669
+ testingRecommendation: 'Consider',
670
+ guidelineSource: 'CPIC'
671
+ },
672
+ {
673
+ gene: 'HLA-B*57:01',
674
+ variant: 'Presence of allele',
675
+ affectedDrugs: [
676
+ {
677
+ drug: 'Abacavir',
678
+ effect: 'Hypersensitivity reaction',
679
+ recommendation: 'Test before initiating',
680
+ doseAdjustment: 'Do not use if positive'
681
+ }
682
+ ],
683
+ testingRecommendation: 'Required',
684
+ guidelineSource: 'FDA label, CPIC'
685
+ }
686
+ ];
687
+
688
+ // ═══════════════════════════════════════════════════════════════════════════════
689
+ // TUMOR MICROENVIRONMENT ANALYSIS
690
+ // ═══════════════════════════════════════════════════════════════════════════════
691
+
692
+ export interface TumorMicroenvironment {
693
+ immuneInfiltration: ImmuneInfiltration;
694
+ stromalPhenotype: StromalPhenotype;
695
+ vascularization: VascularStatus;
696
+ immunePhenotype: 'Inflamed' | 'Excluded' | 'Desert';
697
+ therapeuticImplications: TherapeuticImplication[];
698
+ }
699
+
700
+ export interface ImmuneInfiltration {
701
+ cd8TILs: 'High' | 'Intermediate' | 'Low' | 'Absent';
702
+ cd4TILs: 'High' | 'Intermediate' | 'Low';
703
+ tregs: 'High' | 'Low';
704
+ myeloidCells: MDSCStatus;
705
+ nkCells: 'Present' | 'Absent';
706
+ bCells: 'Present' | 'Absent' | 'TLS Present';
707
+ }
708
+
709
+ export interface MDSCStatus {
710
+ mdscLevel: 'High' | 'Low';
711
+ m1m2Ratio: 'M1-predominant' | 'M2-predominant' | 'Mixed';
712
+ }
713
+
714
+ export interface StromalPhenotype {
715
+ cafPresence: 'High' | 'Low';
716
+ ecmDensity: 'Dense' | 'Moderate' | 'Loose';
717
+ fibrosis: boolean;
718
+ }
719
+
720
+ export interface VascularStatus {
721
+ vascularDensity: 'High' | 'Moderate' | 'Low';
722
+ vascularNormalization: boolean;
723
+ hypoxia: boolean;
724
+ }
725
+
726
+ export interface TherapeuticImplication {
727
+ finding: string;
728
+ implication: string;
729
+ recommendation: string;
730
+ }
731
+
732
+ export const TME_THERAPEUTIC_IMPLICATIONS: Record<string, TherapeuticImplication[]> = {
733
+ 'Inflamed': [
734
+ {
735
+ finding: 'High CD8+ TIL infiltration with PD-L1 expression',
736
+ implication: 'Likely responsive to PD-1/PD-L1 blockade',
737
+ recommendation: 'First-line immunotherapy appropriate'
738
+ },
739
+ {
740
+ finding: 'Tertiary lymphoid structures (TLS) present',
741
+ implication: 'Associated with improved immunotherapy response',
742
+ recommendation: 'Immunotherapy highly recommended'
743
+ }
744
+ ],
745
+ 'Excluded': [
746
+ {
747
+ finding: 'T cells present at tumor margin but not infiltrating',
748
+ implication: 'Physical or immunological barrier to T cell entry',
749
+ recommendation: 'Consider anti-TGF-beta, CAF-targeting, or combination approaches'
750
+ },
751
+ {
752
+ finding: 'Dense fibrotic stroma',
753
+ implication: 'Stromal barrier limiting drug penetration',
754
+ recommendation: 'Consider stromal-targeting agents or chemotherapy to disrupt'
755
+ }
756
+ ],
757
+ 'Desert': [
758
+ {
759
+ finding: 'Absence of immune infiltrate',
760
+ implication: 'Poor immunogenicity or immune evasion',
761
+ recommendation: 'Consider chemotherapy to induce immunogenic cell death, oncolytic viruses, or vaccines'
762
+ },
763
+ {
764
+ finding: 'Low TMB, no neoantigens',
765
+ implication: 'Limited targets for immune recognition',
766
+ recommendation: 'Chemotherapy or targeted therapy may be more appropriate than immunotherapy'
767
+ }
768
+ ]
769
+ };
770
+
771
+ // ═══════════════════════════════════════════════════════════════════════════════
772
+ // LIQUID BIOPSY / ctDNA INTERPRETATION
773
+ // ═══════════════════════════════════════════════════════════════════════════════
774
+
775
+ export interface LiquidBiopsyResult {
776
+ sampleDate: string;
777
+ ctdnaFraction: number;
778
+ alterationsDetected: CtDNAAlteration[];
779
+ clinicalInterpretation: CtDNAInterpretation;
780
+ }
781
+
782
+ export interface CtDNAAlteration {
783
+ gene: string;
784
+ alteration: string;
785
+ vaf: number; // Variant allele frequency
786
+ clinicalSignificance: 'Actionable' | 'Resistance' | 'Prognostic' | 'VUS' | 'Benign';
787
+ }
788
+
789
+ export interface CtDNAInterpretation {
790
+ summary: string;
791
+ actionableFindings: string[];
792
+ resistanceMutations: string[];
793
+ monitoringRecommendation: string;
794
+ tissueConfirmationNeeded: boolean;
795
+ }
796
+
797
+ export function interpretCtDNA(result: LiquidBiopsyResult): CtDNAInterpretation {
798
+ const actionableFindings: string[] = [];
799
+ const resistanceMutations: string[] = [];
800
+
801
+ for (const alt of result.alterationsDetected) {
802
+ if (alt.clinicalSignificance === 'Actionable') {
803
+ actionableFindings.push(`${alt.gene} ${alt.alteration} (VAF: ${alt.vaf}%)`);
804
+ }
805
+ if (alt.clinicalSignificance === 'Resistance') {
806
+ resistanceMutations.push(`${alt.gene} ${alt.alteration}`);
807
+ }
808
+ }
809
+
810
+ let summary = '';
811
+ if (result.ctdnaFraction < 0.5) {
812
+ summary = 'Low ctDNA fraction - may indicate low tumor burden or shedding; consider repeat testing or tissue biopsy';
813
+ } else if (result.ctdnaFraction > 10) {
814
+ summary = 'High ctDNA fraction - indicates significant tumor burden';
815
+ } else {
816
+ summary = 'Detectable ctDNA with interpretable results';
817
+ }
818
+
819
+ const tissueConfirmationNeeded = result.ctdnaFraction < 1 && actionableFindings.length > 0;
820
+
821
+ let monitoringRecommendation = 'Repeat ctDNA in 8-12 weeks or at clinical/radiographic progression';
822
+ if (resistanceMutations.length > 0) {
823
+ monitoringRecommendation = 'Resistance mutations detected - consider treatment change; repeat ctDNA after new therapy started';
824
+ }
825
+
826
+ return {
827
+ summary,
828
+ actionableFindings,
829
+ resistanceMutations,
830
+ monitoringRecommendation,
831
+ tissueConfirmationNeeded
832
+ };
833
+ }
834
+
835
+ // ═══════════════════════════════════════════════════════════════════════════════
836
+ // PRECISION MEDICINE ENGINE
837
+ // ═══════════════════════════════════════════════════════════════════════════════
838
+
839
+ export class PrecisionMedicineEngine {
840
+ getActionableAlterations(gene: string): GenomicAlteration[] {
841
+ return ACTIONABLE_GENOMIC_DATABASE.filter(a =>
842
+ a.gene.toLowerCase() === gene.toLowerCase()
843
+ );
844
+ }
845
+
846
+ getAlterationByType(alteration: string): GenomicAlteration | undefined {
847
+ return ACTIONABLE_GENOMIC_DATABASE.find(a =>
848
+ a.alteration.toLowerCase().includes(alteration.toLowerCase()) ||
849
+ alteration.toLowerCase().includes(a.alteration.toLowerCase())
850
+ );
851
+ }
852
+
853
+ getTherapiesForAlteration(gene: string, alteration: string): TargetedTherapy[] {
854
+ const genomicAlt = ACTIONABLE_GENOMIC_DATABASE.find(a =>
855
+ a.gene.toLowerCase() === gene.toLowerCase() &&
856
+ a.alteration.toLowerCase().includes(alteration.toLowerCase())
857
+ );
858
+ return genomicAlt?.therapies || [];
859
+ }
860
+
861
+ getPharmacogenomicRecommendation(drug: string): PharmacogenomicMarker | undefined {
862
+ return PHARMACOGENOMIC_MARKERS.find(p =>
863
+ p.affectedDrugs.some(d => d.drug.toLowerCase().includes(drug.toLowerCase()))
864
+ );
865
+ }
866
+
867
+ assessActionability(alterations: { gene: string; alteration: string }[]): {
868
+ level1: GenomicAlteration[];
869
+ level2: GenomicAlteration[];
870
+ level3: GenomicAlteration[];
871
+ notActionable: string[];
872
+ } {
873
+ const result = {
874
+ level1: [] as GenomicAlteration[],
875
+ level2: [] as GenomicAlteration[],
876
+ level3: [] as GenomicAlteration[],
877
+ notActionable: [] as string[]
878
+ };
879
+
880
+ for (const alt of alterations) {
881
+ const match = ACTIONABLE_GENOMIC_DATABASE.find(a =>
882
+ a.gene.toLowerCase() === alt.gene.toLowerCase()
883
+ );
884
+
885
+ if (match) {
886
+ if (match.actionability.level === 'Level 1') {
887
+ result.level1.push(match);
888
+ } else if (match.actionability.level === 'Level 2') {
889
+ result.level2.push(match);
890
+ } else if (match.actionability.level.includes('3')) {
891
+ result.level3.push(match);
892
+ }
893
+ } else {
894
+ result.notActionable.push(`${alt.gene} ${alt.alteration}`);
895
+ }
896
+ }
897
+
898
+ return result;
899
+ }
900
+
901
+ getTMEImplications(phenotype: TumorMicroenvironment['immunePhenotype']): TherapeuticImplication[] {
902
+ return TME_THERAPEUTIC_IMPLICATIONS[phenotype] || [];
903
+ }
904
+
905
+ interpretLiquidBiopsy(result: LiquidBiopsyResult): CtDNAInterpretation {
906
+ return interpretCtDNA(result);
907
+ }
908
+
909
+ generatePrecisionReport(
910
+ patientId: string,
911
+ genomicProfile: { gene: string; alteration: string; type: string }[],
912
+ pharmacogenomics: string[],
913
+ tmeIfAvailable?: TumorMicroenvironment
914
+ ): {
915
+ actionableTargets: GenomicAlteration[];
916
+ pgxRecommendations: PharmacogenomicMarker[];
917
+ tmeImplications: TherapeuticImplication[];
918
+ clinicalTrialTargets: string[];
919
+ summary: string;
920
+ } {
921
+ const actionability = this.assessActionability(genomicProfile);
922
+
923
+ const pgxRecommendations: PharmacogenomicMarker[] = [];
924
+ for (const gene of pharmacogenomics) {
925
+ const pgx = PHARMACOGENOMIC_MARKERS.find(p => p.gene === gene);
926
+ if (pgx) pgxRecommendations.push(pgx);
927
+ }
928
+
929
+ const tmeImplications = tmeIfAvailable
930
+ ? this.getTMEImplications(tmeIfAvailable.immunePhenotype)
931
+ : [];
932
+
933
+ const clinicalTrialTargets = [
934
+ ...actionability.level1.flatMap(a => a.clinicalTrials),
935
+ ...actionability.level2.flatMap(a => a.clinicalTrials),
936
+ ...actionability.level3.flatMap(a => a.clinicalTrials)
937
+ ];
938
+
939
+ const summary = `Found ${actionability.level1.length} Level 1, ${actionability.level2.length} Level 2, and ${actionability.level3.length} Level 3 actionable alterations. ${pgxRecommendations.length} pharmacogenomic considerations identified.`;
940
+
941
+ return {
942
+ actionableTargets: [...actionability.level1, ...actionability.level2],
943
+ pgxRecommendations,
944
+ tmeImplications,
945
+ clinicalTrialTargets: [...new Set(clinicalTrialTargets)],
946
+ summary
947
+ };
948
+ }
949
+ }
950
+
951
+ // Export singleton
952
+ export const precisionMedicineEngine = new PrecisionMedicineEngine();