General practicals notes from basic presentation to treatments given

Asking for Preferences
Asking for Preferences
Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Reading File
These notes cover the full scope of General Medicine clinical practicals. Here is a quick overview of what is included:

What These Notes Cover

9 major sections structured from presentation → investigations → management:
SectionTopics
Part 1History taking (SOCRATES), ABCDE examination, vital signs
Part 2 - CardiovascularChest pain (ACS, angina, dissection, PE), Heart Failure (HFrEF/HFpEF, 4-pillar therapy), Hypertension (staging, step-wise treatment)
Part 3 - RespiratoryDyspnoea differential, Pneumonia (CURB-65, antibiotics), Asthma (severity grading, BTS steps), COPD (GOLD, AECOPD, oxygen targets)
Part 4 - GIAbdominal pain (regional differentials, clinical signs), Jaundice (pre/hepatic/post-hepatic), Upper GI bleed (Glasgow-Blatchford, management)
Part 5 - NeurologyHeadache (red flags, migraine, SAH, meningitis), Stroke (FAST, syndromes, thrombolysis, thrombectomy), Seizures/Epilepsy (status epilepticus protocol)
Part 6 - EndocrineDiabetes (T1/T2, DKA protocol), Thyroid (hypo/hyperthyroidism, thyroid storm)
Part 7ECG interpretation quick reference, ABG analysis
Part 8Key drugs - indications, side effects, monitoring
Part 9IV fluid types, resuscitation approach
A few key clinical pearls to keep in mind:
  • In COPD, O2 target is 88-92% (not 94-98%) to avoid suppressing hypoxic drive
  • Sodium valproate is contraindicated in women of childbearing age
  • In hypertensive emergencies, do not drop BP >25% in the first hour (risk of infarction)
  • Do not stop long-acting insulin in DKA - continue subcutaneous background insulin throughout

Make a quick reference cheat sheet for common drug doses

Reading File
Reading File
Reading File
Running Command

ls -la /home/daytona/workspace/ 2>/dev/null || echo "workspace empty or not found"

Running Command

mkdir -p /home/daytona/workspace/drug-cheatsheet

Writing File

~/drug-cheatsheet/build.js

const pptxgen = require("pptxgenjs");

const pres = new pptxgen();
pres.layout = "LAYOUT_WIDE"; // 13.3" x 7.5"
pres.title = "General Medicine Drug Doses - Quick Reference";

// ─── COLOUR PALETTE ───────────────────────────────────────────────────────────
const C = {
  navy:    "0D1B2A",
  teal:    "1B6CA8",
  tealLt:  "2390D1",
  green:   "1A7A4A",
  greenLt: "22A35F",
  red:     "B32A2A",
  redLt:   "D63B3B",
  amber:   "B56A00",
  amberLt: "E08C1A",
  purple:  "5C2D91",
  purpleLt:"7B3FB8",
  slate:   "374151",
  slateL:  "6B7280",
  offWhite:"F5F7FA",
  white:   "FFFFFF",
  rowAlt:  "EEF3FA",
  rowBase: "FFFFFF",
  headerBg:"1B4F72",
};

// ─── HELPERS ──────────────────────────────────────────────────────────────────
function hdrRect(slide, x, y, w, h, color) {
  slide.addShape(pres.ShapeType.rect, { x, y, w, h, fill: { color }, line: { color, width: 0 } });
}
function cell(slide, text, x, y, w, h, opts = {}) {
  const {
    bg = C.white, color = C.slate, bold = false, sz = 7.5,
    align = "left", valign = "middle", border = true, italic = false
  } = opts;
  if (bg !== C.white || border) {
    slide.addShape(pres.ShapeType.rect, {
      x, y, w, h,
      fill: { color: bg },
      line: border ? { color: "D1D5DB", width: 0.5 } : { color: bg, width: 0 },
    });
  }
  slide.addText(text, {
    x, y, w, h,
    fontSize: sz, fontFace: "Calibri", color,
    bold, italic, align, valign,
    margin: 3, wrap: true,
  });
}

function sectionLabel(slide, text, x, y, w, color) {
  slide.addShape(pres.ShapeType.rect, { x, y, w, h: 0.26, fill: { color }, line: { color, width: 0 } });
  slide.addText(text, {
    x, y, w, h: 0.26,
    fontSize: 8.5, fontFace: "Calibri", color: C.white,
    bold: true, align: "center", valign: "middle", margin: 2,
  });
}

// Column widths for drug tables: Drug | Dose | Route/Freq | Indication | Notes
const CW = [1.75, 2.0, 1.15, 1.8, 1.8]; // total ~8.5"
function colX(startX, colIdx) {
  let x = startX;
  for (let i = 0; i < colIdx; i++) x += CW[i];
  return x;
}

function tableHeader(slide, startX, y, cols) {
  cols.forEach((label, i) => {
    const x = colX(startX, i);
    slide.addShape(pres.ShapeType.rect, { x, y, w: CW[i], h: 0.24, fill: { color: C.headerBg }, line: { color: C.headerBg, width: 0 } });
    slide.addText(label, { x, y, w: CW[i], h: 0.24, fontSize: 7, fontFace: "Calibri", color: C.white, bold: true, align: "center", valign: "middle", margin: 1 });
  });
}

