@erosolaraijs/cure 2.3.0 → 2.4.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 (68) hide show
  1. package/README.md +321 -26
  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/cureValidationFramework.d.ts +195 -0
  9. package/dist/capabilities/cureValidationFramework.d.ts.map +1 -0
  10. package/dist/capabilities/cureValidationFramework.js +577 -0
  11. package/dist/capabilities/cureValidationFramework.js.map +1 -0
  12. package/dist/capabilities/emergencyOncology.d.ts +97 -0
  13. package/dist/capabilities/emergencyOncology.d.ts.map +1 -0
  14. package/dist/capabilities/emergencyOncology.js +1824 -0
  15. package/dist/capabilities/emergencyOncology.js.map +1 -0
  16. package/dist/capabilities/index.d.ts +11 -0
  17. package/dist/capabilities/index.d.ts.map +1 -1
  18. package/dist/capabilities/index.js +22 -0
  19. package/dist/capabilities/index.js.map +1 -1
  20. package/dist/capabilities/multimodalOncologyModule.d.ts +149 -0
  21. package/dist/capabilities/multimodalOncologyModule.d.ts.map +1 -0
  22. package/dist/capabilities/multimodalOncologyModule.js +701 -0
  23. package/dist/capabilities/multimodalOncologyModule.js.map +1 -0
  24. package/dist/capabilities/palliativeCareModule.d.ts +216 -0
  25. package/dist/capabilities/palliativeCareModule.d.ts.map +1 -0
  26. package/dist/capabilities/palliativeCareModule.js +1160 -0
  27. package/dist/capabilities/palliativeCareModule.js.map +1 -0
  28. package/dist/capabilities/precisionMedicineModule.d.ts +151 -0
  29. package/dist/capabilities/precisionMedicineModule.d.ts.map +1 -0
  30. package/dist/capabilities/precisionMedicineModule.js +758 -0
  31. package/dist/capabilities/precisionMedicineModule.js.map +1 -0
  32. package/dist/capabilities/specialPopulationsModule.d.ts +126 -0
  33. package/dist/capabilities/specialPopulationsModule.d.ts.map +1 -0
  34. package/dist/capabilities/specialPopulationsModule.js +574 -0
  35. package/dist/capabilities/specialPopulationsModule.js.map +1 -0
  36. package/dist/capabilities/survivorshipManagement.d.ts +178 -0
  37. package/dist/capabilities/survivorshipManagement.d.ts.map +1 -0
  38. package/dist/capabilities/survivorshipManagement.js +983 -0
  39. package/dist/capabilities/survivorshipManagement.js.map +1 -0
  40. package/dist/capabilities/treatmentSequencing.d.ts +140 -0
  41. package/dist/capabilities/treatmentSequencing.d.ts.map +1 -0
  42. package/dist/capabilities/treatmentSequencing.js +1689 -0
  43. package/dist/capabilities/treatmentSequencing.js.map +1 -0
  44. package/dist/capabilities/universalHealthFramework.d.ts +108 -0
  45. package/dist/capabilities/universalHealthFramework.d.ts.map +1 -0
  46. package/dist/capabilities/universalHealthFramework.js +615 -0
  47. package/dist/capabilities/universalHealthFramework.js.map +1 -0
  48. package/dist/compliance/hipaa.d.ts.map +1 -1
  49. package/dist/compliance/hipaa.js +7 -16
  50. package/dist/compliance/hipaa.js.map +1 -1
  51. package/dist/tools/index.d.ts +31 -0
  52. package/dist/tools/index.d.ts.map +1 -0
  53. package/dist/tools/index.js +1373 -0
  54. package/dist/tools/index.js.map +1 -0
  55. package/package.json +3 -2
  56. package/src/bin/cure.ts +130 -1
  57. package/src/capabilities/clinicalTrialMatchingModule.ts +600 -0
  58. package/src/capabilities/emergencyOncology.ts +1945 -0
  59. package/src/capabilities/index.ts +181 -0
  60. package/src/capabilities/multimodalOncologyModule.ts +873 -0
  61. package/src/capabilities/palliativeCareModule.ts +1438 -0
  62. package/src/capabilities/precisionMedicineModule.ts +952 -0
  63. package/src/capabilities/specialPopulationsModule.ts +711 -0
  64. package/src/capabilities/survivorshipManagement.ts +1213 -0
  65. package/src/capabilities/treatmentSequencing.ts +1878 -0
  66. package/src/capabilities/universalHealthFramework.ts +739 -0
  67. package/src/compliance/hipaa.ts +7 -15
  68. package/src/tools/index.ts +1628 -0
