Last search for anti hypertensives

Reading File
Finding Sources
Searching PubMed

"antihypertensive" AND "hypertension treatment"

Finding Sources
Reading File
Finding Sources
Reading File
Finding Sources
Reading File
Finding Sources
Reading File
Finding Sources
Reading File
Reading File
Reading File
I now have comprehensive data from Goodman & Gilman's and Family Medicine textbooks. Here is the full, organized reference on antihypertensives:

Antihypertensive Drugs - Comprehensive Summary

Definition & Goals

Hypertension is defined as:
  • USA (AHA/ACC): BP ≥ 130/80 mmHg
  • Europe (ESC): BP ≥ 140/90 mmHg
The primary goal of antihypertensive therapy is blood pressure lowering per se - evidence from large prospective trials shows no major outcome difference between drug classes when BP is equally controlled.

First-Line Drug Classes

The four preferred first-line classes (no compelling indications) are:
ClassKey Examples
ACE InhibitorsCaptopril, Enalapril, Lisinopril, Ramipril, Perindopril
ARBsValsartan, Losartan, Candesartan, Olmesartan, Telmisartan
Calcium Channel Blockers (CCBs)Amlodipine, Nifedipine (ER), Diltiazem, Verapamil
Thiazide/Thiazide-like DiureticsHydrochlorothiazide, Chlorthalidone, Indapamide

Drug Classes: Mechanisms & Key Points

1. Thiazide Diuretics

  • MOA: Block the NaCl cotransporter (SLC12A3) in the distal convoluted tubule → initial decrease in extracellular volume → long-term decrease in peripheral vascular resistance (indirect, via negative Na+ balance)
  • Examples: Hydrochlorothiazide, chlorthalidone, indapamide
  • Adverse effects: Hypokalemia, hyperglycemia, hyperuricemia, hyponatremia
  • Note: Lose efficacy in renal insufficiency (GFR < 30); loop diuretics preferred then

2. Loop Diuretics

  • Examples: Furosemide (20-80 mg, twice daily), Bumetanide, Torsemide, Ethacrynic acid
  • Use: Volume overload, renal insufficiency, resistant hypertension
  • SE: Hypokalemia, ototoxicity (ethacrynic acid - only non-sulfonamide)

3. Potassium-Sparing Diuretics / MRA

  • Spironolactone (12.5-100 mg) - aldosterone antagonist, SE: gynecomastia
  • Eplerenone (25-50 mg) - more selective, less gynecomastia
  • Amiloride, Triamterene - ENaC blockers; SE: hyperkalemia
  • Use: Resistant hypertension (4th-line add-on), heart failure, Conn syndrome

4. Beta-Blockers (β-Blockers)

  • MOA: Reduce cardiac output (decrease HR and contractility); reduce renin release; central sympatholytic effects
  • Cardioselective: Atenolol, Bisoprolol, Metoprolol succinate (preferred), Nebivolol
  • Non-selective: Propranolol, Nadolol, Timolol
  • Mixed α/β: Carvedilol, Labetalol
  • Preferred when: Post-MI, ischemic heart disease, atrial fibrillation, HFrEF, younger patients with high sympathetic drive
  • Contraindications/Caution: Asthma/COPD, decompensated heart failure, AV block
  • Note: Once-daily dosing preferred (extended-release metoprolol succinate)

5. ACE Inhibitors

  • MOA: Inhibit conversion of Angiotensin I → Angiotensin II → decreased vasoconstriction, decreased aldosterone, reduced afterload/preload
  • Examples: Captopril*, Enalapril, Lisinopril, Ramipril, Perindopril, Benazepril, Fosinopril
  • Special benefits: Diabetic nephropathy (slow progression of glomerulopathy), chronic kidney disease, proteinuria, post-MI, HFrEF
  • Adverse effects: Dry cough (bradykinin accumulation), angioedema (contraindicated if prior angioedema), hyperkalemia, teratogenic (avoid in pregnancy)
  • *Short half-life of captopril makes it unsuitable for chronic once-daily use

6. Angiotensin Receptor Blockers (ARBs)

  • MOA: Selective competitive antagonism at AT1 receptor → same downstream effects as ACEi but without bradykinin accumulation
  • Examples: Valsartan, Losartan, Candesartan, Olmesartan, Telmisartan, Irbesartan, Azilsartan
  • Advantages over ACEi: No dry cough, lower risk of angioedema
  • Uses: Same as ACEi; also atrial fibrillation prevention, portal hypertension, stroke prevention
  • Adverse effects: Hyperkalemia; teratogenic (contraindicated in pregnancy); do NOT combine with ACEi (increased adverse effects without added benefit)

7. Calcium Channel Blockers (CCBs)

  • Dihydropyridines (arterial selective): Amlodipine, Nifedipine ER, Felodipine, Clevidipine (IV, ultra-short)
    • Preferred for: Isolated systolic hypertension, elderly, asymptomatic atherosclerosis, angina
    • SE: Peripheral edema, reflex tachycardia
  • Non-dihydropyridines (cardiac): Diltiazem (benzothiazepine), Verapamil (phenylalkylamine)
    • Rate control in AF, angina
    • SE: Bradycardia, constipation (verapamil), AV block; contraindicated with β-blockers (risk of complete heart block)

8. Alpha-1 Blockers

  • MOA: Block α1 adrenergic receptors → arteriolar and venous dilation
  • Examples: Prazosin (1-10 mg, twice daily), Terazosin (1-20 mg), Doxazosin (2-16 mg)
  • Favorable metabolic effects: Reduce LDL/triglycerides, raise HDL
  • Not recommended as monotherapy (ALLHAT trial showed inferior outcomes)
  • Preferred add-on in: BPH with hypertension
  • SE: First-dose orthostatic hypotension, salt/water retention

9. Central Alpha-2 Agonists

  • MOA: Stimulate central α2 receptors → reduce sympathetic outflow
  • Clonidine (0.1-0.8 mg, 2-3x daily; also TTS patch): Sedation, dry mouth, rebound hypertension on withdrawal
  • Methyldopa (250-500 mg, twice daily): Drug of choice in pregnancy; SE: hepatic disorders, autoimmune hemolytic anemia
  • Guanfacine - less withdrawal risk than clonidine
  • Moxonidine - selective I1 imidazoline receptor agonist

10. Direct Vasodilators

  • Hydralazine - arterial vasodilator; SE: reflex tachycardia, lupus-like syndrome (high dose); used in pregnancy (IV)
  • Minoxidil - potent arterial vasodilator (K+ channel opener); reserved for resistant hypertension; causes hirsutism, fluid retention
  • Sodium nitroprusside - arterial + venous; IV only; hypertensive emergencies; SE: cyanide toxicity
  • Diazoxide, Fenoldopam (DA1 agonist) - IV use for hypertensive crisis

11. Newer Agents

  • Aldosterone synthase inhibitors (e.g., lorundrostat, baxdrostat) - emerging class; meta-analysis (2025, PMID 39886765) shows significant BP reduction with acceptable safety profile
  • Low-dose triple single-pill combinations (e.g., telmisartan + amlodipine + chlorthalidone) - systematic review (2025, PMID 40488970) supports efficacy and safety in LMICs

Drug Selection by Comorbidity

ComorbidityPreferred Agents
Diabetes mellitusACEi, ARB, CCB, thiazide
Diabetes + proteinuriaACEi, ARB
Chronic kidney disease / proteinuriaACEi, ARB
Post-MIACEi, ARB, BB
Coronary artery disease / AnginaBB, CCB, ACEi, ARB
Heart failure (HFrEF)ACEi, ARB, BB, diuretics, MRA
Atrial fibrillation (rate control)BB, non-DHP CCBs
Atrial fibrillation (prevention)ACEi, ARB, BB
Stroke preventionACEi, ARB, diuretics
Left ventricular hypertrophyACEi, ARB, CCB
Isolated systolic hypertensionACEi, ARB, CCB, diuretics
Metabolic syndromeACEi, ARB, CCB
BPHα1 blockers
PregnancyMethyldopa, Labetalol, Hydralazine, Nifedipine
PheochromocytomaPhenoxybenzamine (irreversible α-blocker)
Peripheral artery diseaseACEi, CCB
Aortic aneurysmBB
Asymptomatic atherosclerosisCCB
Renal insufficiencyACEi, ARB (+ loop diuretics if GFR low)

Combination Therapy Principles

  • Preferred combinations: ACEi or ARB + CCB + thiazide diuretic (as single-pill if possible)
  • BB added as 4th drug in resistant hypertension or when specific indication exists
  • Avoid combining: ACEi + ARB (dual RAS blockade), BB + non-DHP CCB (risk of complete heart block)
  • Trough-to-peak ratio > 50% required for 24-hour BP control (guides once-daily dosing)

Resistant Hypertension

  • Defined as BP above goal despite 3 drugs (including a diuretic) at maximum tolerated doses
  • Consider spironolactone as 4th agent
  • Rule out secondary causes: primary hyperaldosteronism, renal artery stenosis, sleep apnea, medication non-adherence

Special Populations

PopulationKey Considerations
ElderlyThiazides first-step; CCBs safe; orthostatic hypotension risk; avoid high-dose thiazides
PregnancyMethyldopa, labetalol, nifedipine ER; ACEi/ARBs contraindicated
BreastfeedingSpecific agents safe - consult Brenner & Rector's guidelines
Renal insufficiencyLoop diuretics > thiazides; ACEi/ARBs preferred but monitor K+/creatinine
African AmericansThiazides and CCBs more effective; ACEi/ARBs less effective as monotherapy

