iono dilators

Reading File
Finding Sources
Finding Sources
Searching the Web

inodilators pharmacology dobutamine milrinone levosimendan mechanism heart failure

Reading File
Reading File
Reading File
I now have comprehensive information from multiple authoritative textbooks. Here is a full answer:

Inodilators

Inodilators are drugs that combine positive inotropy (increased myocardial contractility) with vasodilation (reduced preload and/or afterload). They are used primarily in acute decompensated heart failure (ADHF) and cardiogenic shock.

The Main Inodilators

1. Dobutamine

  • Class: Synthetic sympathomimetic amine
  • Mechanism: Stimulates beta-1 receptors (increases heart rate and contractility) + beta-2 receptors (peripheral vasodilation). This dual action is why it is classified as an inodilator.
  • Effect on oxygen demand: Increases myocardial O2 consumption - a significant drawback.
  • Dose: Typically 2.5-20 mcg/kg/min; minimal chronotropy at low doses, moderate at higher doses.
  • Limitation: Vasodilating activity can be counterproductive when a vasopressor effect is also needed (e.g., severe hypotension). - Current Surgical Therapy 14e

2. Milrinone

  • Class: Bipyridine phosphodiesterase-3 (PDE-3) inhibitor
  • Mechanism: Inhibits PDE-3, preventing breakdown of cyclic AMP (cAMP). Elevated cAMP activates protein kinase A, phosphorylating myocardial targets to augment contractility. Also decreases systemic vascular resistance (SVR) and pulmonary vascular resistance (PVR).
  • Key advantage over dobutamine: Acts independently of beta-receptors, so it works even when patients are on beta-blockers.
  • Also useful for: Reversibility of marked pulmonary hypertension; right ventricular failure.
  • Dose: 0.125-0.75 mcg/kg/min (no loading dose routinely used in heart failure).
  • Half-life: ~2.4 hours (much longer than catecholamines at 2-3 minutes).
  • Clearance: Renal - doses must be reduced in renal insufficiency (risk of accumulation and prolonged hypotension).
  • Side effects: Hypotension, thrombocytopenia, arrhythmias (new-onset atrial arrhythmias).
  • OPTIME-CHF trial: Milrinone vs. placebo in all ADHF patients did NOT reduce hospital duration and was associated with a non-significant trend toward higher mortality plus more arrhythmias and sustained hypotension. - Fuster and Hurst's The Heart, 15th Ed.

3. Levosimendan

  • Class: Calcium sensitizer (+ weak PDE-3 inhibitor at higher doses)
  • Mechanism: Binds to calcium-saturated troponin C in the myocardial thin filament, prolonging actin-myosin coupling. The key advantage is that it does not increase myocardial oxygen demand - a major benefit over catecholamines and even milrinone.
  • Additional properties: Vasodilatory, anti-inflammatory, antiapoptotic.
  • Clinical trials:
    • REVIVE-II: No overall mortality benefit vs. placebo.
    • SURVIVE: No mortality benefit vs. dobutamine; more tachycardia, atrial fibrillation, and hypokalemia in levosimendan group.
  • Regulatory status: Not FDA-approved in the United States; used in Europe and other countries for ADHF.
  • Fuster and Hurst's The Heart, 15th Ed.

Comparison Table

FeatureDobutamineMilrinoneLevosimendan
ClassBeta-agonistPDE-3 inhibitorCalcium sensitizer
Inotropic mechanismBeta-1 stimulationcAMP accumulationTroponin C binding
VasodilationBeta-2 (systemic)Systemic + pulmonarySystemic + pulmonary
O2 demandIncreasesModest increaseNo increase
Beta-blocker interactionBlunted effectIndependentIndependent
Half-life2-3 min~2.4 hours~1 hour (active metabolite ~80 h)
ClearanceHepaticRenalHepatic
Key side effectsTachycardia, arrhythmiasHypotension, thrombocytopeniaAF, tachycardia, hypokalemia

Clinical Use

  • First-line inodilator in most guidelines (e.g., cardiogenic shock, low-output ADHF): dobutamine. - Bailey and Love's Short Practice of Surgery 28e
  • Milrinone is preferred when patients are on beta-blockers or when pulmonary hypertension/RV failure is present.
  • When both inotropic support and vasopressor effect are needed (e.g., cardiogenic shock with hypotension), inodilators are often combined with norepinephrine.
  • Guidelines (ACC/AHA) recommend inodilators only for hypotension with signs of low cardiac output (short-term), or for palliative use in Stage D heart failure. Routine use is discouraged and associated with increased mortality. - Fuster and Hurst's The Heart, 15th Ed.

Important Caution

Both milrinone and dobutamine are arrhythmogenic and are associated with increased mortality in observational data when used in patients with normal or elevated blood pressure (ADHERE registry). Inodilators should not be used routinely to augment diuresis. - Harrison's Principles of Internal Medicine 22E

make a flowchart of anti microbial drugs class and make revision chart for the anti leprosy ,anti tuberculosis and anti malaria drugs

Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Running Command

ls /home/daytona/workspace/ 2>/dev/null || echo "workspace empty or missing"

Running Command

mkdir -p /home/daytona/workspace/antimicrobial-charts && ls /home/daytona/workspace/antimicrobial-charts

Writing File

~/antimicrobial-charts/build.js

const pptxgen = require("pptxgenjs");
const pres = new pptxgen();
pres.layout = "LAYOUT_WIDE"; // 13.3 x 7.5

// ─── COLOR PALETTE ───
const C = {
  bg:       "0D1B2A",  // deep navy
  bgLight:  "1A2F47",  // medium navy
  accent1:  "00B4D8",  // cyan
  accent2:  "90E0EF",  // light cyan
  accent3:  "FF6B6B",  // coral red
  accent4:  "FFD166",  // amber
  accent5:  "06D6A0",  // mint green
  accent6:  "A78BFA",  // violet
  white:    "FFFFFF",
  gray:     "B0C4DE",
  darkText: "0D1B2A",
};

// ═══════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE
// ═══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:13.3, h:7.5, fill:{color:C.bg} });

  // Decorative gradient bar top
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:13.3, h:0.12, fill:{color:C.accent1} });
  s.addShape(pres.ShapeType.rect, { x:0, y:7.38, w:13.3, h:0.12, fill:{color:C.accent5} });

  // Big circle decoration
  s.addShape(pres.ShapeType.ellipse, { x:9.5, y:-1, w:5, h:5, fill:{color:"132B42"}, line:{color:"132B42"} });
  s.addShape(pres.ShapeType.ellipse, { x:-1.5, y:4, w:4, h:4, fill:{color:"132B42"}, line:{color:"132B42"} });

  s.addText("ANTIMICROBIAL DRUGS", {
    x:1, y:1.8, w:11.3, h:1.2, fontSize:52, bold:true, color:C.white,
    align:"center", fontFace:"Calibri", charSpacing:4
  });
  s.addText("Classification Flowchart  •  Revision Charts", {
    x:1, y:3.2, w:11.3, h:0.6, fontSize:22, color:C.accent2,
    align:"center", fontFace:"Calibri", italic:true
  });
  s.addShape(pres.ShapeType.line, { x:3, y:4.0, w:7.3, h:0, line:{color:C.accent1, width:2} });
  s.addText("Anti-TB  •  Anti-Leprosy  •  Anti-Malarial", {
    x:1, y:4.2, w:11.3, h:0.5, fontSize:16, color:C.gray,
    align:"center", fontFace:"Calibri"
  });
  s.addText("Based on Goodman & Gilman's | Harrison's | Fuster & Hurst's", {
    x:1, y:6.8, w:11.3, h:0.4, fontSize:11, color:C.gray,
    align:"center", fontFace:"Calibri", italic:true
  });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 2 — ANTIMICROBIAL FLOWCHART (full hierarchy)
// ═══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:13.3, h:7.5, fill:{color:C.bg} });
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:13.3, h:0.08, fill:{color:C.accent1} });

  s.addText("ANTIMICROBIAL DRUG CLASSIFICATION", {
    x:0.2, y:0.12, w:12.9, h:0.55, fontSize:22, bold:true, color:C.white,
    align:"center", fontFace:"Calibri", charSpacing:2
  });

  // ── ROOT BOX ──
  function box(s, x, y, w, h, label, sublabel, fillColor, textColor) {
    s.addShape(pres.ShapeType.roundRect, {
      x, y, w, h,
      fill: { color: fillColor },
      line: { color: C.white, width: 0.5 },
      rectRadius: 0.08
    });
    const lines = [];
    lines.push({ text: label, options: { bold:true, fontSize:11, color: textColor||C.darkText, breakLine: sublabel?true:false } });
    if (sublabel) lines.push({ text: sublabel, options: { fontSize:8.5, color: textColor||C.darkText, italic:true } });
    s.addText(lines, { x, y, w, h, align:"center", valign:"middle", fontFace:"Calibri", margin:2 });
  }

  function arrow(s, x1, y1, x2, y2) {
    s.addShape(pres.ShapeType.line, {
      x:x1, y:y1, w: x2-x1, h: y2-y1,
      line: { color: C.gray, width: 1, endArrowType:"arrow" }
    });
  }

  // ROOT
  box(s, 5.4, 0.82, 2.5, 0.52, "ANTIMICROBIAL AGENTS", null, C.accent1, C.darkText);

  // LEVEL 1 branches — 4 categories
  const L1 = [
    { x:0.15, label:"ANTIBACTERIAL", sub:"Bacteria", col: C.accent5 },
    { x:3.65, label:"ANTIVIRAL", sub:"Viruses", col:"#E879F9" },
    { x:7.15, label:"ANTIFUNGAL", sub:"Fungi", col: C.accent4 },
    { x:10.65, label:"ANTIPARASITIC", sub:"Parasites", col: C.accent3 },
  ];
  L1.forEach(b => {
    box(s, b.x, 1.65, 2.4, 0.5, b.label, b.sub, b.col, C.darkText);
    arrow(s, 6.65, 1.34, b.x+1.2, 1.65);
  });

  // ── ANTIBACTERIAL sub-classes
  const AB = [
    { x:0.05, y:2.55, label:"β-Lactams", sub:"Pen / Ceph / Carbapenems / Monobactams", col:"#CFFAFE" },
    { x:0.05, y:3.18, label:"Aminoglycosides", sub:"Genta / Amika / Tobra / Strepto", col:"#CFFAFE" },
    { x:0.05, y:3.81, label:"Tetracyclines", sub:"Doxy / Mino / Tigecycline", col:"#CFFAFE" },
    { x:0.05, y:4.44, label:"Macrolides", sub:"Azithro / Clarithro / Erythro", col:"#CFFAFE" },
    { x:0.05, y:5.07, label:"Fluoroquinolones", sub:"Cipro / Levo / Moxi", col:"#CFFAFE" },
    { x:0.05, y:5.70, label:"Glycopeptides", sub:"Vanco / Teico / Dalba", col:"#CFFAFE" },
    { x:0.05, y:6.33, label:"Others", sub:"Sulfonamides / Linezolid / Chloramphenicol", col:"#CFFAFE" },
  ];
  AB.forEach(b => {
    box(s, b.x, b.y, 3.2, 0.55, b.label, b.sub, "#0E7490", C.white);
    arrow(s, 1.35, 2.15, 1.65, b.y);
  });

  // ── ANTIVIRAL sub-classes
  const AV = [
    { y:2.55, label:"Antiherpes", sub:"Acyclovir / Ganciclovir / Valacyclovir" },
    { y:3.18, label:"Anti-HIV (ARVs)", sub:"NRTIs / NNRTIs / PIs / Integrase inh." },
    { y:3.81, label:"Anti-Hepatitis", sub:"Interferon / DAAs (Sofosbuvir, etc.)" },
    { y:4.44, label:"Anti-Influenza", sub:"Oseltamivir / Zanamivir / Baloxavir" },
    { y:5.07, label:"Broad-Spectrum", sub:"Ribavirin / Remdesivir" },
  ];
  AV.forEach(b => {
    box(s, 3.55, b.y, 3.2, 0.55, b.label, b.sub, "#7E22CE", C.white);
    arrow(s, 4.85, 2.15, 5.15, b.y);
  });

  // ── ANTIFUNGAL sub-classes
  const AF = [
    { y:2.55, label:"Azoles", sub:"Fluconazole / Itraconazole / Voriconazole" },
    { y:3.18, label:"Polyenes", sub:"Amphotericin B / Nystatin" },
    { y:3.81, label:"Echinocandins", sub:"Caspofungin / Micafungin / Anidula" },
    { y:4.44, label:"Allylamines", sub:"Terbinafine / Naftifine" },
    { y:5.07, label:"Others", sub:"Flucytosine / Griseofulvin" },
  ];
  AF.forEach(b => {
    box(s, 7.05, b.y, 3.2, 0.55, b.label, b.sub, "#92400E", C.white);
    arrow(s, 8.35, 2.15, 8.65, b.y);
  });

  // ── ANTIPARASITIC sub-classes
  const AP = [
    { y:2.55, label:"Anti-Malarial", sub:"Chloroquine / Artemisinin / Quinine" },
    { y:3.18, label:"Anti-Leprosy", sub:"Dapsone / Rifampicin / Clofazimine" },
    { y:3.81, label:"Anti-TB", sub:"INH / Rifampicin / PZA / Ethambutol" },
    { y:4.44, label:"Antihelmintics", sub:"Albendazole / Mebendazole / Ivermectin" },
    { y:5.07, label:"Antiprotozoals", sub:"Metronidazole / Tinidazole" },
  ];
  AP.forEach(b => {
    box(s, 10.05, b.y, 3.2, 0.55, b.label, b.sub, "#991B1B", C.white);
    arrow(s, 11.85, 2.15, 11.85, b.y);
  });

  // Mechanism labels at bottom
  s.addText("Key Mechanisms: Cell Wall Synthesis Inhibition  •  Protein Synthesis Inhibition  •  DNA/RNA Synthesis Inhibition  •  Cell Membrane Disruption  •  Metabolic Pathway Inhibition", {
    x:0.1, y:7.1, w:13.1, h:0.35, fontSize:9, color:C.gray, align:"center", fontFace:"Calibri", italic:true
  });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 3 — ANTI-TB REVISION CHART