function tableRow(slide, rowData, startX, y, rowIndex) {
  const bg = rowIndex % 2 === 0 ? C.white : C.rowAlt;
  rowData.forEach((text, i) => {
    const x = colX(startX, i);
    const isNote = i === 4;
    cell(slide, text, x, y, CW[i], 0.235, { bg, sz: isNote ? 6.8 : 7.5, italic: isNote, color: isNote ? C.slateL : C.slate });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 1 - COVER
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  // Full background
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 7.5, fill: { color: C.navy }, line: { color: C.navy, width: 0 } });
  // Accent bar
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 0.08, fill: { color: C.tealLt }, line: { color: C.tealLt, width: 0 } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 7.42, w: 13.3, h: 0.08, fill: { color: C.tealLt }, line: { color: C.tealLt, width: 0 } });

  s.addText("General Medicine", { x: 1, y: 1.6, w: 11.3, h: 0.8, fontSize: 40, fontFace: "Calibri", color: C.tealLt, bold: true, align: "center" });
  s.addText("Common Drug Doses", { x: 1, y: 2.45, w: 11.3, h: 0.8, fontSize: 46, fontFace: "Calibri", color: C.white, bold: true, align: "center" });
  s.addText("QUICK REFERENCE CHEAT SHEET", { x: 1, y: 3.3, w: 11.3, h: 0.45, fontSize: 16, fontFace: "Calibri", color: C.tealLt, bold: true, align: "center", charSpacing: 4 });

  // Pill icons as coloured rectangles
  const tags = [
    ["CARDIOVASCULAR", C.teal],
    ["RESPIRATORY", C.green],
    ["NEUROLOGY", C.purple],
    ["ENDOCRINE", C.amber],
    ["ANTIBIOTICS", C.red],
    ["EMERGENCY", "8B0000"],
  ];
  const tagW = 1.7, tagGap = 0.12;
  const totalW = tags.length * tagW + (tags.length - 1) * tagGap;
  const startX = (13.3 - totalW) / 2;
  tags.forEach(([label, color], i) => {
    const x = startX + i * (tagW + tagGap);
    s.addShape(pres.ShapeType.roundRect, { x, y: 4.2, w: tagW, h: 0.32, fill: { color }, line: { color, width: 0 }, rectRadius: 0.06 });
    s.addText(label, { x, y: 4.2, w: tagW, h: 0.32, fontSize: 7.5, fontFace: "Calibri", color: C.white, bold: true, align: "center", valign: "middle" });
  });

  s.addText("For educational use only. Always verify doses with current formulary and patient-specific factors.", {
    x: 1, y: 6.8, w: 11.3, h: 0.4, fontSize: 8, fontFace: "Calibri", color: "6B7280", italic: true, align: "center"
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 2 - CARDIOVASCULAR DRUGS
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 7.5, fill: { color: C.offWhite }, line: { color: C.offWhite, width: 0 } });

  // Title bar
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 0.5, fill: { color: C.teal }, line: { color: C.teal, width: 0 } });
  s.addText("CARDIOVASCULAR DRUGS", { x: 0.2, y: 0, w: 10, h: 0.5, fontSize: 16, fontFace: "Calibri", color: C.white, bold: true, valign: "middle" });
  s.addText("Slide 2 of 6", { x: 10.3, y: 0, w: 2.8, h: 0.5, fontSize: 9, fontFace: "Calibri", color: "B3CFED", align: "right", valign: "middle" });

  // LEFT COLUMN - ACE Inhibitors / ARBs / ARNIs
  const LX = 0.15;
  const cols = ["Drug", "Standard Dose", "Route/Freq", "Indication", "Key Notes"];

  // Section: ACE Inhibitors
  sectionLabel(s, "ACE INHIBITORS / ARBs / ARNI", LX, 0.56, 8.55, C.teal);
  tableHeader(s, LX, 0.82, cols);
  [
    ["Ramipril", "2.5–10 mg", "PO OD", "HTN, HF, post-MI, DM nephroprotection", "⚠ Hold if K+>5.5 or AKI. Dry cough 10%"],
    ["Enalapril", "2.5–20 mg", "PO BD", "HTN, HFrEF", "Monitor U&E/K+ at 1-2 weeks"],
    ["Lisinopril", "5–40 mg", "PO OD", "HTN, HF, DM", "Avoid in pregnancy (all trimesters)"],
    ["Losartan", "25–100 mg", "PO OD", "HTN, HF (ACEi intolerant), DM nephropathy", "Less cough vs ACEi. Same K+/renal risks"],
    ["Sacubitril/Valsartan", "24/26–97/103 mg", "PO BD", "HFrEF (replace ACEi/ARB)", "Washout 36h from ACEi. Superior mortality benefit"],
  ].forEach((row, i) => tableRow(s, row, LX, 1.06 + i * 0.235, i));

  // Section: Beta-Blockers
  sectionLabel(s, "BETA-BLOCKERS", LX, 2.28, 8.55, C.tealLt);
  tableHeader(s, LX, 2.54, cols);
  [
    ["Bisoprolol", "1.25–10 mg", "PO OD", "HFrEF, HTN, AF rate control", "Titrate slowly in HF. Avoid in asthma/decompensated HF"],
    ["Carvedilol", "3.125–25 mg", "PO BD", "HFrEF, post-MI", "Non-selective; has alpha-blocking effect"],
    ["Metoprolol (succinate)", "12.5–200 mg", "PO OD", "HF, HTN, AF, angina", "Cardioselective. MERIT-HF trial"],
    ["Atenolol", "25–100 mg", "PO OD", "HTN, angina", "Avoid in HF/COPD. Less CNS penetration"],
    ["Propranolol", "10–80 mg", "PO BD–TDS", "Anxiety, thyrotoxicosis, migraine Px, essential tremor", "Non-selective. Crosses BBB. Masks hypoglycaemia"],
  ].forEach((row, i) => tableRow(s, row, LX, 2.78 + i * 0.235, i));

  // Section: Calcium Channel Blockers
  sectionLabel(s, "CALCIUM CHANNEL BLOCKERS", LX, 3.98, 8.55, "145A6E");
  tableHeader(s, LX, 4.24, cols);
  [
    ["Amlodipine", "5–10 mg", "PO OD", "HTN, stable angina", "Peripheral oedema common. Safe in HFpEF"],
    ["Diltiazem", "60–120 mg", "PO TDS (or SR BD)", "AF rate control, angina, HTN", "⚠ Avoid with beta-blocker (heart block)"],
    ["Verapamil", "40–120 mg", "PO TDS", "AF rate control, SVT, cluster headache Px", "⚠ Avoid with beta-blocker. Constipation"],
    ["Nifedipine LA", "30–60 mg", "PO OD", "HTN, Raynaud's, angina", "Do NOT use short-acting for HTN (reflex tachycardia)"],
  ].forEach((row, i) => tableRow(s, row, LX, 4.48 + i * 0.235, i));

  // Section: Diuretics  (right column area, placed below)
  sectionLabel(s, "DIURETICS", LX, 5.43, 8.55, C.slate);
  tableHeader(s, LX, 5.69, cols);
  [
    ["Furosemide", "20–80 mg (up to 500 mg IV in resistant)", "PO/IV OD–BD", "Acute pulmonary oedema, HF, oedema", "Monitor K+/Na+. Ototoxic at high IV doses"],
    ["Spironolactone", "12.5–50 mg", "PO OD", "HFrEF, hyperaldosteronism, ascites", "⚠ K+-sparing. Avoid if K+>5.0. Gynaecomastia"],
    ["Eplerenone", "25–50 mg", "PO OD", "Post-MI HF, HFrEF", "Fewer endocrine SE than spironolactone"],
    ["Indapamide", "1.5 mg SR or 2.5 mg", "PO OD", "HTN (thiazide-like)", "Less metabolic disturbance than HCTZ"],
  ].forEach((row, i) => tableRow(s, row, LX, 5.93 + i * 0.235, i));

  // Footer
  s.addText("⚠ Doses are for average adults with normal renal/hepatic function. Always adjust for patient factors.", {
    x: 0.15, y: 7.3, w: 13, h: 0.18, fontSize: 6.5, fontFace: "Calibri", color: C.redLt, italic: true
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 3 - CARDIOVASCULAR CONT. (Anticoagulants, Antiplatelets, Statins, Anti-arrhythmics)
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 7.5, fill: { color: C.offWhite }, line: { color: C.offWhite, width: 0 } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 0.5, fill: { color: C.teal }, line: { color: C.teal, width: 0 } });
  s.addText("CARDIOVASCULAR DRUGS (cont.) — Antiplatelets, Anticoagulants, Statins, Anti-arrhythmics", { x: 0.2, y: 0, w: 12, h: 0.5, fontSize: 13, fontFace: "Calibri", color: C.white, bold: true, valign: "middle" });
  s.addText("Slide 3 of 6", { x: 10.3, y: 0, w: 2.8, h: 0.5, fontSize: 9, fontFace: "Calibri", color: "B3CFED", align: "right", valign: "middle" });

  const LX = 0.15;
  const cols = ["Drug", "Standard Dose", "Route/Freq", "Indication", "Key Notes"];

  sectionLabel(s, "ANTIPLATELETS", LX, 0.56, 8.55, C.red);
  tableHeader(s, LX, 0.82, cols);
  [
    ["Aspirin", "75 mg (maintenance) / 300 mg loading", "PO OD", "ACS secondary prevention, AF (rare now), stroke", "Loading 300 mg for ACS. GI protection with PPI"],
    ["Clopidogrel", "75 mg (maint) / 300–600 mg load", "PO OD", "ACS, post-PCI, stroke/TIA (non-cardioembolic)", "Prodrug – CYP2C19 metabolism. Avoid with PPIs if possible"],
    ["Ticagrelor", "90 mg BD (maint) / 180 mg load", "PO BD", "ACS (preferred over clopidogrel for ACS)", "Dyspnoea SE. Reversible binding (holds advantage over clopidogrel in surgery)"],
    ["Prasugrel", "5–10 mg OD (10 mg if >60 kg)", "PO OD", "ACS with PCI (especially STEMI)", "⚠ Contraindicated if prior TIA/stroke, age ≥75, weight <60 kg"],
    ["Dipyridamole MR", "200 mg BD", "PO BD", "Stroke/TIA prevention (with aspirin)", "Headache common at start. Avoid in unstable angina"],
  ].forEach((row, i) => tableRow(s, row, LX, 1.06 + i * 0.235, i));

  sectionLabel(s, "ANTICOAGULANTS", LX, 2.28, 8.55, "7B0D1E");
  tableHeader(s, LX, 2.54, cols);
  [
    ["Warfarin", "Dose variable (INR guided, start 5–10 mg)", "PO OD", "AF, mechanical valves, VTE treatment/Px", "Target INR 2–3 (AF/VTE); 2.5–3.5 (metallic valves). Many interactions"],
    ["Apixaban", "5 mg BD (2.5 mg BD if ≥2 of: age≥80, wt≤60kg, Cr≥133)", "PO BD", "AF, VTE Tx/Px", "Hold if eGFR <15. No routine monitoring. Less bleeding vs warfarin"],
    ["Rivaroxaban", "20 mg OD (with evening meal) for AF; 15 mg BD x21d then 20 mg for VTE", "PO OD/BD", "AF, DVT/PE treatment and prevention", "Renal dose adj if eGFR <50. Take with food"],
    ["Edoxaban", "60 mg OD (30 mg if eGFR 15-50 or wt≤60 kg)", "PO OD", "AF, VTE", "Reduce dose in renal impairment or low weight"],
    ["LMWH (Enoxaparin)", "Treatment: 1 mg/kg SC BD. Prophylaxis: 40 mg SC OD", "SC", "DVT/PE treatment, surgical prophylaxis, ACS bridging", "Reduce dose if eGFR <30. Monitor anti-Xa if obese/pregnant/renal"],
    ["UFH (Unfractionated)", "IV 5000 U bolus then 18 U/kg/h infusion (aPTT guided)", "IV infusion", "STEMI (PCI), PE with instability, reversal with protamine needed", "Reverse with protamine sulphate. Short half-life – useful peri-op"],
  ].forEach((row, i) => tableRow(s, row, LX, 2.78 + i * 0.235, i));

  sectionLabel(s, "STATINS", LX, 4.22, 8.55, C.purple);
  tableHeader(s, LX, 4.48, cols);
  [
    ["Atorvastatin", "10–80 mg", "PO nocte", "CVD primary/secondary prevention, HF, post-ACS (80 mg)", "High-intensity. Most commonly used. Take at night"],
    ["Rosuvastatin", "5–40 mg", "PO OD", "High CVD risk, familial hypercholesterolaemia", "High-intensity. Fewer myopathy interactions vs atorvastatin"],
    ["Simvastatin", "10–40 mg (max 80 mg – avoid due to myopathy risk)", "PO nocte", "CVD prevention", "⚠ Multiple drug interactions (diltiazem, amiodarone). Now rarely first-line"],
  ].forEach((row, i) => tableRow(s, row, LX, 4.72 + i * 0.235, i));

  sectionLabel(s, "ANTI-ARRHYTHMICS", LX, 5.42, 8.55, "4B2067");
  tableHeader(s, LX, 5.68, cols);
  [
    ["Amiodarone", "200 mg TDS x1 wk → 200 mg BD x1 wk → 200 mg OD. IV: 300 mg over 20–60 min", "PO/IV", "AF, VT, VF (cardiac arrest)", "⚠ Thyroid, pulmonary, hepatic toxicity. TFTs/LFTs/CXR every 6 months. Photosensitivity"],
    ["Digoxin", "62.5–250 mcg OD (loading: 250–500 mcg, then 125–250 mcg)", "PO OD", "AF rate control (especially HF), HF with AF", "Narrow TI. Toxic if K+ low. Level 1–2 nmol/L. Bradycardia, N&V, visual changes"],
    ["Flecainide", "50–150 mg BD", "PO BD", "AF rhythm control, SVT", "⚠ Avoid post-MI or structural heart disease (pro-arrhythmic). Pill-in-pocket for paroxysmal AF"],
    ["Adenosine", "6 mg IV rapid bolus → 12 mg → 12 mg (with flush)", "IV rapid bolus", "SVT (diagnostic + treatment)", "Very short half-life (<10 s). Chest tightness/bronchospasm. Contraindicated in asthma → use verapamil"],
  ].forEach((row, i) => tableRow(s, row, LX, 5.92 + i * 0.235, i));

  s.addText("⚠ Doses are for average adults with normal renal/hepatic function. Always adjust for patient factors.", {
    x: 0.15, y: 7.3, w: 13, h: 0.18, fontSize: 6.5, fontFace: "Calibri", color: C.redLt, italic: true
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 4 - RESPIRATORY + NEUROLOGY DRUGS
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 7.5, fill: { color: C.offWhite }, line: { color: C.offWhite, width: 0 } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 0.5, fill: { color: C.green }, line: { color: C.green, width: 0 } });
  s.addText("RESPIRATORY + NEUROLOGY DRUGS", { x: 0.2, y: 0, w: 10, h: 0.5, fontSize: 15, fontFace: "Calibri", color: C.white, bold: true, valign: "middle" });
  s.addText("Slide 4 of 6", { x: 10.3, y: 0, w: 2.8, h: 0.5, fontSize: 9, fontFace: "Calibri", color: "A3CFAA", align: "right", valign: "middle" });

  const LX = 0.15;
  const cols = ["Drug", "Standard Dose", "Route/Freq", "Indication", "Key Notes"];

  // RESPIRATORY
  sectionLabel(s, "BRONCHODILATORS — RESPIRATORY", LX, 0.56, 8.55, C.green);
  tableHeader(s, LX, 0.82, cols);
  [
    ["Salbutamol (SABA)", "100–200 mcg (2–4 puffs) PRN. Neb: 2.5–5 mg", "Inhaler/Neb", "Asthma/COPD relief, acute asthma", "⚠ Tachycardia, hypokalaemia (high doses/nebs). Continuous neb in severe asthma"],
    ["Ipratropium (SAMA)", "Neb: 250–500 mcg QDS. MDI: 20–40 mcg TDS–QDS", "Inhaler/Neb", "COPD, acute asthma adjunct", "Additive effect with salbutamol. Caution in glaucoma/urinary retention"],
    ["Salmeterol (LABA)", "50 mcg BD (in ICS/LABA combo)", "Inhaler BD", "Asthma step 3+ (with ICS), COPD maintenance", "⚠ Never use without ICS in asthma. Vilanterol, formoterol similar"],
    ["Tiotropium (LAMA)", "18 mcg OD (Handihaler) or 2.5 mcg (Respimat)", "Inhaler OD", "COPD maintenance (first-line)", "Reduces exacerbations. Dry mouth, urinary retention"],
    ["Beclometasone (ICS)", "100–400 mcg BD (low–high dose ranges vary by device)", "Inhaler BD", "Asthma step 2+ maintenance", "Rinse mouth after use (prevent oral candidiasis)"],
    ["Prednisolone", "30–50 mg OD x 5 days (acute); chronic varies", "PO OD", "Acute asthma, AECOPD, allergic reactions, IBD, RA, vasculitis", "Monitor glucose/BP. Adrenal suppression >3 weeks. Bone protection if long-term"],
    ["Magnesium Sulphate", "2 g in 100 mL 0.9% NaCl over 20 min IV (single dose)", "IV", "Severe/life-threatening acute asthma (refractory to nebulisers)", "Bronchodilator + anti-inflammatory. Monitor BP during infusion"],
    ["Montelukast (LTRA)", "10 mg OD", "PO nocte", "Asthma step 3 add-on, allergic rhinitis", "⚠ Neuropsychiatric SE reported (anxiety, suicidal ideation) – counsel patient"],
  ].forEach((row, i) => tableRow(s, row, LX, 1.06 + i * 0.235, i));

  // NEUROLOGY
  sectionLabel(s, "NEUROLOGY — SEIZURES / HEADACHE / STROKE", LX, 3.02, 8.55, C.purple);
  tableHeader(s, LX, 3.28, cols);
  [
    ["Lorazepam", "4 mg IV/IM or buccal (max 2 doses)", "IV/IM/buccal", "Status epilepticus (1st line)", "Give slowly IV. Respiratory depression risk. Have resuscitation ready"],
    ["Midazolam", "10 mg buccal/IM (IM in community, buccal in hospital)", "Buccal/IM", "SE 1st line (if no IV access)", "Buccal preferred in paediatrics/community"],
    ["Levetiracetam", "60 mg/kg IV over 15 min (max 4.5 g) for SE. Maintenance: 500–1500 mg BD", "IV/PO BD", "SE 2nd line, focal epilepsy, generalised epilepsy", "Few drug interactions. Mood/behavioural SE. Safe in renal (dose adj required)"],
    ["Sodium Valproate", "SE: 40 mg/kg IV over 15 min. Oral: 500–2000 mg/day in divided doses", "IV/PO BD–TDS", "Generalised epilepsy, JME, SE (2nd line)", "⚠ Major teratogen – AVOID in women of childbearing potential (VALPROATE PREGNANCY PREVENTION PROGRAMME)"],
    ["Lamotrigine", "Start 25 mg OD x2 wks, titrate slowly to 100–200 mg BD", "PO BD", "Focal epilepsy, Generalised, bipolar disorder", "⚠ Slow titration mandatory (Stevens-Johnson syndrome risk if escalated quickly)"],
    ["Carbamazepine", "100–200 mg BD titrated to 400–1200 mg/day", "PO BD", "Focal epilepsy, trigeminal neuralgia", "⚠ Induces CYP450. Aplastic anaemia (rare). Hyponatraemia. Many interactions"],
    ["Sumatriptan", "50–100 mg PO or 6 mg SC or 10–20 mg nasal", "PO/SC/nasal", "Acute migraine, acute cluster headache (SC)", "Do NOT use within 24h of ergotamine. SC fastest onset for cluster"],
    ["Alteplase (tPA)", "0.9 mg/kg IV (max 90 mg); 10% as bolus, rest over 60 min", "IV infusion", "Ischaemic stroke <4.5h from onset", "⚠ Strict BP control (<185/110 before). Multiple contraindications. Risk of haemorrhagic transformation"],
  ].forEach((row, i) => tableRow(s, row, LX, 3.52 + i * 0.235, i));

  s.addText("⚠ Doses are for average adults with normal renal/hepatic function. Always adjust for patient factors.", {
    x: 0.15, y: 7.3, w: 13, h: 0.18, fontSize: 6.5, fontFace: "Calibri", color: C.redLt, italic: true
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 5 - ENDOCRINE + GI DRUGS
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 7.5, fill: { color: C.offWhite }, line: { color: C.offWhite, width: 0 } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 0.5, fill: { color: C.amber }, line: { color: C.amber, width: 0 } });
  s.addText("ENDOCRINE + GASTROINTESTINAL DRUGS", { x: 0.2, y: 0, w: 10, h: 0.5, fontSize: 15, fontFace: "Calibri", color: C.white, bold: true, valign: "middle" });
  s.addText("Slide 5 of 6", { x: 10.3, y: 0, w: 2.8, h: 0.5, fontSize: 9, fontFace: "Calibri", color: "F5DFA0", align: "right", valign: "middle" });

  const LX = 0.15;
  const cols = ["Drug", "Standard Dose", "Route/Freq", "Indication", "Key Notes"];

  sectionLabel(s, "DIABETES DRUGS", LX, 0.56, 8.55, C.amber);
  tableHeader(s, LX, 0.82, cols);
  [
    ["Metformin", "500 mg OD–BD initially; titrate to 1000 mg BD (max 3g/day)", "PO OD–BD with food", "T2DM first-line (if eGFR ≥30)", "⚠ Hold if eGFR <30, contrast, surgery, illness (sick-day rules). GI SE – take with food. B12 deficiency long-term"],
    ["Empagliflozin (SGLT2i)", "10–25 mg OD", "PO OD (morning)", "T2DM + CVD/HF/CKD, HFrEF (even without DM), HFpEF", "⚠ Hold during illness/surgery (DKA risk). Genital infections. NOT for eGFR <20 for glucose lowering"],
    ["Dapagliflozin (SGLT2i)", "10 mg OD", "PO OD", "T2DM, HFrEF, HFpEF, CKD protection", "Same class as empagliflozin. Euglycaemic DKA risk"],
    ["Semaglutide (GLP-1 RA)", "PO: 3–14 mg OD. SC: 0.25–1 mg weekly (Ozempic). 2.4 mg weekly (Wegovy – obesity)", "PO OD or SC weekly", "T2DM + obesity/CVD, obesity treatment", "GI SE (nausea, vomiting) – start low. Pancreatitis risk. Weight loss benefit"],
    ["Liraglutide (GLP-1 RA)", "0.6 mg SC OD x1 wk → 1.2 mg → 1.8 mg OD", "SC OD", "T2DM + CVD risk, obesity (3 mg Saxenda)", "LEADER trial: reduced CV events. Pancreatitis, gallstones"],
    ["Sitagliptin (DPP-4i)", "100 mg OD (50 mg if eGFR 30–50; 25 mg if eGFR <30)", "PO OD", "T2DM add-on (weight neutral)", "Well tolerated. Nasopharyngitis, URTI. No hypoglycaemia risk alone"],
    ["Gliclazide (SU)", "40–320 mg OD–BD (MR: 30–120 mg OD)", "PO OD–BD", "T2DM (when other agents not suitable)", "⚠ Hypoglycaemia risk. Weight gain. Safer SU than glibenclamide in elderly"],
    ["Insulin Glargine/Detemir", "0.1–0.2 units/kg/day SC initially; titrate to FBG", "SC OD (nocte)", "T1DM basal, T2DM add-on", "Flat peakless profile. Titrate by 2 units every 3 days to FBG target 4–7 mmol/L"],
    ["Insulin Aspart/Lispro", "4–10 units SC with meals (titrate to post-prandial BG)", "SC with meals", "T1DM bolus, T2DM mealtime", "Inject immediately before or with meal. May give after eating in uncertain intake"],
  ].forEach((row, i) => tableRow(s, row, LX, 1.06 + i * 0.235, i));

  sectionLabel(s, "THYROID DRUGS", LX, 3.21, 8.55, "7B4F00");
  tableHeader(s, LX, 3.47, cols);
  [
    ["Levothyroxine (T4)", "Start 25–50 mcg OD (1.6 mcg/kg ideal), titrate to TSH", "PO OD (empty stomach)", "Hypothyroidism", "Start low in elderly/IHD (25 mcg). Check TSH every 6–8 wk until stable, then 6–12 monthly"],
    ["Carbimazole", "20–40 mg OD initially; maintenance 5–15 mg OD", "PO OD", "Hyperthyroidism (Graves', toxic nodule)", "⚠ Agranulocytosis (sore throat = STOP + urgent FBC). LFTs. First-trimester: use PTU"],
    ["Propylthiouracil (PTU)", "200–400 mg/day in divided doses initially", "PO BD–TDS", "Hyperthyroidism (1st trimester pregnancy, thyroid storm)", "⚠ Hepatotoxicity (monitor LFTs). Agranulocytosis risk. Block-replace regimen in thyroid storm"],
  ].forEach((row, i) => tableRow(s, row, LX, 3.71 + i * 0.235, i));

  sectionLabel(s, "GI DRUGS — PPI, ANTIEMETICS, LAXATIVES", LX, 4.41, 8.55, C.green);
  tableHeader(s, LX, 4.67, cols);
  [
    ["Omeprazole (PPI)", "20–40 mg OD. IV: 80 mg bolus + 8 mg/h (UGIB)", "PO OD (before food) / IV", "GORD, PUD, H. pylori eradication, UGIB, aspirin/NSAID gastroprotection", "⚠ Avoid long-term without indication (C. diff risk, hypomagnesaemia, B12 deficiency)"],
    ["Metoclopramide", "10 mg TDS (max 5 days)", "PO/IV/IM TDS", "Nausea/vomiting, gastroparesis, migraine adjunct", "⚠ Extrapyramidal SE (dystonia esp. young females). Max 5 days. Avoid in Parkinson's"],
    ["Ondansetron", "4–8 mg TDS", "PO/IV/IM TDS", "Chemotherapy-induced N&V, post-op N&V, hospital N&V", "⚠ QT prolongation (check ECG + K+). Constipation. 5-HT3 antagonist"],
    ["Cyclizine", "50 mg TDS", "PO/IV/IM TDS", "N&V (including vestibular, post-op, opioid-induced)", "Sedating. Anticholinergic SE. Safe in pregnancy"],
    ["Lactulose", "15–30 mL BD (titrate)", "PO BD", "Constipation, hepatic encephalopathy (lactulose 3–4 soft stools/day)", "May take 48h to work. Flatulence. High dose in HE to trap NH3"],
    ["Senna", "7.5–15 mg OD–BD", "PO nocte", "Constipation (stimulant laxative)", "Works overnight. Avoid in bowel obstruction"],
  ].forEach((row, i) => tableRow(s, row, LX, 4.91 + i * 0.235, i));

  s.addText("⚠ Doses are for average adults with normal renal/hepatic function. Always adjust for patient factors.", {
    x: 0.15, y: 7.3, w: 13, h: 0.18, fontSize: 6.5, fontFace: "Calibri", color: C.redLt, italic: true
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 6 - ANTIBIOTICS + EMERGENCY DRUGS
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 7.5, fill: { color: C.offWhite }, line: { color: C.offWhite, width: 0 } });
  s.addShape(pres.ShapeType.rect, { x: 0, y: 0, w: 13.3, h: 0.5, fill: { color: C.red }, line: { color: C.red, width: 0 } });
  s.addText("ANTIBIOTICS + EMERGENCY / RESUSCITATION DRUGS", { x: 0.2, y: 0, w: 10, h: 0.5, fontSize: 14, fontFace: "Calibri", color: C.white, bold: true, valign: "middle" });
  s.addText("Slide 6 of 6", { x: 10.3, y: 0, w: 2.8, h: 0.5, fontSize: 9, fontFace: "Calibri", color: "F5B8B8", align: "right", valign: "middle" });

  const LX = 0.15;
  const cols = ["Drug", "Standard Dose", "Route/Freq", "Indication", "Key Notes"];

  sectionLabel(s, "COMMON ANTIBIOTICS", LX, 0.56, 8.55, C.red);
  tableHeader(s, LX, 0.82, cols);
  [
    ["Amoxicillin", "500 mg TDS. High dose: 1 g TDS. IV: 1 g TDS", "PO/IV TDS", "CAP (mild), UTI, otitis media, sinusitis, strep throat", "Penicillin. Check allergy. Rash if given in EBV (glandular fever)"],
    ["Co-amoxiclav (Augmentin)", "625 mg TDS PO or 1.2 g TDS IV", "PO/IV TDS", "CAP (moderate-severe), UTI, abdominal infections, cellulitis", "Cholestatic hepatitis risk (with/after use). Broad spectrum penicillin + BLI"],
    ["Piperacillin-Tazobactam (Tazocin)", "4.5 g IV every 6–8h (q6h for severe sepsis)", "IV q6–8h", "HAP, severe sepsis, intra-abdominal, Pseudomonas cover", "Broad spectrum. Add vancomycin/teicoplanin for MRSA cover"],
    ["Clarithromycin", "250–500 mg BD PO or IV", "PO/IV BD", "Atypical pneumonia (Mycoplasma, Legionella), CAP (add-on), H. pylori, skin infections (penicillin allergy)", "⚠ QT prolongation. CYP3A4 inhibitor (many interactions – statins, warfarin). GI SE"],
    ["Doxycycline", "100–200 mg OD (loading 200 mg)", "PO OD", "CAP (mild, PCN allergy), Chlamydia, LRTI, Lyme disease, malaria prophylaxis", "Take upright with water (oesophageal ulceration). Photosensitivity. Avoid in pregnancy/children <8y"],
    ["Trimethoprim", "200 mg BD x 7 days", "PO BD", "Uncomplicated lower UTI", "Folate antagonist – caution in pregnancy. Check local resistance patterns"],
    ["Nitrofurantoin", "50 mg QDS x 5–7 days (or 100 mg MR BD)", "PO QDS/BD", "Lower UTI (not upper – does not achieve therapeutic renal tissue levels)", "⚠ Avoid if eGFR <30 (ineffective + toxic). Pulmonary SE with long-term use"],
    ["Ceftriaxone", "1–2 g IV OD (2 g for meningitis/serious infections)", "IV OD", "Meningitis (with amoxicillin for Listeria cover), severe CAP, spontaneous bacterial peritonitis, gonorrhoea", "3rd gen cephalosporin. Biliary sludge with prolonged use. Avoid in hyperbilirubinaemia (neonates)"],
    ["Metronidazole", "400 mg TDS PO or 500 mg TDS IV", "PO/IV TDS", "Anaerobic infections, C. diff (oral, 2nd line), intra-abdominal, pelvic, dental infections", "⚠ Disulfiram reaction with alcohol. Peripheral neuropathy (prolonged use). Metallic taste"],
    ["Vancomycin", "15–20 mg/kg IV BD (AUC-guided dosing preferred)", "IV BD (infuse over ≥60 min)", "MRSA, C. diff (oral PO only for colitis), line infections, endocarditis (staph)", "⚠ Nephrotoxic + ototoxic. Red man syndrome if rapid infusion. Therapeutic drug monitoring required"],
  ].forEach((row, i) => tableRow(s, row, LX, 1.06 + i * 0.235, i));

  sectionLabel(s, "EMERGENCY / RESUSCITATION DRUGS", LX, 3.46, 8.55, "8B0000");
  tableHeader(s, LX, 3.72, cols);
  [
    ["Adrenaline (Epinephrine)", "Cardiac arrest: 1 mg IV every 3–5 min. Anaphylaxis: 0.5 mg (500 mcg) IM (thigh)", "IV / IM", "Cardiac arrest (PEA/asystole/VF), anaphylaxis, severe asthma", "IM adrenaline for anaphylaxis: use anterolateral thigh. Auto-injector: 0.3–0.5 mg. IV for cardiac arrest only"],
    ["Atropine", "0.5–1 mg IV (repeat to max 3 mg). Bradycardia: 0.6–1.2 mg", "IV", "Symptomatic bradycardia, organophosphate poisoning, pre-op antisialagogue", "Cholinergic blockade. Tachycardia, dry mouth, urinary retention, blurred vision"],
    ["GTN (Glyceryl trinitrate)", "0.4 mg sublingual spray PRN. IV: 1–10 mg/h infusion", "SL / IV infusion", "Acute angina, ACS pain relief, acute hypertensive emergency, pulmonary oedema", "⚠ Hypotension – have patient sitting/lying. Do NOT use if systolic BP <90 or if PDE5 inhibitor taken in 24–48h"],
    ["Naloxone", "0.4–2 mg IV/IM/SC; repeat every 2–3 min until respiratory rate improves (max 10 mg)", "IV/IM/SC", "Opioid overdose (respiratory depression)", "Short half-life (<45 min) – may need repeated doses or infusion (opioid lasts longer). Precipitates withdrawal"],
    ["Flumazenil", "200 mcg IV over 15 sec; repeat 100 mcg every 60 sec to max 1 mg", "IV", "Benzodiazepine overdose reversal", "⚠ Short half-life – re-sedation likely. Can precipitate seizures in BZD-dependent patients. NOT routine in OD"],
    ["Hydrocortisone", "100–200 mg IV QDS (acute adrenal crisis). 100 mg IV pre-op (at-risk patients)", "IV QDS", "Addisonian crisis, severe asthma, anaphylaxis (2nd line), hypercalcaemia (lymphoma)", "Give with saline in Addisonian crisis. Switch to oral once stable"],
    ["Dextrose (Glucose)", "50 mL of 50% glucose IV (or 150 mL of 20% glucose)", "IV bolus", "Severe hypoglycaemia (unconscious patient)", "Flush cannula well after 50% glucose (irritant). Repeat BG in 15 min. Follow with snack once conscious"],
    ["Glucagon", "1 mg IM/SC/IV", "IM/SC", "Severe hypoglycaemia (no IV access), beta-blocker overdose", "Effects take 10–15 min. N&V common. Give carbohydrate once conscious. Limited glycogen stores in fasting/alcohol"],
  ].forEach((row, i) => tableRow(s, row, LX, 3.96 + i * 0.235, i));

  s.addText("⚠ Doses are for average adults with normal renal/hepatic function. Always adjust for patient factors.", {
    x: 0.15, y: 7.3, w: 13, h: 0.18, fontSize: 6.5, fontFace: "Calibri", color: C.redLt, italic: true
  });
}