Sources: Goodman & Gilman's Pharmacological Basis of Therapeutics; Katzung's Basic & Clinical Pharmacology, 16e; Textbook of Family Medicine, 9e; Brenner & Rector's The Kidney
Recent evidence update:
  • Aldosterone synthase inhibitors show promising BP reduction (Meta-analysis, 2025 - PMID 39886765)
  • Low-dose triple single-pill combinations are effective and safe in LMICs (Systematic review, 2025 - PMID 40488970)
  • Network meta-analysis of 6 ARBs (2024, PMID 38861046) found broadly comparable efficacy across the ARB class

Make a chart of different antihypertensives used in different comorboditis with drug dose and also include side effects and contraindications make chart in colourful design

Reading File
Reading File
Reading File
Reading File
Running Command

ls /home/daytona/workspace/ 2>/dev/null || mkdir -p /home/daytona/workspace/antihypertensives

Running Command

mkdir -p /home/daytona/workspace/antihypertensives

Writing File

~/antihypertensives/build.js

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

// ─── PALETTE ────────────────────────────────────────────────────────────────
const C = {
  navy:    "0D1B2A",
  teal:    "1B998B",
  coral:   "E84855",
  gold:    "F4A261",
  violet:  "7B2D8B",
  sky:     "2196F3",
  green:   "27AE60",
  orange:  "E67E22",
  pink:    "E91E8C",
  indigo:  "3949AB",
  white:   "FFFFFF",
  lightGray: "F4F7FB",
  darkText: "1A1A2E",
  mutedText: "5A6A7A",
};