// ═══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:13.3, h:7.5, fill:{color:C.bg} });
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:13.3, h:0.08, fill:{ color:C.accent5 } });

  s.addText("ANTI-TUBERCULOSIS DRUGS — REVISION CHART", {
    x:0.2, y:0.12, w:12.9, h:0.55, fontSize:20, bold:true, color:C.white,
    align:"center", fontFace:"Calibri", charSpacing:2
  });

  // Table header
  const hdrY = 0.8;
  const cols = [
    { x:0.1,  w:1.5,  label:"Drug" },
    { x:1.7,  w:2.2,  label:"Mechanism" },
    { x:4.0,  w:1.8,  label:"Key Adverse Effects" },
    { x:5.9,  w:1.6,  label:"Monitoring / Notes" },
    { x:7.6,  w:1.4,  label:"Bactericidal?" },
    { x:9.1,  w:2.1,  label:"Regimen / Phase" },
    { x:11.3, w:1.95, label:"Resistance Mechanism" },
  ];

  cols.forEach(c => {
    s.addShape(pres.ShapeType.rect, { x:c.x, y:hdrY, w:c.w, h:0.42, fill:{color:C.accent5}, line:{color:C.bg, width:0.5} });
    s.addText(c.label, { x:c.x, y:hdrY, w:c.w, h:0.42, fontSize:9, bold:true, color:C.darkText, align:"center", valign:"middle", fontFace:"Calibri", margin:2 });
  });

  const tbDrugs = [
    {
      drug:"Isoniazid\n(INH / H)",
      mech:"Inhibits mycolic acid synthesis\n(InhA + KatG activation)",
      ae:"Peripheral neuropathy\nHepatotoxicity\nLupus-like syndrome",
      notes:"Pyridoxine (B6) supplement\nHigh acetylator variability",
      bact:"YES\n(Rapid dividers)",
      regimen:"Initial & Continuation\nPhase (6 mo)",
      resist:"katG / inhA\nmutation",
      color:"#0C4A6E"
    },
    {
      drug:"Rifampicin\n(RIF / R)",
      mech:"Inhibits DNA-dependent\nRNA polymerase (β-subunit)",
      ae:"Hepatotoxicity\nRed-orange secretions\nFlu-like syndrome",
      notes:"Strong CYP450 inducer\n(multiple DDIs)",
      bact:"YES\n(All populations)",
      regimen:"Initial & Continuation\nPhase (6 mo)",
      resist:"rpoB\nmutation",
      color:"#7C2D12"
    },
    {
      drug:"Pyrazinamide\n(PZA / Z)",
      mech:"Converted to pyrazinoic acid\n→ disrupts cell membrane energy",
      ae:"Hepatotoxicity\nHyperuricemia / gout\nArthralgia",
      notes:"Uric acid levels\nAvoid in gout",
      bact:"YES\n(Acid / dormant)",
      regimen:"Initial Phase only\n(2 months)",
      resist:"pncA\nmutation",
      color:"#064E3B"
    },
    {
      drug:"Ethambutol\n(EMB / E)",
      mech:"Inhibits arabinosyl transferase\n→ disrupts arabinogalactan",
      ae:"Optic neuritis\n(red-green color loss)",
      notes:"Visual acuity +\ncolor vision testing",
      bact:"Bacteriostatic\n(mostly)",
      regimen:"Initial Phase\n(2 months)",
      resist:"embB\nmutation",
      color:"#3B0764"
    },
    {
      drug:"Streptomycin\n(SM / S)",
      mech:"Binds 30S ribosome\n→ misreading of mRNA",
      ae:"Ototoxicity\nNephrotoxicity\nVestibular damage",
      notes:"Renal function\nAudiometry\nIM/IV only",
      bact:"YES\n(Extracellular)",
      regimen:"Cat II (retreatment)\nDR-TB regimens",
      resist:"rpsL / rrs\nmutation",
      color:"#1E3A5F"
    },
    {
      drug:"Second-line:\nFluoroquinolones",
      mech:"Inhibit DNA gyrase\n(topoisomerase II/IV)",
      ae:"QT prolongation\nTendinopathy",
      notes:"Levofloxacin / Moxi\nMDR-TB backbone",
      bact:"YES",
      regimen:"MDR-TB / XDR-TB",
      resist:"gyrA / gyrB\nmutation",
      color:"#374151"
    },
    {
      drug:"Second-line:\nBedaquiline",
      mech:"Inhibits mycobacterial\nATP synthase",
      ae:"QT prolongation\nHepatotoxicity\nNausea",
      notes:"ECG monitoring\nNew MDR-TB drug",
      bact:"YES\n(All)",
      regimen:"MDR / XDR-TB\n(BPaL regimen)",
      resist:"atpE mutation\nMmpL5 efflux",
      color:"#374151"
    },
  ];

  const rowH = 0.74;
  tbDrugs.forEach((d, i) => {
    const rowY = hdrY + 0.42 + i * rowH;
    const bg = i % 2 === 0 ? C.bgLight : C.bg;
    s.addShape(pres.ShapeType.rect, { x:0.1, y:rowY, w:13.1, h:rowH, fill:{color:bg}, line:{color:"1E3A5F", width:0.3} });
    // drug name badge
    s.addShape(pres.ShapeType.roundRect, { x:0.1, y:rowY+0.06, w:1.5, h:rowH-0.12, fill:{color:d.color}, line:{color:C.white, width:0.3}, rectRadius:0.06 });
    s.addText(d.drug, { x:0.1, y:rowY+0.06, w:1.5, h:rowH-0.12, fontSize:8.5, bold:true, color:C.white, align:"center", valign:"middle", fontFace:"Calibri", margin:2 });

    const cells = [
      { x:1.7, w:2.2, t:d.mech },
      { x:4.0, w:1.8, t:d.ae },
      { x:5.9, w:1.6, t:d.notes },
      { x:7.6, w:1.4, t:d.bact },
      { x:9.1, w:2.1, t:d.regimen },
      { x:11.3, w:1.95, t:d.resist },
    ];
    cells.forEach(c => {
      s.addText(c.t, { x:c.x, y:rowY, w:c.w, h:rowH, fontSize:7.8, color:C.white, align:"center", valign:"middle", fontFace:"Calibri", margin:3 });
    });
  });

  // DOTS regimen box at bottom
  s.addShape(pres.ShapeType.roundRect, { x:0.1, y:7.0, w:13.1, h:0.42, fill:{color:"#042F2E"}, line:{color:C.accent5, width:1}, rectRadius:0.05 });
  s.addText("WHO DOTS Regimen:  2HRZE / 4HR  (new cases)  •  Treat latent TB: INH 6-9 months  •  MDR-TB: use fluoroquinolone + bedaquiline + PZA backbone", {
    x:0.1, y:7.0, w:13.1, h:0.42, fontSize:8.5, color:C.accent5, align:"center", valign:"middle", fontFace:"Calibri", bold:true, margin:3
  });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 4 — ANTI-LEPROSY REVISION CHART
// ═══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:13.3, h:7.5, fill:{color:C.bg} });
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:13.3, h:0.08, fill:{color:C.accent4} });

  s.addText("ANTI-LEPROSY DRUGS — REVISION CHART", {
    x:0.2, y:0.12, w:12.9, h:0.55, fontSize:20, bold:true, color:C.white,
    align:"center", fontFace:"Calibri", charSpacing:2
  });

  // WHO MDT regimens box
  s.addShape(pres.ShapeType.roundRect, { x:0.1, y:0.78, w:6.2, h:1.05, fill:{color:"#292524"}, line:{color:C.accent4, width:1.5}, rectRadius:0.08 });
  s.addText([
    { text: "WHO MDT — PAUCIBACILLARY (PB) — 6 months\n", options:{bold:true, color:C.accent4, fontSize:9.5} },
    { text: "Rifampicin 600 mg once monthly  +  Dapsone 100 mg daily", options:{color:C.white, fontSize:9} }
  ], { x:0.15, y:0.82, w:6.1, h:0.95, fontFace:"Calibri", valign:"middle", margin:4 });

  s.addShape(pres.ShapeType.roundRect, { x:7.0, y:0.78, w:6.2, h:1.05, fill:{color:"#292524"}, line:{color:C.accent3, width:1.5}, rectRadius:0.08 });
  s.addText([
    { text: "WHO MDT — MULTIBACILLARY (MB) — 12 months\n", options:{bold:true, color:C.accent3, fontSize:9.5} },
    { text: "Rifampicin 600 mg once monthly  +  Clofazimine 300 mg once monthly + 50 mg daily  +  Dapsone 100 mg daily", options:{color:C.white, fontSize:9} }
  ], { x:7.05, y:0.82, w:6.1, h:0.95, fontFace:"Calibri", valign:"middle", margin:4 });

  // Table header
  const hdrY = 2.0;
  const cols2 = [
    { x:0.1,  w:1.8,  label:"Drug" },
    { x:2.0,  w:2.5,  label:"Mechanism of Action" },
    { x:4.6,  w:2.2,  label:"Key Adverse Effects" },
    { x:6.9,  w:2.0,  label:"Special Notes" },
    { x:9.0,  w:2.1,  label:"Activity" },
    { x:11.2, w:2.0,  label:"Role in Regimen" },
  ];
  cols2.forEach(c => {
    s.addShape(pres.ShapeType.rect, { x:c.x, y:hdrY, w:c.w, h:0.42, fill:{color:C.accent4}, line:{color:C.bg, width:0.5} });
    s.addText(c.label, { x:c.x, y:hdrY, w:c.w, h:0.42, fontSize:9.5, bold:true, color:C.darkText, align:"center", valign:"middle", fontFace:"Calibri" });
  });

  const lepDrugs = [
    {
      drug:"Dapsone\n(DDS)",
      mech:"Folate synthesis inhibitor\n(PABA antagonist — like sulfonamides)\nBacteriostatic",
      ae:"Hemolytic anemia\n(esp. G6PD deficiency)\nMethemoglobinemia\nDapsone hypersensitivity syndrome",
      notes:"G6PD screen before use\nCrossreacts with sulfonamides\nAlso used in PCP prophylaxis",
      act:"Bacteriostatic vs M. leprae\nAlso anti-inflammatory",
      role:"Core drug: PB + MB\nDaily component",
      color:"#78350F"
    },
    {
      drug:"Rifampicin\n(RIF)",
      mech:"Inhibits DNA-dependent\nRNA polymerase (β-subunit)\nBactericidal",
      ae:"Hepatotoxicity\nRed-orange discoloration\n(urine, tears, sweat)\nFlu-like syndrome",
      notes:"Strong CYP450 inducer\nOnce-monthly dosing in leprosy\n(different from TB daily dosing)",
      act:"Strongly BACTERICIDAL\nvs M. leprae\n(most potent in MDT)",
      role:"Core drug: PB + MB\nMonthly supervised dose",
      color:"#7C2D12"
    },
    {
      drug:"Clofazimine",
      mech:"Binds to guanine bases of DNA\nInhibits mitochondrial electron\ntransport chain\nBactericidal at higher doses",
      ae:"Skin hyperpigmentation\n(reddish-brown/black)\nIchthyosis / dry skin\nGI disturbances\nCrystal deposits in tissues",
      notes:"Irreversible skin pigmentation\n(may last years after stopping)\nHas anti-inflammatory properties\n(useful in leprosy reactions)",
      act:"Bactericidal + bacteriostatic\nAlso suppresses\nType II lepra reactions\n(ENL)",
      role:"MB regimen only\nMonthly + daily",
      color:"#831843"
    },
    {
      drug:"Alternative:\nOfloxacin",
      mech:"Inhibits DNA gyrase\n(Fluoroquinolone)",
      ae:"GI upset, QT prolongation\nTendinopathy",
      notes:"Used in ROM regimen\n(Single-dose for PB leprosy)\nROM = Rifampicin + Ofloxacin + Minocycline",
      act:"Bactericidal",
      role:"ROM single-dose regimen\n(single-lesion PB)",
      color:"#374151"
    },
    {
      drug:"Alternative:\nMinocycline",
      mech:"30S ribosome inhibitor\n(Tetracycline class)",
      ae:"Vestibular side effects\nSkin pigmentation",
      notes:"Active vs M. leprae\nUsed in ROM regimen",
      act:"Bactericidal\nvs M. leprae",
      role:"ROM regimen / rifampicin\nallergy substitute",
      color:"#374151"
    },
  ];

  const rowH2 = 0.9;
  lepDrugs.forEach((d, i) => {
    const rowY = hdrY + 0.42 + i * rowH2;
    const bg = i % 2 === 0 ? C.bgLight : C.bg;
    s.addShape(pres.ShapeType.rect, { x:0.1, y:rowY, w:13.1, h:rowH2, fill:{color:bg}, line:{color:"2D1B00", width:0.3} });
    s.addShape(pres.ShapeType.roundRect, { x:0.1, y:rowY+0.06, w:1.8, h:rowH2-0.12, fill:{color:d.color}, line:{color:C.white, width:0.3}, rectRadius:0.06 });
    s.addText(d.drug, { x:0.1, y:rowY+0.06, w:1.8, h:rowH2-0.12, fontSize:9, bold:true, color:C.white, align:"center", valign:"middle", fontFace:"Calibri", margin:2 });

    [
      { x:2.0, w:2.5, t:d.mech },
      { x:4.6, w:2.2, t:d.ae },
      { x:6.9, w:2.0, t:d.notes },
      { x:9.0, w:2.1, t:d.act },
      { x:11.2,w:2.0, t:d.role },
    ].forEach(c => {
      s.addText(c.t, { x:c.x, y:rowY, w:c.w, h:rowH2, fontSize:7.8, color:C.white, align:"center", valign:"middle", fontFace:"Calibri", margin:3 });
    });
  });

  // Lepra reactions box
  s.addShape(pres.ShapeType.roundRect, { x:0.1, y:7.0, w:13.1, h:0.42, fill:{color:"#1C0A00"}, line:{color:C.accent4, width:1}, rectRadius:0.05 });
  s.addText("Lepra Reactions:  Type I (Reversal) → Prednisolone  •  Type II (ENL) → Thalidomide or Clofazimine  •  Do NOT stop MDT during reactions", {
    x:0.1, y:7.0, w:13.1, h:0.42, fontSize:8.5, color:C.accent4, align:"center", valign:"middle", fontFace:"Calibri", bold:true, margin:3
  });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 5 — ANTI-MALARIAL REVISION CHART