// ──────────────────────────────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/drug-cheatsheet/GenMed_Drug_Doses_CheatSheet.pptx" })
  .then(() => console.log("DONE: GenMed_Drug_Doses_CheatSheet.pptx created"))
  .catch(e => { console.error("ERROR:", e); process.exit(1); });
Running Command

cd /home/daytona/workspace/drug-cheatsheet && node build.js 2>&1

Your cheat sheet is ready:

GenMed Drug Doses CheatSheet

Presentation · PPTX


Here is what is inside (6 slides, widescreen format):
SlideContent
1 - CoverTitle slide with colour-coded category tags
2 - CardiovascularACE inhibitors/ARBs/ARNI, Beta-blockers, Calcium channel blockers, Diuretics
3 - Cardiovascular cont.Antiplatelets (aspirin, clopidogrel, ticagrelor, prasugrel), Anticoagulants (warfarin, DOACs, heparin), Statins, Anti-arrhythmics (amiodarone, digoxin, flecainide, adenosine)
4 - Respiratory + NeurologyBronchodilators (SABA/SAMA/LABA/LAMA/ICS), steroids, magnesium sulphate, montelukast; seizure drugs (lorazepam, levetiracetam, valproate, lamotrigine, carbamazepine), sumatriptan, alteplase
5 - Endocrine + GIDiabetes drugs (metformin, SGLT2i, GLP-1 RA, DPP-4i, sulfonylureas, insulins), thyroid drugs (levothyroxine, carbimazole, PTU), PPIs, antiemetics, laxatives
6 - Antibiotics + EmergencyCommon antibiotics (amoxicillin, co-amoxiclav, Tazocin, clarithromycin, doxycycline, ceftriaxone, vancomycin, etc.); Emergency drugs (adrenaline, atropine, GTN, naloxone, flumazenil, glucose, glucagon)
Each row shows: Drug | Standard Dose | Route/Freq | Indication | Key Notes (warnings/monitoring) - with warning symbols (⚠) on the most important safety points.