// colour strips per class (used as left accent bar colour)
const classColor = {
  "Thiazide Diuretics":    C.sky,
  "Loop Diuretics":        C.indigo,
  "K-Sparing Diuretics":   C.teal,
  "Beta-Blockers":         C.coral,
  "ACE Inhibitors":        C.green,
  "ARBs":                  C.gold,
  "Calcium Channel Blockers": C.violet,
  "Alpha-1 Blockers":      C.orange,
  "Central Alpha-2 Agonists": C.pink,
  "Direct Vasodilators":   "8B5CF6",
};

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 1 – TITLE
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  // dark bg
  s.background = { color: C.navy };

  // large decorative circle top-right
  s.addShape(pres.shapes.OVAL, { x: 9.8, y: -1.2, w: 4.5, h: 4.5,
    fill: { color: C.teal, transparency: 75 }, line: { type: "none" } });
  s.addShape(pres.shapes.OVAL, { x: 10.5, y: -0.5, w: 3, h: 3,
    fill: { color: C.coral, transparency: 80 }, line: { type: "none" } });

  // bottom strip
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 6.5, w: 13.3, h: 1,
    fill: { color: C.teal, transparency: 0 }, line: { type: "none" } });
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 6.8, w: 13.3, h: 0.7,
    fill: { color: C.coral, transparency: 0 }, line: { type: "none" } });

  // left accent bar
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 0.2, h: 7.5,
    fill: { color: C.gold }, line: { type: "none" } });

  s.addText("ANTIHYPERTENSIVE DRUGS", {
    x: 0.5, y: 1.2, w: 12, h: 1.1,
    fontSize: 42, bold: true, color: C.white, fontFace: "Calibri",
    charSpacing: 3,
  });
  s.addText("Management by Comorbidity", {
    x: 0.5, y: 2.45, w: 10, h: 0.7,
    fontSize: 24, color: C.gold, fontFace: "Calibri", italic: true,
  });
  s.addText("Drug • Dose • Side Effects • Contraindications", {
    x: 0.5, y: 3.2, w: 10, h: 0.5,
    fontSize: 16, color: "B0C4D8", fontFace: "Calibri",
  });

  // pill icons (simple shape motifs)
  const pills = [
    { x: 0.5,  col: C.sky },
    { x: 1.8,  col: C.coral },
    { x: 3.1,  col: C.teal },
    { x: 4.4,  col: C.gold },
    { x: 5.7,  col: C.violet },
  ];
  pills.forEach(p => {
    s.addShape(pres.shapes.ROUNDED_RECTANGLE, {
      x: p.x, y: 4.3, w: 0.9, h: 0.4,
      fill: { color: p.col, transparency: 30 },
      line: { color: p.col, pt: 1 },
      rectRadius: 0.2,
    });
  });

  s.addText("Sources: Goodman & Gilman's | Katzung's Basic & Clinical Pharmacology | Family Medicine 9e", {
    x: 0.3, y: 6.85, w: 12, h: 0.35,
    fontSize: 8.5, color: C.white, fontFace: "Calibri", transparency: 20,
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// HELPER: add a colour-coded section slide (class overview)
// ═══════════════════════════════════════════════════════════════════════════
function addClassSlide(classInfo) {
  const { title, color, drugs, bg } = classInfo;
  const s = pres.addSlide();
  s.background = { color: bg || C.lightGray };

  // header bar
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 13.3, h: 1.1,
    fill: { color }, line: { type: "none" } });

  // left accent thin strip
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 0.15, h: 7.5,
    fill: { color: C.navy }, line: { type: "none" } });

  s.addText(title, {
    x: 0.3, y: 0, w: 13, h: 1.1,
    fontSize: 26, bold: true, color: C.white, fontFace: "Calibri",
    valign: "middle", margin: 0,
  });

  // column headers
  const hdrY = 1.2;
  const cols = [
    { label: "Drug / Examples",        x: 0.2,  w: 2.4 },
    { label: "Dose Range",             x: 2.7,  w: 2.1 },
    { label: "Comorbidities (Preferred)", x: 4.9, w: 2.8 },
    { label: "Side Effects",           x: 7.8,  w: 2.5 },
    { label: "Contraindications",      x: 10.4, w: 2.7 },
  ];

  cols.forEach(c => {
    s.addShape(pres.shapes.RECTANGLE, {
      x: c.x, y: hdrY, w: c.w, h: 0.45,
      fill: { color }, line: { type: "none" },
    });
    s.addText(c.label, {
      x: c.x + 0.05, y: hdrY, w: c.w - 0.1, h: 0.45,
      fontSize: 9.5, bold: true, color: C.white, fontFace: "Calibri",
      valign: "middle", margin: 4,
    });
  });

  // rows
  drugs.forEach((drug, i) => {
    const rowY = 1.75 + i * 0.9;
    const rowBg = i % 2 === 0 ? "FFFFFF" : "EFF6FF";

    s.addShape(pres.shapes.RECTANGLE, {
      x: 0.2, y: rowY, w: 12.9, h: 0.82,
      fill: { color: rowBg }, line: { color: "D0DCE8", pt: 0.5 },
    });

    // left color indicator dot
    s.addShape(pres.shapes.OVAL, {
      x: 0.22, y: rowY + 0.28, w: 0.18, h: 0.18,
      fill: { color }, line: { type: "none" },
    });

    const cells = [
      { text: drug.name,            x: 0.45,  w: 2.15 },
      { text: drug.dose,            x: 2.7,   w: 2.1  },
      { text: drug.comorbidities,   x: 4.9,   w: 2.8  },
      { text: drug.sideEffects,     x: 7.8,   w: 2.5  },
      { text: drug.contraindications, x: 10.4, w: 2.7 },
    ];

    cells.forEach(cell => {
      s.addText(cell.text, {
        x: cell.x, y: rowY + 0.04, w: cell.w, h: 0.75,
        fontSize: 8, color: C.darkText, fontFace: "Calibri",
        valign: "middle", wrap: true, margin: 3,
      });
    });
  });

  // footer
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 7.15, w: 13.3, h: 0.35,
    fill: { color: C.navy }, line: { type: "none" } });
  s.addText("Antihypertensive Drug Reference  |  For Educational Use", {
    x: 0.2, y: 7.15, w: 13, h: 0.35,
    fontSize: 7.5, color: C.white, fontFace: "Calibri", valign: "middle",
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// DATA
// ═══════════════════════════════════════════════════════════════════════════
const slides = [
  {
    title: "💊  THIAZIDE & THIAZIDE-LIKE DIURETICS",
    color: C.sky,
    drugs: [
      {
        name: "Hydrochlorothiazide (HCTZ)",
        dose: "12.5–25 mg once daily",
        comorbidities: "Essential HTN, Osteoporosis, Isolated systolic HTN, Elderly",
        sideEffects: "Hypokalemia, Hyponatremia, Hyperuricemia, Hyperglycemia, Hyperlipidemia, Photosensitivity",
        contraindications: "Anuria, Sulfonamide allergy, Gout (relative), Hypokalemia",
      },
      {
        name: "Chlorthalidone",
        dose: "12.5–25 mg once daily",
        comorbidities: "Essential HTN, Cardiovascular risk reduction, Metabolic syndrome",
        sideEffects: "Hypokalemia, Hyponatremia, Hyperuricemia, Hyperglycemia, Impotence",
        contraindications: "Anuria, Sulfonamide allergy, Severe renal impairment (GFR <30)",
      },
      {
        name: "Indapamide",
        dose: "1.25–2.5 mg once daily",
        comorbidities: "Essential HTN, Diabetes (metabolically neutral), Heart failure",
        sideEffects: "Mild hypokalemia, Headache, Dizziness (less metabolic effects than HCTZ)",
        contraindications: "Severe hepatic impairment, Hypokalemia, Anuria",
      },
    ],
  },
  {
    title: "💊  LOOP DIURETICS",
    color: C.indigo,
    drugs: [
      {
        name: "Furosemide (Frusemide)",
        dose: "20–80 mg once or twice daily (oral); 20–40 mg IV bolus",
        comorbidities: "Hypertension with renal insufficiency (GFR <30), Heart failure, Pulmonary edema, Hypercalcemia",
        sideEffects: "Hypokalemia, Hyponatremia, Hypomagnesemia, Ototoxicity (high IV doses), Hyperuricemia, Dehydration",
        contraindications: "Anuria, Sulfonamide allergy (furosemide), Pre-renal azotemia, Hepatic coma",
      },
      {
        name: "Bumetanide",
        dose: "0.5–2 mg once or twice daily",
        comorbidities: "HTN + CKD, Resistant edema, Heart failure",
        sideEffects: "Hypokalemia, Ototoxicity, Muscle cramps, Hyperuricemia",
        contraindications: "Anuria, Sulfonamide allergy, Severe electrolyte depletion",
      },
      {
        name: "Torsemide",
        dose: "5–20 mg once daily",
        comorbidities: "Heart failure, CKD-related HTN, Resistant HTN",
        sideEffects: "Hypokalemia, Dizziness, Headache (less ototoxic than furosemide)",
        contraindications: "Anuria, Sulfonamide allergy, Hepatic cirrhosis (use with caution)",
      },
    ],
  },
  {
    title: "💊  POTASSIUM-SPARING DIURETICS / MRA",
    color: C.teal,
    drugs: [
      {
        name: "Spironolactone",
        dose: "12.5–100 mg once daily (HTN); 25–50 mg in HF",
        comorbidities: "Heart failure (HFrEF), Resistant HTN (4th agent), Primary Hyperaldosteronism, Conn syndrome",
        sideEffects: "Hyperkalemia, Gynecomastia, Menstrual irregularities, Impotence, GI upset",
        contraindications: "Hyperkalemia (K+ >5.5), Anuria, Addison's disease, Concurrent ACEi/ARB (risk of hyperkalemia)",
      },
      {
        name: "Eplerenone",
        dose: "25–50 mg once or twice daily",
        comorbidities: "Post-MI HTN + LV dysfunction, Heart failure, Primary Hyperaldosteronism",
        sideEffects: "Hyperkalemia, Dizziness, Fatigue (less gynecomastia than spironolactone)",
        contraindications: "K+ >5.5 mEq/L, eGFR <30, Diabetes with microalbuminuria, Strong CYP3A4 inhibitors",
      },
      {
        name: "Amiloride / Triamterene",
        dose: "Amiloride: 5–10 mg/day; Triamterene: 50–100 mg/day",
        comorbidities: "Combined with thiazide to prevent K+ loss, Hypokalemia prevention",
        sideEffects: "Hyperkalemia, Nausea, Renal stones (triamterene), Megaloblastic anemia",
        contraindications: "Hyperkalemia, Renal insufficiency, Use with ACEi/ARBs or other K+ sparing agents",
      },
    ],
  },
  {
    title: "💊  BETA-BLOCKERS (β-Blockers)",
    color: C.coral,
    drugs: [
      {
        name: "Metoprolol Succinate (β1-selective)",
        dose: "25–200 mg once daily (ER)",
        comorbidities: "Post-MI, Angina, HFrEF, Atrial fibrillation (rate control), Hyperthyroidism, Anxiety (perioperative)",
        sideEffects: "Bradycardia, Fatigue, Cold extremities, Bronchospasm, Hyperglycemia (masking), Depression, Impotence",
        contraindications: "Asthma/COPD, 2nd/3rd degree AV block, Cardiogenic shock, Raynaud's phenomenon, Decompensated HF",
      },
      {
        name: "Bisoprolol (β1-selective)",
        dose: "2.5–10 mg once daily",
        comorbidities: "HFrEF, Post-MI, Angina, AF rate control, HTN + Stable COPD (use cautiously)",
        sideEffects: "Bradycardia, Fatigue, Cold extremities, Sexual dysfunction, Sleep disturbance",
        contraindications: "Severe asthma, AV block (2nd/3rd degree), Sick sinus syndrome, Cardiogenic shock",
      },
      {
        name: "Carvedilol (α+β blocker)",
        dose: "3.125–25 mg twice daily",
        comorbidities: "HFrEF, Post-MI with LV dysfunction, HTN + HF, Diabetes (vasodilatory β-blocker)",
        sideEffects: "Orthostatic hypotension, Bradycardia, Dizziness, Fluid retention, Fatigue",
        contraindications: "Decompensated HF, Severe hepatic impairment, Severe bradycardia, Asthma",
      },
      {
        name: "Labetalol (α+β blocker)",
        dose: "100–400 mg twice daily (oral); 20–80 mg IV bolus",
        comorbidities: "HTN in pregnancy (2nd/3rd trimester), Hypertensive crisis, Perioperative HTN, Aortic dissection",
        sideEffects: "Orthostatic hypotension, Scalp tingling, Nausea, Bronchospasm, Fatigue",
        contraindications: "Asthma, Cardiogenic shock, Bradycardia, Pre-eclampsia with high vagal tone",
      },
    ],
  },
  {
    title: "💊  ACE INHIBITORS (ACEi)",
    color: C.green,
    drugs: [
      {
        name: "Ramipril",
        dose: "2.5–10 mg once or twice daily",
        comorbidities: "Post-MI (HOPE trial), Diabetic nephropathy, CKD + Proteinuria, HFrEF, CVD risk reduction",
        sideEffects: "Dry cough (10–20%), Hyperkalemia, Angioedema (rare, 0.1%), First-dose hypotension, Acute kidney injury (bilateral RAS)",
        contraindications: "Pregnancy (teratogenic), Bilateral RAS, History of ACEi-induced angioedema, Hyperkalemia (K+>5.5)",
      },
      {
        name: "Lisinopril",
        dose: "5–40 mg once daily",
        comorbidities: "Essential HTN, Diabetes + microalbuminuria, CKD, Post-MI, HFrEF, Stroke prevention",
        sideEffects: "Dry cough, Hyperkalemia, Angioedema, Hypotension (first dose), Rash, Dysgeusia",
        contraindications: "Pregnancy, Bilateral RAS, Prior ACEi angioedema, Hyperkalemia, Do NOT combine with ARB",
      },
      {
        name: "Enalapril / Perindopril",
        dose: "Enalapril: 5–40 mg/day ÷ 1–2 doses; Perindopril: 4–8 mg once daily",
        comorbidities: "Essential HTN, CAD, HFrEF, LVH reduction, Elderly with CVD risk",
        sideEffects: "Dry cough, Angioedema, Hyperkalemia, Elevated creatinine (early, usually benign)",
        contraindications: "Pregnancy, Prior angioedema, Concurrent ARB use (dual RAS blockade), Hyperkalemia",
      },
    ],
  },
  {
    title: "💊  ANGIOTENSIN RECEPTOR BLOCKERS (ARBs)",
    color: C.gold,
    drugs: [
      {
        name: "Valsartan",
        dose: "80–320 mg once daily",
        comorbidities: "Essential HTN, Post-MI LV dysfunction, HFrEF (if ACEi intolerant), Diabetic nephropathy",
        sideEffects: "Hyperkalemia, Dizziness, Hypotension, Elevated creatinine (usually benign), Rare angioedema",
        contraindications: "Pregnancy (teratogenic), Bilateral RAS, Hyperkalemia, Concurrent ACEi, Concurrent aliskiren (in diabetes/CKD)",
      },
      {
        name: "Losartan",
        dose: "25–100 mg once or twice daily",
        comorbidities: "Essential HTN, Diabetic nephropathy (RENAAL trial), HFrEF, Marfan syndrome (aortic dilation)",
        sideEffects: "Dizziness, Hyperkalemia, Back/leg pain (unique to losartan), Mild cough (much less than ACEi)",
        contraindications: "Pregnancy, Bilateral RAS, Hyperkalemia, Concurrent ACEi or aliskiren",
      },
      {
        name: "Telmisartan / Olmesartan",
        dose: "Telmisartan: 40–80 mg/day; Olmesartan: 20–40 mg/day",
        comorbidities: "Essential HTN with metabolic syndrome (telmisartan – PPAR-γ partial agonist), AF prevention, Stroke prevention",
        sideEffects: "Hyperkalemia, Dizziness, Olmesartan: sprue-like enteropathy (rare but severe)",
        contraindications: "Pregnancy, Bilateral RAS, Hyperkalemia, Concurrent ACEi; Olmesartan in bile duct obstruction",
      },
    ],
  },
  {
    title: "💊  CALCIUM CHANNEL BLOCKERS (CCBs)",
    color: C.violet,
    drugs: [
      {
        name: "Amlodipine (DHP – arterial)",
        dose: "2.5–10 mg once daily",
        comorbidities: "Essential HTN, Elderly, Asymptomatic atherosclerosis, Angina, LVH, Isolated systolic HTN, PAD",
        sideEffects: "Peripheral edema (ankle), Flushing, Headache, Reflex tachycardia, Gingival hyperplasia",
        contraindications: "Cardiogenic shock, Severe aortic stenosis (relative), Unstable angina (short-acting DHP)",
      },
      {
        name: "Nifedipine Extended Release (DHP)",
        dose: "30–90 mg once daily (ER only – IR is contraindicated for chronic HTN)",
        comorbidities: "HTN, Angina, Raynaud's phenomenon, Esophageal spasm, Preterm labor (tocolysis)",
        sideEffects: "Peripheral edema, Flushing, Headache, Tachycardia, Constipation",
        contraindications: "Cardiogenic shock, Acute MI (immediate release), Combined with grapefruit (CYP3A4 inhibition)",
      },
      {
        name: "Diltiazem (Non-DHP – cardiac)",
        dose: "120–360 mg once daily (ER); 30–60 mg 4× daily (IR)",
        comorbidities: "HTN + Angina (vasospastic/stable), AF rate control, Subarachnoid hemorrhage vasospasm prevention",
        sideEffects: "Bradycardia, AV block, Constipation, Peripheral edema, Hypotension",
        contraindications: "Sick sinus, 2nd/3rd AV block, HFrEF, Concurrent β-blocker (risk of complete AV block), WPW",
      },
      {
        name: "Verapamil (Non-DHP – cardiac)",
        dose: "80–120 mg 3× daily (IR); 120–240 mg twice daily (SR)",
        comorbidities: "HTN + AF rate control, PSVT, Cluster headache (prophylaxis), Hypertrophic obstructive cardiomyopathy",
        sideEffects: "Severe constipation, Bradycardia, AV block, Hypotension, Negative inotropy",
        contraindications: "Concurrent β-blocker, HFrEF (severe depression of function), AV block, WPW with AF, Cardiogenic shock",
      },
    ],
  },
  {
    title: "💊  ALPHA-1 BLOCKERS  |  CENTRAL ALPHA-2 AGONISTS",
    color: C.orange,
    drugs: [
      {
        name: "Doxazosin (α1-blocker)",
        dose: "1–16 mg once daily (start 1 mg to minimize first-dose hypotension)",
        comorbidities: "HTN + BPH (dual benefit), Resistant HTN (adjunct), Pheochromocytoma preparation (phenoxybenzamine preferred)",
        sideEffects: "First-dose orthostatic hypotension, Dizziness, Fatigue, Palpitations, Peripheral edema",
        contraindications: "NOT as monotherapy (ALLHAT trial: increased HF risk), Concurrent phosphodiesterase-5 inhibitors",
      },
      {
        name: "Clonidine (central α2-agonist)",
        dose: "0.1–0.8 mg 2–3× daily; TTS patch: 0.1–0.3 mg/24h (weekly)",
        comorbidities: "Resistant HTN, HTN urgency, Opioid/alcohol withdrawal, ADHD, Menopausal flushing",
        sideEffects: "Sedation, Dry mouth, Bradycardia, Constipation, Rebound hypertension on withdrawal, Depression",
        contraindications: "Sudden discontinuation (rebound crisis), Sick sinus syndrome, AV block; caution with β-blockers",
      },
      {
        name: "Methyldopa (central α2-agonist)",
        dose: "250–500 mg 2–3× daily (max 3g/day)",
        comorbidities: "PREGNANCY-INDUCED HYPERTENSION (1st choice), HTN in chronic kidney disease",
        sideEffects: "Sedation, Dry mouth, Autoimmune hemolytic anemia (Coombs+), Hepatotoxicity, Impotence, Hyperprolactinemia",
        contraindications: "Active hepatic disease, Prior methyldopa-related hepatitis, Concurrent MAO inhibitors, Pheochromocytoma",
      },
    ],
  },
  {
    title: "💊  DIRECT VASODILATORS  |  SPECIAL SITUATIONS",
    color: "8B5CF6",
    drugs: [
      {
        name: "Hydralazine",
        dose: "25–100 mg 2–4× daily (oral); 5–20 mg IV/IM (pregnancy/crisis)",
        comorbidities: "HTN in pregnancy (pre-eclampsia), HFrEF (with nitrates), Resistant HTN (add-on)",
        sideEffects: "Reflex tachycardia (must use with BB), Drug-induced lupus (>200 mg/day), Fluid retention, Headache, Flushing",
        contraindications: "Coronary artery disease (reflex tachycardia worsens ischemia), SLE, Mitral valve rheumatic disease",
      },
      {
        name: "Minoxidil",
        dose: "2.5–100 mg once or twice daily (rarely used – expert only)",
        comorbidities: "Resistant HTN (3–4 drugs failed), HTN + Renal failure",
        sideEffects: "Severe reflex tachycardia, Fluid retention/edema, Hirsutism (hair growth – topical use), Pericardial effusion",
        contraindications: "Pheochromocytoma, Acute MI, Must combine with diuretic + β-blocker to prevent fluid/HR side effects",
      },
      {
        name: "Sodium Nitroprusside (IV)",
        dose: "0.3–10 mcg/kg/min IV infusion (titrated to effect)",
        comorbidities: "Hypertensive EMERGENCY, Acute aortic dissection, Severe HF (afterload reduction), Post-op HTN",
        sideEffects: "Cyanide/thiocyanate toxicity (prolonged use/renal failure), Profound hypotension, Reflex tachycardia, Methemoglobinemia",
        contraindications: "Compensatory HTN (AV shunt), Hepatic failure (cyanide accumulation), Vitamin B12 deficiency",
      },
    ],
  },
];

slides.forEach(s => addClassSlide(s));

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE: COMORBIDITY QUICK REFERENCE CHART
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.lightGray };

  // header
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 13.3, h: 1.1,
    fill: { color: C.navy }, line: { type: "none" } });
  s.addText("COMORBIDITY-BASED DRUG SELECTION – QUICK REFERENCE", {
    x: 0.3, y: 0, w: 13, h: 1.1,
    fontSize: 20, bold: true, color: C.white, fontFace: "Calibri",
    valign: "middle", margin: 0,
  });

  const tableData = [
    // Header row
    [
      { text: "Comorbidity", options: { bold: true, color: C.white, fill: { color: C.navy }, fontSize: 9 } },
      { text: "Preferred Agents", options: { bold: true, color: C.white, fill: { color: C.navy }, fontSize: 9 } },
      { text: "Avoid / Caution", options: { bold: true, color: C.white, fill: { color: C.navy }, fontSize: 9 } },
      { text: "Key Dose Note", options: { bold: true, color: C.white, fill: { color: C.navy }, fontSize: 9 } },
    ],
    // data rows
    [
      { text: "🫀 Post-MI / CAD", options: { fill: { color: "FFE4E8" }, fontSize: 8 } },
      { text: "ACEi, ARB, β-blocker (bisoprolol / metoprolol / carvedilol)", options: { fill: { color: "FFE4E8" }, fontSize: 8 } },
      { text: "Non-DHP CCBs (depress LV function)", options: { fill: { color: "FFE4E8" }, fontSize: 8 } },
      { text: "Ramipril 2.5–10 mg/day", options: { fill: { color: "FFE4E8" }, fontSize: 8 } },
    ],
    [
      { text: "💓 Heart Failure (HFrEF)", options: { fill: { color: "FFF0E4" }, fontSize: 8 } },
      { text: "ACEi/ARB, BB (bisoprolol/carvedilol), MRA, Loop diuretic", options: { fill: { color: "FFF0E4" }, fontSize: 8 } },
      { text: "Non-DHP CCBs, α1-blockers as monotherapy", options: { fill: { color: "FFF0E4" }, fontSize: 8 } },
      { text: "Carvedilol 3.125–25 mg BD; Eplerenone 25–50 mg", options: { fill: { color: "FFF0E4" }, fontSize: 8 } },
    ],
    [
      { text: "🩺 Diabetes Mellitus", options: { fill: { color: "E4F9F5" }, fontSize: 8 } },
      { text: "ACEi, ARB, CCB (amlodipine), Thiazide (low dose)", options: { fill: { color: "E4F9F5" }, fontSize: 8 } },
      { text: "β-blockers (mask hypoglycemia), High-dose thiazide", options: { fill: { color: "E4F9F5" }, fontSize: 8 } },
      { text: "Lisinopril 5–40 mg; Amlodipine 5–10 mg", options: { fill: { color: "E4F9F5" }, fontSize: 8 } },
    ],
    [
      { text: "🫘 CKD / Proteinuria", options: { fill: { color: "E8F4FD" }, fontSize: 8 } },
      { text: "ACEi / ARB (first-line – reduce proteinuria), Loop diuretics (if GFR <30)", options: { fill: { color: "E8F4FD" }, fontSize: 8 } },
      { text: "Thiazides (ineffective GFR <30), K+-sparing (hyperkalemia risk)", options: { fill: { color: "E8F4FD" }, fontSize: 8 } },
      { text: "Valsartan 80–320 mg; Furosemide 20–80 mg", options: { fill: { color: "E8F4FD" }, fontSize: 8 } },
    ],
    [
      { text: "🧠 Stroke Prevention", options: { fill: { color: "F0E8FD" }, fontSize: 8 } },
      { text: "ACEi (perindopril), ARB, Thiazide/thiazide-like", options: { fill: { color: "F0E8FD" }, fontSize: 8 } },
      { text: "Abrupt BP lowering in acute stroke", options: { fill: { color: "F0E8FD" }, fontSize: 8 } },
      { text: "Perindopril 4–8 mg + Indapamide 1.25 mg (PROGRESS)", options: { fill: { color: "F0E8FD" }, fontSize: 8 } },
    ],
    [
      { text: "🤰 Pregnancy", options: { fill: { color: "FFF5E4" }, fontSize: 8 } },
      { text: "Methyldopa (safest), Labetalol, Nifedipine ER, Hydralazine (IV)", options: { fill: { color: "FFF5E4" }, fontSize: 8 } },
      { text: "ACEi, ARBs (teratogenic – category D/X), Atenolol (IUGR)", options: { fill: { color: "FFF5E4" }, fontSize: 8 } },
      { text: "Methyldopa 250–500 mg BD; Labetalol 100–400 mg BD", options: { fill: { color: "FFF5E4" }, fontSize: 8 } },
    ],
    [
      { text: "🫁 Asthma / COPD", options: { fill: { color: "E4F9E4" }, fontSize: 8 } },
      { text: "ACEi/ARB, CCB (amlodipine), Thiazide", options: { fill: { color: "E4F9E4" }, fontSize: 8 } },
      { text: "β-blockers (bronchospasm), ACEi cough can mimic asthma", options: { fill: { color: "E4F9E4" }, fontSize: 8 } },
      { text: "Amlodipine 5–10 mg; Losartan 25–100 mg", options: { fill: { color: "E4F9E4" }, fontSize: 8 } },
    ],
    [
      { text: "🚨 Hypertensive Emergency", options: { fill: { color: "FFE0E0" }, fontSize: 8 } },
      { text: "IV Labetalol, IV Nicardipine, IV Nitroprusside, IV Enalaprilat", options: { fill: { color: "FFE0E0" }, fontSize: 8 } },
      { text: "Rapid correction >25% in 1hr (end-organ ischemia)", options: { fill: { color: "FFE0E0" }, fontSize: 8 } },
      { text: "Reduce MAP by ≤25% in first hour, then to 160/100 over 2–6h", options: { fill: { color: "FFE0E0" }, fontSize: 8 } },
    ],
    [
      { text: "🫀 Atrial Fibrillation (Rate Control)", options: { fill: { color: "E4F0FF" }, fontSize: 8 } },
      { text: "β-blocker, Non-DHP CCBs (diltiazem, verapamil)", options: { fill: { color: "E4F0FF" }, fontSize: 8 } },
      { text: "DHP CCBs (do not control rate), Digoxin (only in sedentary patients)", options: { fill: { color: "E4F0FF" }, fontSize: 8 } },
      { text: "Diltiazem 120–360 mg/day; Metoprolol 25–200 mg/day", options: { fill: { color: "E4F0FF" }, fontSize: 8 } },
    ],
    [
      { text: "🔷 BPH + Hypertension", options: { fill: { color: "FFF0FA" }, fontSize: 8 } },
      { text: "α1-blockers (doxazosin, terazosin) – treat both", options: { fill: { color: "FFF0FA" }, fontSize: 8 } },
      { text: "As sole antihypertensive (ALLHAT – inferior outcomes); use as adjunct", options: { fill: { color: "FFF0FA" }, fontSize: 8 } },
      { text: "Doxazosin 1–16 mg/day (start low)", options: { fill: { color: "FFF0FA" }, fontSize: 8 } },
    ],
    [
      { text: "🔴 Pheochromocytoma", options: { fill: { color: "FFE8DC" }, fontSize: 8 } },
      { text: "Phenoxybenzamine (irreversible α-blocker), then add β-blocker", options: { fill: { color: "FFE8DC" }, fontSize: 8 } },
      { text: "β-blocker FIRST (will cause hypertensive crisis due to unopposed α)", options: { fill: { color: "FFE8DC" }, fontSize: 8 } },
      { text: "Phenoxybenzamine 10 mg BD, titrate up; Propranolol added after α-block", options: { fill: { color: "FFE8DC" }, fontSize: 8 } },
    ],
  ];

  s.addTable(tableData, {
    x: 0.15, y: 1.2, w: 13, h: 6.1,
    border: { pt: 0.5, color: "C5D5E4" },
    autoPage: false,
    colW: [2.0, 3.5, 3.2, 4.3],
  });

  // footer
  s.addShape(pres.shapes.RECTANGLE, { x: 0, y: 7.15, w: 13.3, h: 0.35,
    fill: { color: C.navy }, line: { type: "none" } });
  s.addText("Antihypertensive Drug Reference  |  For Educational Use", {
    x: 0.2, y: 7.15, w: 13, h: 0.35,
    fontSize: 7.5, color: C.white, fontFace: "Calibri", valign: "middle",
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// LAST SLIDE: KEY PRINCIPLES
// ═══════════════════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.background = { color: C.navy };

  s.addShape(pres.shapes.OVAL, { x: -1, y: -1, w: 5, h: 5,
    fill: { color: C.teal, transparency: 80 }, line: { type: "none" } });
  s.addShape(pres.shapes.OVAL, { x: 10, y: 4, w: 4, h: 4,
    fill: { color: C.coral, transparency: 80 }, line: { type: "none" } });

  s.addText("KEY PRESCRIBING PRINCIPLES", {
    x: 0.4, y: 0.3, w: 12.5, h: 0.75,
    fontSize: 28, bold: true, color: C.gold, fontFace: "Calibri",
  });

  const points = [
    { icon: "①", text: "First-line preferred classes: ACEi / ARB + CCB + Thiazide diuretic (as single-pill combination where possible)", col: C.sky },
    { icon: "②", text: "β-Blockers are added as 4th drug in resistant HTN, or when specific indication exists (HF, post-MI, AF)", col: C.coral },
    { icon: "③", text: "NEVER combine ACEi + ARB – dual RAS blockade increases adverse effects without added benefit", col: "FF6B6B" },
    { icon: "④", text: "NEVER combine BB + non-DHP CCB – risk of complete AV block and cardiogenic shock", col: "FF6B6B" },
    { icon: "⑤", text: "ACEi & ARBs are teratogenic (Category D/X) – switch to methyldopa or labetalol before or during pregnancy", col: C.gold },
    { icon: "⑥", text: "Resistant HTN (BP above goal on 3 drugs incl. diuretic): add spironolactone 12.5–50 mg/day as 4th agent", col: C.teal },
    { icon: "⑦", text: "Trough-to-peak ratio >50% required – choose agents with long half-lives for once-daily dosing compliance", col: C.green },
  ];

  points.forEach((p, i) => {
    s.addShape(pres.shapes.RECTANGLE, {
      x: 0.3, y: 1.25 + i * 0.78, w: 0.45, h: 0.62,
      fill: { color: p.col }, line: { type: "none" },
    });
    s.addText(p.icon, {
      x: 0.3, y: 1.25 + i * 0.78, w: 0.45, h: 0.62,
      fontSize: 14, bold: true, color: C.white, fontFace: "Calibri",
      align: "center", valign: "middle", margin: 0,
    });
    s.addText(p.text, {
      x: 0.85, y: 1.28 + i * 0.78, w: 12.2, h: 0.6,
      fontSize: 11, color: C.white, fontFace: "Calibri",
      valign: "middle", wrap: true,
    });
  });
}

// Write file
pres.writeFile({ fileName: "/home/daytona/workspace/antihypertensives/Antihypertensives_Drug_Chart.pptx" })
  .then(() => console.log("SUCCESS: file written"))
  .catch(e => { console.error("ERROR:", e); process.exit(1); });
Running Command

cd /home/daytona/workspace/antihypertensives && node build.js 2>&1

Running Command

ls -lh /home/daytona/workspace/antihypertensives/

Your colourful antihypertensive chart is ready!

Antihypertensives Drug Chart

Presentation · PPTX


Here is what is inside the 11-slide PPTX (403 KB, LAYOUT_WIDE 13.3×7.5"):
SlideContent
1Title slide - dark navy with teal/coral accents and pill motifs
2Thiazide & Thiazide-like Diuretics (sky blue theme) - HCTZ, Chlorthalidone, Indapamide
3Loop Diuretics (indigo) - Furosemide, Bumetanide, Torsemide
4K-Sparing Diuretics / MRA (teal) - Spironolactone, Eplerenone, Amiloride
5Beta-Blockers (coral/red) - Metoprolol, Bisoprolol, Carvedilol, Labetalol
6ACE Inhibitors (green) - Ramipril, Lisinopril, Enalapril/Perindopril
7ARBs (gold) - Valsartan, Losartan, Telmisartan/Olmesartan
8Calcium Channel Blockers (violet) - Amlodipine, Nifedipine ER, Diltiazem, Verapamil
9Alpha-blockers + Central Agonists (orange) - Doxazosin, Clonidine, Methyldopa
10Direct Vasodilators (purple) - Hydralazine, Minoxidil, Nitroprusside
11Comorbidity Quick Reference Table - all 12 comorbidities with preferred drugs, avoid list, and key dose notes
12Key Prescribing Principles - 7 rules (dark slide with gold/colour-coded numbered blocks)
Each drug slide has 5 colour-coded columns: Drug/Examples | Dose Range | Comorbidities (Preferred) | Side Effects | Contraindications, with alternating row shading and a colour dot indicator per class.

Create a summary PDF quick-reference card for clinical pocket use

Reading File
Writing File

~/antihypertensives/build_pdf.py

"""
Antihypertensive Quick-Reference Pocket Card
A5 landscape (148 x 210 mm) – 4 pages, print-ready
Uses ReportLab only (pre-installed).
"""

from reportlab.lib.pagesizes import A5, landscape
from reportlab.lib import colors
from reportlab.lib.units import mm
from reportlab.platypus import (
    SimpleDocTemplate, Table, TableStyle, Paragraph,
    Spacer, HRFlowable, KeepTogether
)
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_RIGHT
from reportlab.platypus import PageBreak
from reportlab.pdfgen import canvas as pdfcanvas
from reportlab.lib.colors import HexColor, white, black
import os

# ── output path ────────────────────────────────────────────────────────────
OUT = "/home/daytona/workspace/antihypertensives/Antihypertensives_Pocket_Card.pdf"
PAGE = landscape(A5)          # 210 x 148 mm  (595 x 420 pt)
W, H = PAGE
M = 10 * mm                    # margin

# ── colour palette ─────────────────────────────────────────────────────────
NAVY    = HexColor("#0D1B2A")
TEAL    = HexColor("#1B998B")
CORAL   = HexColor("#E84855")
GOLD    = HexColor("#F4A261")
VIOLET  = HexColor("#7B2D8B")
SKY     = HexColor("#2196F3")
GREEN   = HexColor("#27AE60")
ORANGE  = HexColor("#E67E22")
PINK    = HexColor("#D63384")
INDIGO  = HexColor("#3949AB")
WHITE   = white
LTGRAY  = HexColor("#F4F7FB")
MIDGRAY = HexColor("#CBD5E1")
DARKTEXT= HexColor("#1A1A2E")
RED_WARN= HexColor("#FF3B30")

CLASS_COLORS = {
    "Thiazides":        SKY,
    "Loop Diuretics":   INDIGO,
    "K-Sparing/MRA":    TEAL,
    "Beta-Blockers":    CORAL,
    "ACE Inhibitors":   GREEN,
    "ARBs":             GOLD,
    "CCBs":             VIOLET,
    "Alpha-1 Blockers": ORANGE,
    "Central Agonists": PINK,
    "Vasodilators":     HexColor("#8B5CF6"),
}

# ── helper: background canvas callback ─────────────────────────────────────
def page_bg(canvas, doc):
    canvas.saveState()
    # header bar
    canvas.setFillColor(NAVY)
    canvas.rect(0, H - 18*mm, W, 18*mm, fill=1, stroke=0)
    # thin gold accent strip
    canvas.setFillColor(GOLD)
    canvas.rect(0, H - 20*mm, W, 2*mm, fill=1, stroke=0)
    # footer bar
    canvas.setFillColor(NAVY)
    canvas.rect(0, 0, W, 7*mm, fill=1, stroke=0)
    # footer text
    canvas.setFillColor(WHITE)
    canvas.setFont("Helvetica", 6)
    canvas.drawCentredString(W/2, 2.2*mm,
        "Antihypertensive Pocket Reference  |  For Clinical & Educational Use  "
        "|  Sources: Goodman & Gilman's, Katzung's, Family Medicine 9e")
    # header title
    canvas.setFillColor(WHITE)
    canvas.setFont("Helvetica-Bold", 13)
    canvas.drawString(M, H - 13*mm, "ANTIHYPERTENSIVE DRUGS  —  Clinical Pocket Reference")
    canvas.setFont("Helvetica", 8)
    canvas.setFillColor(GOLD)
    canvas.drawRightString(W - M, H - 13*mm, f"Page {doc.page}")
    canvas.restoreState()

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

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

hdr1 = S("hdr1", fontName="Helvetica-Bold", fontSize=9, textColor=WHITE,
          leading=11, spaceAfter=1)
body = S("body", fontName="Helvetica", fontSize=7.2, textColor=DARKTEXT,
         leading=9.5, spaceAfter=1)
bold7 = S("bold7", fontName="Helvetica-Bold", fontSize=7.5, textColor=DARKTEXT,
          leading=9.5)
warn = S("warn", fontName="Helvetica-Bold", fontSize=6.8, textColor=RED_WARN,
         leading=9)
small = S("small", fontName="Helvetica", fontSize=6, textColor=HexColor("#64748B"),
          leading=8)
section_title = S("sttl", fontName="Helvetica-Bold", fontSize=8.5,
                  textColor=NAVY, leading=11, spaceBefore=4, spaceAfter=2)
combo_ok = S("cok", fontName="Helvetica", fontSize=7, textColor=GREEN, leading=9)
combo_no = S("cno", fontName="Helvetica-Bold", fontSize=7, textColor=RED_WARN, leading=9)

# ── data ───────────────────────────────────────────────────────────────────
# Each drug block:  class, color, [(drug, dose, comorbidities, side_effects, contraindications)]
DRUG_DATA = [
    ("Thiazides", SKY, [
        ("Hydrochlorothiazide", "12.5–25 mg OD",
         "HTN, osteoporosis, elderly, isolated systolic HTN",
         "Hypokalemia, hyponatremia, hyperuricemia, hyperglycemia",
         "Anuria, sulfonamide allergy, gout, GFR <30"),
        ("Chlorthalidone", "12.5–25 mg OD",
         "HTN, CV risk reduction, metabolic syndrome",
         "Hypokalemia, hyperuricemia, impotence",
         "Anuria, sulfonamide allergy, severe renal impairment"),
        ("Indapamide", "1.25–2.5 mg OD",
         "HTN + diabetes (metabolically neutral), HF",
         "Mild hypokalemia, headache (less metabolic SE)",
         "Severe hepatic impairment, hypokalemia"),
    ]),
    ("Loop Diuretics", INDIGO, [
        ("Furosemide", "20–80 mg OD/BD oral; 20–40 mg IV",
         "HTN + CKD (GFR <30), HF, pulmonary oedema, hypercalcaemia",
         "Hypokalemia, hyponatremia, ototoxicity (high IV dose), dehydration",
         "Anuria, sulfonamide allergy, pre-renal AKI"),
        ("Torsemide", "5–20 mg OD",
         "HF-related HTN, CKD, resistant HTN",
         "Hypokalemia, dizziness (less ototoxic than furosemide)",
         "Anuria, hepatic cirrhosis (caution)"),
    ]),
    ("K-Sparing/MRA", TEAL, [
        ("Spironolactone", "12.5–50 mg OD (HTN); 25–50 mg HF",
         "Resistant HTN (4th agent), HFrEF, Conn syndrome, primary hyperaldosteronism",
         "Hyperkalemia, gynecomastia, menstrual irregularities",
         "K+ >5.5, anuria, Addison's disease; avoid with ACEi+ARB combo"),
        ("Eplerenone", "25–50 mg OD/BD",
         "Post-MI + LV dysfunction, HFrEF, primary hyperaldosteronism",
         "Hyperkalemia, dizziness (less gynaecomastia)",
         "K+ >5.5, eGFR <30, strong CYP3A4 inhibitors"),
    ]),
    ("Beta-Blockers", CORAL, [
        ("Metoprolol succinate", "25–200 mg OD (ER)",
         "Post-MI, angina, HFrEF, AF rate control, hyperthyroidism",
         "Bradycardia, fatigue, bronchospasm, cold extremities, hyperglycemia masking",
         "Asthma/COPD, 2nd-3rd AV block, cardiogenic shock, decompensated HF"),
        ("Bisoprolol", "2.5–10 mg OD",
         "HFrEF, post-MI, angina, AF rate control",
         "Bradycardia, fatigue, sexual dysfunction, sleep disturbance",
         "Severe asthma, AV block, sick sinus, cardiogenic shock"),
        ("Carvedilol (α+β)", "3.125–25 mg BD",
         "HFrEF, post-MI + LV dysfunction, HTN + HF",
         "Orthostatic hypotension, bradycardia, fluid retention",
         "Decompensated HF, severe hepatic impairment, asthma"),
        ("Labetalol (α+β)", "100–400 mg BD; 20–80 mg IV bolus",
         "HTN in pregnancy, hypertensive crisis, aortic dissection",
         "Orthostatic hypotension, scalp tingling, nausea, bronchospasm",
         "Asthma, cardiogenic shock, bradycardia"),
    ]),
    ("ACE Inhibitors", GREEN, [
        ("Ramipril", "2.5–10 mg OD/BD",
         "Post-MI (HOPE), diabetic nephropathy, CKD + proteinuria, HFrEF, CVD risk reduction",
         "Dry cough (10-20%), hyperkalemia, angioedema (0.1%), hypotension (1st dose)",
         "Pregnancy (teratogenic), bilateral RAS, prior ACEi angioedema, K+ >5.5"),
        ("Lisinopril", "5–40 mg OD",
         "Essential HTN, DM + microalbuminuria, CKD, post-MI, stroke prevention",
         "Dry cough, hyperkalemia, angioedema, rash, dysgeusia",
         "Pregnancy, bilateral RAS, prior ACEi angioedema; do NOT combine with ARB"),
        ("Perindopril", "4–8 mg OD",
         "HTN, CAD, HFrEF, LVH reduction, elderly + CVD risk",
         "Dry cough, angioedema, hyperkalemia",
         "Pregnancy, prior angioedema, concurrent ARB (dual RAS blockade)"),
    ]),
    ("ARBs", GOLD, [
        ("Losartan", "25–100 mg OD/BD",
         "HTN, diabetic nephropathy (RENAAL), HFrEF (ACEi-intolerant), Marfan syndrome",
         "Dizziness, hyperkalemia, back/leg pain (losartan-specific), minimal cough",
         "Pregnancy (teratogenic), bilateral RAS, K+ >5.5; do NOT combine with ACEi"),
        ("Valsartan", "80–320 mg OD",
         "HTN, post-MI LV dysfunction, HFrEF, diabetic nephropathy",
         "Hyperkalemia, dizziness, hypotension, mildly elevated creatinine",
         "Pregnancy, bilateral RAS, K+ >5.5, concurrent ACEi or aliskiren"),
        ("Telmisartan", "40–80 mg OD",
         "HTN + metabolic syndrome (PPAR-γ partial agonist), AF prevention, stroke prevention",
         "Dizziness, hyperkalemia, upper respiratory infection",
         "Pregnancy, bilateral RAS, bile duct obstruction, K+ >5.5"),
    ]),
    ("CCBs", VIOLET, [
        ("Amlodipine (DHP)", "2.5–10 mg OD",
         "Essential HTN, elderly, asymptomatic atherosclerosis, angina, isolated systolic HTN, PAD",
         "Peripheral oedema (ankle), flushing, headache, reflex tachycardia, gingival hyperplasia",
         "Cardiogenic shock, severe aortic stenosis (relative), unstable angina with short-acting DHP"),
        ("Nifedipine ER (DHP)", "30–90 mg OD (ER ONLY)",
         "HTN, angina, Raynaud's, preterm labour (tocolysis)",
         "Peripheral oedema, flushing, headache, tachycardia",
         "Acute MI (IR form), cardiogenic shock; avoid grapefruit (CYP3A4)"),
        ("Diltiazem (non-DHP)", "120–360 mg OD (ER); 30–60 mg QID (IR)",
         "HTN + angina (vasospastic/stable), AF rate control",
         "Bradycardia, AV block, constipation, peripheral oedema",
         "Sick sinus, 2nd-3rd AV block, HFrEF, concurrent β-blocker, WPW"),
        ("Verapamil (non-DHP)", "80–120 mg TDS; 120–240 mg BD (SR)",
         "HTN + AF rate control, PSVT, cluster headache prophylaxis, HOCM",
         "Severe constipation, bradycardia, AV block, negative inotropy",
         "Concurrent β-blocker (complete AV block), HFrEF, AV block, WPW with AF"),
    ]),
    ("Alpha-1 Blockers", ORANGE, [
        ("Doxazosin", "1–16 mg OD (start 1 mg)",
         "HTN + BPH (dual benefit), resistant HTN (add-on)",
         "First-dose orthostatic hypotension, dizziness, palpitations, peripheral oedema",
         "NOT as monotherapy (ALLHAT trial); avoid with PDE-5 inhibitors (severe hypotension)"),
        ("Prazosin", "1–10 mg BD-TDS",
         "HTN, PTSD nightmares (off-label), pheochromocytoma (adjunct)",
         "First-dose syncope, dizziness, nasal congestion, fluid retention",
         "Avoid as sole antihypertensive; caution with other antihypertensives"),
    ]),
    ("Central Agonists", PINK, [
        ("Clonidine", "0.1–0.8 mg BD-TDS; patch 0.1–0.3 mg/24h (weekly)",
         "Resistant HTN, HTN urgency, opioid withdrawal, ADHD",
         "Sedation, dry mouth, bradycardia, constipation, rebound HTN on abrupt withdrawal",
         "Abrupt discontinuation (rebound crisis); caution with β-blockers, sick sinus, AV block"),
        ("Methyldopa", "250–500 mg BD-TDS (max 3 g/day)",
         "PREGNANCY HTN (1st choice), CKD-related HTN",
         "Sedation, dry mouth, autoimmune haemolytic anaemia (Coombs+), hepatotoxicity, impotence",
         "Active hepatic disease, prior methyldopa hepatitis, MAO inhibitors, pheochromocytoma"),
    ]),
    ("Vasodilators", HexColor("#8B5CF6"), [
        ("Hydralazine", "25–100 mg BD-QID oral; 5–20 mg IV/IM",
         "HTN in pregnancy (pre-eclampsia), HFrEF + nitrate, resistant HTN (add-on)",
         "Reflex tachycardia, drug-induced lupus (>200 mg/day), fluid retention, headache, flushing",
         "CAD (reflex tachycardia worsens ischaemia), SLE, mitral valve rheumatic disease"),
        ("Sodium Nitroprusside", "0.3–10 mcg/kg/min IV infusion",
         "Hypertensive EMERGENCY, acute aortic dissection, severe HF (afterload reduction)",
         "Cyanide/thiocyanate toxicity (prolonged use), profound hypotension, reflex tachycardia",
         "Hepatic failure (cyanide accumulation), compensatory HTN, B12 deficiency"),
        ("Minoxidil", "2.5–100 mg OD/BD (reserved – 3rd/4th line)",
         "Resistant HTN (when other agents failed), HTN + severe renal failure",
         "Severe reflex tachycardia, fluid retention/oedema, hirsutism, pericardial effusion",
         "Phaeochromocytoma, acute MI; MUST combine with diuretic + β-blocker"),
    ]),
]

# Comorbidity quick-look table
COMORBIDITY_TABLE = [
    # (condition, preferred, avoid, dose_note)
    ("Post-MI / CAD", "ACEi ✦ ARB ✦ β-blocker",
     "Non-DHP CCBs (depress LV)", "Ramipril 2.5–10 mg/day"),
    ("Heart Failure HFrEF", "ACEi/ARB ✦ β-blocker ✦ MRA ✦ loop diuretic",
     "Non-DHP CCBs ✦ α1-blockers (monotherapy)", "Carvedilol 3.125–25 mg BD"),
    ("Diabetes Mellitus", "ACEi ✦ ARB ✦ CCB ✦ thiazide (low dose)",
     "High-dose thiazide ✦ β-blockers (mask hypoglycaemia)", "Lisinopril 5–40 mg/day"),
    ("CKD / Proteinuria", "ACEi / ARB (1st line) ✦ loop diuretic if GFR <30",
     "Thiazides (GFR <30) ✦ K-sparing + ACEi/ARB combo", "Valsartan 80–320 mg/day"),
    ("Stroke Prevention", "ACEi ✦ ARB ✦ thiazide-like diuretic",
     "Abrupt BP lowering in acute stroke", "Perindopril 4–8 mg + Indapamide 1.25 mg"),
    ("Pregnancy", "Methyldopa ✦ Labetalol ✦ Nifedipine ER ✦ Hydralazine IV",
     "ACEi & ARBs (TERATOGENIC) ✦ Atenolol (IUGR)", "Methyldopa 250–500 mg BD"),
    ("Asthma / COPD", "ACEi/ARB ✦ CCB (amlodipine) ✦ thiazide",
     "β-blockers (bronchospasm)", "Amlodipine 5–10 mg/day"),
    ("HTN Emergency", "IV Labetalol ✦ IV Nicardipine ✦ IV Nitroprusside",
     "Reduce MAP >25% in 1st hour (end-organ ischaemia)", "↓ MAP ≤25% in 1st hr → 160/100 over 2–6 h"),
    ("Atrial Fibrillation", "β-blocker ✦ non-DHP CCBs (diltiazem/verapamil)",
     "DHP CCBs (no rate control) ✦ Digoxin (only sedentary)", "Diltiazem 120–360 mg/day"),
    ("BPH + HTN", "α1-blockers – Doxazosin / Terazosin (dual benefit)",
     "NOT as sole antihypertensive (ALLHAT)", "Doxazosin 1–16 mg/day (start 1 mg)"),
    ("Pheochromocytoma", "Phenoxybenzamine (irreversible α) → then add β-blocker",
     "β-blocker FIRST (unopposed α → crisis!)", "Phenoxybenzamine 10 mg BD, titrate up"),
    ("Resistant HTN", "Add spironolactone as 4th agent; exclude 2° causes",
     "Do NOT combine ACEi + ARB", "Spironolactone 12.5–50 mg/day"),
]

KEY_RULES = [
    ("1st-line preferred", "ACEi/ARB  +  CCB  +  Thiazide  (single-pill combination preferred)", TEAL),
    ("Add β-blocker when", "4th drug in resistant HTN, or: HF / post-MI / AF / angina", CORAL),
    ("NEVER combine", "ACEi + ARB  —  dual RAS blockade → no added benefit, more harm", RED_WARN),
    ("NEVER combine", "β-blocker + non-DHP CCB (verapamil/diltiazem) → complete AV block", RED_WARN),
    ("Pregnancy rule", "Stop ACEi/ARB immediately → methyldopa / labetalol / nifedipine ER", GOLD),
    ("Resistant HTN", "BP above goal on 3 max-dose drugs (incl. diuretic) → add spironolactone", HexColor("#8B5CF6")),
    ("Compliance tip", "Choose agents with t½ allowing once-daily dosing; trough:peak ratio >50%", GREEN),
    ("African Americans", "Thiazides + CCBs more effective; ACEi/ARBs less so as monotherapy", ORANGE),
]

# ── build story ────────────────────────────────────────────────────────────
story = []

def p(text, style=body):
    return Paragraph(text, style)

def colored_tag(text, col, text_col=WHITE, size=7):
    return f'<font color="#{col.hexval()[1:]}" size="{size}"><b> {text} </b></font>'

# ┌─────────────────────────────────────────────────────────────────────────┐
# │  PAGE 1  –  Drug-class blocks, two columns                              │
# └─────────────────────────────────────────────────────────────────────────┘

def make_drug_block(cls_name, cls_color, drugs):
    """Returns a Table acting as a coloured block for one drug class."""
    rows = []
    # class header
    rows.append([
        Paragraph(f'<font color="#FFFFFF"><b>● {cls_name.upper()}</b></font>', hdr1),
        Paragraph('<font color="#FFFFFF"><b>DOSE</b></font>', hdr1),
        Paragraph('<font color="#FFFFFF"><b>COMORBIDITIES</b></font>', hdr1),
        Paragraph('<font color="#FFFFFF"><b>SIDE EFFECTS</b></font>', hdr1),
        Paragraph('<font color="#FFFFFF"><b>CONTRAINDICATIONS</b></font>', hdr1),
    ])
    for i, (drug, dose, comor, se, ci) in enumerate(drugs):
        bg = HexColor("#FFFFFF") if i % 2 == 0 else HexColor("#F0F7FF")
        rows.append([
            Paragraph(f'<b>{drug}</b>', bold7),
            Paragraph(dose, body),
            Paragraph(comor, body),
            Paragraph(se, body),
            Paragraph(f'<font color="#CC0000">{ci}</font>', body),
        ])

    col_w = [32*mm, 33*mm, 46*mm, 48*mm, 46*mm]

    ts = TableStyle([
        ("BACKGROUND",  (0,0), (-1,0), cls_color),
        ("TEXTCOLOR",   (0,0), (-1,0), WHITE),
        ("GRID",        (0,0), (-1,-1), 0.3, HexColor("#CBD5E1")),
        ("ROWBACKGROUNDS", (0,1), (-1,-1), [HexColor("#FFFFFF"), HexColor("#F0F7FF")]),
        ("TOPPADDING",  (0,0), (-1,-1), 2),
        ("BOTTOMPADDING",(0,0),(-1,-1), 2),
        ("LEFTPADDING", (0,0), (-1,-1), 3),
        ("RIGHTPADDING",(0,0), (-1,-1), 3),
        ("FONTSIZE",    (0,0), (-1,0), 8),
        ("FONTNAME",    (0,0), (-1,0), "Helvetica-Bold"),
        ("VALIGN",      (0,0), (-1,-1), "TOP"),
        ("LINEBELOW",   (0,0), (-1,0), 1, cls_color),
    ])

    t = Table(rows, colWidths=col_w, repeatRows=1)
    t.setStyle(ts)
    return t

# Pages 1-3: drug class tables
for cls_name, cls_color, drugs in DRUG_DATA:
    story.append(make_drug_block(cls_name, cls_color, drugs))
    story.append(Spacer(1, 3*mm))

# ── PAGE BREAK → Comorbidity table ────────────────────────────────────────
story.append(PageBreak())

# comorbidity table header
story.append(Spacer(1, 3*mm))
story.append(p("<b>COMORBIDITY-BASED DRUG SELECTION</b>", S("ch",
    fontName="Helvetica-Bold", fontSize=11, textColor=NAVY,
    leading=14, spaceAfter=3)))
story.append(HRFlowable(width="100%", thickness=1.5, color=GOLD, spaceAfter=3))

comor_rows = [[
    Paragraph("<b>Comorbidity</b>", ParagraphStyle("ch", fontName="Helvetica-Bold",
              fontSize=8, textColor=WHITE, leading=10)),
    Paragraph("<b>Preferred Agents</b>", ParagraphStyle("ch", fontName="Helvetica-Bold",
              fontSize=8, textColor=WHITE, leading=10)),
    Paragraph("<b>Avoid / Caution</b>", ParagraphStyle("ch", fontName="Helvetica-Bold",
              fontSize=8, textColor=WHITE, leading=10)),
    Paragraph("<b>Key Dose Note</b>", ParagraphStyle("ch", fontName="Helvetica-Bold",
              fontSize=8, textColor=WHITE, leading=10)),
]]

ROW_COLORS = [
    HexColor("#FFE4E8"), HexColor("#FFF0E4"), HexColor("#E4F9F5"),
    HexColor("#E8F4FD"), HexColor("#F0E8FD"), HexColor("#FFF5E4"),
    HexColor("#E4F9E4"), HexColor("#FFE0E0"), HexColor("#E4F0FF"),
    HexColor("#FFF0FA"), HexColor("#FFE8DC"), HexColor("#E8FAFF"),
]

for idx, (cond, pref, avoid, dose_n) in enumerate(COMORBIDITY_TABLE):
    comor_rows.append([
        Paragraph(f"<b>{cond}</b>",
                  ParagraphStyle("cnd", fontName="Helvetica-Bold", fontSize=7.5,
                                 textColor=NAVY, leading=10)),
        Paragraph(pref,  ParagraphStyle("cp", fontName="Helvetica", fontSize=7,
                         textColor=HexColor("#0D5C3A"), leading=9.5)),
        Paragraph(f'<font color="#CC0000">{avoid}</font>',
                  ParagraphStyle("ca", fontName="Helvetica", fontSize=7,
                                 textColor=RED_WARN, leading=9.5)),
        Paragraph(dose_n, ParagraphStyle("cd", fontName="Helvetica-Oblique", fontSize=7,
                           textColor=HexColor("#1A3A6A"), leading=9.5)),
    ])

ct = Table(comor_rows,
           colWidths=[40*mm, 65*mm, 60*mm, 40*mm],
           repeatRows=1)
ct.setStyle(TableStyle([
    ("BACKGROUND",  (0,0), (-1,0), NAVY),
    ("TEXTCOLOR",   (0,0), (-1,0), WHITE),
    ("GRID",        (0,0), (-1,-1), 0.3, HexColor("#CBD5E1")),
    ("ROWBACKGROUNDS", (0,1), (-1,-1), ROW_COLORS),
    ("TOPPADDING",  (0,0), (-1,-1), 2.5),
    ("BOTTOMPADDING",(0,0),(-1,-1), 2.5),
    ("LEFTPADDING", (0,0), (-1,-1), 3),
    ("RIGHTPADDING",(0,0), (-1,-1), 3),
    ("VALIGN",      (0,0), (-1,-1), "TOP"),
    ("LINEBELOW",   (0,0), (-1,0), 1.5, GOLD),
    ("FONTNAME",    (0,0), (-1,0), "Helvetica-Bold"),
]))
story.append(ct)

# ── PAGE BREAK → Key Rules ────────────────────────────────────────────────
story.append(PageBreak())
story.append(Spacer(1, 3*mm))
story.append(p("<b>KEY PRESCRIBING RULES  &amp;  COMBINATION PRINCIPLES</b>",
               S("krh", fontName="Helvetica-Bold", fontSize=11, textColor=NAVY,
                 leading=14, spaceAfter=3)))
story.append(HRFlowable(width="100%", thickness=1.5, color=CORAL, spaceAfter=5))

rule_rows = []
for label, rule_text, col in KEY_RULES:
    rule_rows.append([
        Paragraph(f'<font color="#FFFFFF"><b>{label}</b></font>',
                  ParagraphStyle("rl", fontName="Helvetica-Bold", fontSize=8,
                                 textColor=WHITE, leading=10, alignment=TA_CENTER)),
        Paragraph(rule_text,
                  ParagraphStyle("rt", fontName="Helvetica", fontSize=8.2,
                                 textColor=DARKTEXT, leading=11)),
    ])

rt = Table(rule_rows, colWidths=[38*mm, 167*mm])
rule_styles = [
    ("GRID", (0,0), (-1,-1), 0.3, MIDGRAY),
    ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
    ("TOPPADDING", (0,0), (-1,-1), 4),
    ("BOTTOMPADDING", (0,0), (-1,-1), 4),
    ("LEFTPADDING", (0,0), (-1,-1), 4),
    ("RIGHTPADDING", (0,0), (-1,-1), 4),
]
for i, (_, _, col) in enumerate(KEY_RULES):
    rule_styles.append(("BACKGROUND", (0,i), (0,i), col))
    row_bg = HexColor("#FFFFFF") if i % 2 == 0 else HexColor("#F8F8FF")
    rule_styles.append(("BACKGROUND", (1,i), (1,i), row_bg))
rt.setStyle(TableStyle(rule_styles))
story.append(rt)

story.append(Spacer(1, 5*mm))
story.append(HRFlowable(width="100%", thickness=1, color=MIDGRAY, spaceAfter=4))

# bp targets mini-table
story.append(p("<b>BLOOD PRESSURE TARGETS (AHA/ACC 2018 vs ESC 2018)</b>",
               S("bpt", fontName="Helvetica-Bold", fontSize=9,
                 textColor=NAVY, leading=11, spaceAfter=3)))

bp_data = [
    [Paragraph("<b>Population</b>",
               ParagraphStyle("bh", fontName="Helvetica-Bold", fontSize=8, textColor=WHITE, leading=10)),
     Paragraph("<b>AHA/ACC Target</b>",
               ParagraphStyle("bh", fontName="Helvetica-Bold", fontSize=8, textColor=WHITE, leading=10)),
     Paragraph("<b>ESC Target</b>",
               ParagraphStyle("bh", fontName="Helvetica-Bold", fontSize=8, textColor=WHITE, leading=10)),
     Paragraph("<b>Definition of HTN</b>",
               ParagraphStyle("bh", fontName="Helvetica-Bold", fontSize=8, textColor=WHITE, leading=10))],
    [p("General adults"), p("<130/80 mmHg"), p("<140/90 mmHg"), p("≥130/80 (USA) / ≥140/90 (EU)")],
    [p("High CVD risk / SPRINT"), p("<120 mmHg systolic"), p("<130/80 mmHg"), p("Intensified target (SPRINT)")],
    [p("Elderly (≥65 yr)"), p("<130 mmHg (SBP)"), p("<140/90 mmHg"), p("Orthostatic hypotension risk")],
    [p("Diabetes mellitus"), p("<130/80 mmHg"), p("<130/80 mmHg"), p("ACEi/ARB preferred")],
    [p("CKD + Proteinuria"), p("<130/80 mmHg"), p("<130/80 mmHg"), p("ACEi/ARB reduce proteinuria")],
    [p("Pregnancy"), p("<160/110 acute; <140/90 chronic"), p("<150/100 mmHg"), p("Methyldopa / Labetalol")],
]
bpt = Table(bp_data, colWidths=[40*mm, 52*mm, 52*mm, 61*mm])
bpt.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), NAVY),
    ("TEXTCOLOR", (0,0), (-1,0), WHITE),
    ("GRID", (0,0), (-1,-1), 0.3, MIDGRAY),
    ("ROWBACKGROUNDS", (0,1), (-1,-1), [WHITE, HexColor("#F0F7FF")]),
    ("TOPPADDING", (0,0), (-1,-1), 2.5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 2.5),
    ("LEFTPADDING", (0,0), (-1,-1), 3),
    ("RIGHTPADDING", (0,0), (-1,-1), 3),
    ("FONTSIZE", (0,0), (-1,-1), 7.5),
    ("VALIGN", (0,0), (-1,-1), "TOP"),
    ("LINEBELOW", (0,0), (-1,0), 1.5, GOLD),
]))
story.append(bpt)