// ═══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:13.3, h:7.5, fill:{color:C.bg} });
  s.addShape(pres.ShapeType.rect, { x:0, y:0, w:13.3, h:0.08, fill:{color:C.accent3} });

  s.addText("ANTI-MALARIAL DRUGS — REVISION CHART", {
    x:0.2, y:0.12, w:12.9, h:0.55, fontSize:20, bold:true, color:C.white,
    align:"center", fontFace:"Calibri", charSpacing:2
  });

  // Plasmodium species top bar
  s.addShape(pres.ShapeType.roundRect, { x:0.1, y:0.8, w:13.1, h:0.42, fill:{color:"#450A0A"}, line:{color:C.accent3, width:1}, rectRadius:0.05 });
  s.addText("Species:  P. falciparum (most lethal)  •  P. vivax  •  P. ovale  •  P. malariae  •  P. knowlesi  |  Only P. vivax / ovale have hypnozoites (liver latency) → need Primaquine", {
    x:0.1, y:0.8, w:13.1, h:0.42, fontSize:8.5, color:C.accent2, align:"center", valign:"middle", fontFace:"Calibri", bold:true, margin:3
  });

  // Table
  const hdrY = 1.38;
  const cols3 = [
    { x:0.1,  w:1.8,  label:"Drug / Class" },
    { x:2.0,  w:2.1,  label:"Mechanism" },
    { x:4.2,  w:1.7,  label:"Key Side Effects" },
    { x:6.0,  w:1.7,  label:"Indications" },
    { x:7.8,  w:1.5,  label:"Stage Targeted" },
    { x:9.4,  w:1.7,  label:"Special Notes" },
    { x:11.2, w:2.0,  label:"Contraindications" },
  ];
  cols3.forEach(c => {
    s.addShape(pres.ShapeType.rect, { x:c.x, y:hdrY, w:c.w, h:0.42, fill:{color:C.accent3}, line:{color:C.bg, width:0.5} });
    s.addText(c.label, { x:c.x, y:hdrY, w:c.w, h:0.42, fontSize:9, bold:true, color:C.darkText, align:"center", valign:"middle", fontFace:"Calibri" });
  });

  const malDrugs = [
    {
      drug:"Chloroquine\n(4-aminoquinoline)",
      mech:"Accumulates in parasite\nfood vacuole; prevents\nheme detox (heme polymerase\ninhibition) → toxic heme",
      ae:"GI upset\nPruritus (esp. dark skin)\nRetinopathy (long-term)\nCardiotoxicity",
      ind:"P. vivax / ovale / malariae\nProphylaxis in sensitive areas",
      stage:"Blood schizonts\n(erythrocytic phase)",
      notes:"Most Pf strains\nare NOW resistant\nCheap, well tolerated",
      ci:"Porphyria\nPf malaria (resistance)\nRetinal disease",
      color:"#0369A1"
    },
    {
      drug:"Artemisinin\n(ACT partner drugs:\nArtemether + Lumef.\nor AS+AQ)",
      mech:"Endoperoxide bridge\nactivated by heme Fe²⁺\n→ free radicals → protein\nalkylation → parasite death",
      ae:"Neurotoxicity (high dose/\nparenteral)\nQT prolongation (lumefantrine)\nNausea/vomiting",
      ind:"FIRST-LINE for P. falciparum\n(uncomplicated + severe)\nACT = artemisinin combo",
      stage:"All blood stages\n(ring, trophozoite,\nschizont)\nGametocytes too",
      notes:"Fastest acting\nNo resistance yet\n(partial in SE Asia)\nSevere: IV artesunate",
      ci:"1st trimester pregnancy\n(use quinine instead)",
      color:"#065F46"
    },
    {
      drug:"Quinine\n(Cinchona alkaloid)",
      mech:"Same as chloroquine\n(heme polymerase inhibition)\n+ intercalates DNA",
      ae:"Cinchonism (tinnitus,\nheadache, nausea)\nHypoglycemia\nQT prolongation\nBlackwater fever",
      ind:"Severe/complicated Pf\n(if IV artesunate unavailable)\n1st trimester pregnancy",
      stage:"Blood schizonts",
      notes:"Narrow therapeutic\nwindow\nAlways combine with\ndoxycycline / clindamycin",
      ci:"Myasthenia gravis\nOptic neuritis\nHemoglobinuria",
      color:"#6B21A8"
    },
    {
      drug:"Primaquine\n(8-aminoquinoline)",
      mech:"Metabolized to reactive\nquinoline quinones\n→ mitochondrial disruption\n→ kills hypnozoites",
      ae:"Hemolytic anemia\n(G6PD deficiency!)\nMethemoglobinemia\nGI upset",
      ind:"Radical cure of\nP. vivax / ovale\n(kill hypnozoites)\nGametocidal for Pf",
      stage:"LIVER (hypnozoites)\nGametocytes (Pf)",
      notes:"G6PD screen MANDATORY\nbefore use\nTafenoquine = single dose\nalternative (weekly)",
      ci:"G6PD deficiency\nPregnancy\nLactating (if infant G6PD-)",
      color:"#7C2D12"
    },
    {
      drug:"Mefloquine\n(4-quinolinemethanol)",
      mech:"Heme polymerization\ninhibition (similar to\nchloroquine)",
      ae:"Neuropsychiatric:\nnightmares, psychosis,\nseizures\nCardiac arrhythmias",
      ind:"Prophylaxis + Rx\nfor chloroquine-resistant\nPf and Pv",
      stage:"Blood schizonts",
      notes:"Avoid in psychiatric\nhistory / epilepsy\nLong half-life (3 wks)",
      ci:"Psychiatric disorders\nSeizure history\n1st trimester",
      color:"#374151"
    },
    {
      drug:"Atovaquone +\nProguanil\n(Malarone)",
      mech:"Atovaquone: inhibits\nmitochondrial electron\ntransport (CoQ)\nProguanil: DHFR inhibitor",
      ae:"GI upset\nHeadache\nTransaminase elevation",
      ind:"Prophylaxis + treatment\nof Pf (incl. multi-resistant)\nTravel prophylaxis",
      stage:"Liver schizonts\n+ Blood schizonts",
      stage2:"Causal prophylactic",
      notes:"Must take with food\n(fatty meal increases\nabsorption)\nConvenient 3-day Rx",
      ci:"Severe renal impairment\nPregnancy / lactation\n(limited data)",
      color:"#374151"
    },
  ];

  const rowH3 = 0.82;
  malDrugs.forEach((d, i) => {
    const rowY = hdrY + 0.42 + i * rowH3;
    const bg = i % 2 === 0 ? C.bgLight : C.bg;
    s.addShape(pres.ShapeType.rect, { x:0.1, y:rowY, w:13.1, h:rowH3, fill:{color:bg}, line:{color:"1E3A5F", width:0.3} });
    s.addShape(pres.ShapeType.roundRect, { x:0.1, y:rowY+0.06, w:1.8, h:rowH3-0.12, fill:{color:d.color}, line:{color:C.white, width:0.3}, rectRadius:0.06 });
    s.addText(d.drug, { x:0.1, y:rowY+0.06, w:1.8, h:rowH3-0.12, fontSize:8, bold:true, color:C.white, align:"center", valign:"middle", fontFace:"Calibri", margin:2 });
    [
      { x:2.0, w:2.1, t:d.mech },
      { x:4.2, w:1.7, t:d.ae },
      { x:6.0, w:1.7, t:d.ind },
      { x:7.8, w:1.5, t:d.stage },
      { x:9.4, w:1.7, t:d.notes },
      { x:11.2,w:2.0, t:d.ci },
    ].forEach(c => {
      s.addText(c.t, { x:c.x, y:rowY, w:c.w, h:rowH3, fontSize:7.5, color:C.white, align:"center", valign:"middle", fontFace:"Calibri", margin:3 });
    });
  });

  // Bottom tip bar
  s.addShape(pres.ShapeType.roundRect, { x:0.1, y:7.08, w:13.1, h:0.36, fill:{color:"#450A0A"}, line:{color:C.accent3, width:1}, rectRadius:0.05 });
  s.addText("Severe P. falciparum: IV Artesunate (drug of choice)  •  ACT = Artemisinin-based Combination Therapy (WHO 1st-line for Pf)  •  Pv/Po: ACT + Primaquine (radical cure)", {
    x:0.1, y:7.08, w:13.1, h:0.36, fontSize:8.5, color:C.accent3, align:"center", valign:"middle", fontFace:"Calibri", bold:true, margin:3
  });
}

// ═══════════════════════════════════════════════════════════════
// SAVE
// ═══════════════════════════════════════════════════════════════
pres.writeFile({ fileName: "/home/daytona/workspace/antimicrobial-charts/Antimicrobial_Drugs_Charts.pptx" })
  .then(() => console.log("DONE: Antimicrobial_Drugs_Charts.pptx"))
  .catch(e => { console.error(e); process.exit(1); });
Running Command

cd /home/daytona/workspace/antimicrobial-charts && node build.js 2>&1

Running Command

ls -lh /home/daytona/workspace/antimicrobial-charts/

Your PPTX is ready! Here's the download link:

Antimicrobial Drugs Charts

Presentation · PPTX


What's inside (5 slides, wide format):

Slide 1 - Title Page

Dark navy design with the full title and source attribution.

Slide 2 - Antimicrobial Drug Classification Flowchart

A full hierarchy from the root "Antimicrobial Agents" branching into 4 main categories with color-coded sub-classes:
CategorySub-classes shown
AntibacterialBeta-lactams, Aminoglycosides, Tetracyclines, Macrolides, Fluoroquinolones, Glycopeptides, Others
AntiviralAntiherpes, Anti-HIV (ARVs), Anti-Hepatitis, Anti-Influenza, Broad-spectrum
AntifungalAzoles, Polyenes, Echinocandins, Allylamines, Others
AntiparasiticAnti-malarial, Anti-leprosy, Anti-TB, Antihelmintics, Antiprotozoals

Slide 3 - Anti-TB Revision Chart

7 drugs covered (INH, Rifampicin, PZA, Ethambutol, Streptomycin, Fluoroquinolones, Bedaquiline) with columns for: Mechanism, Adverse Effects, Monitoring, Bactericidal status, Regimen/Phase, and Resistance mechanism. WHO DOTS regimen summary at the bottom.

Slide 4 - Anti-Leprosy Revision Chart

5 drugs (Dapsone, Rifampicin, Clofazimine, Ofloxacin, Minocycline) with WHO MDT regimens for Paucibacillary vs Multibacillary at the top, and a lepra reactions summary at the bottom.

Slide 5 - Anti-Malarial Revision Chart

6 drugs (Chloroquine, Artemisinin/ACT, Quinine, Primaquine, Mefloquine, Atovaquone+Proguanil) with columns for: Mechanism, Side Effects, Indications, Stage targeted, Special Notes, and Contraindications. Plasmodium species bar and severe malaria treatment tip at the bottom.

details fo anti microbial group and make pdf and add above ppt in it

Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Running Command

cd /home/daytona/workspace/antimicrobial-charts && libreoffice --headless --convert-to pdf Antimicrobial_Drugs_Charts.pptx --outdir . 2>&1

Running Command

cp /home/daytona/workspace/antimicrobial-charts/Antimicrobial_Drugs_Charts.pptx /tmp/amcharts.pptx && libreoffice --headless --convert-to pdf /tmp/amcharts.pptx --outdir /tmp/ 2>&1 && ls -lh /tmp/amcharts.pdf

Writing File

~/antimicrobial-charts/build_pdf.py

#!/usr/bin/env python3
"""Build a comprehensive Antimicrobial Drugs detail PDF, then merge with the PPTX PDF."""