Build a drug interaction quick reference (statins + macrolides, ACE + NSAIDs, etc.)

Reading File
Writing File

~/drug-cheatsheet/interactions.js

const pptxgen = require("pptxgenjs");

const pres = new pptxgen();
pres.layout = "LAYOUT_WIDE"; // 13.3" x 7.5"
pres.title = "Drug Interactions Quick Reference";

// ─── COLOUR PALETTE ───────────────────────────────────────────────────────────
const C = {
  // Severity colours
  contraindicated: "8B0000",  // deep red
  ciLight:         "FDECEA",
  serious:         "C0392B",  // red
  serLight:        "FDECEA",
  major:           "D35400",  // dark orange
  majLight:        "FEF0E6",
  moderate:        "B7770D",  // amber
  modLight:        "FEF9E7",
  monitor:         "1A6B3C",  // green
  monLight:        "EAF6EE",
  // UI
  navy:    "0D1B2A",
  teal:    "1B5E8C",
  slate:   "374151",
  slateL:  "6B7280",
  offWhite:"F4F6F9",
  white:   "FFFFFF",
  rowAlt:  "F0F4FA",
  hdrBg:   "1B3A5C",
  hdrText: "FFFFFF",
  subHdr:  "2563EB",
};

// Severity config
const SEV = {
  X: { label: "CONTRAINDICATED", bg: "8B0000",  light: "FDECEA", text: "FFFFFF" },
  S: { label: "SERIOUS",         bg: "C0392B",  light: "FDECEA", text: "FFFFFF" },
  M: { label: "MAJOR",           bg: "D35400",  light: "FEF0E6", text: "FFFFFF" },
  W: { label: "MODERATE",        bg: "B7770D",  light: "FEF9E7", text: "FFFFFF" },
  O: { label: "MONITOR",         bg: "1A6B3C",  light: "EAF6EE", text: "FFFFFF" },
};

// ─── HELPERS ──────────────────────────────────────────────────────────────────
function bg(slide, x, y, w, h, color, rounded = false) {
  slide.addShape(rounded ? pres.ShapeType.roundRect : pres.ShapeType.rect, {
    x, y, w, h,
    fill: { color },
    line: { color, width: 0 },
    ...(rounded ? { rectRadius: 0.05 } : {}),
  });
}

function txt(slide, text, x, y, w, h, opts = {}) {
  const { color = C.slate, sz = 7.5, bold = false, italic = false, align = "left", valign = "middle", margin = 3, wrap = true } = opts;
  slide.addText(text, { x, y, w, h, fontSize: sz, fontFace: "Calibri", color, bold, italic, align, valign, margin, wrap });
}

function titleBar(slide, title, sub, color) {
  bg(slide, 0, 0, 13.3, 0.52, color);
  txt(slide, title, 0.18, 0, 9.5, 0.52, { color: C.white, sz: 15, bold: true, valign: "middle" });
  txt(slide, sub, 9.8, 0, 3.3, 0.52, { color: "C5D8F0", sz: 9, align: "right", valign: "middle" });
}

function severityBadge(slide, sev, x, y) {
  const cfg = SEV[sev];
  bg(slide, x, y + 0.01, 1.05, 0.2, cfg.bg, true);
  txt(slide, cfg.label, x, y + 0.01, 1.05, 0.2, { color: cfg.text, sz: 5.8, bold: true, align: "center", margin: 1 });
}

// Column layout: Drug A | Drug B | Severity badge | Mechanism | Effect | Management
// Widths:         1.5      1.4       1.1              2.3          2.3       2.45   = 11.05 + 0.15 margins = ~13.2"
const SX = 0.12; // start x
const CW = [1.5, 1.4, 1.1, 2.35, 2.35, 2.45];

function cx(col) {
  let x = SX;
  for (let i = 0; i < col; i++) x += CW[i];
  return x;
}

const HDR_COLS = ["Drug A", "Drug B", "Severity", "Mechanism", "Clinical Effect", "Management"];

function tableHeader(slide, y) {
  HDR_COLS.forEach((label, i) => {
    bg(slide, cx(i), y, CW[i], 0.22, C.hdrBg);
    txt(slide, label, cx(i), y, CW[i], 0.22, { color: C.hdrText, sz: 7.2, bold: true, align: "center", margin: 1 });
  });
}

function interactionRow(slide, data, y, rowIdx) {
  // data = [drugA, drugB, severity, mechanism, effect, management]
  const [drugA, drugB, sev, mech, effect, mgmt] = data;
  const rowBg = rowIdx % 2 === 0 ? C.white : C.rowAlt;
  const cfg = SEV[sev];
  const RH = 0.25;

  // Background
  CW.forEach((w, i) => {
    const cellBg = i === 2 ? cfg.light : rowBg;
    bg(slide, cx(i), y, w, RH, cellBg);
    // border line
    slide.addShape(pres.ShapeType.line, { x: cx(i), y: y + RH, w: w, h: 0, line: { color: "D1D5DB", width: 0.5 } });
  });

  // Drug A
  txt(slide, drugA, cx(0), y, CW[0], RH, { sz: 7.8, bold: true, color: C.navy, margin: 3 });
  // Drug B
  txt(slide, drugB, cx(1), y, CW[1], RH, { sz: 7.8, bold: true, color: C.teal, margin: 3 });
  // Severity badge
  severityBadge(slide, sev, cx(2) + 0.03, y + 0.025);
  // Mechanism
  txt(slide, mech, cx(3), y, CW[3], RH, { sz: 7, italic: true, color: C.slateL, margin: 3 });
  // Effect
  txt(slide, effect, cx(4), y, CW[4], RH, { sz: 7.3, color: C.slate, margin: 3 });
  // Management
  txt(slide, mgmt, cx(5), y, CW[5], RH, { sz: 7.3, bold: false, color: "1A3A1A", margin: 3 });
}

function sectionDivider(slide, label, y, color) {
  bg(slide, SX, y, 13.06, 0.21, color);
  txt(slide, label, SX + 0.1, y, 12.8, 0.21, { color: C.white, sz: 8, bold: true, valign: "middle", charSpacing: 1 });
}

function footer(slide) {
  txt(slide, "For educational use only. Severity ratings based on pharmacological principles and clinical guidelines. Always verify with current BNF/local formulary.", 0.12, 7.33, 13, 0.16, { sz: 6.2, italic: true, color: C.slateL });
}