# ── BUILD PDF ──────────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
    OUT,
    pagesize=PAGE,
    leftMargin=M, rightMargin=M,
    topMargin=22*mm, bottomMargin=12*mm,
    title="Antihypertensive Drugs – Clinical Pocket Reference",
    author="Clinical Reference Card",
    subject="Antihypertensive pharmacology",
)

doc.build(story, onFirstPage=page_bg, onLaterPages=page_bg)
print(f"PDF written → {OUT}")
Running Command

cd /home/daytona/workspace/antihypertensives && python build_pdf.py 2>&1

Running Command

ls -lh /home/daytona/workspace/antihypertensives/*.pdf

Your pocket card is ready:

Antihypertensives Pocket Card

PDF Document · PDF


Here is what is inside the A5 landscape, print-ready PDF:
Layout: Navy header bar + gold accent strip on every page, branded footer, page numbers.
PageContent
1-3Drug-class tables - one colour-coded block per class (10 classes total). Each row shows: Drug name
4Comorbidity Quick-Look Table - 12 conditions (post-MI, HF, diabetes, CKD, stroke, pregnancy, asthma, HTN emergency, AF, BPH, phaeochromocytoma, resistant HTN) with preferred agents, what to avoid (in red), and key dose notes
5Key Prescribing Rules - 8 rules with colour-coded labels (green = ok, red = danger, gold = warning) covering first-line combinations, when to add β-blockers, dangerous combos to avoid, pregnancy rules, and resistant HTN management
5 (cont.)BP Target Mini-Table - AHA/ACC vs ESC targets for 6 populations side-by-side
This is a shared conversation. Sign in to Orris to start your own chat.