from reportlab.lib.pagesizes import A4
from reportlab.lib.units import cm, mm
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_JUSTIFY
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    PageBreak, HRFlowable, KeepTogether
)
from reportlab.platypus.flowables import HRFlowable
from pypdf import PdfWriter, PdfReader
import os

# ─── COLORS ────────────────────────────────────────────────────────────────
NAVY       = colors.HexColor("#0D1B2A")
CYAN       = colors.HexColor("#00B4D8")
CYAN_LIGHT = colors.HexColor("#90E0EF")
MINT       = colors.HexColor("#06D6A0")
CORAL      = colors.HexColor("#FF6B6B")
AMBER      = colors.HexColor("#FFD166")
VIOLET     = colors.HexColor("#A78BFA")
BLUE_MID   = colors.HexColor("#1A2F47")
GRAY       = colors.HexColor("#B0C4DE")
GRAY_LIGHT = colors.HexColor("#E8F4FD")
WHITE      = colors.white
BLACK      = colors.HexColor("#0D1B2A")

# ─── STYLES ────────────────────────────────────────────────────────────────
styles = getSampleStyleSheet()

def S(name, **kw):
    return ParagraphStyle(name, **kw)

TITLE = S("TITLE", fontName="Helvetica-Bold", fontSize=28, textColor=WHITE,
           alignment=TA_CENTER, spaceAfter=6)
SUBTITLE = S("SUBTITLE", fontName="Helvetica", fontSize=13, textColor=CYAN_LIGHT,
              alignment=TA_CENTER, spaceAfter=4)
H1 = S("H1", fontName="Helvetica-Bold", fontSize=16, textColor=CYAN,
        spaceBefore=14, spaceAfter=4)
H2 = S("H2", fontName="Helvetica-Bold", fontSize=12, textColor=AMBER,
        spaceBefore=8, spaceAfter=3)
H3 = S("H3", fontName="Helvetica-Bold", fontSize=10, textColor=MINT,
        spaceBefore=5, spaceAfter=2)
BODY = S("BODY", fontName="Helvetica", fontSize=9, textColor=BLACK,
          leading=14, spaceAfter=4, alignment=TA_JUSTIFY)
BODY_W = S("BODY_W", fontName="Helvetica", fontSize=9, textColor=WHITE,
            leading=13, spaceAfter=2)
BOLD_W = S("BOLD_W", fontName="Helvetica-Bold", fontSize=9, textColor=WHITE, leading=13)
SMALL = S("SMALL", fontName="Helvetica", fontSize=8, textColor=GRAY,
           leading=11, spaceAfter=2)
NOTE = S("NOTE", fontName="Helvetica-Oblique", fontSize=8.5, textColor=colors.HexColor("#FFD166"),
          leading=12, spaceAfter=3, leftIndent=8)
TH = S("TH", fontName="Helvetica-Bold", fontSize=8.5, textColor=WHITE,
        alignment=TA_CENTER, leading=11)
TD = S("TD", fontName="Helvetica", fontSize=8, textColor=BLACK, leading=11, alignment=TA_LEFT)
TD_C = S("TD_C", fontName="Helvetica", fontSize=8, textColor=BLACK, leading=11, alignment=TA_CENTER)

W = A4[0] - 2*cm   # usable width

# ─── HELPER: DRUG TABLE ────────────────────────────────────────────────────
def drug_table(headers, rows, col_widths, row_colors=None):
    header_row = [Paragraph(h, TH) for h in headers]
    data = [header_row]
    for row in rows:
        data.append([Paragraph(str(c), TD) for c in row])
    t = Table(data, colWidths=col_widths, repeatRows=1)
    style = [
        ("BACKGROUND",  (0,0), (-1,0),  NAVY),
        ("ROWBACKGROUNDS", (0,1), (-1,-1), [GRAY_LIGHT, WHITE]),
        ("GRID",         (0,0), (-1,-1), 0.3, GRAY),
        ("TOPPADDING",   (0,0), (-1,-1), 4),
        ("BOTTOMPADDING",(0,0), (-1,-1), 4),
        ("LEFTPADDING",  (0,0), (-1,-1), 4),
        ("RIGHTPADDING", (0,0), (-1,-1), 4),
        ("VALIGN",       (0,0), (-1,-1), "TOP"),
        ("FONTNAME",     (0,0), (-1,0),  "Helvetica-Bold"),
    ]
    if row_colors:
        for (row_idx, color) in row_colors:
            style.append(("BACKGROUND", (0, row_idx), (-1, row_idx), color))
    t.setStyle(TableStyle(style))
    return t

def section_bg(text, bg=NAVY, fg=CYAN, size=13):
    """A full-width colored heading bar."""
    t = Table([[Paragraph(text, S("sh", fontName="Helvetica-Bold", fontSize=size,
                                   textColor=fg, alignment=TA_LEFT))]],
              colWidths=[W])
    t.setStyle(TableStyle([
        ("BACKGROUND",   (0,0), (-1,-1), bg),
        ("TOPPADDING",   (0,0), (-1,-1), 6),
        ("BOTTOMPADDING",(0,0), (-1,-1), 6),
        ("LEFTPADDING",  (0,0), (-1,-1), 10),
        ("RIGHTPADDING", (0,0), (-1,-1), 10),
    ]))
    return t

def badge_row(label, color=NAVY):
    t = Table([[Paragraph(label, S("br", fontName="Helvetica-Bold", fontSize=10,
                                   textColor=WHITE, alignment=TA_CENTER))]],
              colWidths=[W])
    t.setStyle(TableStyle([
        ("BACKGROUND",   (0,0), (-1,-1), color),
        ("TOPPADDING",   (0,0), (-1,-1), 5),
        ("BOTTOMPADDING",(0,0), (-1,-1), 5),
        ("ROUNDEDCORNERS", [4]),
    ]))
    return t

# ══════════════════════════════════════════════════════════════════════
# BUILD STORY
# ══════════════════════════════════════════════════════════════════════
story = []

# ── COVER ──────────────────────────────────────────────────────────────────
cover_bg = Table(
    [[Paragraph("ANTIMICROBIAL DRUGS", S("ct", fontName="Helvetica-Bold", fontSize=32,
                                           textColor=WHITE, alignment=TA_CENTER)),
      ],
    ],
    colWidths=[W]
)
cover_bg.setStyle(TableStyle([
    ("BACKGROUND",   (0,0), (-1,-1), NAVY),
    ("TOPPADDING",   (0,0), (-1,-1), 30),
    ("BOTTOMPADDING",(0,0), (-1,-1), 10),
]))
story.append(cover_bg)

cover2 = Table([[Paragraph("Comprehensive Study Guide", S("cs", fontName="Helvetica-Oblique",
                            fontSize=16, textColor=CYAN_LIGHT, alignment=TA_CENTER))]],
               colWidths=[W])
cover2.setStyle(TableStyle([("BACKGROUND",(0,0),(-1,-1),NAVY),
                              ("TOPPADDING",(0,0),(-1,-1),4),
                              ("BOTTOMPADDING",(0,0),(-1,-1),20)]))
story.append(cover2)
story.append(Spacer(1, 6*mm))
story.append(HRFlowable(width=W, thickness=2, color=CYAN))
story.append(Spacer(1, 4*mm))

intro = ("Antimicrobial agents are drugs that kill or inhibit microorganisms. "
         "They are classified by the type of organism targeted (bacteria, viruses, fungi, parasites), "
         "by mechanism of action, and by chemical structure. "
         "This guide covers each major group with mechanism, spectrum, key drugs, adverse effects, "
         "and clinical pearls.")
story.append(Paragraph(intro, BODY))
story.append(Spacer(1, 3*mm))

# TABLE OF CONTENTS (decorative)
toc_data = [
    ["#", "Section", "Coverage"],
    ["1", "ANTIBACTERIAL DRUGS", "Beta-lactams, Aminoglycosides, Tetracyclines, Macrolides, Fluoroquinolones, Glycopeptides, Sulfonamides, Oxazolidinones, others"],
    ["2", "ANTIVIRAL DRUGS", "Antiherpes, Anti-HIV (ARVs), Anti-Hepatitis, Anti-Influenza, Broad-spectrum"],
    ["3", "ANTIFUNGAL DRUGS", "Azoles, Polyenes, Echinocandins, Allylamines, Flucytosine, Griseofulvin"],
    ["4", "ANTIPARASITIC DRUGS", "Anti-malarial, Anti-TB, Anti-leprosy, Antihelmintics, Antiprotozoals"],
    ["5", "REVISION CHARTS (PPT SLIDES)", "Flowchart + Anti-TB + Anti-Leprosy + Anti-Malarial tables"],
]
story.append(drug_table(
    ["#", "Section", "Coverage"],
    [r[1:] for r in toc_data[1:]],
    [1*cm, 4.5*cm, W - 5.5*cm]
))
story.append(PageBreak())

# ════════════════════════════════════════════════════════════════════
# SECTION 1 — ANTIBACTERIAL
# ════════════════════════════════════════════════════════════════════
story.append(section_bg("SECTION 1 — ANTIBACTERIAL DRUGS", NAVY, CYAN, 15))
story.append(Spacer(1, 4*mm))

story.append(Paragraph("Overview of Mechanisms", H1))
mech_overview = [
    ["Mechanism", "Drug Classes", "Target"],
    ["Cell wall synthesis inhibition", "Beta-lactams, Glycopeptides, Fosfomycin", "PBPs / peptidoglycan / UDP-MurNAc"],
    ["Protein synthesis inhibition (30S)", "Aminoglycosides, Tetracyclines", "16S rRNA (aminoglyc.) / A-site (tetra.)"],
    ["Protein synthesis inhibition (50S)", "Macrolides, Clindamycin, Chloramphenicol, Linezolid", "23S rRNA / peptidyl transferase"],
    ["DNA/RNA synthesis inhibition", "Fluoroquinolones, Rifampicin, Metronidazole", "Topoisomerase II/IV / RNA pol / DNA"],
    ["Cell membrane disruption", "Polymyxins, Daptomycin", "Lipid A / phospholipid bilayer"],
    ["Folate synthesis inhibition", "Sulfonamides, Trimethoprim", "DHPS / DHFR enzymes"],
]
story.append(drug_table(mech_overview[0], mech_overview[1:],
             [3.5*cm, 5.5*cm, W-9*cm]))
story.append(Spacer(1, 4*mm))

# ── 1.1 BETA-LACTAMS ──
story.append(KeepTogether([
    section_bg("1.1  Beta-Lactam Antibiotics", BLUE_MID, MINT, 12),
    Spacer(1, 2*mm),
    Paragraph(
        "<b>Mechanism:</b> Inhibit penicillin-binding proteins (PBPs), enzymes that cross-link peptidoglycan "
        "strands in the bacterial cell wall. This causes cell lysis. They are <b>bactericidal</b> for most organisms.",
        BODY),
    Paragraph(
        "<b>Resistance:</b> Beta-lactamase production (cleaves the beta-lactam ring), altered PBPs (e.g., MRSA mecA gene), "
        "reduced porin expression (Gram-negatives), efflux pumps. "
        "Beta-lactamase inhibitors (clavulanate, sulbactam, tazobactam, avibactam) restore activity.",
        BODY),
]))

bl_table = [
    ["Sub-class", "Key Drugs", "Spectrum", "Clinical Use", "Key ADRs"],
    ["Penicillins\n(Natural)", "Penicillin G (IV)\nPenicillin V (oral)", "Narrow: Strep, Neisseria, Treponema", "Strep pharyngitis, syphilis, Strep endocarditis", "Allergy/anaphylaxis, hypersensitivity"],
    ["Aminopenicillins", "Ampicillin\nAmoxicillin\n(+clavulanate = Augmentin)", "Extended: H. influenzae, E. coli, Listeria", "Otitis media, UTI, meningitis (Listeria)", "Maculopapular rash, GI upset, diarrhea"],
    ["Anti-staphylococcal\nPenicillins", "Nafcillin, Oxacillin\nDicloxacillin (oral)", "MSSA only (penicillinase-resistant)", "MSSA skin/soft tissue, endocarditis", "Hepatotoxicity (nafcillin), phlebitis"],
    ["Anti-pseudomonal\nPenicillins", "Piperacillin + tazobactam\n(Pip-Tazo / Zosyn)\nTicarcillin-clavulanate", "Broad: Pseudomonas, anaerobes, Enterobacteriaceae", "Hospital-acquired infections, febrile neutropenia, sepsis", "Hypokalemia, bleeding (high doses)"],
    ["1st Gen\nCephalosporins", "Cefazolin (IV)\nCephalexin (oral)", "Gram+ cocci, some E. coli, Klebsiella", "Surgical prophylaxis, MSSA infections, UTI", "Cross-allergy with PCN (<2%)"],
    ["2nd Gen\nCephalosporins", "Cefuroxime, Cefoxitin\nCefaclor", "Expanded Gram-; some anaerobes (cefoxitin)", "Sinusitis, community RTI, prophylaxis", "GI upset, rash"],
    ["3rd Gen\nCephalosporins", "Ceftriaxone, Cefotaxime\nCeftazidime (Pseudo)", "Excellent Gram-; Neisseria; CNS penetration", "Meningitis, gonorrhea, typhoid, sepsis", "Biliary sludge (ceftriaxone)"],
    ["4th Gen\nCephalosporins", "Cefepime", "Gram+ & Gram-, Pseudomonas", "Febrile neutropenia, hospital-acquired pneumonia", "Neurotoxicity (dose-dependent)"],
    ["5th Gen\nCephalosporins", "Ceftaroline", "MRSA + Gram-", "MRSA skin infections, CAP", "Eosinophilia, rash"],
    ["Carbapenems", "Meropenem\nImipenem-cilastatin\nErtapenem\nDoripenem", "Broadest spectrum: ESBL, AmpC, anaerobes, Pseudomonas (not ertapenem)", "Severe/resistant infections, polymicrobial infections", "Seizures (imipenem), nausea; cilastatin prevents renal DHP-I degradation"],
    ["Monobactams", "Aztreonam", "Gram- only (including Pseudomonas)\nNO Gram+ / anaerobe activity", "Gram- infections in PCN-allergic patients", "Rash; safe in PCN allergy"],
]
story.append(drug_table(bl_table[0], bl_table[1:],
             [2.8*cm, 3.5*cm, 3.5*cm, 3.5*cm, W-13.3*cm]))