function legendBar(slide, y) {
  const items = [
    ["X", "CONTRAINDICATED"],
    ["S", "SERIOUS"],
    ["M", "MAJOR"],
    ["W", "MODERATE"],
    ["O", "MONITOR"],
  ];
  txt(slide, "SEVERITY KEY:", 0.12, y, 1.2, 0.22, { sz: 7, bold: true, color: C.slate });
  items.forEach(([key, label], i) => {
    const cfg = SEV[key];
    const x = 1.3 + i * 2.35;
    bg(slide, x, y + 0.02, 1.1, 0.19, cfg.bg, true);
    txt(slide, cfg.label, x, y + 0.02, 1.1, 0.19, { color: cfg.text, sz: 6.5, bold: true, align: "center", margin: 1 });
  });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 1 — COVER
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  bg(s, 0, 0, 13.3, 7.5, C.navy);
  bg(s, 0, 0, 13.3, 0.07, "2563EB");
  bg(s, 0, 7.43, 13.3, 0.07, "2563EB");

  // Decorative diagonal accent band
  s.addShape(pres.ShapeType.rect, { x: 8.8, y: 0, w: 4.5, h: 7.5, fill: { color: "0F2744" }, line: { color: "0F2744", width: 0 } });

  txt(s, "DRUG INTERACTIONS", 0.8, 1.3, 8, 1.0, { color: "60A5FA", sz: 38, bold: true, align: "left" });
  txt(s, "Quick Reference", 0.8, 2.28, 8, 0.75, { color: C.white, sz: 44, bold: true, align: "left" });
  txt(s, "FOR CLINICAL MEDICAL STUDENTS", 0.8, 3.1, 8, 0.4, { color: "93C5FD", sz: 13, bold: true, align: "left", charSpacing: 3 });

  // Severity legend on cover
  const sevItems = [
    ["CONTRAINDICATED", "8B0000"],
    ["SERIOUS",         "C0392B"],
    ["MAJOR",           "D35400"],
    ["MODERATE",        "B7770D"],
    ["MONITOR",         "1A6B3C"],
  ];
  txt(s, "SEVERITY SCALE", 0.8, 3.8, 8, 0.28, { color: "93C5FD", sz: 9, bold: true, charSpacing: 2 });
  sevItems.forEach(([label, color], i) => {
    bg(s, 0.8 + i * 1.5, 4.08, 1.38, 0.28, color, true);
    txt(s, label, 0.8 + i * 1.5, 4.08, 1.38, 0.28, { color: C.white, sz: 6.5, bold: true, align: "center", margin: 1 });
  });

  // Slide list
  const slides = [
    ["2", "CYP450 Drug Interactions",           "2563EB"],
    ["3", "Cardiovascular Drug Interactions",   "1A5276"],
    ["4", "Antibiotics + Drug Interactions",    "145A32"],
    ["5", "CNS + Psychiatric Drug Interactions","4A235B"],
    ["6", "Endocrine + Renal Interactions",     "6E2F0A"],
    ["7", "High-Risk Pairs at a Glance",        "78281F"],
  ];
  slides.forEach(([num, label, color], i) => {
    const x = 9.1;
    const y = 0.9 + i * 0.88;
    bg(s, x, y, 3.9, 0.68, color, true);
    txt(s, num, x + 0.08, y, 0.4, 0.68, { color: "93C5FD", sz: 18, bold: true, align: "center" });
    txt(s, label, x + 0.52, y, 3.25, 0.68, { color: C.white, sz: 9, bold: false, valign: "middle", wrap: true });
  });

  txt(s, "For educational use only. Always verify with current BNF / local formulary.", 0.8, 6.8, 12, 0.4, { color: "4B5563", italic: true, sz: 8 });
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 2 — CYP450 INTERACTIONS (Statins, Macrolides, Azoles, Warfarin)
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  bg(s, 0, 0, 13.3, 7.5, C.offWhite);
  titleBar(s, "CYP450-MEDIATED DRUG INTERACTIONS", "Slide 2 of 7", "1A3A5C");
  legendBar(s, 0.56);

  sectionDivider(s, "STATINS — CYP3A4 Inhibitors increase statin levels → Myopathy / Rhabdomyolysis risk", 0.82, "8B3A00");
  tableHeader(s, 1.03);
  [
    ["Simvastatin / Lovastatin", "Clarithromycin / Erythromycin (Macrolides)", "X", "Macrolides inhibit CYP3A4 → simvastatin/lovastatin AUC ↑ 5–12×", "Severe myopathy, rhabdomyolysis, AKI (myoglobinuria)", "CONTRAINDICATED. Use azithromycin (does not inhibit CYP3A4) or switch to pravastatin/rosuvastatin (not CYP3A4)"],
    ["Simvastatin / Lovastatin", "Fluconazole / Itraconazole / Ketoconazole (Azoles)", "X", "Azole antifungals = potent CYP3A4 inhibitors; statin levels increase 10-20×", "Rhabdomyolysis, acute renal failure", "CONTRAINDICATED. Use fluconazole if needed → switch to pravastatin or rosuvastatin"],
    ["Simvastatin / Lovastatin", "Diltiazem / Verapamil (non-DHP CCBs)", "M", "Non-DHP CCBs inhibit CYP3A4 → moderate statin level rise", "Myopathy risk (less severe than macrolides)", "Limit simvastatin ≤10 mg/day with diltiazem or verapamil. Consider atorvastatin as safer alternative"],
    ["Simvastatin / Lovastatin", "Amiodarone", "M", "Amiodarone inhibits CYP3A4 and CYP2C9 → statin AUC ↑", "Myopathy; more pronounced with simvastatin 80 mg", "Limit simvastatin ≤20 mg/day with amiodarone. Atorvastatin/rosuvastatin preferred"],
    ["Atorvastatin", "Clarithromycin / Erythromycin", "S", "CYP3A4 inhibition raises atorvastatin levels (less than simvastatin)", "Myopathy risk (lower than simvastatin)", "Avoid or use lowest dose atorvastatin. Switch to azithromycin or pravastatin/rosuvastatin"],
    ["Any statin", "Gemfibrozil (Fibrate)", "S", "Gemfibrozil inhibits OATP1B1 transporter + glucuronidation → all statins ↑", "Rhabdomyolysis; CETP trial data confirms risk", "Avoid gemfibrozil + statin combination. Use fenofibrate (safer fibrate) if needed"],
    ["Rosuvastatin / Pravastatin", "Cyclosporin", "S", "Cyclosporin inhibits OATP1B1 and MRP2 transporters → statin AUC ↑ 5–7×", "Rhabdomyolysis in transplant patients", "If unavoidable: limit rosuvastatin ≤5 mg/day, pravastatin ≤20 mg/day. Monitor CK"],
  ].forEach((row, i) => interactionRow(s, row, 1.25 + i * 0.25, i));

  sectionDivider(s, "WARFARIN — Multiple CYP450 Interactions (CYP2C9 substrate — narrow therapeutic index)", 3.01, "5B2C6F");
  tableHeader(s, 3.22);
  [
    ["Warfarin", "Fluconazole / Miconazole", "X", "Azoles inhibit CYP2C9 → warfarin (S-enantiomer) metabolism ↓ → INR ↑↑↑", "Major bleeding (GI, intracranial)", "CONTRAINDICATED concurrent use. If azole essential: stop warfarin, bridge with LMWH. Topical miconazole can also interact"],
    ["Warfarin", "Amiodarone", "X", "Amiodarone + active metabolite inhibit CYP2C9 and CYP3A4 (effect persists months after stopping)", "INR doubles within 1–2 weeks; major bleeding", "Reduce warfarin dose by ~30–50% when starting amiodarone. Monitor INR every 3 days until stable. Consider DOAC instead"],
    ["Warfarin", "Clarithromycin / Erythromycin", "S", "CYP3A4 and CYP2C9 inhibition + ↓ gut flora (vitamin K production)", "INR ↑ → bleeding risk", "Monitor INR closely (within 3–5 days of starting). Consider dose reduction. Azithromycin safer"],
    ["Warfarin", "Metronidazole / Ciprofloxacin", "S", "Metronidazole: CYP2C9 inhibition. Ciprofloxacin: unknown mechanism + gut flora ↓", "INR ↑ → bleeding", "Reduce warfarin dose ~25% when prescribing. Check INR at 3–5 days"],
    ["Warfarin", "Rifampicin", "S", "Rifampicin = potent CYP450 inducer → warfarin metabolism ↑↑", "INR ↓ → subtherapeutic anticoagulation → thrombosis", "INR can fall to <1.5 within days. Massive dose increase needed. Consider LMWH/DOAC instead"],
    ["Warfarin", "NSAIDs (Ibuprofen, Naproxen)", "S", "Pharmacodynamic: NSAIDs inhibit platelets + GI mucosal damage; some inhibit CYP2C9", "Bleeding risk ↑↑ (GI haemorrhage especially)", "Avoid NSAIDs in anticoagulated patients. Use paracetamol for analgesia. If unavoidable: add PPI"],
    ["Warfarin", "Phenytoin / Carbamazepine / Phenobarbitone", "M", "Anticonvulsants induce CYP2C9/CYP3A4 → warfarin metabolism ↑", "INR ↓ → subtherapeutic → thrombosis", "Monitor INR frequently when starting/stopping AEDs. May need significantly higher warfarin doses"],
  ].forEach((row, i) => interactionRow(s, row, 3.44 + i * 0.25, i));

  sectionDivider(s, "ORAL CONTRACEPTIVE PILL (OCP) — Enzyme Induction reduces contraceptive efficacy", 5.19, "145A6E");
  tableHeader(s, 5.40);
  [
    ["Combined OCP / Progestogen-only pill", "Rifampicin / Rifabutin", "X", "Rifampicin potently induces CYP3A4 → contraceptive steroid levels ↓↓", "Contraceptive failure → unplanned pregnancy", "OCP unreliable even with added barrier methods during rifampicin. Use LARC (IUD/IUS/DMPA injection). Continue precautions 28 days after stopping rifampicin"],
    ["Combined OCP", "Enzyme-inducing AEDs (phenytoin, carbamazepine, phenobarb, topiramate ≥200 mg)", "S", "CYP3A4 induction ↓ ethinylestradiol and levonorgestrel levels", "Contraceptive failure", "FSRH guidance: avoid OCP or use ≥50 mcg ethinylestradiol (specialist) + barrier. IUD/IUS preferred"],
    ["OCP", "Broad-spectrum antibiotics (amoxicillin, doxycycline)", "O", "Theory: gut flora disruption ↓ enterohepatic recycling of oestrogen — clinical evidence weak/disputed", "Theoretical contraceptive failure risk (small)", "FSRH 2019: no additional contraception needed for non-enzyme-inducing antibiotics. Counsel patients of theoretical risk"],
  ].forEach((row, i) => interactionRow(s, row, 5.62 + i * 0.25, i));

  footer(s);
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 3 — CARDIOVASCULAR INTERACTIONS
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  bg(s, 0, 0, 13.3, 7.5, C.offWhite);
  titleBar(s, "CARDIOVASCULAR DRUG INTERACTIONS", "Slide 3 of 7", "1A3A5C");
  legendBar(s, 0.56);

  sectionDivider(s, "ACE INHIBITORS / ARBs — Hyperkalaemia, Hypotension, Renal Failure", 0.82, "154360");
  tableHeader(s, 1.03);
  [
    ["ACE inhibitor / ARB", "NSAIDs (Ibuprofen, Diclofenac, Naproxen)", "S", "NSAIDs ↓ renal prostaglandins → reduced GFR, ↓ RAS counterregulation; both drugs reduce renal perfusion", "AKI (the 'triple whammy' with diuretics), ↑ K+, ↑ BP (blunted antihypertensive effect)", "Avoid regular NSAIDs in patients on ACEi/ARB, especially the elderly or if on diuretics. Use paracetamol. If essential: monitor U&E/creatinine at 1 week. STOP in acute illness/dehydration"],
    ["ACE inhibitor / ARB", "Potassium-sparing diuretics (Spironolactone, Eplerenone, Amiloride)", "M", "Additive retention of K+ (both drugs reduce aldosterone-driven K+ excretion)", "Hyperkalaemia → cardiac arrhythmias, cardiac arrest", "Combination used intentionally in HFrEF (evidence-based) — requires baseline K+ <5.0 mmol/L and regular monitoring. STOP if K+ >5.5. Avoid in CKD stage 4+"],
    ["ACE inhibitor / ARB", "Trimethoprim / Cotrimoxazole", "M", "Trimethoprim blocks renal K+ secretion (similar to amiloride) → additive hyperkalaemia", "Hyperkalaemia (especially in elderly or CKD)", "Monitor U&E/K+ within 1 week of starting. Reduce dose of trimethoprim if needed. Nitrofurantoin safer alternative for UTI"],
    ["ACE inhibitor", "ARB (Dual RAS Blockade)", "S", "Additive RAAS inhibition → ↓↓ aldosterone, ↑↑ K+, GFR reduction", "Hyperkalaemia, AKI — ONTARGET trial showed harm with dual blockade", "AVOID routine dual ACEi+ARB. Exception: specialist-supervised resistant proteinuric nephropathy. Monitor U&E closely"],
    ["ACE inhibitor / ARB", "Lithium", "M", "ACEi/ARBs ↓ renal lithium excretion via ↓ angiotensin II → GFR effects", "Lithium toxicity (narrow therapeutic index)", "Monitor lithium levels 1 week after starting ACEi/ARB. Dose adjustment likely needed. Symptoms: tremor, confusion, polyuria"],
  ].forEach((row, i) => interactionRow(s, row, 1.25 + i * 0.25, i));

  sectionDivider(s, "BETA-BLOCKERS — Bradycardia, Hypoglycaemia masking, Bronchospasm", 2.52, "1A5276");
  tableHeader(s, 2.73);
  [
    ["Beta-blocker (any)", "Verapamil / Diltiazem (non-DHP CCBs)", "X", "Additive depression of SA and AV node → severe bradycardia, heart block, asystole", "Complete heart block, cardiogenic shock", "CONTRAINDICATED combination (IV verapamil + beta-blocker especially dangerous). Use amlodipine if CCB needed alongside beta-blocker"],
    ["Beta-blocker (any)", "Digoxin", "M", "Additive suppression of AV conduction", "Severe bradycardia, complete heart block", "Use cautiously if combined for AF rate control. Monitor resting HR (target 60–80). ECG monitoring"],
    ["Beta-blocker (any)", "Insulin / Sulfonylurea", "W", "Beta-blockers mask adrenergic hypoglycaemia symptoms (palpitations, tremor) — diaphoresis still present", "Unrecognised hypoglycaemia → prolonged episode", "Counsel diabetic patients. Cardioselective beta-blockers (bisoprolol, atenolol) slightly safer. Use with caution in insulin-dependent DM"],
    ["Beta-blocker (any)", "Adrenaline / Epinephrine", "M", "Non-selective beta-blockers block beta-2 → unopposed alpha → severe hypertension, bradycardia (reflex)", "Hypertensive crisis, bradycardia (especially propranolol)", "Use cardioselective beta-blockers where possible. Anaphylaxis management: give adrenaline IM but may need higher doses + atropine for refractory bradycardia"],
    ["Propranolol / Non-selective BB", "Salbutamol / Salmeterol", "M", "Beta-blocker antagonises beta-2 bronchodilation", "Severe bronchospasm, attenuated bronchodilator response in asthma/COPD", "Avoid non-selective beta-blockers in asthma. Use cardioselective (bisoprolol, atenolol) if beta-blocker essential. Monitor peak flow"],
  ].forEach((row, i) => interactionRow(s, row, 2.95 + i * 0.25, i));

  sectionDivider(s, "DIGOXIN — Narrow Therapeutic Index (target 1.0–2.0 nmol/L)", 4.22, "4A235B");
  tableHeader(s, 4.43);
  [
    ["Digoxin", "Amiodarone", "S", "Amiodarone inhibits P-glycoprotein + CYP2C9/3A4 → digoxin levels ↑↑", "Digoxin toxicity: bradycardia, AV block, nausea, visual changes (yellow-green halos)", "Reduce digoxin dose by 50% when starting amiodarone. Monitor levels and ECG. Titrate to effect"],
    ["Digoxin", "Diltiazem / Verapamil", "S", "Inhibit P-glycoprotein → ↓ renal/biliary digoxin excretion → digoxin ↑ ~70%", "Digoxin toxicity, bradycardia, heart block", "Reduce digoxin dose by 30–50%. Monitor levels. Avoid verapamil + digoxin if possible"],
    ["Digoxin", "Loop / Thiazide diuretics", "M", "Diuretics → hypokalaemia → ↑ digoxin binding to Na+/K+-ATPase → enhanced toxicity", "Arrhythmias and toxicity even at 'normal' digoxin levels", "Monitor K+ (target >4.0 mmol/L in patients on digoxin). Replace K+ aggressively. Monitor ECG"],
    ["Digoxin", "Clarithromycin / Erythromycin", "M", "Macrolides eliminate gut bacteria (Eubacterium lentum) that inactivate digoxin + P-gp inhibition", "Digoxin toxicity (nausea, bradycardia, visual symptoms)", "Monitor digoxin level and ECG within 48–72h of starting macrolide. Use azithromycin if possible"],
    ["Digoxin", "Spironolactone", "W", "Spironolactone interferes with some digoxin assay methods (falsely elevated levels)", "Potential over-treatment based on falsely elevated digoxin assay", "Be aware of assay interference. Use clinical symptoms + ECG to guide dosing alongside levels"],
  ].forEach((row, i) => interactionRow(s, row, 4.65 + i * 0.25, i));

  sectionDivider(s, "QT-PROLONGING DRUGS — Additive risk of Torsades de Pointes (TdP)", 5.91, "78281F");
  tableHeader(s, 6.12);
  [
    ["Amiodarone", "Any QT-prolonging drug (ondansetron, clarithromycin, haloperidol, fluconazole, citalopram, methadone)", "X", "Additive QT prolongation → triggered arrhythmia mechanism (early afterdepolarisations)", "Torsades de Pointes → VF → sudden cardiac death", "Check CredibleMeds/AzCERT database for all QT-risk drugs. Avoid combinations. Monitor ECG + electrolytes (K+, Mg2+). Correct electrolytes before starting QT drugs"],
    ["Sotalol", "Clarithromycin / Azithromycin / Ciprofloxacin", "S", "Class III anti-arrhythmic with inherent QT prolongation + antibiotic-mediated QT prolongation", "TdP, VF", "Avoid. If antibiotic needed: choose agent with lowest QT risk (e.g., amoxicillin). ECG mandatory if combination unavoidable"],
    ["Methadone", "Fluconazole + SSRIs/TCAs", "S", "Multiple mechanisms: CYP3A4 inhibition ↑ methadone + additive QT", "TdP (methadone has high intrinsic QT risk)", "Baseline ECG before starting methadone. Avoid QT-prolonging drugs. ECG if QTc >450 ms (men) or >470 ms (women)"],
  ].forEach((row, i) => interactionRow(s, row, 6.34 + i * 0.25, i));

  footer(s);
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 4 — ANTIBIOTICS + DRUG INTERACTIONS
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  bg(s, 0, 0, 13.3, 7.5, C.offWhite);
  titleBar(s, "ANTIBIOTICS — DRUG INTERACTIONS", "Slide 4 of 7", "145A32");
  legendBar(s, 0.56);

  sectionDivider(s, "MACROLIDES (Clarithromycin / Erythromycin) — Potent CYP3A4 Inhibitors", 0.82, "145A32");
  tableHeader(s, 1.03);
  [
    ["Clarithromycin / Erythromycin", "Simvastatin / Lovastatin", "X", "CYP3A4 inhibition → statin AUC ↑ 5–12×", "Rhabdomyolysis, AKI", "CONTRAINDICATED. Use azithromycin or switch to pravastatin/rosuvastatin. See slide 2"],
    ["Clarithromycin / Erythromycin", "Warfarin", "S", "CYP2C9 + CYP3A4 inhibition; gut flora ↓ vitamin K production", "INR ↑↑ → major bleeding", "Monitor INR within 3–5 days. Anticipate dose reduction ~20–30%"],
    ["Clarithromycin / Erythromycin", "Colchicine", "X", "CYP3A4 inhibition + P-gp inhibition → colchicine AUC ↑ 3×", "Colchicine toxicity: diarrhoea, myopathy, multi-organ failure, death", "CONTRAINDICATED (especially in renal impairment). Use azithromycin. If unavoidable: max colchicine 0.5 mg total dose"],
    ["Clarithromycin / Erythromycin", "Carbamazepine", "S", "CYP3A4 inhibition → carbamazepine level ↑↑", "Carbamazepine toxicity: diplopia, ataxia, drowsiness, seizures", "Monitor carbamazepine levels. Use azithromycin or doxycycline. Anticipate 50% level rise"],
    ["Clarithromycin", "Digoxin", "M", "P-gp inhibition + gut bacteria elimination → digoxin ↑", "Digoxin toxicity (nausea, bradycardia, vision)", "See digoxin section. Use azithromycin if possible. Monitor digoxin level"],
    ["Clarithromycin / Erythromycin", "QT-prolonging drugs (antipsychotics, methadone, sotalol)", "S", "Additive QT prolongation (macrolides themselves prolong QTc)", "Torsades de Pointes → VF", "Check QTc before prescribing. Avoid combination. Azithromycin also has QT risk (less CYP interaction but QT-prolonging)"],
  ].forEach((row, i) => interactionRow(s, row, 1.25 + i * 0.25, i));

  sectionDivider(s, "FLUOROQUINOLONES (Ciprofloxacin / Levofloxacin) — QT Risk + Metal chelation + CYP1A2", 2.77, "1A5276");
  tableHeader(s, 2.98);
  [
    ["Ciprofloxacin / Levofloxacin", "QT-prolonging drugs (amiodarone, haloperidol, ondansetron)", "S", "Fluoroquinolones prolong QTc independently; additive with other QT drugs", "TdP, VF", "ECG before prescribing. Avoid combining. Levofloxacin has higher QT risk than ciprofloxacin"],
    ["Ciprofloxacin", "Theophylline / Aminophylline", "M", "Ciprofloxacin inhibits CYP1A2 → theophylline AUC ↑ 50–100%", "Theophylline toxicity: tachycardia, seizures, nausea", "Reduce theophylline dose by 30–50% or avoid. Monitor theophylline levels. Use amoxicillin if possible"],
    ["Ciprofloxacin", "Warfarin", "S", "CYP1A2 inhibition → minor effect + mechanism unclear; clinically significant", "INR ↑ → bleeding", "Monitor INR within 3–5 days. Consider trimethoprim or amoxicillin as safer alternatives"],
    ["Ciprofloxacin / Any fluoroquinolone", "Oral iron / Antacids / Calcium supplements", "W", "Metal cations chelate fluoroquinolone in gut → ↓ absorption by up to 75%", "Antibiotic treatment failure", "Take fluoroquinolone 2 hours before or 4 hours after iron/antacids/calcium supplements"],
    ["Ciprofloxacin", "NSAIDs", "W", "Fluoroquinolones lower seizure threshold; NSAIDs inhibit GABA-A → additive CNS excitability", "Seizures (especially in elderly or with pre-existing seizure risk)", "Use paracetamol for analgesia where possible. Caution in epilepsy"],
  ].forEach((row, i) => interactionRow(s, row, 3.20 + i * 0.25, i));

  sectionDivider(s, "METRONIDAZOLE — Disulfiram Reactions + CYP Inhibition", 4.44, "145A32");
  tableHeader(s, 4.65);
  [
    ["Metronidazole", "Alcohol", "X", "Metronidazole inhibits acetaldehyde dehydrogenase → aldehyde accumulates (disulfiram-like reaction)", "Severe flushing, nausea, vomiting, tachycardia, hypotension (can be dangerous)", "CONTRAINDICATED. Avoid alcohol during and 48 hours after metronidazole. Warn patient explicitly. Tinidazole: same interaction"],
    ["Metronidazole", "Warfarin", "S", "CYP2C9 inhibition → warfarin (S-enantiomer) metabolism ↓", "INR ↑↑ → bleeding. Can double INR within days", "Reduce warfarin dose ~25–30%. Monitor INR at 3–5 days. Consider azithromycin or cephalosporins if alternatives for infection"],
    ["Metronidazole", "Lithium", "W", "Reduced renal lithium excretion (mechanism not fully elucidated)", "Lithium toxicity: tremor, ataxia, confusion, seizures", "Monitor lithium levels. Ensure good hydration. Check level at 5–7 days"],
    ["Metronidazole", "5-Fluorouracil (5-FU)", "M", "Metronidazole inhibits CYP2C9 → 5-FU clearance ↓", "5-FU toxicity: mucositis, myelosuppression, diarrhoea", "Avoid combination in oncology patients. Specialist review required"],
  ].forEach((row, i) => interactionRow(s, row, 4.87 + i * 0.25, i));

  sectionDivider(s, "RIFAMPICIN — Potent Enzyme INDUCER (opposite effect: ↓ drug levels)", 5.88, "78281F");
  tableHeader(s, 6.09);
  [
    ["Rifampicin", "Warfarin / DOACs (apixaban, rivaroxaban, edoxaban)", "X", "Rifampicin induces CYP3A4, CYP2C9, P-gp → anticoagulant levels ↓↓ dramatically", "Subtherapeutic anticoagulation → DVT, PE, stroke", "AVOID if possible. If essential for TB: use LMWH/UFH (not affected by CYP induction). DOAC levels decrease ≥50%"],
    ["Rifampicin", "Combined OCP / Progestogen pill", "X", "CYP3A4 induction → steroid contraceptive levels ↓↓↓", "Contraceptive failure → unplanned pregnancy", "Use IUD/IUS or DMPA injection. Continue barrier contraception for 28 days after stopping rifampicin"],
    ["Rifampicin", "HIV antiretrovirals (protease inhibitors, some NNRTIs)", "X", "Profound CYP3A4 induction → ART levels ↓↓ → virological failure", "HIV treatment failure, resistance emergence", "Replace rifampicin with rifabutin (weaker inducer) in HIV/TB co-infection. Specialist ID guidance essential"],
    ["Rifampicin", "Corticosteroids (prednisolone, dexamethasone)", "M", "CYP3A4 induction → steroid clearance ↑ → ↓ efficacy", "Loss of steroid effect (important in Addison's, transplant, IBD)", "Double or triple steroid dose during rifampicin. Monitor for adrenal crisis if steroid-dependent"],
  ].forEach((row, i) => interactionRow(s, row, 6.31 + i * 0.25, i));

  footer(s);
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 5 — CNS + PSYCHIATRIC INTERACTIONS
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  bg(s, 0, 0, 13.3, 7.5, C.offWhite);
  titleBar(s, "CNS + PSYCHIATRIC DRUG INTERACTIONS", "Slide 5 of 7", "3B0F5E");
  legendBar(s, 0.56);

  sectionDivider(s, "SEROTONIN SYNDROME — Life-threatening if missed", 0.82, "6E2C00");
  tableHeader(s, 1.03);
  [
    ["SSRIs / SNRIs (any)", "MAOIs (phenelzine, tranylcypromine, selegiline, linezolid, methylene blue)", "X", "MAOI prevents serotonin breakdown; SSRI/SNRI ↑ serotonin release → ↑↑↑ serotonin", "Serotonin syndrome: agitation, clonus, hyperreflexia, diaphoresis, hyperthermia → DEATH", "CONTRAINDICATED. Washout 14 days after stopping MAOI before starting SSRI. 5 weeks after fluoxetine (long t½). Linezolid is a reversible MAOI — avoid SSRIs"],
    ["SSRIs / SNRIs", "Tramadol", "S", "Tramadol inhibits serotonin reuptake + is weak opioid → serotonergic excess", "Serotonin syndrome (even at normal doses), seizures", "Avoid combination. Use alternative analgesia (paracetamol, codeine, morphine). If unavoidable: lowest tramadol dose, warn about symptoms"],
    ["SSRIs", "Triptans (sumatriptan, rizatriptan)", "W", "Both serotonergic → theoretical additive effect; regulatory warning issued 2006 (FDA/MHRA)", "Serotonin syndrome — evidence weak but real case reports exist", "FDA/MHRA advisory: monitor for serotonin syndrome symptoms. Clinical benefits usually outweigh risks (migraine in depression). Document discussion"],
    ["SSRIs / SNRIs", "Lithium", "W", "Additive serotonergic effects + lithium lowers seizure threshold", "Serotonin-like symptoms, neurotoxicity (even at therapeutic lithium levels)", "Monitor lithium levels. Reduce lithium dose. Educate patient. This combination is sometimes intentional (augmentation) — needs specialist oversight"],
    ["SSRIs (fluoxetine, fluvoxamine, paroxetine)", "Tamoxifen", "S", "Fluoxetine/paroxetine inhibit CYP2D6 → ↓ conversion of tamoxifen to active metabolite (endoxifen)", "Reduced tamoxifen efficacy → increased breast cancer recurrence", "Avoid fluoxetine, fluvoxamine, paroxetine in patients on tamoxifen. Use sertraline, citalopram, escitalopram, or venlafaxine (minimal CYP2D6 inhibition)"],
  ].forEach((row, i) => interactionRow(s, row, 1.25 + i * 0.25, i));

  sectionDivider(s, "ANTIEPILEPTICS — CYP450 Inducers (carbamazepine, phenytoin, phenobarbitone, primidone)", 2.52, "4A235B");
  tableHeader(s, 2.73);
  [
    ["Carbamazepine / Phenytoin / Phenobarb", "OCP / HRT (oestrogens)", "X", "CYP3A4 induction → sex steroid levels ↓", "Contraceptive failure / loss of menopausal symptom control", "Do not use OCP in enzyme-inducing AED patients. Use IUD/IUS/DMPA + barrier. Increase HRT dose under specialist guidance"],
    ["Carbamazepine / Phenytoin", "Warfarin / DOACs", "S", "CYP2C9/3A4 induction → anticoagulant levels ↓", "Subtherapeutic anticoagulation → thrombosis", "Monitor INR frequently. Higher warfarin doses required. DOACs unreliable — prefer LMWH or warfarin with careful INR monitoring"],
    ["Carbamazepine", "Carbamazepine + Erythromycin / Clarithromycin", "S", "Macrolides inhibit CYP3A4 → carbamazepine ↑↑ (autoinduction also makes levels unpredictable)", "Carbamazepine toxicity: diplopia, nausea, ataxia, seizures (paradoxically)", "Use azithromycin or doxycycline. Check carbamazepine level if macrolide unavoidable"],
    ["Sodium Valproate", "Lamotrigine", "M", "Valproate inhibits glucuronidation (UGT enzymes) → lamotrigine half-life doubles", "Lamotrigine toxicity: rash, diplopia, dizziness, Stevens-Johnson syndrome", "Halve lamotrigine dose when starting valproate. Titrate very slowly. Standard lamotrigine dose causes toxicity when combined with valproate"],
    ["Phenytoin", "Multiple drugs (warfarin, ciclosporin, doxycycline, methotrexate, many more)", "M", "CYP2C9/CYP3A4 induction + phenytoin itself is a substrate → highly variable + multiple interactions", "Variable: loss of efficacy of co-administered drugs", "Phenytoin is a 'problem drug'. Check all co-medications in BNF. Therapeutic drug monitoring essential (narrow TI, non-linear kinetics)"],
  ].forEach((row, i) => interactionRow(s, row, 2.95 + i * 0.25, i));

  sectionDivider(s, "LITHIUM — Narrow Therapeutic Index (0.6–1.0 mmol/L), Multiple Renal Interactions", 4.22, "154360");
  tableHeader(s, 4.43);
  [
    ["Lithium", "NSAIDs (Ibuprofen, Diclofenac, Naproxen)", "S", "NSAIDs ↓ renal prostaglandins → ↓ GFR → ↓ lithium excretion → lithium ↑", "Lithium toxicity: coarse tremor, vomiting, confusion, seizures, coma, renal failure", "AVOID NSAIDs in lithium patients. Use paracetamol. If inadvertent NSAID use: check lithium level immediately. Educate patients"],
    ["Lithium", "ACE inhibitors / ARBs", "M", "↓ renal perfusion → ↓ lithium clearance", "Lithium toxicity (can occur within days of starting ACEi/ARB)", "Monitor lithium level 1 week after starting. Reduce lithium dose. Common combination in bipolar + hypertension — needs monitoring"],
    ["Lithium", "Thiazide diuretics (Bendroflumethiazide, Indapamide)", "M", "Thiazides → sodium depletion → compensatory ↑ renal Na+ (and Li+) reabsorption", "Lithium toxicity (even standard doses)", "Avoid thiazides. Use loop diuretics (furosemide) if diuretic needed — safer with lithium. Monitor levels frequently"],
    ["Lithium", "SSRIs + Serotonergic drugs", "W", "Additive serotonergic effects", "Serotonin-like toxicity, neurotoxicity", "Monitor for serotonin-like features. Check lithium levels. Reduce doses if symptoms arise"],
  ].forEach((row, i) => interactionRow(s, row, 4.65 + i * 0.25, i));

  sectionDivider(s, "ANTIPSYCHOTICS — QT Prolongation, Sedation, Extrapyramidal", 5.68, "4A235B");
  tableHeader(s, 5.89);
  [
    ["Haloperidol / Quetiapine / Clozapine", "Any QT-prolonging drug (clarithromycin, ondansetron, methadone, amiodarone, fluconazole)", "S", "Additive blockade of hERG cardiac K+ channels → QT ↑↑", "Torsades de Pointes → VF, sudden death", "Check CredibleMeds database for all QT drugs. Mandatory ECG before prescribing. Correct K+/Mg2+. Avoid combining high-risk QT agents"],
    ["Clozapine", "Ciprofloxacin / Fluvoxamine", "S", "CYP1A2 inhibition → clozapine AUC ↑ 2–3×", "Clozapine toxicity: seizures, hypotension, agranulocytosis risk ↑, sedation", "Avoid ciprofloxacin + clozapine. Use trimethoprim or amoxicillin for UTI. Monitor clozapine level + FBC"],
    ["Antipsychotics (any)", "Metoclopramide / Domperidone", "M", "Additive dopamine D2 blockade in nigrostriatal pathway", "Extrapyramidal side-effects: acute dystonia, akathisia, parkinsonism, risk of tardive dyskinesia", "Avoid combination especially long-term. Use ondansetron or cyclizine for nausea in antipsychotic-treated patients"],
    ["Clozapine", "Smoking cessation (stopping smoking)", "M", "Smoking induces CYP1A2 → clozapine metabolised faster; stopping → CYP1A2 activity ↓ → clozapine ↑", "Clozapine toxicity when patient stops smoking (e.g., hospital admission, NRT)", "Reduce clozapine dose by ~25% when stopping smoking. Monitor levels. Restart dose increase if smoking resumes"],
  ].forEach((row, i) => interactionRow(s, row, 6.11 + i * 0.25, i));

  footer(s);
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 6 — ENDOCRINE + RENAL INTERACTIONS
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  bg(s, 0, 0, 13.3, 7.5, C.offWhite);
  titleBar(s, "ENDOCRINE + RENAL DRUG INTERACTIONS", "Slide 6 of 7", "6E2F0A");
  legendBar(s, 0.56);

  sectionDivider(s, "DIABETES DRUGS — Hypoglycaemia, Lactic Acidosis, Interaction with Common Co-medications", 0.82, "6E2F0A");
  tableHeader(s, 1.03);
  [
    ["Metformin", "IV Contrast media (iodinated)", "S", "Contrast → transient renal impairment → metformin accumulates → lactic acidosis (rare but serious)", "Metformin-associated lactic acidosis (MALA) — high mortality", "HOLD metformin on day of contrast procedure + 48 hours after. Restart only if eGFR stable at 48h check. MHRA guidance 2020"],
    ["Metformin", "Alcohol (chronic excess)", "M", "Alcohol → hepatic impairment + ↑ lactate production → additive lactic acidosis risk", "Lactic acidosis", "Counsel patients to avoid binge/heavy drinking. Moderate intake generally acceptable. Monitor LFTs"],
    ["Sulfonylureas (Gliclazide, Glibenclamide)", "Fluconazole", "S", "Fluconazole inhibits CYP2C9 → sulfonylurea AUC ↑ significantly", "Severe hypoglycaemia (can last hours due to long t½ of drug)", "Reduce sulfonylurea dose. Monitor glucose frequently. Consider hospital admission for severe hypo. Use topical antifungal if possible"],
    ["Sulfonylureas", "Beta-blockers", "W", "Beta-blockers mask adrenergic hypoglycaemia warning symptoms (palpitations, tremor); diaphoresis preserved", "Unrecognised hypoglycaemia → severe prolonged episode", "Counsel patient — rely on sweating symptom. Cardioselective BB slightly safer. More frequent glucose monitoring"],
    ["Insulin", "Corticosteroids (prednisolone, dexamethasone)", "W", "Steroids → insulin resistance + stimulate hepatic gluconeogenesis → hyperglycaemia, especially post-prandial", "Loss of glycaemic control; steroid-induced hyperglycaemia", "Increase insulin dose (often need +20–50% or more). Monitor 4-times daily glucose. Use variable rate IV insulin if nil by mouth. STOP extra insulin when steroids stop"],
    ["SGLT2 inhibitors (empagliflozin, dapagliflozin)", "Loop diuretics (furosemide)", "W", "Both cause natriuresis/osmotic diuresis → additive volume depletion", "Dehydration, AKI, hypotension (especially in elderly)", "Monitor renal function and BP. Educate patient on sick-day rules: STOP SGLT2i if acutely unwell/dehydrated. Hold before surgery"],
    ["SGLT2 inhibitors", "Insulin / Sulfonylurea", "W", "SGLT2i may lower glucose further when combined with insulin/SU", "Hypoglycaemia (more common when combined)", "Reduce insulin or SU dose by ~20% when initiating SGLT2i. Monitor glucose. Risk of euglycaemic DKA with insulin + SGLT2i combination"],
  ].forEach((row, i) => interactionRow(s, row, 1.25 + i * 0.25, i));

  sectionDivider(s, "IMMUNOSUPPRESSANTS (Ciclosporin / Tacrolimus) — Narrow TI, Multiple Interactions", 3.02, "154360");
  tableHeader(s, 3.23);
  [
    ["Ciclosporin / Tacrolimus", "Clarithromycin / Erythromycin / Azole antifungals", "X", "CYP3A4 inhibition → immunosuppressant AUC ↑ 2–5×", "Severe nephrotoxicity, neurotoxicity, transplant rejection if stopped abruptly", "CONTRAINDICATED. If antifungal needed: use liposomal amphotericin or specialist azole dosing with daily drug level monitoring"],
    ["Ciclosporin / Tacrolimus", "Rifampicin", "X", "CYP3A4 induction → immunosuppressant levels ↓↓ up to 70%", "Acute transplant rejection, graft loss", "AVOID. If TB treatment essential: replace rifampicin with rifabutin (weaker inducer). Multiple daily drug level checks needed"],
    ["Ciclosporin", "NSAIDs", "S", "Additive nephrotoxicity (both reduce renal prostaglandins/GFR)", "AKI in transplant patients", "AVOID NSAIDs in ciclosporin-treated patients. Use paracetamol. Monitor eGFR closely if unavoidable"],
    ["Ciclosporin", "Statins (see slide 2)", "S", "OATP1B1/MRP2 inhibition → statin AUC ↑↑", "Rhabdomyolysis", "Limit rosuvastatin ≤5 mg/day, pravastatin ≤20 mg/day. Avoid simvastatin/lovastatin. Monitor CK"],
    ["Tacrolimus", "Potassium-sparing agents (ACEi, ARB, spironolactone)", "M", "Tacrolimus → hyperkalaemia (direct tubular effect) + additive with K+-retaining agents", "Severe hyperkalaemia → arrhythmia", "Monitor K+ weekly initially. Target K+ <5.0. Avoid ACEi/ARB/spironolactone combination unless essential + closely monitored"],
  ].forEach((row, i) => interactionRow(s, row, 3.45 + i * 0.25, i));

  sectionDivider(s, "DIURETICS — Electrolyte Disturbances + Interactions", 4.72, "1A5276");
  tableHeader(s, 4.93);
  [
    ["Furosemide / Thiazides (loop + thiazide diuretics)", "Gentamicin / Vancomycin (aminoglycosides)", "S", "Loop diuretics enhance aminoglycoside-induced cochlear endolymph damage + share nephrotoxicity", "Ototoxicity (sensorineural hearing loss — IRREVERSIBLE) + AKI", "Avoid concurrent use where possible. If essential: ensure normovolaemia, monitor U&E daily, audiological assessment, target lowest effective aminoglycoside dose"],
    ["Loop / Thiazide diuretics", "Digoxin", "M", "Diuretic-induced hypokalaemia + hypomagnesaemia → ↑ digoxin binding at Na+/K+-ATPase", "Digoxin toxicity at therapeutic levels", "Maintain K+ >4.0 mmol/L. Replace Mg2+ if deficient. Monitor digoxin level and ECG"],
    ["Loop / Thiazide diuretics", "Lithium", "M", "Sodium depletion → compensatory proximal tubular Li+ reabsorption ↑", "Lithium toxicity", "Avoid thiazides with lithium. Furosemide safer if diuretic needed (loop diuretics act on distal tubule). Monitor Li+ levels weekly initially"],
    ["Furosemide", "NSAIDs", "M", "NSAIDs ↓ renal prostaglandins → blunt diuretic-induced GFR protection + ↓ natriuresis", "Reduced diuretic efficacy ('diuretic resistance'), AKI risk (triple whammy with ACEi)", "Avoid regular NSAIDs. Paracetamol for analgesia. Weigh patient daily; warn to avoid NSAID OTC purchases"],
  ].forEach((row, i) => interactionRow(s, row, 5.15 + i * 0.25, i));

  sectionDivider(s, "CORTICOSTEROIDS — Multiple Important Interactions", 6.16, "6E2F0A");
  tableHeader(s, 6.37);
  [
    ["Prednisolone / Dexamethasone", "NSAIDs (Ibuprofen, Naproxen, Diclofenac)", "S", "Additive gastropathy: both damage gastric mucosa via prostaglandin suppression and direct mucosal damage", "GI bleeding, perforation, peptic ulceration", "AVOID combination. If both needed: add PPI (lansoprazole/omeprazole). Use paracetamol for analgesia. Higher-dose steroids especially risky"],
    ["Prednisolone / Dexamethasone", "Rifampicin", "M", "CYP3A4 induction → steroid clearance ↑ → ↓ efficacy", "Adrenal crisis if steroid-dependent, loss of treatment effect in IBD/RA etc.", "Double or triple steroid dose. Critical in Addison's or transplant. Monitor for loss of control of underlying disease"],
    ["Prednisolone", "Live vaccines (MMR, varicella, BCG, yellow fever)", "X", "Immunosuppression → normal vaccine virus replication → disseminated infection", "Systemic live vaccine infection — potentially fatal", "CONTRAINDICATED in patients on prednisolone ≥40 mg/day or >1 mg/kg for >1 week. Inactivated/killed vaccines safe"],
  ].forEach((row, i) => interactionRow(s, row, 6.59 + i * 0.25, i));

  footer(s);
}