@@ -0,0 +1,1438 @@
1
+ /**
2
+ * Comprehensive Palliative Care and Pain Management Module
3
+ *
4
+ * ╔═══════════════════════════════════════════════════════════════════════════════╗
5
+ * ║ PALLIATIVE CARE - COMFORT AND QUALITY OF LIFE FOR ALL PATIENTS ║
6
+ * ╠═══════════════════════════════════════════════════════════════════════════════╣
7
+ * ║ This module provides: ║
8
+ * ║ - Comprehensive pain management (nociceptive, neuropathic, visceral) ║
9
+ * ║ - Symptom cluster management by cancer type ║
10
+ * ║ - Refractory symptom escalation protocols ║
11
+ * ║ - End-of-life care and hospice transition ║
12
+ * ║ - Goals of care communication frameworks ║
13
+ * ║ - Advance care planning integration ║
14
+ * ╚═══════════════════════════════════════════════════════════════════════════════╝
15
+ */
16
+
17
+ // ═══════════════════════════════════════════════════════════════════════════════
18
+ // PAIN MANAGEMENT DEFINITIONS
19
+ // ═══════════════════════════════════════════════════════════════════════════════
20
+
21
+ export interface PainAssessment {
22
+ location: string[];
23
+ intensity: number; // 0-10 NRS
24
+ quality: PainQuality[];
25
+ temporalPattern: 'Constant' | 'Intermittent' | 'Breakthrough' | 'Incident';
26
+ aggravatingFactors: string[];
27
+ relievingFactors: string[];
28
+ functionalImpact: FunctionalImpact;
29
+ psychologicalImpact: string[];
30
+ painType: PainType[];
31
+ }
32
+
33
+ export type PainQuality =
34
+ | 'Sharp' | 'Dull' | 'Aching' | 'Burning' | 'Shooting' | 'Stabbing'
35
+ | 'Throbbing' | 'Cramping' | 'Pressure' | 'Tingling' | 'Numbness';
36
+
37
+ export type PainType =
38
+ | 'Nociceptive-Somatic' | 'Nociceptive-Visceral' | 'Neuropathic-Peripheral'
39
+ | 'Neuropathic-Central' | 'Mixed' | 'Bone' | 'Inflammatory';
40
+
41
+ export interface FunctionalImpact {
42
+ sleepDisturbance: 0 | 1 | 2 | 3; // None, Mild, Moderate, Severe
43
+ mobilityImpairment: 0 | 1 | 2 | 3;
44
+ selfCareImpairment: 0 | 1 | 2 | 3;
45
+ socialImpairment: 0 | 1 | 2 | 3;
46
+ overallQoL: number; // 0-10
47
+ }
48
+
49
+ export interface PainManagementProtocol {
50
+ painType: PainType;
51
+ severity: 'Mild' | 'Moderate' | 'Severe';
52
+ firstLine: PainIntervention[];
53
+ secondLine: PainIntervention[];
54
+ thirdLine: PainIntervention[];
55
+ adjuvants: AdjuvantTherapy[];
56
+ interventional: InterventionalProcedure[];
57
+ monitoring: PainMonitoring;
58
+ }
59
+
60
+ export interface PainIntervention {
61
+ medication: string;
62
+ class: string;
63
+ startingDose: string;
64
+ titrationSchedule: string;
65
+ maxDose: string;
66
+ routeOptions: string[];
67
+ precautions: string[];
68
+ contraindications: string[];
69
+ monitoringRequired: string[];
70
+ }
71
+
72
+ export interface AdjuvantTherapy {
73
+ medication: string;
74
+ indication: string;
75
+ dose: string;
76
+ mechanism: string;
77
+ evidence: string;
78
+ }
79
+
80
+ export interface InterventionalProcedure {
81
+ procedure: string;
82
+ indication: string;
83
+ technique: string;
84
+ expectedBenefit: string;
85
+ duration: string;
86
+ risks: string[];
87
+ contraindications: string[];
88
+ }
89
+
90
+ export interface PainMonitoring {
91
+ assessmentFrequency: string;
92
+ tools: string[];
93
+ escalationCriteria: string[];
94
+ deescalationCriteria: string[];
95
+ }
96
+
97
+ // ═══════════════════════════════════════════════════════════════════════════════
98
+ // WHO PAIN LADDER - ENHANCED
99
+ // ═══════════════════════════════════════════════════════════════════════════════
100
+
101
+ export const WHO_PAIN_LADDER: PainManagementProtocol[] = [
102
+ {
103
+ painType: 'Nociceptive-Somatic',
104
+ severity: 'Mild',
105
+ firstLine: [
106
+ {
107
+ medication: 'Acetaminophen',
108
+ class: 'Non-opioid analgesic',
109
+ startingDose: '650-1000mg PO q6h',
110
+ titrationSchedule: 'Fixed dosing',
111
+ maxDose: '3000mg/day (2000mg if hepatic impairment)',
112
+ routeOptions: ['PO', 'IV', 'PR'],
113
+ precautions: ['Hepatic impairment', 'Alcohol use'],
114
+ contraindications: ['Severe hepatic failure'],
115
+ monitoringRequired: ['LFTs if prolonged use']
116
+ },
117
+ {
118
+ medication: 'Ibuprofen',
119
+ class: 'NSAID',
120
+ startingDose: '400mg PO q6-8h',
121
+ titrationSchedule: 'Fixed dosing',
122
+ maxDose: '2400mg/day',
123
+ routeOptions: ['PO'],
124
+ precautions: ['GI bleeding risk', 'Renal impairment', 'Cardiovascular disease'],
125
+ contraindications: ['Active GI bleed', 'CKD stage 4-5', 'Aspirin-sensitive asthma'],
126
+ monitoringRequired: ['Creatinine', 'GI symptoms']
127
+ }
128
+ ],
129
+ secondLine: [
130
+ {
131
+ medication: 'Tramadol',
132
+ class: 'Weak opioid',
133
+ startingDose: '50mg PO q6h',
134
+ titrationSchedule: 'Increase by 50mg q3d as needed',
135
+ maxDose: '400mg/day',
136
+ routeOptions: ['PO'],
137
+ precautions: ['Seizure risk', 'Serotonin syndrome with SSRIs'],
138
+ contraindications: ['Seizure disorder', 'MAO inhibitor use'],
139
+ monitoringRequired: ['Pain relief', 'Side effects']
140
+ }
141
+ ],
142
+ thirdLine: [],
143
+ adjuvants: [],
144
+ interventional: [],
145
+ monitoring: {
146
+ assessmentFrequency: 'Weekly until stable',
147
+ tools: ['NRS', 'BPI-SF'],
148
+ escalationCriteria: ['NRS >3 despite max non-opioid', 'Functional impairment'],
149
+ deescalationCriteria: ['NRS ≤3 sustained', 'Improved function']
150
+ }
151
+ },
152
+ {
153
+ painType: 'Nociceptive-Somatic',
154
+ severity: 'Moderate',
155
+ firstLine: [
156
+ {
157
+ medication: 'Morphine IR',
158
+ class: 'Strong opioid',
159
+ startingDose: '5-10mg PO q4h (opioid-naive)',
160
+ titrationSchedule: 'Increase by 25-50% q24-48h',
161
+ maxDose: 'No ceiling (titrate to effect)',
162
+ routeOptions: ['PO', 'IV', 'SC', 'PR'],
163
+ precautions: ['Respiratory depression', 'Constipation', 'Sedation'],
164
+ contraindications: ['Severe respiratory depression', 'Paralytic ileus'],
165
+ monitoringRequired: ['Pain relief', 'RR', 'Sedation', 'Bowel function']
166
+ },
167
+ {
168
+ medication: 'Oxycodone IR',
169
+ class: 'Strong opioid',
170
+ startingDose: '5mg PO q4-6h (opioid-naive)',
171
+ titrationSchedule: 'Increase by 25-50% q24-48h',
172
+ maxDose: 'No ceiling',
173
+ routeOptions: ['PO'],
174
+ precautions: ['Same as morphine'],
175
+ contraindications: ['Same as morphine'],
176
+ monitoringRequired: ['Same as morphine']
177
+ }
178
+ ],
179
+ secondLine: [
180
+ {
181
+ medication: 'Hydromorphone',
182
+ class: 'Strong opioid',
183
+ startingDose: '2mg PO q4-6h',
184
+ titrationSchedule: 'Increase by 25-50% q24-48h',
185
+ maxDose: 'No ceiling',
186
+ routeOptions: ['PO', 'IV', 'SC'],
187
+ precautions: ['More potent than morphine (5:1)'],
188
+ contraindications: ['Same as morphine'],
189
+ monitoringRequired: ['Same as morphine']
190
+ }
191
+ ],
192
+ thirdLine: [
193
+ {
194
+ medication: 'Fentanyl Transdermal',
195
+ class: 'Strong opioid',
196
+ startingDose: '25mcg/hr patch (only if opioid-tolerant)',
197
+ titrationSchedule: 'Increase by 25mcg/hr q72h',
198
+ maxDose: 'No ceiling',
199
+ routeOptions: ['Transdermal'],
200
+ precautions: ['Only for opioid-tolerant patients', 'Takes 12-24h to reach steady state'],
201
+ contraindications: ['Opioid-naive patients', 'Acute pain'],
202
+ monitoringRequired: ['Pain relief', 'Patch adherence', 'Fever (increases absorption)']
203
+ }
204
+ ],
205
+ adjuvants: [
206
+ {
207
+ medication: 'Acetaminophen',
208
+ indication: 'Opioid-sparing',
209
+ dose: '650mg q6h',
210
+ mechanism: 'Central COX inhibition',
211
+ evidence: 'Reduces opioid requirement 20-30%'
212
+ },
213
+ {
214
+ medication: 'NSAID (if not contraindicated)',
215
+ indication: 'Inflammatory component',
216
+ dose: 'Variable',
217
+ mechanism: 'COX-1/2 inhibition',
218
+ evidence: 'Synergistic with opioids'
219
+ }
220
+ ],
221
+ interventional: [],
222
+ monitoring: {
223
+ assessmentFrequency: 'Daily during titration, then weekly',
224
+ tools: ['NRS', 'BPI-SF', 'Opioid Risk Tool'],
225
+ escalationCriteria: ['Inadequate relief at current dose', 'Dose escalation >50% in 1 week'],
226
+ deescalationCriteria: ['Stable pain control', 'Disease response to treatment']
227
+ }
228
+ },
229
+ {
230
+ painType: 'Nociceptive-Somatic',
231
+ severity: 'Severe',
232
+ firstLine: [
233
+ {
234
+ medication: 'Morphine IV/SC',
235
+ class: 'Strong opioid',
236
+ startingDose: '2-4mg IV q2-4h or PCA',
237
+ titrationSchedule: 'Rapid titration: redose at 50% q15-30min until controlled',
238
+ maxDose: 'No ceiling',
239
+ routeOptions: ['IV', 'SC'],
240
+ precautions: ['Rapid titration requires monitoring'],
241
+ contraindications: ['Severe respiratory compromise'],
242
+ monitoringRequired: ['Continuous pulse ox initially', 'RR q1h', 'Sedation scale']
243
+ }
244
+ ],
245
+ secondLine: [
246
+ {
247
+ medication: 'Hydromorphone IV',
248
+ class: 'Strong opioid',
249
+ startingDose: '0.5-1mg IV q2-4h',
250
+ titrationSchedule: 'Rapid titration as above',
251
+ maxDose: 'No ceiling',
252
+ routeOptions: ['IV', 'SC'],
253
+ precautions: ['5x more potent than morphine'],
254
+ contraindications: ['Same'],
255
+ monitoringRequired: ['Same']
256
+ },
257
+ {
258
+ medication: 'Fentanyl IV',
259
+ class: 'Strong opioid',
260
+ startingDose: '25-50mcg IV q30min-1h',
261
+ titrationSchedule: 'Rapid onset, short duration - good for titration',
262
+ maxDose: 'No ceiling',
263
+ routeOptions: ['IV'],
264
+ precautions: ['Short duration requires frequent dosing or infusion'],
265
+ contraindications: ['Same'],
266
+ monitoringRequired: ['Same']
267
+ }
268
+ ],
269
+ thirdLine: [
270
+ {
271
+ medication: 'Methadone',
272
+ class: 'Strong opioid + NMDA antagonist',
273
+ startingDose: 'Complex conversion - specialist required',
274
+ titrationSchedule: 'Slow titration due to long half-life (specialist only)',
275
+ maxDose: 'Variable',
276
+ routeOptions: ['PO', 'IV'],
277
+ precautions: ['QTc prolongation', 'Complex pharmacokinetics', 'Drug interactions'],
278
+ contraindications: ['QTc >500ms', 'Concurrent QTc-prolonging drugs'],
279
+ monitoringRequired: ['ECG at baseline and during titration', 'QTc monitoring']
280
+ }
281
+ ],
282
+ adjuvants: [
283
+ {
284
+ medication: 'Dexamethasone',
285
+ indication: 'Inflammatory pain, nerve compression, bone pain',
286
+ dose: '4-8mg daily',
287
+ mechanism: 'Anti-inflammatory, reduces edema',
288
+ evidence: 'Effective for bone mets, liver capsule pain'
289
+ },
290
+ {
291
+ medication: 'Ketamine',
292
+ indication: 'Opioid-refractory pain, central sensitization',
293
+ dose: '0.1-0.5mg/kg/hr IV',
294
+ mechanism: 'NMDA antagonist',
295
+ evidence: 'Reduces opioid tolerance, effective for refractory pain'
296
+ }
297
+ ],
298
+ interventional: [
299
+ {
300
+ procedure: 'Intrathecal Drug Delivery System (IDDS)',
301
+ indication: 'Refractory pain despite high-dose systemic opioids',
302
+ technique: 'Implanted pump with intrathecal catheter',
303
+ expectedBenefit: '50-70% pain reduction',
304
+ duration: 'Permanent (pump refills q1-3 months)',
305
+ risks: ['Infection', 'Catheter malfunction', 'CSF leak'],
306
+ contraindications: ['Active infection', 'Coagulopathy', 'Limited life expectancy <3 months']
307
+ },
308
+ {
309
+ procedure: 'Neurolytic Celiac Plexus Block',
310
+ indication: 'Pancreatic cancer pain, upper abdominal malignancy',
311
+ technique: 'Alcohol or phenol injection to celiac plexus',
312
+ expectedBenefit: '70-90% pain reduction',
313
+ duration: '3-6 months',
314
+ risks: ['Hypotension', 'Diarrhea', 'Paraplegia (rare)'],
315
+ contraindications: ['Coagulopathy', 'Bowel obstruction']
316
+ }
317
+ ],
318
+ monitoring: {
319
+ assessmentFrequency: 'Q4h during titration',
320
+ tools: ['NRS', 'RASS for sedation', 'CPOT if non-verbal'],
321
+ escalationCriteria: ['Pain crisis', 'Respiratory compromise'],
322
+ deescalationCriteria: ['Stable control', 'Can convert to oral']
323
+ }
324
+ }
325
+ ];
326
+
327
+ // ═══════════════════════════════════════════════════════════════════════════════
328
+ // NEUROPATHIC PAIN PROTOCOLS
329
+ // ═══════════════════════════════════════════════════════════════════════════════
330
+
331
+ export const NEUROPATHIC_PAIN_PROTOCOLS: PainManagementProtocol[] = [
332
+ {
333
+ painType: 'Neuropathic-Peripheral',
334
+ severity: 'Moderate',
335
+ firstLine: [
336
+ {
337
+ medication: 'Gabapentin',
338
+ class: 'Anticonvulsant',
339
+ startingDose: '100-300mg PO TID',
340
+ titrationSchedule: 'Increase by 300mg q3-7d',
341
+ maxDose: '3600mg/day (in divided doses)',
342
+ routeOptions: ['PO'],
343
+ precautions: ['Sedation', 'Dizziness', 'Peripheral edema', 'Renal dosing required'],
344
+ contraindications: ['Severe renal impairment without dose adjustment'],
345
+ monitoringRequired: ['Sedation', 'Renal function', 'Suicidal ideation']
346
+ },
347
+ {
348
+ medication: 'Pregabalin',
349
+ class: 'Anticonvulsant',
350
+ startingDose: '75mg PO BID',
351
+ titrationSchedule: 'Increase to 150mg BID after 3-7d, then 300mg BID',
352
+ maxDose: '600mg/day',
353
+ routeOptions: ['PO'],
354
+ precautions: ['Same as gabapentin', 'Controlled substance'],
355
+ contraindications: ['Same'],
356
+ monitoringRequired: ['Same']
357
+ }
358
+ ],
359
+ secondLine: [
360
+ {
361
+ medication: 'Duloxetine',
362
+ class: 'SNRI',
363
+ startingDose: '30mg PO daily',
364
+ titrationSchedule: 'Increase to 60mg after 1-2 weeks',
365
+ maxDose: '120mg/day',
366
+ routeOptions: ['PO'],
367
+ precautions: ['Nausea initially', 'Hepatic metabolism', 'Hypertension', 'Bleeding risk with anticoagulants'],
368
+ contraindications: ['MAO inhibitors', 'Uncontrolled glaucoma', 'Severe hepatic impairment'],
369
+ monitoringRequired: ['BP', 'Mood', 'LFTs']
370
+ },
371
+ {
372
+ medication: 'Amitriptyline',
373
+ class: 'TCA',
374
+ startingDose: '10-25mg PO qhs',
375
+ titrationSchedule: 'Increase by 10-25mg q1-2 weeks',
376
+ maxDose: '150mg/day',
377
+ routeOptions: ['PO'],
378
+ precautions: ['Anticholinergic effects', 'Sedation', 'Cardiac conduction', 'Falls risk in elderly'],
379
+ contraindications: ['Recent MI', 'Arrhythmia', 'Glaucoma', 'Urinary retention'],
380
+ monitoringRequired: ['ECG if cardiac risk', 'Anticholinergic burden']
381
+ }
382
+ ],
383
+ thirdLine: [
384
+ {
385
+ medication: 'Lidocaine 5% Patch',
386
+ class: 'Local anesthetic',
387
+ startingDose: '1-3 patches to affected area 12h on/12h off',
388
+ titrationSchedule: 'Fixed',
389
+ maxDose: '3 patches simultaneously',
390
+ routeOptions: ['Topical'],
391
+ precautions: ['Local skin reaction'],
392
+ contraindications: ['Severe hepatic impairment'],
393
+ monitoringRequired: ['Skin integrity']
394
+ },
395
+ {
396
+ medication: 'Capsaicin 8% Patch',
397
+ class: 'TRPV1 agonist',
398
+ startingDose: 'Applied for 60 min (healthcare setting)',
399
+ titrationSchedule: 'Repeat q3 months if effective',
400
+ maxDose: '4 patches per application',
401
+ routeOptions: ['Topical'],
402
+ precautions: ['Intense burning during application', 'Requires pretreatment analgesia'],
403
+ contraindications: ['Broken skin'],
404
+ monitoringRequired: ['BP during application']
405
+ }
406
+ ],
407
+ adjuvants: [
408
+ {
409
+ medication: 'Opioids',
410
+ indication: 'Add if neuropathic-specific agents insufficient',
411
+ dose: 'Per WHO ladder',
412
+ mechanism: 'Mu-opioid agonism',
413
+ evidence: 'Less effective for neuropathic than nociceptive but still helpful'
414
+ },
415
+ {
416
+ medication: 'Dexamethasone',
417
+ indication: 'Nerve compression',
418
+ dose: '4-8mg daily',
419
+ mechanism: 'Reduces perineural edema',
420
+ evidence: 'Effective for tumor-related nerve compression'
421
+ }
422
+ ],
423
+ interventional: [
424
+ {
425
+ procedure: 'Spinal Cord Stimulation',
426
+ indication: 'Refractory neuropathic pain',
427
+ technique: 'Epidural electrode placement with implanted pulse generator',
428
+ expectedBenefit: '50% pain reduction in 60-70% of patients',
429
+ duration: 'Permanent',
430
+ risks: ['Infection', 'Lead migration', 'Hardware failure'],
431
+ contraindications: ['Active infection', 'Coagulopathy', 'Pacemaker (relative)']
432
+ }
433
+ ],
434
+ monitoring: {
435
+ assessmentFrequency: 'Weekly during titration',
436
+ tools: ['NRS', 'DN4', 'painDETECT'],
437
+ escalationCriteria: ['Inadequate relief', 'Intolerable side effects'],
438
+ deescalationCriteria: ['Stable control', 'Resolved neuropathy']
439
+ }
440
+ }
441
+ ];
442
+
443
+ // ═══════════════════════════════════════════════════════════════════════════════
444
+ // CHEMOTHERAPY-INDUCED PERIPHERAL NEUROPATHY (CIPN)
445
+ // ═══════════════════════════════════════════════════════════════════════════════
446
+
447
+ export interface CIPNProtocol {
448
+ causingAgent: string;
449
+ riskFactors: string[];
450
+ prevention: PreventionStrategy[];
451
+ treatment: PainIntervention[];
452
+ doseModification: DoseModificationGuideline[];
453
+ prognosis: string;
454
+ }
455
+
456
+ export interface PreventionStrategy {
457
+ intervention: string;
458
+ evidence: string;
459
+ recommendation: 'Recommended' | 'May Consider' | 'Not Recommended';
460
+ }
461
+
462
+ export interface DoseModificationGuideline {
463
+ grade: number;
464
+ description: string;
465
+ action: string;
466
+ }
467
+
468
+ export const CIPN_PROTOCOLS: CIPNProtocol[] = [
469
+ {
470
+ causingAgent: 'Taxanes (Paclitaxel, Docetaxel)',
471
+ riskFactors: ['Cumulative dose', 'Pre-existing neuropathy', 'Diabetes', 'Alcohol use'],
472
+ prevention: [
473
+ {
474
+ intervention: 'Cryotherapy (frozen gloves/socks during infusion)',
475
+ evidence: 'Moderate evidence for reduction',
476
+ recommendation: 'May Consider'
477
+ },
478
+ {
479
+ intervention: 'Compression therapy',
480
+ evidence: 'Limited evidence',
481
+ recommendation: 'May Consider'
482
+ },
483
+ {
484
+ intervention: 'Vitamin E, glutamine, acetyl-L-carnitine',
485
+ evidence: 'Insufficient evidence',
486
+ recommendation: 'Not Recommended'
487
+ }
488
+ ],
489
+ treatment: [
490
+ {
491
+ medication: 'Duloxetine',
492
+ class: 'SNRI',
493
+ startingDose: '30mg PO daily x1 week, then 60mg',
494
+ titrationSchedule: 'Increase after 1 week',
495
+ maxDose: '60mg/day (studied dose)',
496
+ routeOptions: ['PO'],
497
+ precautions: ['Nausea', 'Hepatic metabolism'],
498
+ contraindications: ['MAO inhibitors'],
499
+ monitoringRequired: ['Mood', 'BP']
500
+ }
501
+ ],
502
+ doseModification: [
503
+ { grade: 1, description: 'Mild paresthesias, no functional impairment', action: 'Continue at current dose with monitoring' },
504
+ { grade: 2, description: 'Moderate symptoms limiting instrumental ADLs', action: 'Consider dose reduction 20-25%' },
505
+ { grade: 3, description: 'Severe symptoms limiting self-care ADLs', action: 'Hold until grade ≤1, resume at reduced dose or discontinue' }
506
+ ],
507
+ prognosis: 'Often improves after treatment cessation but may persist in 30-40%'
508
+ },
509
+ {
510
+ causingAgent: 'Platinum agents (Oxaliplatin, Cisplatin)',
511
+ riskFactors: ['Cumulative dose', 'Cold sensitivity', 'Pre-existing neuropathy'],
512
+ prevention: [
513
+ {
514
+ intervention: 'Calcium/Magnesium infusions',
515
+ evidence: 'Conflicting evidence',
516
+ recommendation: 'May Consider'
517
+ },
518
+ {
519
+ intervention: 'Avoid cold exposure during and 3 days after infusion',
520
+ evidence: 'Standard practice',
521
+ recommendation: 'Recommended'
522
+ },
523
+ {
524
+ intervention: 'Stop-and-go strategy (oxaliplatin holiday)',
525
+ evidence: 'OPTIMOX studies',
526
+ recommendation: 'Recommended'
527
+ }
528
+ ],
529
+ treatment: [
530
+ {
531
+ medication: 'Duloxetine',
532
+ class: 'SNRI',
533
+ startingDose: '30mg PO daily',
534
+ titrationSchedule: 'Increase to 60mg after 1 week',
535
+ maxDose: '60mg/day',
536
+ routeOptions: ['PO'],
537
+ precautions: ['Same as above'],
538
+ contraindications: ['Same'],
539
+ monitoringRequired: ['Same']
540
+ },
541
+ {
542
+ medication: 'Gabapentin/Pregabalin',
543
+ class: 'Anticonvulsant',
544
+ startingDose: 'Per neuropathic protocol',
545
+ titrationSchedule: 'Per protocol',
546
+ maxDose: 'Per protocol',
547
+ routeOptions: ['PO'],
548
+ precautions: ['Sedation'],
549
+ contraindications: ['Renal impairment without adjustment'],
550
+ monitoringRequired: ['Sedation']
551
+ }
552
+ ],
553
+ doseModification: [
554
+ { grade: 1, description: 'Cold-induced dysesthesias resolving', action: 'Continue with precautions' },
555
+ { grade: 2, description: 'Persistent paresthesias between cycles', action: 'Consider dose reduction or stop-and-go' },
556
+ { grade: 3, description: 'Functional impairment', action: 'Discontinue oxaliplatin' }
557
+ ],
558
+ prognosis: 'Acute cold sensitivity resolves; chronic sensory neuropathy may persist'
559
+ },
560
+ {
561
+ causingAgent: 'Vinca alkaloids (Vincristine, Vinblastine)',
562
+ riskFactors: ['Cumulative dose', 'Hepatic impairment', 'Pre-existing neuropathy'],
563
+ prevention: [
564
+ {
565
+ intervention: 'Dose capping (vincristine 2mg max)',
566
+ evidence: 'Standard practice',
567
+ recommendation: 'Recommended'
568
+ }
569
+ ],
570
+ treatment: [
571
+ {
572
+ medication: 'Gabapentin/Pregabalin',
573
+ class: 'Anticonvulsant',
574
+ startingDose: 'Per neuropathic protocol',
575
+ titrationSchedule: 'Per protocol',
576
+ maxDose: 'Per protocol',
577
+ routeOptions: ['PO'],
578
+ precautions: ['Sedation'],
579
+ contraindications: [],
580
+ monitoringRequired: ['Neuropathy assessment']
581
+ }
582
+ ],
583
+ doseModification: [
584
+ { grade: 1, description: 'Mild sensory changes', action: 'Continue with monitoring' },
585
+ { grade: 2, description: 'Motor weakness, constipation', action: 'Reduce dose 25-50%' },
586
+ { grade: 3, description: 'Significant motor impairment', action: 'Hold or discontinue' }
587
+ ],
588
+ prognosis: 'Often reversible after cessation but may take months'
589
+ },
590
+ {
591
+ causingAgent: 'Bortezomib',
592
+ riskFactors: ['Pre-existing neuropathy', 'Cumulative dose', 'IV route (vs SC)'],
593
+ prevention: [
594
+ {
595
+ intervention: 'Subcutaneous administration (vs IV)',
596
+ evidence: 'Reduced neuropathy incidence',
597
+ recommendation: 'Recommended'
598
+ },
599
+ {
600
+ intervention: 'Weekly dosing (vs twice weekly)',
601
+ evidence: 'Reduced toxicity with similar efficacy',
602
+ recommendation: 'Recommended'
603
+ }
604
+ ],
605
+ treatment: [
606
+ {
607
+ medication: 'Per neuropathic pain protocols',
608
+ class: 'Various',
609
+ startingDose: 'Per protocol',
610
+ titrationSchedule: 'Per protocol',
611
+ maxDose: 'Per protocol',
612
+ routeOptions: ['PO'],
613
+ precautions: [],
614
+ contraindications: [],
615
+ monitoringRequired: []
616
+ }
617
+ ],
618
+ doseModification: [
619
+ { grade: 1, description: 'Pain or paresthesias without functional loss', action: 'Continue or reduce to 1.0mg/m²' },
620
+ { grade: 2, description: 'Functional impairment', action: 'Hold until ≤G1, resume at 0.7mg/m²' },
621
+ { grade: 3, description: 'Severe symptoms', action: 'Discontinue' }
622
+ ],
623
+ prognosis: 'Often improves after dose modification or cessation'
624
+ }
625
+ ];
626
+
627
+ // ═══════════════════════════════════════════════════════════════════════════════
628
+ // BONE PAIN MANAGEMENT
629
+ // ═══════════════════════════════════════════════════════════════════════════════
630
+
631
+ export interface BonePainProtocol {
632
+ indication: string;
633
+ pharmacological: PainIntervention[];
634
+ boneTargeted: BoneTargetedTherapy[];
635
+ radiation: RadiationForPain[];
636
+ interventional: InterventionalProcedure[];
637
+ surgical: string[];
638
+ }
639
+
640
+ export interface BoneTargetedTherapy {
641
+ agent: string;
642
+ class: string;
643
+ dose: string;
644
+ frequency: string;
645
+ painBenefit: string;
646
+ skeletalEventReduction: string;
647
+ precautions: string[];
648
+ }
649
+
650
+ export interface RadiationForPain {
651
+ technique: string;
652
+ dose: string;
653
+ fractionation: string;
654
+ responseRate: string;
655
+ timeToResponse: string;
656
+ retreatmentOption: boolean;
657
+ }
658
+
659
+ export const BONE_PAIN_PROTOCOL: BonePainProtocol = {
660
+ indication: 'Painful bone metastases from solid tumors or multiple myeloma',
661
+ pharmacological: [
662
+ {
663
+ medication: 'NSAIDs (if not contraindicated)',
664
+ class: 'Anti-inflammatory',
665
+ startingDose: 'Ibuprofen 400-600mg TID or Naproxen 500mg BID',
666
+ titrationSchedule: 'Fixed',
667
+ maxDose: 'Standard NSAID limits',
668
+ routeOptions: ['PO'],
669
+ precautions: ['GI, renal, CV risk'],
670
+ contraindications: ['Active bleeding', 'CKD', 'High CV risk'],
671
+ monitoringRequired: ['Creatinine', 'GI symptoms']
672
+ },
673
+ {
674
+ medication: 'Dexamethasone',
675
+ class: 'Corticosteroid',
676
+ startingDose: '4-8mg PO daily',
677
+ titrationSchedule: 'Taper if possible after 1-2 weeks',
678
+ maxDose: '16mg/day',
679
+ routeOptions: ['PO', 'IV'],
680
+ precautions: ['Hyperglycemia', 'Insomnia', 'Immunosuppression'],
681
+ contraindications: ['Active infection (relative)'],
682
+ monitoringRequired: ['Blood glucose', 'Mood']
683
+ },
684
+ {
685
+ medication: 'Opioids per WHO ladder',
686
+ class: 'Strong opioid',
687
+ startingDose: 'Per severity',
688
+ titrationSchedule: 'Per protocol',
689
+ maxDose: 'No ceiling',
690
+ routeOptions: ['Various'],
691
+ precautions: ['Standard opioid precautions'],
692
+ contraindications: ['Standard'],
693
+ monitoringRequired: ['Standard']
694
+ }
695
+ ],
696
+ boneTargeted: [
697
+ {
698
+ agent: 'Zoledronic acid',
699
+ class: 'Bisphosphonate',
700
+ dose: '4mg IV',
701
+ frequency: 'Every 3-4 weeks (may extend to q12 weeks after 1 year)',
702
+ painBenefit: 'Reduces bone pain in 30-50% of patients',
703
+ skeletalEventReduction: '40% reduction in SREs',
704
+ precautions: ['Renal dosing required', 'ONJ risk', 'Hypocalcemia']
705
+ },
706
+ {
707
+ agent: 'Denosumab',
708
+ class: 'RANK-L inhibitor',
709
+ dose: '120mg SC',
710
+ frequency: 'Every 4 weeks',
711
+ painBenefit: 'Similar to zoledronic acid',
712
+ skeletalEventReduction: 'Superior to zoledronic acid',
713
+ precautions: ['Hypocalcemia (severe)', 'ONJ risk', 'No renal adjustment needed']
714
+ }
715
+ ],
716
+ radiation: [
717
+ {
718
+ technique: 'Single fraction EBRT',
719
+ dose: '8 Gy',
720
+ fractionation: 'Single fraction',
721
+ responseRate: '60-70% (complete response 25-30%)',
722
+ timeToResponse: '2-4 weeks',
723
+ retreatmentOption: true
724
+ },
725
+ {
726
+ technique: 'Multi-fraction EBRT',
727
+ dose: '30 Gy',
728
+ fractionation: '10 fractions',
729
+ responseRate: '60-70% (similar to single)',
730
+ timeToResponse: '2-4 weeks',
731
+ retreatmentOption: true
732
+ },
733
+ {
734
+ technique: 'SBRT',
735
+ dose: '24-27 Gy',
736
+ fractionation: '3 fractions',
737
+ responseRate: '80-90%',
738
+ timeToResponse: '1-3 months',
739
+ retreatmentOption: false
740
+ }
741
+ ],
742
+ interventional: [
743
+ {
744
+ procedure: 'Vertebroplasty/Kyphoplasty',
745
+ indication: 'Painful vertebral compression fracture',
746
+ technique: 'Cement injection into vertebral body',
747
+ expectedBenefit: '70-90% pain relief',
748
+ duration: 'Immediate and lasting',
749
+ risks: ['Cement leak', 'Adjacent fracture'],
750
+ contraindications: ['Posterior wall destruction', 'Active infection']
751
+ },
752
+ {
753
+ procedure: 'Radiofrequency Ablation (RFA)',
754
+ indication: 'Painful bone metastasis not amenable to RT',
755
+ technique: 'CT-guided thermal ablation',
756
+ expectedBenefit: '70-95% pain reduction',
757
+ duration: 'Weeks to months',
758
+ risks: ['Nerve injury', 'Fracture'],
759
+ contraindications: ['Near critical structures']
760
+ },
761
+ {
762
+ procedure: 'Cryoablation',
763
+ indication: 'Same as RFA',
764
+ technique: 'CT-guided freezing',
765
+ expectedBenefit: 'Similar to RFA',
766
+ duration: 'Weeks to months',
767
+ risks: ['Similar to RFA'],
768
+ contraindications: ['Similar']
769
+ }
770
+ ],
771
+ surgical: [
772
+ 'Prophylactic fixation for impending fracture (Mirels score ≥9)',
773
+ 'Surgical stabilization for pathologic fracture',
774
+ 'Decompression for spinal cord compression'
775
+ ]
776
+ };
777
+
778
+ // ═══════════════════════════════════════════════════════════════════════════════
779
+ // CANCER-SPECIFIC SYMPTOM CLUSTERS
780
+ // ═══════════════════════════════════════════════════════════════════════════════
781
+
782
+ export interface SymptomCluster {
783
+ cancerType: string;
784
+ commonSymptoms: SymptomManagement[];
785
+ psychologicalSymptoms: string[];
786
+ interventions: ClusterIntervention[];
787
+ }
788
+
789
+ export interface SymptomManagement {
790
+ symptom: string;
791
+ prevalence: string;
792
+ firstLineManagement: string[];
793
+ secondLineManagement: string[];
794
+ refractory: string[];
795
+ }
796
+
797
+ export interface ClusterIntervention {
798
+ type: string;
799
+ intervention: string;
800
+ evidence: string;
801
+ }
802
+
803
+ export const CANCER_SYMPTOM_CLUSTERS: SymptomCluster[] = [
804
+ {
805
+ cancerType: 'Pancreatic Cancer',
806
+ commonSymptoms: [
807
+ {
808
+ symptom: 'Pain (epigastric/back)',
809
+ prevalence: '80-85%',
810
+ firstLineManagement: ['Opioids', 'NSAIDs', 'Dexamethasone'],
811
+ secondLineManagement: ['Celiac plexus block', 'Intrathecal pump'],
812
+ refractory: ['Ketamine infusion', 'Palliative sedation']
813
+ },
814
+ {
815
+ symptom: 'Cachexia/Anorexia',
816
+ prevalence: '80%',
817
+ firstLineManagement: ['Nutritional counseling', 'Oral supplements', 'Megestrol acetate'],
818
+ secondLineManagement: ['Dronabinol', 'Mirtazapine', 'Olanzapine'],
819
+ refractory: ['Accept as disease trajectory', 'Comfort-focused care']
820
+ },
821
+ {
822
+ symptom: 'Nausea/Vomiting',
823
+ prevalence: '50-60%',
824
+ firstLineManagement: ['Ondansetron', 'Metoclopramide (if no obstruction)'],
825
+ secondLineManagement: ['Dexamethasone', 'Haloperidol', 'Olanzapine'],
826
+ refractory: ['Octreotide (if obstruction)', 'Continuous antiemetic infusion']
827
+ },
828
+ {
829
+ symptom: 'Jaundice/Pruritus',
830
+ prevalence: '50%',
831
+ firstLineManagement: ['Biliary stenting (ERCP/PTC)', 'Cholestyramine'],
832
+ secondLineManagement: ['Rifampin', 'Naltrexone', 'Sertraline'],
833
+ refractory: ['Biliary drainage', 'Plasmapheresis (rare)']
834
+ }
835
+ ],
836
+ psychologicalSymptoms: ['Depression (50%)', 'Anxiety (40%)', 'Existential distress'],
837
+ interventions: [
838
+ {
839
+ type: 'Early palliative care integration',
840
+ intervention: 'Concurrent palliative care from diagnosis',
841
+ evidence: 'Improves QoL and may improve survival (Temel NEJM 2010 model)'
842
+ },
843
+ {
844
+ type: 'Celiac plexus neurolysis',
845
+ intervention: 'Early consideration for pain',
846
+ evidence: '70-90% pain relief, may reduce opioid requirement'
847
+ }
848
+ ]
849
+ },
850
+ {
851
+ cancerType: 'Lung Cancer',
852
+ commonSymptoms: [
853
+ {
854
+ symptom: 'Dyspnea',
855
+ prevalence: '65-75%',
856
+ firstLineManagement: ['Opioids (morphine 2.5-5mg q4h)', 'Oxygen if hypoxic', 'Fan therapy'],
857
+ secondLineManagement: ['Benzodiazepines (for anxiety component)', 'Bronchodilators if obstruction'],
858
+ refractory: ['Continuous opioid infusion', 'Palliative sedation']
859
+ },
860
+ {
861
+ symptom: 'Cough',
862
+ prevalence: '50-70%',
863
+ firstLineManagement: ['Dextromethorphan', 'Codeine', 'Benzonatate'],
864
+ secondLineManagement: ['Gabapentin', 'Nebulized lidocaine'],
865
+ refractory: ['Opioids', 'Endobronchial intervention if obstruction']
866
+ },
867
+ {
868
+ symptom: 'Hemoptysis',
869
+ prevalence: '20-30%',
870
+ firstLineManagement: ['Tranexamic acid', 'Radiation therapy'],
871
+ secondLineManagement: ['Bronchial artery embolization'],
872
+ refractory: ['Endobronchial laser/electrocautery', 'Palliative sedation if massive']
873
+ },
874
+ {
875
+ symptom: 'Pain',
876
+ prevalence: '50-70%',
877
+ firstLineManagement: ['Per WHO ladder'],
878
+ secondLineManagement: ['Chest wall blocks', 'Radiation'],
879
+ refractory: ['Intrathecal pump', 'Ketamine']
880
+ }
881
+ ],
882
+ psychologicalSymptoms: ['Anxiety (35-45%)', 'Depression (25-35%)', 'Panic with dyspnea'],
883
+ interventions: [
884
+ {
885
+ type: 'Breathlessness clinic',
886
+ intervention: 'Multicomponent intervention (breathing techniques, fan, positioning)',
887
+ evidence: 'Improves dyspnea and reduces anxiety'
888
+ },
889
+ {
890
+ type: 'Palliative thoracentesis/pleurodesis',
891
+ intervention: 'For malignant pleural effusion',
892
+ evidence: 'Relieves dyspnea in 70-90%'
893
+ }
894
+ ]
895
+ },
896
+ {
897
+ cancerType: 'Brain Tumors',
898
+ commonSymptoms: [
899
+ {
900
+ symptom: 'Headache',
901
+ prevalence: '50-60%',
902
+ firstLineManagement: ['Dexamethasone (4-16mg daily)', 'Acetaminophen', 'NSAIDs'],
903
+ secondLineManagement: ['Opioids if needed'],
904
+ refractory: ['Increase steroids', 'Consider decompressive surgery']
905
+ },
906
+ {
907
+ symptom: 'Seizures',
908
+ prevalence: '40-60%',
909
+ firstLineManagement: ['Levetiracetam', 'Lacosamide', 'Valproate'],
910
+ secondLineManagement: ['Add second AED', 'Clobazam'],
911
+ refractory: ['Phenobarbital', 'Midazolam infusion']
912
+ },
913
+ {
914
+ symptom: 'Cognitive Decline',
915
+ prevalence: '40-80%',
916
+ firstLineManagement: ['Treat reversible causes (steroids, seizures)', 'Cognitive rehabilitation'],
917
+ secondLineManagement: ['Methylphenidate', 'Modafinil', 'Memantine (radiation-induced)'],
918
+ refractory: ['Supportive care', 'Caregiver support']
919
+ },
920
+ {
921
+ symptom: 'Fatigue',
922
+ prevalence: '60-90%',
923
+ firstLineManagement: ['Treat underlying causes', 'Energy conservation', 'Exercise'],
924
+ secondLineManagement: ['Methylphenidate', 'Modafinil'],
925
+ refractory: ['Accept and adapt']
926
+ }
927
+ ],
928
+ psychologicalSymptoms: ['Depression (15-40%)', 'Anxiety', 'Personality changes', 'Caregiver burden'],
929
+ interventions: [
930
+ {
931
+ type: 'Steroid management',
932
+ intervention: 'Use lowest effective dose, taper when possible',
933
+ evidence: 'Reduces steroid myopathy, hyperglycemia, insomnia'
934
+ },
935
+ {
936
+ type: 'Seizure prophylaxis',
937
+ intervention: 'Continue AED for life if seizure history',
938
+ evidence: 'Prevents breakthrough seizures, ensures safety'
939
+ }
940
+ ]
941
+ },
942
+ {
943
+ cancerType: 'Gastrointestinal Cancers (Gastric, Esophageal)',
944
+ commonSymptoms: [
945
+ {
946
+ symptom: 'Dysphagia',
947
+ prevalence: '60-80%',
948
+ firstLineManagement: ['Esophageal stenting', 'Dietary modification'],
949
+ secondLineManagement: ['Radiation therapy', 'Dilation'],
950
+ refractory: ['Feeding tube (G-tube, J-tube)', 'TPN']
951
+ },
952
+ {
953
+ symptom: 'Nausea/Vomiting',
954
+ prevalence: '40-70%',
955
+ firstLineManagement: ['Metoclopramide (if no obstruction)', 'Ondansetron'],
956
+ secondLineManagement: ['Dexamethasone', 'Haloperidol'],
957
+ refractory: ['Octreotide', 'Venting gastrostomy']
958
+ },
959
+ {
960
+ symptom: 'Bowel Obstruction',
961
+ prevalence: 'Variable',
962
+ firstLineManagement: ['NPO, NG tube', 'IV fluids', 'Dexamethasone'],
963
+ secondLineManagement: ['Octreotide', 'Hyoscine butylbromide'],
964
+ refractory: ['Venting gastrostomy', 'Surgical bypass if appropriate']
965
+ },
966
+ {
967
+ symptom: 'Ascites',
968
+ prevalence: '30-50% in advanced disease',
969
+ firstLineManagement: ['Diuretics (spironolactone ± furosemide)', 'Sodium restriction'],
970
+ secondLineManagement: ['Therapeutic paracentesis'],
971
+ refractory: ['Indwelling drain', 'Peritoneovenous shunt (rare)']
972
+ }
973
+ ],
974
+ psychologicalSymptoms: ['Depression', 'Anxiety', 'Loss of eating enjoyment'],
975
+ interventions: [
976
+ {
977
+ type: 'Nutritional support',
978
+ intervention: 'Early dietitian involvement, consider enteral feeding',
979
+ evidence: 'Maintains nutrition, improves tolerance of treatment'
980
+ }
981
+ ]
982
+ }
983
+ ];
984
+
985
+ // ═══════════════════════════════════════════════════════════════════════════════
986
+ // END-OF-LIFE CARE PROTOCOLS
987
+ // ═══════════════════════════════════════════════════════════════════════════════
988
+
989
+ export interface EndOfLifeProtocol {
990
+ phase: 'Last weeks' | 'Last days' | 'Actively dying';
991
+ clinicalIndicators: string[];
992
+ symptomPriorities: string[];
993
+ medicationChanges: MedicationTransition;
994
+ familySupport: string[];
995
+ practicalConsiderations: string[];
996
+ }
997
+
998
+ export interface MedicationTransition {
999
+ currentRoute: string;
1000
+ alternativeRoutes: string[];
1001
+ essentialMedications: string[];
1002
+ medicationsToDiscontinue: string[];
1003
+ prnProtocols: PRNProtocol[];
1004
+ }
1005
+
1006
+ export interface PRNProtocol {
1007
+ symptom: string;
1008
+ medication: string;
1009
+ dose: string;
1010
+ route: string;
1011
+ frequency: string;
1012
+ maxDose24h: string;
1013
+ }
1014
+
1015
+ export const END_OF_LIFE_PROTOCOLS: EndOfLifeProtocol[] = [
1016
+ {
1017
+ phase: 'Last weeks',
1018
+ clinicalIndicators: [
1019
+ 'PPS ≤50%',
1020
+ 'Declining oral intake',
1021
+ 'Increasing weakness',
1022
+ 'Spending >50% of day in bed',
1023
+ 'Progressive weight loss'
1024
+ ],
1025
+ symptomPriorities: ['Pain control', 'Nausea/vomiting', 'Dyspnea', 'Anxiety/depression'],
1026
+ medicationChanges: {
1027
+ currentRoute: 'Oral preferred if tolerated',
1028
+ alternativeRoutes: ['Sublingual', 'Transdermal', 'Subcutaneous'],
1029
+ essentialMedications: ['Pain medications', 'Anti-anxiety', 'Antiemetics'],
1030
+ medicationsToDiscontinue: [
1031
+ 'Vitamins/supplements',
1032
+ 'Preventive medications (statins, antihypertensives - with caution)',
1033
+ 'Medications for long-term benefit'
1034
+ ],
1035
+ prnProtocols: []
1036
+ },
1037
+ familySupport: [
1038
+ 'Goals of care discussion',
1039
+ 'Advance directive review',
1040
+ 'Hospice referral discussion',
1041
+ 'Anticipatory grief support'
1042
+ ],
1043
+ practicalConsiderations: [
1044
+ 'Ensure medications available at home',
1045
+ 'Equipment needs (hospital bed, oxygen)',
1046
+ 'Emergency contact plan',
1047
+ '24/7 support availability'
1048
+ ]
1049
+ },
1050
+ {
1051
+ phase: 'Last days',
1052
+ clinicalIndicators: [
1053
+ 'PPS ≤30%',
1054
+ 'Bedbound',
1055
+ 'Minimal oral intake (sips only)',
1056
+ 'Altered consciousness',
1057
+ 'Mottled extremities',
1058
+ 'Changes in breathing pattern'
1059
+ ],
1060
+ symptomPriorities: ['Comfort', 'Minimize distressing symptoms', 'Family support'],
1061
+ medicationChanges: {
1062
+ currentRoute: 'Non-oral routes',
1063
+ alternativeRoutes: ['Subcutaneous', 'Sublingual', 'Rectal'],
1064
+ essentialMedications: [
1065
+ 'Morphine/hydromorphone SC (pain, dyspnea)',
1066
+ 'Midazolam/lorazepam SC (anxiety, agitation)',
1067
+ 'Haloperidol SC (nausea, agitation)',
1068
+ 'Glycopyrrolate/hyoscine SC (secretions)'
1069
+ ],
1070
+ medicationsToDiscontinue: [
1071
+ 'All non-essential medications',
1072
+ 'Anticoagulants (if not for symptom control)',
1073
+ 'Most oral medications'
1074
+ ],
1075
+ prnProtocols: [
1076
+ {
1077
+ symptom: 'Pain/Dyspnea',
1078
+ medication: 'Morphine',
1079
+ dose: '2.5-5mg',
1080
+ route: 'SC',
1081
+ frequency: 'Q1h PRN',
1082
+ maxDose24h: 'No ceiling'
1083
+ },
1084
+ {
1085
+ symptom: 'Anxiety/Agitation',
1086
+ medication: 'Midazolam',
1087
+ dose: '2.5-5mg',
1088
+ route: 'SC',
1089
+ frequency: 'Q1h PRN',
1090
+ maxDose24h: 'No ceiling'
1091
+ },
1092
+ {
1093
+ symptom: 'Nausea',
1094
+ medication: 'Haloperidol',
1095
+ dose: '0.5-1mg',
1096
+ route: 'SC',
1097
+ frequency: 'Q4-6h PRN',
1098
+ maxDose24h: '10mg'
1099
+ },
1100
+ {
1101
+ symptom: 'Secretions (death rattle)',
1102
+ medication: 'Glycopyrrolate',
1103
+ dose: '0.2mg',
1104
+ route: 'SC',
1105
+ frequency: 'Q4h PRN',
1106
+ maxDose24h: '1.2mg'
1107
+ }
1108
+ ]
1109
+ },
1110
+ familySupport: [
1111
+ 'Prepare family for what to expect',
1112
+ 'Signs of imminent death education',
1113
+ 'Permission to be present or take breaks',
1114
+ 'Chaplain/spiritual care'
1115
+ ],
1116
+ practicalConsiderations: [
1117
+ 'Continuous care if available (hospice)',
1118
+ 'Mouth care supplies',
1119
+ 'Positioning aids',
1120
+ 'Quiet, peaceful environment'
1121
+ ]
1122
+ },
1123
+ {
1124
+ phase: 'Actively dying',
1125
+ clinicalIndicators: [
1126
+ 'Unresponsive or minimal response',
1127
+ 'No oral intake',
1128
+ 'Cheyne-Stokes or irregular breathing',
1129
+ 'Peripheral cyanosis',
1130
+ 'Mottling extending centrally',
1131
+ 'Mandibular breathing'
1132
+ ],
1133
+ symptomPriorities: ['Comfort only', 'Minimize interventions', 'Family presence'],
1134
+ medicationChanges: {
1135
+ currentRoute: 'SC only',
1136
+ alternativeRoutes: ['Continuous SC infusion if needed'],
1137
+ essentialMedications: ['Comfort medications only'],
1138
+ medicationsToDiscontinue: ['All except comfort medications'],
1139
+ prnProtocols: [
1140
+ {
1141
+ symptom: 'Any distress',
1142
+ medication: 'Morphine + Midazolam',
1143
+ dose: '2.5mg each',
1144
+ route: 'SC',
1145
+ frequency: 'Q15-30min PRN',
1146
+ maxDose24h: 'As needed for comfort'
1147
+ }
1148
+ ]
1149
+ },
1150
+ familySupport: [
1151
+ 'Continuous presence of support',
1152
+ 'What to do when death occurs',
1153
+ 'After-death care planning',
1154
+ 'Bereavement resources'
1155
+ ],
1156
+ practicalConsiderations: [
1157
+ 'Notify funeral home of expected death',
1158
+ 'DNR confirmed and visible',
1159
+ 'After-hours contact numbers',
1160
+ 'Expected vs unexpected death documentation'
1161
+ ]
1162
+ }
1163
+ ];
1164
+
1165
+ // ═══════════════════════════════════════════════════════════════════════════════
1166
+ // PALLIATIVE SEDATION PROTOCOL
1167
+ // ═══════════════════════════════════════════════════════════════════════════════
1168
+
1169
+ export interface PalliativeSedationProtocol {
1170
+ indications: string[];
1171
+ prerequisites: string[];
1172
+ sedationTypes: SedationType[];
1173
+ medications: SedationMedication[];
1174
+ monitoring: string[];
1175
+ documentation: string[];
1176
+ ethicalConsiderations: string[];
1177
+ }
1178
+
1179
+ export interface SedationType {
1180
+ type: string;
1181
+ description: string;
1182
+ indication: string;
1183
+ }
1184
+
1185
+ export interface SedationMedication {
1186
+ medication: string;
1187
+ startingDose: string;
1188
+ titration: string;
1189
+ maxDose: string;
1190
+ notes: string;
1191
+ }
1192
+
1193
+ export const PALLIATIVE_SEDATION_PROTOCOL: PalliativeSedationProtocol = {
1194
+ indications: [
1195
+ 'Refractory symptoms unresponsive to all other interventions',
1196
+ 'Intolerable suffering despite optimal palliative care',
1197
+ 'Imminent death (hours to days expected)',
1198
+ 'Patient/surrogate consent obtained'
1199
+ ],
1200
+ prerequisites: [
1201
+ 'Palliative care specialist consultation',
1202
+ 'Ethics consultation if any uncertainty',
1203
+ 'Documentation of all attempted interventions',
1204
+ 'Clear goals of care discussion',
1205
+ 'Informed consent or surrogate decision',
1206
+ 'DNR status confirmed'
1207
+ ],
1208
+ sedationTypes: [
1209
+ {
1210
+ type: 'Proportionate Palliative Sedation',
1211
+ description: 'Sedation titrated to relieve suffering, consciousness reduced only as needed',
1212
+ indication: 'Refractory symptoms with awareness causing distress'
1213
+ },
1214
+ {
1215
+ type: 'Continuous Deep Sedation',
1216
+ description: 'Continuous sedation to unconsciousness until death',
1217
+ indication: 'Refractory suffering in imminently dying patient (hours to days)'
1218
+ },
1219
+ {
1220
+ type: 'Respite Sedation',
1221
+ description: 'Temporary sedation (24-48h) with planned re-emergence',
1222
+ indication: 'Severe symptom crisis, patient/family need respite'
1223
+ }
1224
+ ],
1225
+ medications: [
1226
+ {
1227
+ medication: 'Midazolam',
1228
+ startingDose: '0.5-1mg/hr SC/IV infusion',
1229
+ titration: 'Increase by 0.5-1mg/hr q1h until comfortable',
1230
+ maxDose: 'No ceiling (typical range 1-20mg/hr)',
1231
+ notes: 'First-line agent, rapid onset, easily titratable'
1232
+ },
1233
+ {
1234
+ medication: 'Propofol',
1235
+ startingDose: '10-20mg/hr IV',
1236
+ titration: 'Increase by 10mg/hr as needed',
1237
+ maxDose: 'Variable',
1238
+ notes: 'Requires IV access, rapid onset, ICU or specialized setting'
1239
+ },
1240
+ {
1241
+ medication: 'Phenobarbital',
1242
+ startingDose: '100-200mg SC/IV load, then 50-100mg q6-8h',
1243
+ titration: 'Increase maintenance by 50mg/dose as needed',
1244
+ maxDose: 'Variable',
1245
+ notes: 'Long half-life, useful when midazolam tolerance develops'
1246
+ }
1247
+ ],
1248
+ monitoring: [
1249
+ 'Comfort assessment (RASS, sedation scale)',
1250
+ 'Respiratory status',
1251
+ 'Facial expression for distress',
1252
+ 'Family presence and coping',
1253
+ 'Documentation of sedation level and comfort'
1254
+ ],
1255
+ documentation: [
1256
+ 'Indication and refractory nature of symptoms',
1257
+ 'All alternative treatments attempted',
1258
+ 'Consent process and participants',
1259
+ 'Sedation level and titration rationale',
1260
+ 'Ongoing assessment of comfort'
1261
+ ],
1262
+ ethicalConsiderations: [
1263
+ 'Intent is comfort, not hastening death (doctrine of double effect)',
1264
+ 'Proportionality - sedation level matched to symptom severity',
1265
+ 'Patient autonomy respected',
1266
+ 'Distinction from euthanasia (sedation does not cause death)',
1267
+ 'Availability of nutrition/hydration discussed separately'
1268
+ ]
1269
+ };
1270
+
1271
+ // ═══════════════════════════════════════════════════════════════════════════════
1272
+ // OPIOID CONVERSION AND ROTATION
1273
+ // ═══════════════════════════════════════════════════════════════════════════════
1274
+
1275
+ export interface OpioidEquivalence {
1276
+ opioid: string;
1277
+ oralMorphineEquivalent: number; // mg morphine equivalent per mg of drug
1278
+ routes: RouteConversion[];
1279
+ specialConsiderations: string[];
1280
+ }
1281
+
1282
+ export interface RouteConversion {
1283
+ from: string;
1284
+ to: string;
1285
+ ratio: number;
1286
+ }
1287
+
1288
+ export const OPIOID_EQUIVALENCE_TABLE: OpioidEquivalence[] = [
1289
+ {
1290
+ opioid: 'Morphine',
1291
+ oralMorphineEquivalent: 1,
1292
+ routes: [
1293
+ { from: 'PO', to: 'IV/SC', ratio: 3 }, // 30mg PO = 10mg IV
1294
+ { from: 'PO', to: 'PR', ratio: 1 }
1295
+ ],
1296
+ specialConsiderations: ['Renally cleared (avoid in severe renal impairment)', 'Active metabolites (M6G, M3G)']
1297
+ },
1298
+ {
1299
+ opioid: 'Oxycodone',
1300
+ oralMorphineEquivalent: 1.5, // 20mg oxycodone = 30mg morphine
1301
+ routes: [
1302
+ { from: 'PO', to: 'IV', ratio: 2 }
1303
+ ],
1304
+ specialConsiderations: ['No active metabolites', 'OK in mild-moderate renal impairment']
1305
+ },
1306
+ {
1307
+ opioid: 'Hydromorphone',
1308
+ oralMorphineEquivalent: 4, // 7.5mg PO HM = 30mg PO morphine
1309
+ routes: [
1310
+ { from: 'PO', to: 'IV/SC', ratio: 5 } // 7.5mg PO = 1.5mg IV
1311
+ ],
1312
+ specialConsiderations: ['Preferred in renal impairment', 'Less histamine release', 'Available in high-potency formulations']
1313
+ },
1314
+ {
1315
+ opioid: 'Fentanyl Transdermal',
1316
+ oralMorphineEquivalent: 2.4, // 25mcg/hr patch ≈ 60-90mg oral morphine/24h
1317
+ routes: [
1318
+ { from: 'Transdermal', to: 'IV', ratio: 1 } // mcg/hr patch ≈ mcg/hr IV
1319
+ ],
1320
+ specialConsiderations: ['For stable pain only', 'Not for opioid-naive', '12-24h to steady state', 'Avoid in cachexia (absorption issues)']
1321
+ },
1322
+ {
1323
+ opioid: 'Methadone',
1324
+ oralMorphineEquivalent: -1, // Variable - see conversion table
1325
+ routes: [
1326
+ { from: 'PO', to: 'IV', ratio: 2 }
1327
+ ],
1328
+ specialConsiderations: [
1329
+ 'Complex conversion - specialist required',
1330
+ 'Conversion ratio changes with total daily morphine dose:',
1331
+ '≤30mg morphine: 3:1',
1332
+ '31-99mg: 5:1',
1333
+ '100-299mg: 10:1',
1334
+ '300-499mg: 12:1',
1335
+ '500-999mg: 15:1',
1336
+ '≥1000mg: 20:1',
1337
+ 'Long half-life (15-60h), accumulation risk',
1338
+ 'QTc monitoring required'
1339
+ ]
1340
+ }
1341
+ ];
1342
+
1343
+ // ═══════════════════════════════════════════════════════════════════════════════
1344
+ // PALLIATIVE CARE ENGINE
1345
+ // ═══════════════════════════════════════════════════════════════════════════════
1346
+
1347
+ export class PalliativeCareEngine {
1348
+ assessPain(assessment: PainAssessment): PainManagementProtocol | undefined {
1349
+ // Find matching protocol based on pain type and severity
1350
+ const severity = assessment.intensity <= 3 ? 'Mild' : assessment.intensity <= 6 ? 'Moderate' : 'Severe';
1351
+
1352
+ // Check for neuropathic pain
1353
+ if (assessment.painType.some(t => t.includes('Neuropathic'))) {
1354
+ return NEUROPATHIC_PAIN_PROTOCOLS.find(p => p.severity === severity);
1355
+ }
1356
+
1357
+ // Default to WHO ladder for nociceptive
1358
+ return WHO_PAIN_LADDER.find(p => p.severity === severity);
1359
+ }
1360
+
1361
+ getCIPNProtocol(agent: string): CIPNProtocol | undefined {
1362
+ return CIPN_PROTOCOLS.find(p =>
1363
+ p.causingAgent.toLowerCase().includes(agent.toLowerCase())
1364
+ );
1365
+ }
1366
+
1367
+ getBonePainProtocol(): BonePainProtocol {
1368
+ return BONE_PAIN_PROTOCOL;
1369
+ }
1370
+
1371
+ getSymptomCluster(cancerType: string): SymptomCluster | undefined {
1372
+ return CANCER_SYMPTOM_CLUSTERS.find(c =>
1373
+ cancerType.toLowerCase().includes(c.cancerType.toLowerCase()) ||
1374
+ c.cancerType.toLowerCase().includes(cancerType.toLowerCase())
1375
+ );
1376
+ }
1377
+
1378
+ getEndOfLifeProtocol(phase: EndOfLifeProtocol['phase']): EndOfLifeProtocol | undefined {
1379
+ return END_OF_LIFE_PROTOCOLS.find(p => p.phase === phase);
1380
+ }
1381
+
1382
+ calculateOpioidConversion(
1383
+ fromOpioid: string,
1384
+ fromDose: number,
1385
+ fromRoute: string,
1386
+ toOpioid: string,
1387
+ toRoute: string
1388
+ ): { dose: number; notes: string[] } {
1389
+ const fromEquiv = OPIOID_EQUIVALENCE_TABLE.find(o =>
1390
+ o.opioid.toLowerCase() === fromOpioid.toLowerCase()
1391
+ );
1392
+ const toEquiv = OPIOID_EQUIVALENCE_TABLE.find(o =>
1393
+ o.opioid.toLowerCase() === toOpioid.toLowerCase()
1394
+ );
1395
+
1396
+ if (!fromEquiv || !toEquiv) {
1397
+ return { dose: 0, notes: ['Opioid not found in conversion table'] };
1398
+ }
1399
+
1400
+ // Convert to oral morphine equivalent
1401
+ let morphineEquiv = fromDose * fromEquiv.oralMorphineEquivalent;
1402
+
1403
+ // Adjust for route if parenteral
1404
+ const fromRouteConv = fromEquiv.routes.find(r => r.to === fromRoute || r.from === fromRoute);
1405
+ if (fromRouteConv && fromRoute !== 'PO') {
1406
+ morphineEquiv *= fromRouteConv.ratio;
1407
+ }
1408
+
1409
+ // Convert to new opioid
1410
+ let newDose = morphineEquiv / toEquiv.oralMorphineEquivalent;
1411
+
1412
+ // Adjust for target route
1413
+ const toRouteConv = toEquiv.routes.find(r => r.to === toRoute || r.from === toRoute);
1414
+ if (toRouteConv && toRoute !== 'PO') {
1415
+ newDose /= toRouteConv.ratio;
1416
+ }
1417
+
1418
+ // Apply cross-tolerance reduction (25-50%)
1419
+ const reducedDose = newDose * 0.75; // 25% reduction
1420
+
1421
+ return {
1422
+ dose: Math.round(reducedDose * 10) / 10,
1423
+ notes: [
1424
+ `Calculated from ${fromDose}${fromRoute} ${fromOpioid} to ${toRoute} ${toOpioid}`,
1425
+ '25% reduction applied for cross-tolerance',
1426
+ 'Titrate based on response',
1427
+ ...toEquiv.specialConsiderations
1428
+ ]
1429
+ };
1430
+ }
1431
+
1432
+ getPalliativeSedationProtocol(): PalliativeSedationProtocol {
1433
+ return PALLIATIVE_SEDATION_PROTOCOL;
1434
+ }
1435
+ }
1436
+
1437
+ // Export singleton
1438
+ export const palliativeCareEngine = new PalliativeCareEngine();