story.append(Spacer(1, 3*mm))

# ── 1.2 AMINOGLYCOSIDES ──
story.append(KeepTogether([
    section_bg("1.2  Aminoglycosides", BLUE_MID, MINT, 12),
    Spacer(1, 2*mm),
    Paragraph(
        "<b>Mechanism:</b> Bind irreversibly to the <b>30S ribosomal subunit</b> (16S rRNA), causing misreading of mRNA codons "
        "and inhibiting translocation. This disrupts protein synthesis and leads to production of aberrant proteins "
        "that insert into the cell membrane, increasing permeability. <b>Bactericidal</b>, concentration-dependent killing. "
        "Require oxygen for uptake — ineffective against anaerobes.",
        BODY),
    Paragraph(
        "<b>Resistance:</b> Aminoglycoside-modifying enzymes (acetyltransferases, phosphotransferases, nucleotidyltransferases), "
        "ribosomal methylation (16S rRNA), reduced uptake.",
        BODY),
]))
ag_table = [
    ["Drug", "Spectrum", "Clinical Use", "Dosing", "Key ADRs / Monitoring"],
    ["Gentamicin", "Gram- (Enterobacteriaceae, Pseudomonas)\nSynergy vs Gram+", "Gram- sepsis, UTI, synergy in endocarditis", "OD dosing preferred (extended interval)", "Nephrotoxicity (reversible), ototoxicity (irreversible - vestibular)"],
    ["Tobramycin", "Better Pseudomonas activity vs gentamicin", "Pseudomonas infections, inhaled for CF", "OD or inhaled (TOBI)", "Same as gentamicin; less nephrotoxic"],
    ["Amikacin", "Broadest — active vs gentamicin-resistant strains", "MDR Gram-, TB (2nd line)", "OD dosing", "Ototoxicity (cochlear > vestibular)"],
    ["Streptomycin", "M. tuberculosis, Brucella, Plague, Tularemia", "TB (2nd line), rare Gram- infections", "IM/IV only", "Vestibular ototoxicity, nephrotoxicity"],
    ["Neomycin", "GI flora decontamination only", "Hepatic encephalopathy (oral), bowel prep", "Oral/topical — too toxic for systemic use", "Oral: GI upset; topical: contact dermatitis"],
]
story.append(drug_table(ag_table[0], ag_table[1:],
             [2.3*cm, 3.5*cm, 3.5*cm, 2.5*cm, W-11.8*cm]))
story.append(Paragraph("⚠ Monitor trough levels (traditional dosing) or AUC/MIC (OD dosing). Avoid in pregnancy (VIII nerve damage to fetus).", NOTE))
story.append(Spacer(1, 3*mm))

# ── 1.3 TETRACYCLINES ──
story.append(KeepTogether([
    section_bg("1.3  Tetracyclines", BLUE_MID, MINT, 12),
    Spacer(1, 2*mm),
    Paragraph(
        "<b>Mechanism:</b> Bind reversibly to the <b>30S ribosomal subunit</b> (A-site), blocking attachment of aminoacyl-tRNA "
        "and thus inhibiting peptide elongation. <b>Bacteriostatic</b>. Enter gram-negative bacteria via OmpF/OmpC porins.",
        BODY),
    Paragraph(
        "<b>Resistance:</b> Efflux pumps (TetA-TetE), ribosomal protection proteins (TetM, TetO).",
        BODY),
]))
tc_table = [
    ["Drug", "Unique Features", "Spectrum / Indications", "Key ADRs"],
    ["Doxycycline", "Long t½ (18-22h), oral/IV, lipophilic", "Atypicals (Mycoplasma, Chlamydia, Rickettsia), Lyme, MRSA skin, malaria prophylaxis, acne, anthrax", "Photosensitivity, esophagitis, GI upset"],
    ["Minocycline", "Most lipophilic, CNS penetration, vestibular SE", "MRSA, M. leprae, M. marinum, acne", "Vestibular (dizziness, ataxia), blue-grey pigmentation, hypersensitivity syndrome"],
    ["Tetracycline", "Prototype, less used now", "H. pylori, acne, Chlamydia, Brucella, Cholera", "GI, photosensitivity, tooth discoloration"],
    ["Tigecycline", "Glycylcycline subclass; evades TetA/B efflux", "MDR Gram+, MRSA, VRE, ESBL, anaerobes; NOT Pseudomonas/Proteus", "Nausea/vomiting (most common), increased mortality in some HAP/VAP studies"],
]
story.append(drug_table(tc_table[0], tc_table[1:],
             [2.5*cm, 4.5*cm, 5*cm, W-12*cm]))
story.append(Paragraph("⚠ Avoid in children <8 years (tooth discoloration, bone deposition) and pregnancy (teeth, skeletal effects in fetus).", NOTE))
story.append(Spacer(1, 3*mm))

# ── 1.4 MACROLIDES ──
story.append(KeepTogether([
    section_bg("1.4  Macrolides", BLUE_MID, MINT, 12),
    Spacer(1, 2*mm),
    Paragraph(
        "<b>Mechanism:</b> Bind reversibly to the <b>50S ribosomal subunit</b> (23S rRNA, peptidyl transferase center), "
        "blocking translocation of the growing peptide chain. Generally <b>bacteriostatic</b> (bactericidal at high concentrations).",
        BODY),
    Paragraph(
        "<b>Resistance:</b> Ribosomal methylation (erm genes — MLSB resistance), efflux pumps (mef genes), esterases (inactivation).",
        BODY),
]))
mac_table = [
    ["Drug", "t½ / Properties", "Indications", "Key ADRs / Interactions"],
    ["Azithromycin\n(Z-pack)", "t½ 68h; high tissue/intracellular conc.", "CAP, atypicals, Chlamydia, MAC prophylaxis/Rx, pertussis, pediatric ear infections", "GI (most common), QT prolongation, hepatotoxicity; CYP3A4 minor inhibitor"],
    ["Clarithromycin", "t½ 5-7h; H. pylori triple therapy (with amox + PPI)", "H. pylori eradication, CAP, MAC (in HIV), skin infections", "Metallic taste, GI, QT prolongation; strong CYP3A4 inhibitor"],
    ["Erythromycin", "Short t½; IV available; prokinetic effect (motilin agonist)", "Atypicals, Campylobacter, Legionella, diphtheria, pertussis, gastroparesis (prokinetic)", "GI (nausea, vomiting — most common), QT prolongation, cholestatic jaundice; strong CYP3A4 inhibitor"],
    ["Fidaxomicin", "Non-systemic, narrow spectrum macrolide", "C. difficile colitis (lower recurrence than vancomycin)", "GI; minimal systemic absorption"],
]
story.append(drug_table(mac_table[0], mac_table[1:],
             [2.5*cm, 4*cm, 5*cm, W-11.5*cm]))
story.append(Spacer(1, 3*mm))

# ── 1.5 FLUOROQUINOLONES ──
story.append(KeepTogether([
    section_bg("1.5  Fluoroquinolones", BLUE_MID, MINT, 12),
    Spacer(1, 2*mm),
    Paragraph(
        "<b>Mechanism:</b> Inhibit <b>DNA gyrase (topoisomerase II)</b> in Gram-negative bacteria and "
        "<b>topoisomerase IV</b> in Gram-positive bacteria. These enzymes relieve DNA supercoiling during replication. "
        "Inhibition causes double-strand breaks and bacterial death. <b>Bactericidal</b>, concentration-dependent.",
        BODY),
    Paragraph(
        "<b>Resistance:</b> Chromosomal mutations in gyrA/gyrB/parC/parE (target alteration), efflux pumps (e.g., MexAB in Pseudomonas), "
        "plasmid-mediated quinolone resistance (PMQR — qnr genes, aac(6')-Ib-cr).",
        BODY),
]))
fq_table = [
    ["Generation", "Key Drugs", "Spectrum", "Indications", "Key ADRs"],
    ["1st Gen", "Nalidixic acid\nNorfloxacin", "Gram- enteric (UTI only)", "Uncomplicated UTI", "GI, CNS"],
    ["2nd Gen", "Ciprofloxacin\nOfloxacin", "Excellent Gram- (incl. Pseudomonas); limited Gram+", "UTI, pyelonephritis, typhoid, GI infections, anthrax, Pseudomonas", "QT prolongation, tendinopathy/rupture, CNS effects, photosensitivity, cartilage damage (children)"],
    ["3rd Gen", "Levofloxacin", "Gram- + enhanced Strep pneumoniae (respiratory FQ)", "CAP, HAP, sinusitis, UTI, TB (2nd line)", "QT prolongation (less than moxifloxacin), tendinopathy"],
    ["4th Gen", "Moxifloxacin\nGemifloxacin", "Gram-, Gram+, anaerobes (moxifloxacin); NO Pseudomonas", "CAP, TB (2nd line), intra-abdominal (moxi)", "Highest QT prolongation risk; hepatotoxicity"],
]
story.append(drug_table(fq_table[0], fq_table[1:],
             [2*cm, 3.5*cm, 4*cm, 4*cm, W-13.5*cm]))
story.append(Paragraph("⚠ Black Box Warning: Tendon rupture (especially Achilles), peripheral neuropathy, CNS effects, aortic aneurysm. Avoid in pregnancy, children, myasthenia gravis.", NOTE))
story.append(Spacer(1, 3*mm))

# ── 1.6 GLYCOPEPTIDES ──
story.append(KeepTogether([
    section_bg("1.6  Glycopeptides", BLUE_MID, MINT, 12),
    Spacer(1, 2*mm),
    Paragraph(
        "<b>Mechanism:</b> Bind to the <b>D-Ala-D-Ala terminus</b> of peptidoglycan precursors (lipid II), "
        "physically blocking transglycosylation and transpeptidation — inhibiting cell wall synthesis. "
        "<b>Bactericidal</b> for Gram-positive organisms. Too large to penetrate Gram-negative outer membrane.",
        BODY),
    Paragraph(
        "<b>Resistance (VRE):</b> Acquisition of van genes (vanA, vanB) that substitute D-Ala-D-Ala with "
        "D-Ala-D-Lac (vanA/B) or D-Ala-D-Ser (vanC), dramatically reducing vancomycin binding affinity.",
        BODY),
]))
gp_table = [
    ["Drug", "Route / t½", "Indications", "Monitoring", "Key ADRs"],
    ["Vancomycin", "IV (oral for C. diff only); t½ 4-8h (longer in renal failure)", "MRSA (drug of choice), MRSE, VRE (with synergy), C. diff colitis (oral), Enterococcal endocarditis", "Trough or AUC/MIC (AUC 400-600 preferred); renal function", "Red man syndrome (rate-related, not true allergy — infuse over ≥60 min), nephrotoxicity (esp. with aminoglycosides), ototoxicity (rare)"],
    ["Teicoplanin", "IV/IM; long t½ (70-100h), once daily", "MRSA, MRSE, similar spectrum to vancomycin; better tolerated", "Trough levels", "Less nephrotoxic than vancomycin; thrombocytopenia"],
    ["Dalbavancin\nOritavancin\nTelavancin", "Long-acting lipoglycopeptides; single-dose or once-weekly", "MRSA skin/soft tissue infections (ABSSSI)\nTelavancin: HAP due to MRSA", "Less monitoring needed", "GI (nausea), nephrotoxicity (telavancin), infusion reactions"],
]
story.append(drug_table(gp_table[0], gp_table[1:],
             [2.8*cm, 3.5*cm, 4*cm, 3*cm, W-13.3*cm]))
story.append(Spacer(1, 3*mm))