// ══════════════════════════════════════════════════════════════════════════════
// SLIDE 7 — HIGH-RISK PAIRS AT A GLANCE (Summary matrix)
// ══════════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  bg(s, 0, 0, 13.3, 7.5, C.offWhite);
  titleBar(s, "HIGH-RISK DRUG PAIRS — AT A GLANCE SUMMARY", "Slide 7 of 7", "78281F");

  // 2-column layout of quick reference cards
  // Each card: coloured left strip, drug pair, consequence, action

  const CARDS = [
    // [sev, drugA, drugB, consequence, action]
    ["X", "Simvastatin / Lovastatin", "Clarithromycin / Erythromycin",         "Rhabdomyolysis",                    "Use azithromycin OR switch to pravastatin/rosuvastatin"],
    ["X", "SSRIs / SNRIs",            "MAOIs (inc. Linezolid)",                 "Serotonin Syndrome → DEATH",        "14-day washout. Linezolid is a reversible MAOI"],
    ["X", "Warfarin",                  "Fluconazole",                            "INR ↑↑↑ → major bleeding",          "Avoid. If essential: LMWH bridge. Topical miconazole can also interact"],
    ["X", "Warfarin",                  "Amiodarone",                             "INR doubles; persists months",      "Reduce warfarin 30–50%, daily INR monitoring. Consider DOAC"],
    ["X", "Verapamil / Diltiazem",    "Beta-blockers",                          "Complete heart block, asystole",    "CONTRAINDICATED (especially IV verapamil). Use amlodipine if CCB needed"],
    ["X", "Rifampicin",               "DOACs (apixaban, rivaroxaban)",          "DOAC levels ↓↓ → thrombosis",       "Use LMWH/warfarin instead. Rifabutin if TB Rx needed in HIV"],
    ["X", "Colchicine",               "Clarithromycin (renal impairment)",      "Multi-organ failure, death",        "Use azithromycin. Max colchicine 0.5 mg if macrolide unavoidable"],
    ["X", "Metronidazole",            "Alcohol",                                "Disulfiram reaction (severe)",      "No alcohol during and 48h after. Warn patient explicitly"],
    ["X", "Ciclosporin / Tacrolimus", "Rifampicin",                             "Transplant rejection",              "Avoid. Use rifabutin + intensive drug level monitoring"],
    ["X", "OCP",                      "Rifampicin / Enzyme-inducing AEDs",      "Contraceptive failure",             "Use LARC (IUD/IUS). Continue barrier 28 days after stopping rifampicin"],
    ["S", "ACE inhibitor / ARB",      "NSAIDs + Diuretic (Triple Whammy)",      "Acute kidney injury",               "Avoid NSAIDs. Sick-day rules: STOP all 3 if unwell/dehydrated"],
    ["S", "Amiodarone",               "Any QT-prolonging drug",                 "Torsades de Pointes → VF",          "Check CredibleMeds. ECG + electrolytes before any QT drug"],
    ["S", "Digoxin",                  "Amiodarone / Verapamil / Diltiazem",     "Digoxin toxicity",                  "Reduce digoxin by 30–50%. Monitor levels + ECG"],
    ["S", "Lithium",                  "NSAIDs",                                 "Lithium toxicity",                  "AVOID NSAIDs. Use paracetamol. Check level immediately if inadvertent use"],
    ["S", "Metformin",                "IV contrast",                            "Lactic acidosis (MALA)",            "Hold metformin day of procedure + 48h. Restart only if eGFR stable"],
    ["S", "SSRIs (fluoxetine/parox)", "Tamoxifen",                              "Reduced tamoxifen efficacy → cancer recurrence", "Use sertraline/citalopram/escitalopram instead. Avoid CYP2D6-inhibiting SSRIs"],
    ["M", "Beta-blocker",             "Insulin / Sulfonylurea",                 "Masked hypoglycaemia",              "Counsel patient. Cardioselective BB safer. Rely on sweating symptom"],
    ["M", "Valproate",                "Lamotrigine",                            "Lamotrigine toxicity (SJS risk)",   "Halve lamotrigine starting dose. Titrate very slowly"],
    ["M", "Corticosteroids",          "NSAIDs",                                 "GI bleeding / perforation",         "PPI cover mandatory. Use paracetamol for analgesia where possible"],
    ["M", "Ciprofloxacin",            "Theophylline",                           "Theophylline toxicity",             "Reduce theophylline dose 30–50% or use amoxicillin instead"],
    ["M", "Clozapine",                "Stopping smoking",                       "Clozapine toxicity",                "Reduce clozapine ~25% on admission. Monitor levels. Reincrease if smoking resumes"],
    ["W", "SGLT2 inhibitor",          "Acute illness / surgery",                "Euglycaemic DKA",                   "SICK DAY RULES: STOP SGLT2i if acutely unwell, fasting, or before surgery"],
    ["W", "Antipsychotics",           "Metoclopramide / Domperidone",           "Extrapyramidal SE ↑↑",              "Use ondansetron or cyclizine for nausea in antipsychotic-treated patients"],
    ["W", "Fluoroquinolone",          "Oral iron / antacids",                   "↓ antibiotic absorption (75%)",     "Take fluoroquinolone 2h before or 4h after iron/antacids"],
  ];

  // Two columns of cards, 12 cards per column
  const cardH = 0.3;
  const cardGap = 0.02;
  const col1X = 0.12, col2X = 6.76;
  const startY = 0.58;
  const half = Math.ceil(CARDS.length / 2);

  // Legend
  const legItems = [["X","8B0000"],["S","C0392B"],["M","D35400"],["W","B7770D"],["O","1A6B3C"]];
  const legLabels = ["CONTRAINDICATED","SERIOUS","MAJOR","MODERATE","MONITOR"];
  txt(s, "KEY:", 0.12, 0.56, 0.5, 0.2, { sz: 7, bold: true, color: C.slate });
  legItems.forEach(([k, color], i) => {
    bg(s, 0.6 + i * 2.4, 0.56, 1.3, 0.2, color, true);
    txt(s, legLabels[i], 0.6 + i * 2.4, 0.56, 1.3, 0.2, { color: C.white, sz: 6.3, bold: true, align: "center", margin: 1 });
  });

  // Column headers
  bg(s, col1X, 0.80, 6.5, 0.22, C.hdrBg);
  txt(s, "Drug A + Drug B  →  Consequence  →  Action", col1X + 0.15, 0.80, 6.3, 0.22, { color: C.white, sz: 7.5, bold: true, valign: "middle" });
  bg(s, col2X, 0.80, 6.5, 0.22, C.hdrBg);
  txt(s, "Drug A + Drug B  →  Consequence  →  Action", col2X + 0.15, 0.80, 6.3, 0.22, { color: C.white, sz: 7.5, bold: true, valign: "middle" });

  CARDS.forEach((card, i) => {
    const [sev, a, b, consequence, action] = card;
    const cfg = SEV[sev];
    const col = i < half ? 0 : 1;
    const rowIdx = i < half ? i : i - half;
    const x = col === 0 ? col1X : col2X;
    const y = startY + 0.44 + rowIdx * (cardH + cardGap);
    const rowBg = rowIdx % 2 === 0 ? C.white : C.rowAlt;

    // Row background
    bg(s, x, y, 6.5, cardH, rowBg);
    // Left severity stripe
    bg(s, x, y, 0.14, cardH, cfg.bg);
    // Drug pair
    txt(s, `${a} + ${b}`, x + 0.17, y, 2.3, cardH, { sz: 7.2, bold: true, color: C.navy, margin: 2 });
    // Arrow separator
    txt(s, "→", x + 2.48, y, 0.2, cardH, { sz: 8, bold: true, color: cfg.bg, align: "center", margin: 0 });
    // Consequence
    txt(s, consequence, x + 2.68, y, 1.7, cardH, { sz: 7, color: cfg.bg, bold: true, margin: 2 });
    // Arrow 2
    txt(s, "→", x + 4.39, y, 0.18, cardH, { sz: 8, bold: true, color: C.slateL, align: "center", margin: 0 });
    // Action
    txt(s, action, x + 4.57, y, 1.9, cardH, { sz: 6.8, color: C.slate, italic: false, margin: 2 });
    // Bottom border
    slide_line(s, x, y + cardH, x + 6.5, y + cardH, "E5E7EB");
  });

  footer(s);
}