# ── 1.7 SULFONAMIDES & TMP ──
story.append(KeepTogether([
    section_bg("1.7  Sulfonamides & Trimethoprim", BLUE_MID, MINT, 12),
    Spacer(1, 2*mm),
    Paragraph(
        "<b>Mechanism:</b> <b>Sulfonamides</b> are PABA analogues — they competitively inhibit <b>dihydropteroate synthase (DHPS)</b>, "
        "blocking folate synthesis. <b>Trimethoprim</b> inhibits <b>dihydrofolate reductase (DHFR)</b>, the next enzyme in the pathway. "
        "Combined (TMP-SMX / co-trimoxazole) = <b>sequential blockade</b> of folate synthesis → bactericidal synergy.",
        BODY),
]))
sulf_table = [
    ["Drug", "Spectrum / Indications", "Key ADRs", "Contraindications / Notes"],
    ["TMP-SMX\n(Co-trimoxazole)\nBactrim", "UTI, PCP (prophylaxis + Rx), Pneumocystis, Toxoplasma, MRSA skin (community), Nocardia, Stenotrophomonas, Listeria", "Steven-Johnson syndrome/TEN, bone marrow suppression, hyperkalemia (blocks K+ secretion), nephrotoxicity, photosensitivity", "G6PD deficiency (hemolysis), sulfa allergy, pregnancy (kernicterus in newborn, folate antagonism in 1st trimester), neonates"],
    ["Dapsone\n(Sulfone class)", "Leprosy (MDT), PCP prophylaxis (2nd line in PCN allergy), dermatitis herpetiformis", "Hemolytic anemia (G6PD def.), methemoglobinemia, peripheral neuropathy, dapsone hypersensitivity syndrome", "G6PD deficiency (screen first)"],
    ["Sulfadiazine", "Toxoplasma encephalitis (with pyrimethamine), prophylaxis of rheumatic fever", "Crystalluria (alkalinize urine + hydrate), Stevens-Johnson syndrome", "Keep urine alkaline; monitor renal function"],
]
story.append(drug_table(sulf_table[0], sulf_table[1:],
             [2.5*cm, 5*cm, 4*cm, W-11.5*cm]))
story.append(Spacer(1, 3*mm))

# ── 1.8 OTHER ANTIBACTERIALS ──
story.append(section_bg("1.8  Other Key Antibacterials", BLUE_MID, MINT, 12))
story.append(Spacer(1, 2*mm))
other_table = [
    ["Drug / Class", "Mechanism", "Key Indications", "Key ADRs / Notes"],
    ["Linezolid\n(Oxazolidinone)", "Binds 50S (23S rRNA domain V); prevents 70S initiation complex formation — unique binding site (no cross-resistance with other 50S drugs)", "MRSA, VRE, MDR-TB (add-on), MDRB soft tissue infections; oral bioavailability ~100%", "Serotonin syndrome (with SSRIs/MAOIs), myelosuppression (thrombo/leukopenia — monitor CBC weekly), lactic acidosis, optic/peripheral neuropathy (>2 weeks use)"],
    ["Tedizolid\n(Oxazolidinone)", "Same class as linezolid; once daily; fewer ADRs", "MRSA, VRE ABSSSI", "Less myelosuppression than linezolid; once-daily advantage"],
    ["Daptomycin\n(Lipopeptide)", "Calcium-dependent insertion into Gram+ cell membranes → depolarization → K+ efflux → cell death. Bactericidal.", "MRSA bacteremia, right-sided endocarditis, VRE, MRSA skin infections. NOT for pneumonia (inactivated by surfactant!)", "CK elevation / myopathy (check CK weekly), eosinophilic pneumonitis. Avoid with statins."],
    ["Polymyxin B\n& Colistin\n(Polymyxin E)", "Bind to lipid A on LPS of Gram- outer membrane → detergent-like disruption → membrane lysis", "Last-resort for CRE (carbapenem-resistant Enterobacteriaceae), XDR Pseudomonas, Acinetobacter; inhaled colistin for MDR Pseudomonas in CF", "Nephrotoxicity (major — dose-limiting), neurotoxicity (neuromuscular blockade, paresthesia), pain at IM site"],
    ["Chloramphenicol", "Binds 50S (A-site); inhibits peptidyl transferase → bacteriostatic", "Typhoid (resource-limited settings), bacterial meningitis (PCN-allergic), rickettsial diseases, plague", "Gray baby syndrome (neonates — glucuronidation deficiency), aplastic anemia (idiosyncratic), dose-dependent bone marrow suppression, inhibits CYP450"],
    ["Metronidazole\n(Nitroimidazole)", "Prodrug; reduced by ferredoxin in anaerobes → reactive nitroso radicals → DNA strand breaks → bactericidal", "Anaerobic infections, C. difficile (PO), H. pylori (triple therapy), bacterial vaginosis, Trichomonas, Giardia, Entamoeba, intra-abdominal sepsis", "Disulfiram-like reaction with alcohol, metallic taste, peripheral neuropathy (prolonged use), seizures (high dose), avoid 1st trimester pregnancy"],
    ["Rifampicin\n(Rifampin)", "Inhibits beta subunit of DNA-dependent RNA polymerase → blocks mRNA synthesis → bactericidal", "TB (1st line), leprosy, prophylaxis for meningococcal disease / H. influenzae b contacts, Staph biofilm infections (combination)", "Red-orange discoloration of body fluids, hepatotoxicity, flu-like syndrome (intermittent therapy), potent CYP450 inducer (many drug interactions)"],
    ["Fosfomycin", "Inhibits MurA (UDP-N-acetylglucosamine enolpyruvyl transferase) — 1st step of peptidoglycan synthesis", "Uncomplicated UTI (single oral dose), ESBL UTI, MRSA (IV — combination therapy)", "GI, headache, hypernatremia (sodium content of IV formulation)"],
    ["Nitrofurantoin", "Multiple mechanisms: reactive metabolites damage DNA, ribosomes, bacterial enzymes (only active in urine at low pH)", "Uncomplicated UTI and prophylaxis — stays in urine, NOT for pyelonephritis/bacteremia", "Pulmonary toxicity (acute/chronic), peripheral neuropathy, hemolytic anemia (G6PD deficiency), brown urine; avoid at term of pregnancy"],
]
story.append(drug_table(other_table[0], other_table[1:],
             [2.8*cm, 4.5*cm, 4*cm, W-11.3*cm]))
story.append(PageBreak())

# ════════════════════════════════════════════════════════════════════
# SECTION 2 — ANTIVIRAL
# ════════════════════════════════════════════════════════════════════
story.append(section_bg("SECTION 2 — ANTIVIRAL DRUGS", NAVY, CYAN, 15))
story.append(Spacer(1, 4*mm))
story.append(Paragraph(
    "Viruses are obligate intracellular parasites that use the host cell machinery for replication. "
    "Antiviral drugs must selectively target viral enzymes or proteins without damaging host cells. "
    "Key viral targets include viral polymerases, proteases, integrases, neuraminidases, and fusion proteins.",
    BODY))
story.append(Spacer(1, 3*mm))

# 2.1 Antiherpes
story.append(section_bg("2.1  Antiherpes Agents", BLUE_MID, VIOLET, 12))
story.append(Spacer(1, 2*mm))
story.append(Paragraph(
    "<b>Mechanism of Acyclovir:</b> Acyclovir is a guanosine analogue prodrug. It is phosphorylated by "
    "<b>viral thymidine kinase (TK)</b> to acyclovir monophosphate, then by cellular kinases to acyclovir triphosphate. "
    "This competes with dGTP for viral DNA polymerase, causes chain termination (no 3'-OH group), "
    "and irreversibly inactivates viral DNA polymerase. Selective for virus-infected cells.", BODY))
av_table = [
    ["Drug", "Virus Targets", "Clinical Use", "Bioavailability / Route", "ADRs"],
    ["Acyclovir", "HSV-1, HSV-2, VZV (less potent vs CMV/EBV)", "Genital herpes (Rx + suppression), herpes encephalitis (IV), shingles, neonatal herpes", "Oral: 15-30%; IV available; Valacyclovir = L-valyl ester prodrug (55% BA)", "Nephrotoxicity (crystalluria — hydrate well), neurotoxicity (IV high dose), N/V"],
    ["Valacyclovir", "Same as acyclovir (prodrug)", "Herpes simplex (genital/labial), shingles, Bell's palsy prophylaxis, CMV prophylaxis post-transplant", "Oral: 55% (converted to acyclovir); 3x daily vs 5x daily for acyclovir", "Same as acyclovir (nephrotoxicity at high doses for CMV)"],
    ["Ganciclovir\nValganciclovir", "CMV (primary indication), also HSV/VZV", "CMV retinitis, CMV disease in immunocompromised (HIV, transplant), prophylaxis post-transplant", "IV ganciclovir; valganciclovir = oral prodrug (~60% BA)", "Myelosuppression (neutropenia, thrombocytopenia — major), nephrotoxicity, teratogenic/carcinogenic"],
    ["Foscarnet", "CMV, HSV, VZV; does NOT require viral TK activation", "Acyclovir-resistant HSV, ganciclovir-resistant CMV, CMV retinitis", "IV only (poorly absorbed orally)", "Nephrotoxicity (major), electrolyte abnormalities (hypo-Ca, hypo-Mg, hypo-K, hypo/hyper-P), seizures, penile ulcers"],
    ["Cidofovir", "CMV, acyclovir-resistant HSV, adenovirus, smallpox (stockpile)", "CMV retinitis (HIV), acyclovir-resistant HSV, BK virus", "IV; long intracellular t½ (weekly dosing); must give probenecid + IV hydration", "Severe nephrotoxicity (proximal tubule — Fanconi-like), neutropenia, ocular hypotony"],
]
story.append(drug_table(av_table[0], av_table[1:],
             [2.5*cm, 3.5*cm, 3.5*cm, 3.5*cm, W-13*cm]))
story.append(Spacer(1, 3*mm))

# 2.2 Anti-HIV
story.append(section_bg("2.2  Anti-HIV (Antiretrovirals — ARVs)", BLUE_MID, VIOLET, 12))
story.append(Spacer(1, 2*mm))
story.append(Paragraph(
    "HIV replication requires: (1) attachment/entry, (2) reverse transcription, (3) integration, "
    "(4) protease cleavage, (5) assembly/budding. Each step can be targeted. "
    "ART (antiretroviral therapy) uses combinations of 3+ drugs from 2+ classes — "
    "current preferred regimen: 2 NRTIs + 1 INSTI.", BODY))
hiv_table = [
    ["Class (Abbreviation)", "Mechanism", "Key Drugs", "Key ADRs"],
    ["NRTIs\n(Nucleoside Reverse Transcriptase Inhibitors)", "Nucleoside analogues; phosphorylated to triphosphate by cellular kinases → compete with natural nucleotides → chain termination (no 3'-OH) of reverse transcriptase", "Tenofovir DF/TAF, Emtricitabine, Abacavir, Lamivudine, Zidovudine, Stavudine (d4T)", "Class: Lactic acidosis + hepatic steatosis (mitochondrial toxicity)\nABC: hypersensitivity (HLA-B*57:01 screening mandatory)\nZDV: bone marrow suppression, lipoatrophy\nTDF: nephrotoxicity, bone density loss\nTAF: less renal/bone toxicity than TDF"],
    ["NNRTIs\n(Non-Nucleoside RTIs)", "Non-competitive binding to allosteric site on reverse transcriptase → conformational change → inhibition; do NOT require phosphorylation", "Efavirenz, Nevirapine, Rilpivirine, Etravirine, Doravirine", "EFV: CNS effects (vivid dreams, dizziness — take at bedtime), teratogenic (avoid in 1st trimester)\nNVP: hepatotoxicity, SJS/TEN (most dangerous with high CD4 at initiation)\nClass: CYP inducers/substrates (many DDIs); low barrier to resistance"],
    ["PIs\n(Protease Inhibitors)", "Inhibit viral aspartyl protease; prevents cleavage of gag-pol polyprotein → non-infectious immature virions; all boosted with ritonavir/cobicistat (pharmacokinetic enhancers)", "Darunavir/r, Atazanavir/r, Lopinavir/r, Ritonavir (booster dose)", "Class: GI (diarrhea, N/V), lipodystrophy (central obesity, peripheral wasting), dyslipidemia, insulin resistance\nATV: indirect hyperbilirubinemia (jaundice), nephrolithiasis\nRitonavir: potent CYP3A4 inhibitor (booster) — many drug interactions"],
    ["INSTIs\n(Integrase Strand Transfer Inhibitors)", "Inhibit HIV integrase, preventing integration of viral DNA into host cell chromosome; highest barrier to resistance (dolutegravir, bictegravir)", "Dolutegravir (DTG), Bictegravir, Raltegravir, Elvitegravir/c, Cabotegravir", "Well tolerated overall\nDTG: weight gain, neural tube defects (periconception — counsel women)\nRaltegravir: rhabdomyolysis (rare)\nInsomnia, headache"],
    ["Entry/Fusion\nInhibitors", "Enfuvirtide (T-20): binds gp41, prevents 6-helix bundle formation; Maraviroc: CCR5 co-receptor antagonist (requires CCR5 tropism testing before use)", "Enfuvirtide (injection), Maraviroc (oral)", "Enfuvirtide: injection site reactions (every dose)\nMaraviroc: hepatotoxicity, cough; only for CCR5-tropic virus"],
    ["Attachment\nInhibitors", "Fostemsavir: binds gp120 directly, prevents CD4 attachment; Ibalizumab (mAb): binds CD4 domain 2 — conformational block", "Fostemsavir, Ibalizumab (IV infusion)", "For heavily treatment-experienced patients with MDR HIV"],
]
story.append(drug_table(hiv_table[0], hiv_table[1:],
             [3*cm, 4.5*cm, 3.5*cm, W-11*cm]))
story.append(Spacer(1, 3*mm))