function slide_line(slide, x1, y1, x2, y2, color) {
  slide.addShape(pres.ShapeType.line, { x: x1, y: y1, w: x2 - x1, h: 0, line: { color, width: 0.5 } });
}

// ──────────────────────────────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/drug-cheatsheet/Drug_Interactions_QuickRef.pptx" })
  .then(() => console.log("DONE: Drug_Interactions_QuickRef.pptx created"))
  .catch(e => { console.error("ERROR:", e.message); process.exit(1); });
Running Command

cd /home/daytona/workspace/drug-cheatsheet && node interactions.js 2>&1

Your drug interactions cheat sheet is ready:

Drug Interactions QuickRef

Presentation · PPTX


Here's what's inside across 7 slides:

Severity colour coding used throughout

ColourRatingMeaning
Dark RedCONTRAINDICATEDNever combine
RedSERIOUSAvoid; significant harm expected
OrangeMAJORSignificant risk; requires dose change or monitoring
AmberMODERATEManageable with caution/monitoring
GreenMONITORGenerally safe; watch for signs

Slide-by-slide breakdown

SlideTopicKey pairs covered
1Cover + contentsSeverity legend, slide map
2CYP450 interactionsStatins + macrolides/azoles, warfarin + fluconazole/amiodarone/rifampicin/metronidazole, OCP + enzyme inducers
3CardiovascularACE/ARB + NSAIDs ("triple whammy"), ACE/ARB + K+-sparing agents, digoxin + amiodarone/CCBs/diuretics, beta-blocker + verapamil, QT-prolonging drug combinations
4AntibioticsMacrolides (colchicine, carbamazepine, warfarin, QT drugs), fluoroquinolones (theophylline, warfarin, iron chelation), metronidazole + alcohol, rifampicin (inducer - DOACs, OCP, ART, steroids)
5CNS + PsychiatricSerotonin syndrome (SSRIs + MAOIs/tramadol/triptans/lithium), SSRI + tamoxifen (CYP2D6), enzyme-inducing AEDs, lithium interactions, antipsychotics + QT/dopaminergic agents, clozapine + smoking cessation
6Endocrine + RenalMetformin + contrast, sulfonylureas + fluconazole/beta-blockers, insulin + steroids, SGLT2i sick-day rules, ciclosporin/tacrolimus + CYP inhibitors/rifampicin, diuretics + aminoglycosides/digoxin/lithium
7At-a-glance summary24 highest-risk pairs in a two-column rapid-scan format: Drug pair → Consequence → Action
Each row in the tables shows: Drug A | Drug B | Severity | Mechanism | Clinical Effect | Management Action - so you know exactly why an interaction occurs and what to do about it.
This is a shared conversation. Sign in to Orris to start your own chat.