# 2.3 Anti-Hepatitis
story.append(section_bg("2.3  Anti-Hepatitis Agents", BLUE_MID, VIOLET, 12))
story.append(Spacer(1, 2*mm))
hep_table = [
    ["Target", "Drug(s)", "Mechanism", "Indication", "Key ADRs"],
    ["HCV\n(Direct Acting Antivirals — DAAs)", "Sofosbuvir (NS5B pol. inh.)\nLedipasvir, Velpatasvir, Pibrentasvir (NS5A inh.)\nGlecaprevir, Grazoprevir (NS3/4A protease inh.)\nVoxilaprevir (NS3/4A inh.)", "Target different viral proteins:\n• NS5B: chain termination\n• NS5A: replication complex function\n• NS3/4A: polyprotein processing", "Chronic HCV (all genotypes); 8-12 week cure rates >95% with pan-genotypic regimens", "Generally well tolerated; bradycardia (sofosbuvir + amiodarone — avoid); headache, fatigue, nausea; monitor for HBV reactivation"],
    ["HBV", "Tenofovir DF / TAF\nEntecavir\nLamivudine / Telbivudine\nAdefovir", "NRTI-type (block HBV reverse transcriptase/DNA polymerase); also suppress HBsAg", "Chronic HBV — preferred: TDF or TAF or Entecavir (high barrier to resistance)", "TDF: renal/bone toxicity; TAF: less renal/bone effect; Entecavir: lactic acidosis (rare); Lamivudine: high resistance rate"],
    ["HBV/HCV\n(Interferons)", "PEG-IFN-alpha 2a / 2b\n(+ ribavirin for HCV)", "Enhance innate antiviral immunity, upregulate MHC-I, activate NK cells, induce antiviral protein production", "HBV (off-label); older HCV treatment (largely replaced by DAAs)", "Flu-like syndrome, depression/suicidality, neutropenia, thrombocytopenia, thyroid dysfunction, autoimmune conditions, retinopathy"],
]
story.append(drug_table(hep_table[0], hep_table[1:],
             [2.5*cm, 3.5*cm, 3.5*cm, 3*cm, W-12.5*cm]))
story.append(Spacer(1, 3*mm))

# 2.4 Anti-Influenza
story.append(section_bg("2.4  Anti-Influenza Agents", BLUE_MID, VIOLET, 12))
story.append(Spacer(1, 2*mm))
flu_table = [
    ["Drug / Class", "Mechanism", "Indications", "ADRs / Notes"],
    ["Oseltamivir (Tamiflu)\nZanamivir (inhaled)\nPeramivir (IV)\n(Neuraminidase inhibitors)", "Competitively inhibit neuraminidase on influenza A and B → prevents cleavage of sialic acid residues → virions remain clumped to host cell surface, reducing spread", "Treatment (start within 48h of symptoms) and prophylaxis of influenza A and B; most useful in high-risk patients (elderly, immunocompromised, pregnancy)", "Oseltamivir: N/V (take with food); GI upset\nZanamivir: bronchospasm (avoid in asthma/COPD)\nPeramivir: diarrhea"],
    ["Baloxavir marboxil\n(Cap-snatching inhibitor)", "Inhibits PB2 subunit of influenza RNA polymerase; blocks cap-snatching needed for viral mRNA transcription — novel mechanism", "Influenza A and B treatment (single dose); active vs H1N1, H3N2, H7N9, oseltamivir-resistant strains", "Generally well tolerated; GI, headache; potential resistance (PA-I38X mutation)"],
    ["Amantadine\nRimantadine\n(Adamantanes)", "Block M2 ion channels of influenza A → prevent viral uncoating after endocytosis", "Influenza A ONLY (not B); largely obsolete due to near-universal resistance among circulating strains", "CNS effects (amantadine — confusion, hallucinations), GI; rimantadine: fewer CNS effects"],
]
story.append(drug_table(flu_table[0], flu_table[1:],
             [3*cm, 4.5*cm, 3.5*cm, W-11*cm]))
story.append(PageBreak())

# ════════════════════════════════════════════════════════════════════
# SECTION 3 — ANTIFUNGAL
# ════════════════════════════════════════════════════════════════════
story.append(section_bg("SECTION 3 — ANTIFUNGAL DRUGS", NAVY, CYAN, 15))
story.append(Spacer(1, 4*mm))
story.append(Paragraph(
    "Fungi are eukaryotes, making selective toxicity more challenging than for bacteria. "
    "The main targets are ergosterol (the fungal cell membrane sterol, analogous to cholesterol in humans) "
    "and components unique to fungal cells such as glucan and chitin.",
    BODY))
story.append(Spacer(1, 3*mm))

af_table = [
    ["Class / Drug", "Mechanism", "Spectrum", "Key Indications", "Key ADRs"],
    ["AZOLES\nFluconazole\nItraconazole\nVoriconazole\nPosaconazole\nIsavuconazole", "Inhibit fungal CYP51 (14-alpha-demethylase) → block conversion of lanosterol to ergosterol → ergosterol depletion → accumulation of toxic 14-methyl sterols → altered membrane fluidity and function. Fungistatic (fungicidal vs C. glabrata).", "Fluconazole: Candida (not C. krusei, weakly vs C. glabrata), Cryptococcus\nVoriconazole: Aspergillus, Fusarium, Scedosporium, molds\nPosaconazole/Isavuconazole: broadest (Aspergillus, Mucor, Candida)", "Candidiasis (oropharyngeal, esophageal, invasive, vaginal — fluconazole)\nAspergillosis (voriconazole — 1st line)\nMucormycosis (posaconazole / isavuconazole)\nCryptococcal meningitis (fluconazole maintenance)\nProphylaxis in neutropenic/transplant patients", "Hepatotoxicity (all; monitor LFTs)\nVoriconazole: visual disturbances (photopsia — hallmark), photosensitivity, periostitis (fluoride toxicity), hallucinations, QT prolongation\nItraconazole: negative inotrope — avoid in heart failure\nAll azoles: CYP450 inhibitors (many drug interactions)\nFluconazole: relatively safe in pregnancy (avoid high dose in 1st trimester — teratogenic at 400-800 mg)"],
    ["POLYENES\nAmphotericin B\n(AmB)\nNystatin", "Bind directly to ergosterol in fungal cell membrane → form pores → leakage of K+, Mg2+, sugars → cell death. Fungicidal.", "Broadest of all antifungals: most Candida spp., Cryptococcus, Aspergillus, Mucorales, dimorphic fungi (Histoplasma, Coccidioides, Blastomyces). Sporothrix.", "Invasive fungal infections (serious/life-threatening), Mucormycosis (AmB-L = lipid formulation preferred), Cryptococcal meningitis (induction: AmBd + flucytosine × 2 wks), Aspergillosis, Candida endocarditis/meningitis\nNystatin: topical only — oral/vaginal Candida", "Conventional AmB deoxycholate (AmBd): Nephrotoxicity (major — dose-dependent, tubular acidosis, hypo-K, hypo-Mg), infusion-related reactions (fever, chills, rigors — pre-medicate), anemia, neurotoxicity\nLipid formulations (AmB-L, ABLC, ABCD): significantly less nephrotoxic; preferred for most indications\nNystatin: only GI side effects (oral), local irritation (topical)"],
    ["ECHINOCANDINS\nCaspofungin\nMicafungin\nAnidulafungin", "Inhibit beta-1,3-glucan synthase → blocks glucan synthesis → disrupts fungal cell wall (no equivalent in humans) → fungicidal vs Candida, fungistatic vs Aspergillus. High barrier to resistance.", "Candida spp. (including fluconazole-resistant C. glabrata and C. krusei)\nAspergillus (combination or salvage therapy)\nPneumocystis jirovecii (caspofungin — adjunct)\nNOT active vs Cryptococcus, Mucor, Fusarium", "Invasive candidiasis (1st line for unstable patients, ICU, suspected azole resistance)\nCandidemia (bloodstream)\nEsophageal candidiasis (azole-refractory)\nAspergillosis (salvage / combination)", "Generally excellent safety profile — best tolerated class\nHistamine-like infusion reactions (flushing, rash — slow infusion)\nHepatotoxicity (mild, monitor LFTs)\nCaspofungin: hypokalemia; drug interactions (cyclosporine — LFT elevation)\nNo oral formulation available"],
    ["ALLYLAMINES\nTerbinafine\nNaftifine", "Inhibit squalene epoxidase → blocks ergosterol synthesis at an earlier step than azoles → accumulation of squalene (toxic to fungi) → ergosterol depletion. Fungicidal vs dermatophytes.", "Dermatophytes (Tinea): T. rubrum, T. tonsurans, T. verrucosum — fungicidal vs dermatophytes\nCandida: mainly fungistatic (less effective)", "Onychomycosis (nail fungus — terbinafine 1st line, 6-12 weeks oral)\nTinea capitis, tinea corporis, tinea pedis\nTopical naftifine for skin dermatophyte infections", "Hepatotoxicity (check LFTs; rare serious hepatic failure)\nGI (N/V, diarrhea, dyspepsia)\nTaste/smell disturbance (may be permanent)\nRash, SJS (rare)\nCYP2D6 inhibitor (terbinafine)"],
    ["FLUCYTOSINE\n(5-FC)", "Prodrug; converted by fungal cytosine deaminase to 5-fluorouracil (5-FU) → inhibits thymidylate synthase (DNA synthesis) and incorporated into RNA (disrupts protein synthesis). Fungistatic.", "Cryptococcus neoformans, Candida spp.\nNarrow spectrum — used in combination only", "Cryptococcal meningitis (with AmB — synergistic combination; standard induction therapy in HIV)\nCandida endocarditis/meningitis (with AmBd)", "Bone marrow suppression (neutropenia, thrombocytopenia — dose-related)\nHepatotoxicity, GI\nMonitor drug levels (therapeutic: 25-100 mcg/mL); renally excreted — adjust in renal failure\nNEVER use as monotherapy — rapid resistance develops"],
    ["GRISEOFULVIN", "Binds to polymerized microtubules → disrupts mitotic spindle → prevents fungal cell division; also binds keratin precursor cells and concentrates in stratum corneum. Fungistatic.", "Dermatophytes only (Tinea)", "Tinea capitis (children — 1st line before terbinafine era), tinea unguium (nails — largely replaced by terbinafine), tinea corporis/pedis", "GI (take with fatty meal), headache, photosensitivity, CYP450 inducer (warfarin, OCP interactions), teratogenic (avoid in pregnancy, contraception advised)"],
]
story.append(drug_table(af_table[0], af_table[1:],
             [2.8*cm, 4.5*cm, 3*cm, 3.5*cm, W-13.8*cm]))
story.append(PageBreak())

# ════════════════════════════════════════════════════════════════════
# SECTION 4 — ANTIPARASITIC
# ════════════════════════════════════════════════════════════════════
story.append(section_bg("SECTION 4 — ANTIPARASITIC DRUGS", NAVY, CYAN, 15))
story.append(Spacer(1, 4*mm))

# 4.1 Antihelmintics
story.append(section_bg("4.1  Antihelmintics (Anti-worm drugs)", BLUE_MID, MINT, 12))
story.append(Spacer(1, 2*mm))
helm_table = [
    ["Drug / Class", "Mechanism", "Indications", "ADRs"],
    ["Albendazole\nMebendazole\n(Benzimidazoles)", "Bind to beta-tubulin of helminths (& protozoa) → inhibit tubulin polymerization → prevent microtubule formation → block glucose uptake → inhibit larval motility and egg production. Mebendazole poorly absorbed; albendazole better absorbed (+ active metabolite albendazole sulfoxide)", "Albendazole: 1st line for neurocysticercosis, echinococcosis (hydatid disease), strongyloidiasis, filariasis, GI helminths\nMebendazole: GI helminths (roundworm, whipworm, hookworm, pinworm)", "GI upset, transient transaminase elevation (especially albendazole at high doses for cysticercosis), bone marrow suppression (prolonged therapy). Teratogenic (avoid in pregnancy)"],
    ["Praziquantel", "Increases cell permeability to Ca²⁺ → tetanic muscular contraction → parasite detachment from vessel walls → phagocytosis by host immune cells. Also tegumental disruption.", "Drug of choice for: Schistosomiasis (all species), cestodes (Taenia saginata, T. solium intestinal — NOT neurocysticercosis), Cysticercosis (intestinal), Liver flukes (Clonorchis, Opisthorchis, Fasciola — partial)", "Generally well tolerated; fever, eosinophilia, CSF reaction (worm death in neurocysticercosis — use with steroids); GI. Avoid in ocular cysticercosis."],
    ["Ivermectin", "Binds to invertebrate-specific glutamate-gated Cl⁻ channels (Cl⁻ influx → hyperpolarization → paralysis of helminth pharyngeal muscles and locomotion). Also potentiates GABA. No activity against adult filariae.", "Strongyloides (drug of choice), Onchocerciasis (river blindness — single annual dose), Lymphatic filariasis (MDA programs), scabies, head lice; off-label: cutaneous larva migrans, pinworm", "Generally very well tolerated; Mazzotti reaction (fever, itch, rash — from dying microfilariae in onchocerciasis); CNS effects if blood-brain barrier compromised"],
    ["Diethylcarbamazine\n(DEC)", "Alters microfilarial surface leading to immune-mediated killing; also microfilaricide", "Lymphatic filariasis (W. bancrofti, Brugia — primary; NOT alone for onchocerciasis — causes Mazzotti reaction), tropical pulmonary eosinophilia", "Mazzotti-like reaction (fever, pruritus, skin/eye reactions from dying microfilariae — administer with antihistamines/steroids); contraindicated in onchocerciasis (eye damage)"],
    ["Pyrantel pamoate", "Depolarizing neuromuscular blocker → spastic paralysis of helminths", "Pinworm, roundworm, hookworm (OTC available)", "GI upset, headache; not absorbed systemically"],
]
story.append(drug_table(helm_table[0], helm_table[1:],
             [2.8*cm, 5*cm, 4*cm, W-11.8*cm]))
story.append(Spacer(1, 3*mm))

# 4.2 Antiprotozoals
story.append(section_bg("4.2  Antiprotozoals (Luminal & Systemic)", BLUE_MID, MINT, 12))
story.append(Spacer(1, 2*mm))
prot_table = [
    ["Drug", "Target Protozoan", "Mechanism", "ADRs / Notes"],
    ["Metronidazole\nTinidazole", "Entamoeba histolytica\nGiardia lamblia\nTrichomonas vaginalis\nAnaerobic bacteria", "Nitro-group reduction → reactive radicals → DNA strand breaks (anaerobic mechanism)", "Disulfiram reaction with alcohol, metallic taste, peripheral neuropathy; tinidazole: better tolerated, longer t½, single-dose option for Giardia/Trichomonas"],
    ["Diloxanide furoate\nParomomycin (oral)", "Entamoeba (luminal cysts only — non-invasive)", "Luminal amebicides — eliminate intestinal cysts; not absorbed; used after metronidazole for tissue amebiasis to clear bowel", "GI (flatulence, diarrhea); paromomycin: also used for cryptosporidiosis, visceral leishmaniasis"],
    ["Pentamidine", "Pneumocystis jirovecii (2nd line)\nLeishmaniasis\nAfrican sleeping sickness (early stage)", "Disrupts mitochondrial membrane potential, inhibits DHFR and polyamine synthesis in protozoa", "Pancreatitis, hypoglycemia (β cell toxicity → hyperglycemia later), nephrotoxicity, hypotension, arrhythmias; inhaled form for PCP prophylaxis"],
    ["TMP-SMX\n(Co-trimoxazole)", "Pneumocystis jirovecii (PCP)\nToxoplasma gondii (with pyrimethamine)\nCyclospora, Isospora", "Sequential folate blockade (DHPS + DHFR inhibition)", "SJS/TEN, myelosuppression, hyperkalemia, nephrotoxicity (see antibacterial section)"],
    ["Pyrimethamine\n(+ sulfadiazine)", "Toxoplasma gondii\nMalaria (Fansidar — with sulfadoxine)", "Inhibits DHFR of parasite >> host DHFR; given with folinic acid (leucovorin) to minimize host myelosuppression", "Myelosuppression (give leucovorin), rash, megaloblastic anemia; must supplement with folinic acid"],
    ["Sodium Stibogluconate\nMeglumine antimoniate\n(Pentavalent antimonials)", "Leishmania (visceral — kala-azar, cutaneous, mucocutaneous)", "Reduced to Sb(III) in macrophages → inhibits trypanothione reductase and glycolysis of Leishmania amastigotes", "Cardiotoxicity (QT prolongation, sudden death), hepatotoxicity, pancreatitis, thrombocytopenia; pain at injection site; resistance increasing"],
    ["Amphotericin B\n(lipid formulation)", "Visceral leishmaniasis (1st line in many regions)\nFree-living amoeba (Naegleria)", "Ergosterol-like molecule in Leishmania membranes; binds and disrupts membrane integrity", "See antifungal section; AmB-L preferred (less nephrotoxic)"],
    ["Miltefosine", "Visceral leishmaniasis (oral)\nAmebic meningoencephalitis (Naegleria, Balamuthia)", "Alkyl-lysophospholipid analogue → disrupts phospholipid metabolism → apoptosis in Leishmania", "GI (N/V, diarrhea), teratogenic (contraception required during + 3 months after); hepatotoxicity, nephrotoxicity"],
    ["Suramin\nMelarsoprol\nEflornithine", "African trypanosomiasis (sleeping sickness)\nT. brucei gambiense / rhodesiense", "Suramin: early-stage (not CNS); Melarsoprol: late-stage (CNS) — arsenical compound; Eflornithine: DFMO — ornithine decarboxylase inhibitor (T.b. gambiense CNS stage)", "Melarsoprol: reactive encephalopathy (5-10% fatal), exfoliative dermatitis\nSuramin: proteinuria, nephrotoxicity, anaphylaxis\nEflornithine: myelosuppression, GI; much safer than melarsoprol"],
    ["Benznidazole\nNifurtimox", "Trypanosoma cruzi\n(Chagas disease)", "Nitroreductase generates reactive metabolites → oxidative damage to DNA and proteins of T. cruzi", "Neuropathy, dermatitis (benznidazole); anorexia, weight loss, GI, neuropathy (nifurtimox); both better tolerated in children than adults"],
]
story.append(drug_table(prot_table[0], prot_table[1:],
             [2.8*cm, 3*cm, 4*cm, W-9.8*cm]))
story.append(PageBreak())

# ════════════════════════════════════════════════════════════════════
# QUICK MNEMONICS / PEARLS PAGE
# ════════════════════════════════════════════════════════════════════
story.append(section_bg("QUICK REVISION PEARLS & MNEMONICS", NAVY, AMBER, 15))
story.append(Spacer(1, 4*mm))

pearls = [
    ("Cell wall inhibitors", "Beta-lactams (PBP) + Glycopeptides (D-Ala-D-Ala) + Fosfomycin (MurA) → all bactericidal"),
    ("30S Inhibitors", "A-MITT: Aminoglycosides (bactericidal), Tetracyclines (bacteriostatic)"),
    ("50S Inhibitors", "CEL+L: Chloramphenicol, Erythromycin/Macrolides, Lincosamides (Clindamycin), Linezolid — mostly bacteriostatic"),
    ("DNA synthesis inh.", "Fluoroquinolones (topoisomerase) + Metronidazole (radical DNA strand breaks) + Rifampicin (RNA pol)"),
    ("Folate pathway", "Sulfonamides (DHPS) → Trimethoprim (DHFR) — sequential blockade synergy"),
    ("Bactericidal drugs", "Beta-lactams, Aminoglycosides, Fluoroquinolones, Vancomycin, Metronidazole, Daptomycin, Polymyxins"),
    ("Bacteriostatic drugs", "Tetracyclines, Macrolides, Clindamycin, Chloramphenicol, TMP-SMX, Linezolid — 'TECS-TML'"),
    ("Avoid in pregnancy", "Tetracyclines (2nd/3rd tri), Fluoroquinolones, Aminoglycosides, TMP (1st/3rd), Chloramphenicol (near term), Rifampicin (near term)"),
    ("G6PD + hemolysis risk", "Dapsone, Primaquine, Nitrofurantoin, TMP-SMX, Chloroquine (mild), Rasburicase"),
    ("QT prolongation", "Azithromycin, Clarithromycin, Fluoroquinolones (moxifloxacin > levofloxacin), Chloroquine, Quinine, Lumefantrine"),
    ("Hepatotoxic ABX", "INH, Rifampicin, Pyrazinamide (triple threat in TB!), Ketoconazole, Erythromycin estolate, Amoxicillin-clavulanate"),
    ("Renal toxicity", "Aminoglycosides, Vancomycin, Amphotericin B, Polymyxins, Foscarnet, Cidofovir, Acyclovir (high dose IV)"),
    ("Active vs MRSA", "Vancomycin, Daptomycin, Linezolid, Ceftaroline, TMP-SMX (community MRSA), Clindamycin (community MRSA), Tedizolid"),
    ("Anti-pseudomonal", "Pip-Tazo, Cefepime, Ceftazidime, Imipenem/Meropenem, Aztreonam, Ciprofloxacin/Levofloxacin, Aminoglycosides, Polymyxins, Colistin"),
    ("CYP450 Inducers (ABX)", "Rifampicin (most potent), Rifabutin, Griseofulvin — reduce levels of many co-medications"),
    ("CYP450 Inhibitors (ABX/AF)", "Erythromycin/Clarithromycin, Azoles (fluconazole > itraconazole > voriconazole), Metronidazole, Isoniazid"),
]

for (title, body) in pearls:
    story.append(Paragraph(f"<b>{title}:</b>  {body}", BODY))
    story.append(HRFlowable(width=W, thickness=0.3, color=GRAY))
    story.append(Spacer(1, 1.5*mm))

story.append(PageBreak())

# Cover page for slide section
slide_cover = Table([[
    Paragraph("REVISION CHARTS", S("sc", fontName="Helvetica-Bold", fontSize=26, textColor=WHITE, alignment=TA_CENTER)),
]],  colWidths=[W])
slide_cover.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), NAVY),
    ("TOPPADDING", (0,0), (-1,-1), 25),
    ("BOTTOMPADDING", (0,0), (-1,-1), 10),
]))
story.append(slide_cover)
slide_cover2 = Table([[
    Paragraph("The following pages contain the visual flowchart and revision charts from the PPTX presentation\n(Antimicrobial Classification Flowchart • Anti-TB • Anti-Leprosy • Anti-Malarial)", 
              S("sc2", fontName="Helvetica-Oblique", fontSize=12, textColor=CYAN_LIGHT, alignment=TA_CENTER)),
]],  colWidths=[W])
slide_cover2.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), NAVY),
    ("TOPPADDING", (0,0), (-1,-1), 6),
    ("BOTTOMPADDING", (0,0), (-1,-1), 25),
]))
story.append(slide_cover2)

# ── BUILD PDF ──────────────────────────────────────────────────────────────
OUT_CONTENT = "/home/daytona/workspace/antimicrobial-charts/content.pdf"
doc = SimpleDocTemplate(
    OUT_CONTENT,
    pagesize=A4,
    leftMargin=1*cm, rightMargin=1*cm,
    topMargin=1.5*cm, bottomMargin=1.5*cm,
    title="Antimicrobial Drugs - Comprehensive Study Guide"
)

def add_page_bg(canvas, doc):
    canvas.saveState()
    canvas.setFillColor(colors.HexColor("#F7FAFC"))
    canvas.rect(0, 0, A4[0], A4[1], fill=1, stroke=0)
    # footer
    canvas.setFont("Helvetica", 7)
    canvas.setFillColor(GRAY)
    canvas.drawCentredString(A4[0]/2, 0.7*cm, f"Antimicrobial Drugs — Comprehensive Study Guide  |  Page {doc.page}")
    canvas.restoreState()

doc.build(story, onFirstPage=add_page_bg, onLaterPages=add_page_bg)
print(f"Content PDF built: {OUT_CONTENT}")

# ── MERGE: content PDF + PPTX slides PDF ──────────────────────────────────
PPTX_PDF = "/tmp/amcharts.pdf"
OUT_FINAL = "/home/daytona/workspace/antimicrobial-charts/Antimicrobial_Complete_Guide.pdf"

writer = PdfWriter()

# Add content pages
reader_content = PdfReader(OUT_CONTENT)
for page in reader_content.pages:
    writer.add_page(page)

# Add PPTX slides
reader_slides = PdfReader(PPTX_PDF)
for page in reader_slides.pages:
    writer.add_page(page)

# Metadata
writer.add_metadata({
    "/Title": "Antimicrobial Drugs — Complete Study Guide + Revision Charts",
    "/Author": "Orris Medical Education",
    "/Subject": "Pharmacology"
})

with open(OUT_FINAL, "wb") as f:
    writer.write(f)

import os
size = os.path.getsize(OUT_FINAL) / 1024
print(f"Final PDF: {OUT_FINAL}  ({size:.0f} KB)")
print(f"Total pages: {len(reader_content.pages)} content + {len(reader_slides.pages)} slide pages = {len(reader_content.pages)+len(reader_slides.pages)} pages")
Running Command

cd /home/daytona/workspace/antimicrobial-charts && python3 build_pdf.py 2>&1

Your complete PDF is ready - 20 pages total:

Antimicrobial Complete Guide

PDF Document · PDF


What's inside (20 pages):

Pages 1-15 — Detailed Antimicrobial Content

SectionCoverage
Cover + TOCOverview, table of contents
Section 1 — AntibacterialMechanisms overview table, then deep dives into: Beta-lactams (all 10 sub-classes + carbapenems + monobactams), Aminoglycosides, Tetracyclines, Macrolides, Fluoroquinolones (4 generations), Glycopeptides, Sulfonamides/TMP, + 9 other agents (Linezolid, Daptomycin, Polymyxins, Chloramphenicol, Metronidazole, Rifampicin, Fosfomycin, Nitrofurantoin)
Section 2 — AntiviralAntiherpes (Acyclovir, Ganciclovir, Foscarnet, Cidofovir), Anti-HIV by class (NRTIs, NNRTIs, PIs, INSTIs, Entry inhibitors), Anti-Hepatitis (DAAs for HCV, NRTIs for HBV, Interferons), Anti-Influenza (neuraminidase inhibitors, baloxavir, adamantanes)
Section 3 — AntifungalAzoles (all 5 drugs), Polyenes (AmB + Nystatin), Echinocandins, Allylamines, Flucytosine, Griseofulvin
Section 4 — AntiparasiticAntihelmintics (Albendazole, Praziquantel, Ivermectin, DEC, Pyrantel), Antiprotozoals (Metronidazole, TMP-SMX, Pentamidine, Pyrimethamine, Antimonials, Miltefosine, Trypanosomiasis drugs, Chagas drugs)
Quick Pearls Page16 exam-ready mnemonics: bactericidal vs static, organ toxicities, G6PD drugs, QT drugs, MRSA coverage, anti-pseudomonal, CYP interactions
Slide transition pageBridge page before PPTX content

Pages 16-20 — PPTX Revision Slides (embedded)

The 5 slides from the PPTX: Title, Flowchart, Anti-TB table, Anti-Leprosy table, Anti-Malarial table.
This is a shared conversation. Sign in to Orris to start your own chat.