~/arb-notes/create_arb_notes.py
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import mm, cm
from reportlab.pdfgen import canvas
from reportlab.lib.colors import HexColor
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
import math
# ── Output path ──────────────────────────────────────────────────────────────
OUTPUT = "/tmp/workspace/arb-notes/ARB_Sartans_Notes_GTU.pdf"
# ── Colour palette (pastel / highlighter style) ───────────────────────────────
BG = HexColor("#FEFAF0") # warm cream background
TITLE_BG = HexColor("#6C63FF") # deep purple – title bar
TITLE_FG = colors.white
H1_BG = HexColor("#FF6B6B") # coral-red – major heading boxes
H1_FG = colors.white
H2_BG = HexColor("#FFD93D") # yellow – sub-heading boxes
H2_FG = HexColor("#333333")
H3_BG = HexColor("#6BCB77") # green – small label boxes
H3_FG = colors.white
PILL_PINK = HexColor("#FFB6C1")
PILL_BLUE = HexColor("#B8D8F8")
PILL_GREEN = HexColor("#C8F0C8")
PILL_ORANGE = HexColor("#FFDAB9")
ARROW_COL = HexColor("#6C63FF")
HIGHLIGHT1 = HexColor("#FFF3CD") # yellow highlight
HIGHLIGHT2 = HexColor("#D4EDDA") # green highlight
HIGHLIGHT3 = HexColor("#CCE5FF") # blue highlight
BOX_BORDER = HexColor("#CCCCCC")
TEXT_DARK = HexColor("#222222")
TEXT_MUTED = HexColor("#555555")
RED_TEXT = HexColor("#C0392B")
BLUE_TEXT = HexColor("#1A5276")
GREEN_TEXT = HexColor("#1D6A34")
PURPLE_TEXT = HexColor("#6C3483")
DECO_STAR = HexColor("#FFD700")
W, H = A4 # 595.3 x 841.9 pt
# ── Helper draw functions ─────────────────────────────────────────────────────
def draw_rounded_rect(c, x, y, w, h, r=6, fill_color=None, stroke_color=None, lw=1):
c.setLineWidth(lw)
if fill_color:
c.setFillColor(fill_color)
if stroke_color:
c.setStrokeColor(stroke_color)
else:
c.setStrokeColor(colors.transparent)
c.roundRect(x, y, w, h, r, fill=1 if fill_color else 0, stroke=1 if stroke_color else 0)
def title_bar(c, x, y, w, h, text, bg=TITLE_BG, fg=TITLE_FG, fontsize=14):
draw_rounded_rect(c, x, y, w, h, r=8, fill_color=bg, stroke_color=None)
c.setFillColor(fg)
c.setFont("Helvetica-Bold", fontsize)
c.drawCentredString(x + w/2, y + h/2 - fontsize*0.35, text)
def section_box(c, x, y, w, h, text, bg=H1_BG, fg=H1_FG, fontsize=11):
draw_rounded_rect(c, x, y, w, h, r=6, fill_color=bg, stroke_color=None)
c.setFillColor(fg)
c.setFont("Helvetica-Bold", fontsize)
c.drawCentredString(x + w/2, y + h/2 - fontsize*0.35, text)
def pill(c, x, y, w, h, text, bg=PILL_PINK, fg=TEXT_DARK, fontsize=9):
draw_rounded_rect(c, x, y, w, h, r=h/2, fill_color=bg, stroke_color=None)
c.setFillColor(fg)
c.setFont("Helvetica", fontsize)
c.drawCentredString(x + w/2, y + h/2 - fontsize*0.35, text)
def highlight_box(c, x, y, w, h, bg=HIGHLIGHT1, stroke=BOX_BORDER):
draw_rounded_rect(c, x, y, w, h, r=5, fill_color=bg, stroke_color=stroke, lw=0.8)
def arrow(c, x1, y1, x2, y2, col=ARROW_COL, lw=1.5):
c.setStrokeColor(col)
c.setLineWidth(lw)
c.line(x1, y1, x2, y2)
# arrowhead
dx = x2 - x1; dy = y2 - y1
length = math.sqrt(dx*dx + dy*dy)
if length == 0: return
ux = dx/length; uy = dy/length
size = 6
c.setFillColor(col)
p = c.beginPath()
p.moveTo(x2, y2)
p.lineTo(x2 - size*ux + size*0.4*uy, y2 - size*uy - size*0.4*ux)
p.lineTo(x2 - size*ux - size*0.4*uy, y2 - size*uy + size*0.4*ux)
p.close()
c.drawPath(p, fill=1, stroke=0)
def bullet_line(c, x, y, text, color=TEXT_DARK, fontsize=9, bullet="➜", bcol=ARROW_COL):
c.setFillColor(bcol)
c.setFont("Helvetica-Bold", fontsize)
c.drawString(x, y, bullet)
c.setFillColor(color)
c.setFont("Helvetica", fontsize)
c.drawString(x + 14, y, text)
def key_point(c, x, y, text, color=TEXT_DARK, fontsize=9, bullet="★", bcol=DECO_STAR):
c.setFillColor(bcol)
c.setFont("Helvetica-Bold", fontsize)
c.drawString(x, y, bullet)
c.setFillColor(color)
c.setFont("Helvetica", fontsize)
c.drawString(x + 14, y, text)
def small_label(c, x, y, w, h, text, bg=H3_BG, fg=H3_FG, fontsize=8):
draw_rounded_rect(c, x, y, w, h, r=4, fill_color=bg, stroke_color=None)
c.setFillColor(fg)
c.setFont("Helvetica-Bold", fontsize)
c.drawCentredString(x + w/2, y + h/2 - fontsize*0.35, text)
def draw_star(c, cx, cy, r=5, col=DECO_STAR):
c.setFillColor(col)
c.circle(cx, cy, r, fill=1, stroke=0)
def dashed_line(c, x1, y1, x2, y2, col=HexColor("#BBBBBB"), lw=0.5):
c.setStrokeColor(col)
c.setLineWidth(lw)
c.setDash(3, 3)
c.line(x1, y1, x2, y2)
c.setDash()
# ─────────────────────────────────────────────────────────────────────────────
# PAGE 1 – Classification + ARB Overview
# ─────────────────────────────────────────────────────────────────────────────
c = canvas.Canvas(OUTPUT, pagesize=A4)
# Background
c.setFillColor(BG)
c.rect(0, 0, W, H, fill=1, stroke=0)
# Decorative dots
for pos in [(20,820),(570,820),(20,40),(570,40),(295,830)]:
draw_star(c, pos[0], pos[1], r=4, col=HexColor("#E0D0FF"))
# ── MAIN TITLE ────────────────────────────────────────────────────────────────
title_bar(c, 20, H-55, W-40, 42, "ANTIHYPERTENSIVE DRUGS & AT1 RECEPTOR BLOCKERS (ARBs)",
bg=TITLE_BG, fontsize=12)
# subtitle
c.setFillColor(PURPLE_TEXT)
c.setFont("Helvetica-BoldOblique", 9)
c.drawCentredString(W/2, H-68, "GTU B.Pharm Pharmacology II | BP502TP | Subject: Cardiovascular Pharmacology")
# ── SECTION 1: Classification ────────────────────────────────────────────────
y0 = H - 95
section_box(c, 20, y0, W-40, 18, "CLASSIFICATION OF ANTIHYPERTENSIVE DRUGS", bg=H1_BG, fontsize=11)
# Five columns for classes
classes = [
("I. DIURETICS", PILL_BLUE,
["Thiazides", "Hydrochlorothiazide", "Chlorthalidone", "Indapamide",
"", "Loop (High ceiling)", "Furosemide, Torsemide", "",
"Aldo. Antagonists", "Spironolactone", "Eplerenone"]),
("II. RAS INHIBITORS", PILL_GREEN,
["ACE Inhibitors", "Captopril, Enalapril", "Lisinopril, Ramipril", "",
"★ ARBs (Sartans)", "Losartan, Valsartan", "Candesartan, Telmisartan", "",
"Direct Renin Inh.", "Aliskiren"]),
("III. SYMPATHETIC INH.", PILL_ORANGE,
["β-blockers", "Propranolol", "Metoprolol, Atenolol", "",
"α+β blockers", "Labetalol, Carvedilol", "",
"α-blockers", "Prazosin, Terazosin", "",
"Central", "Clonidine, Methyldopa"]),
("IV. CCBs", HexColor("#E8D5FF"),
["Dihydropyridines", "Amlodipine (1st line)", "Nifedipine, Felodipine", "",
"Non-DHPs", "Verapamil", "Diltiazem"]),
("V. VASODILATORS", HexColor("#FFE4E1"),
["Arteriolar", "Hydralazine", "Minoxidil", "",
"Art.+Veno", "Sod. Nitroprusside"]),
]
col_w = (W - 40) / 5
col_x = 20
box_top = y0 - 5
for (title, bg, items) in classes:
bx = col_x
by = box_top - 170
highlight_box(c, bx, by, col_w-4, 168, bg=bg, stroke=HexColor("#AAAAAA"))
# column title
small_label(c, bx+2, box_top-18, col_w-8, 14, title, bg=HexColor("#6C63FF"), fg=colors.white, fontsize=7.5)
iy = box_top - 30
for item in items:
if item == "":
iy -= 4
continue
if item.startswith("★"):
c.setFillColor(RED_TEXT)
c.setFont("Helvetica-Bold", 8)
c.drawString(bx+5, iy, item)
elif item[0].isupper() and len(item) < 20 and not item[0].isdigit() and "," not in item and "." not in item:
c.setFillColor(BLUE_TEXT)
c.setFont("Helvetica-Bold", 7.5)
c.drawString(bx+5, iy, "• " + item)
else:
c.setFillColor(TEXT_DARK)
c.setFont("Helvetica", 7)
c.drawString(bx+8, iy, item)
iy -= 11
col_x += col_w
# ── SECTION 2: ARB Introduction ──────────────────────────────────────────────
y1 = box_top - 182
section_box(c, 20, y1, W-40, 18, "AT1 RECEPTOR BLOCKERS (ARBs / SARTANS) – Overview", bg=HexColor("#6C63FF"), fontsize=11)
# Two-column layout
left_x = 22; right_x = W/2 + 5
col2_w = W/2 - 27
# Left: definition box
highlight_box(c, left_x, y1-90, col2_w, 84, bg=HIGHLIGHT3, stroke=HexColor("#4A90D9"))
c.setFillColor(BLUE_TEXT)
c.setFont("Helvetica-Bold", 9)
c.drawString(left_x+6, y1-12, "Definition")
c.setFillColor(TEXT_DARK)
c.setFont("Helvetica", 8.5)
lines_def = [
"ARBs selectively block the AT1 receptor,",
"preventing Angiotensin II from producing",
"its harmful cardiovascular & renal effects.",
"",
"They do NOT inhibit ACE and do NOT",
"increase Bradykinin → NO dry cough.",
"",
"Prototype: Losartan"
]
ly = y1-24
for ln in lines_def:
if ln == "":
ly -= 4; continue
c.drawString(left_x+6, ly, ln)
ly -= 10
# Right: drugs table
highlight_box(c, right_x, y1-90, col2_w, 84, bg=HIGHLIGHT2, stroke=HexColor("#4CAF50"))
c.setFillColor(GREEN_TEXT)
c.setFont("Helvetica-Bold", 9)
c.drawString(right_x+6, y1-12, "Drugs & Duration of Action")
headers = ["Drug", "Duration"]
col_drugs = [
("Losartan", "Moderate"),
("Valsartan", "Long"),
("Telmisartan", "Very Long ★"),
("Candesartan", "Long"),
("Irbesartan", "Long"),
("Olmesartan", "Long"),
("Azilsartan", "Long"),
("Eprosartan", "Moderate"),
]
tx = right_x + 6; ty = y1-24
c.setFillColor(HexColor("#1D6A34"))
c.setFont("Helvetica-Bold", 8)
c.drawString(tx, ty, "Drug"); c.drawString(tx+90, ty, "Duration"); ty -= 2
dashed_line(c, tx, ty, tx+col2_w-10, ty)
ty -= 9
for drug, dur in col_drugs:
c.setFillColor(BLUE_TEXT)
c.setFont("Helvetica-Bold", 7.5)
c.drawString(tx, ty, drug)
c.setFillColor(TEXT_DARK)
c.setFont("Helvetica", 7.5)
c.drawString(tx+90, ty, dur)
ty -= 9
# Mnemonic strip
y2 = y1 - 97
draw_rounded_rect(c, 20, y2, W-40, 20, r=10, fill_color=HexColor("#FF6B6B"), stroke_color=None)
c.setFillColor(colors.white)
c.setFont("Helvetica-Bold", 9)
c.drawCentredString(W/2, y2+6, "MNEMONIC: L - V - C - T - I - O - A - E → Losartan Valsartan Candesartan Telmisartan Irbesartan Olmesartan Azilsartan Eprosartan")
# ── SECTION 3: MECHANISM OF ACTION ───────────────────────────────────────────
y3 = y2 - 10
section_box(c, 20, y3, W-40, 18, "MECHANISM OF ACTION", bg=H1_BG, fontsize=11)
# RAS pathway diagram (text-based flow)
# Draw flow chart boxes
bw = 90; bh = 18; cx_flow = 90
def flow_box(c, x, y, text, bg=PILL_BLUE, fg=TEXT_DARK, fs=8):
draw_rounded_rect(c, x, y, bw, bh, r=5, fill_color=bg, stroke_color=HexColor("#888888"), lw=0.5)
c.setFillColor(fg)
c.setFont("Helvetica-Bold", fs)
c.drawCentredString(x+bw/2, y+bh/2-fs*0.35, text)
fy = y3 - 25
flow_box(c, cx_flow, fy, "Angiotensinogen", bg=PILL_ORANGE)
arrow(c, cx_flow+bw/2, fy, cx_flow+bw/2, fy-18)
# Renin label
c.setFillColor(GREEN_TEXT); c.setFont("Helvetica-Oblique", 7)
c.drawString(cx_flow+bw+3, fy-10, "Renin (kidney)")
fy -= 22
flow_box(c, cx_flow, fy, "Angiotensin I", bg=PILL_BLUE)
arrow(c, cx_flow+bw/2, fy, cx_flow+bw/2, fy-18)
c.setFillColor(GREEN_TEXT); c.setFont("Helvetica-Oblique", 7)
c.drawString(cx_flow+bw+3, fy-10, "ACE (lungs)")
fy -= 22
flow_box(c, cx_flow, fy, "Angiotensin II", bg=HexColor("#FF6B6B"), fg=colors.white)
# From Ang II → AT1 (left) and AT2 (right)
ang2_cx = cx_flow + bw/2
at1_x = 30; at2_x = 230
at_y = fy - 30
arrow(c, ang2_cx, fy, at1_x + 45, at_y+18, col=HexColor("#C0392B"))
arrow(c, ang2_cx, fy, at2_x + 45, at_y+18, col=HexColor("#1A7A1A"))
# AT1 box
draw_rounded_rect(c, at1_x, at_y, 90, 18, r=5, fill_color=HexColor("#FADBD8"), stroke_color=HexColor("#C0392B"), lw=1.2)
c.setFillColor(RED_TEXT); c.setFont("Helvetica-Bold", 9)
c.drawCentredString(at1_x+45, at_y+5, "AT1 Receptor")
# AT2 box
draw_rounded_rect(c, at2_x, at_y, 90, 18, r=5, fill_color=HexColor("#D5F5E3"), stroke_color=HexColor("#1A7A1A"), lw=1.2)
c.setFillColor(GREEN_TEXT); c.setFont("Helvetica-Bold", 9)
c.drawCentredString(at2_x+45, at_y+5, "AT2 Receptor")
# ARB block label
draw_rounded_rect(c, at1_x-2, at_y+20, 94, 14, r=4, fill_color=HexColor("#6C63FF"), stroke_color=None)
c.setFillColor(colors.white); c.setFont("Helvetica-Bold", 7)
c.drawCentredString(at1_x+45, at_y+27, "ARBs BLOCK THIS ✗")
# AT1 effects (harmful)
eff1_x = 18; eff1_y = at_y - 80
highlight_box(c, eff1_x, eff1_y, 150, 78, bg=HexColor("#FDECEA"), stroke=HexColor("#C0392B"))
c.setFillColor(RED_TEXT); c.setFont("Helvetica-Bold", 8)
c.drawString(eff1_x+5, eff1_y+66, "AT1 Effects (Harmful – BLOCKED)")
at1_effs = [
"Vasoconstriction → ↑ BP",
"Aldosterone secretion → Na+/H2O retention",
"ADH release → ↑ water retention",
"Sympathetic stimulation",
"Cardiac & vascular remodeling",
"↑ Preload & afterload",
]
ey = eff1_y + 54
for ef in at1_effs:
bullet_line(c, eff1_x+5, ey, ef, fontsize=7.5, bullet="✗", bcol=RED_TEXT, color=RED_TEXT)
ey -= 10
# AT2 effects (beneficial)
eff2_x = 218; eff2_y = at_y - 80
highlight_box(c, eff2_x, eff2_y, 150, 78, bg=HexColor("#EAFAF1"), stroke=HexColor("#1A7A1A"))
c.setFillColor(GREEN_TEXT); c.setFont("Helvetica-Bold", 8)
c.drawString(eff2_x+5, eff2_y+66, "AT2 Effects (Beneficial – INTACT)")
at2_effs = [
"↑ Bradykinin → ↑ NO → ↑ cGMP",
"Vasodilation",
"Natriuresis",
"Anti-proliferation",
"Anti-fibrosis",
"↓ BP (additional)",
]
ey = eff2_y + 54
for ef in at2_effs:
bullet_line(c, eff2_x+5, ey, ef, fontsize=7.5, bullet="✓", bcol=GREEN_TEXT, color=GREEN_TEXT)
ey -= 10
# Net result box
nr_x = 390; nr_y = y3 - 25
highlight_box(c, nr_x, nr_y, W-nr_x-18, 170, bg=HexColor("#EDE7F6"), stroke=HexColor("#6C63FF"))
c.setFillColor(PURPLE_TEXT); c.setFont("Helvetica-Bold", 9)
c.drawCentredString(nr_x + (W-nr_x-18)/2, nr_y+158, "NET RESULT OF ARBs")
net_items = [
("Block AT1 vasoconstriction", "↓ Peripheral resistance"),
("Block Aldosterone", "↓ Na+/H2O retention"),
("Block ADH", "↓ Water retention"),
("Allow AT2 stimulation", "Extra vasodilation"),
("↓ Preload & Afterload", "↓ Cardiac workload"),
("Anti-remodeling", "Cardio/renoprotection"),
]
ny = nr_y + 142
for cause, effect in net_items:
c.setFillColor(PURPLE_TEXT); c.setFont("Helvetica-Bold", 7.5)
c.drawString(nr_x+5, ny, cause)
c.setFillColor(RED_TEXT); c.setFont("Helvetica-Bold", 8)
c.drawString(nr_x+110, ny, "→")
c.setFillColor(GREEN_TEXT); c.setFont("Helvetica", 7.5)
c.drawString(nr_x+122, ny, effect)
ny -= 13
draw_rounded_rect(c, nr_x+5, nr_y+5, W-nr_x-28, 22, r=8, fill_color=HexColor("#6C63FF"), stroke_color=None)
c.setFillColor(colors.white); c.setFont("Helvetica-Bold", 10)
c.drawCentredString(nr_x + (W-nr_x-18)/2, nr_y+13, "↓ BLOOD PRESSURE")
# No cough callout
nc_y = eff1_y - 22
draw_rounded_rect(c, 18, nc_y, 355, 18, r=9, fill_color=HexColor("#FFF9C4"), stroke_color=HexColor("#F9A825"), lw=1)
c.setFillColor(HexColor("#7B3F00")); c.setFont("Helvetica-Bold", 8.5)
c.drawCentredString(18+355/2, nc_y+5, "★ ARBs do NOT inhibit ACE → No Bradykinin accumulation → NO DRY COUGH (Unlike ACE inhibitors)")
# footer page 1
c.setFillColor(HexColor("#BBBBBB")); c.setFont("Helvetica", 7)
c.drawCentredString(W/2, 18, "Page 1 of 2 | GTU B.Pharm Pharmacology II – BP502TP | AT1 Receptor Blockers (ARBs / Sartans)")
c.showPage()
# ─────────────────────────────────────────────────────────────────────────────
# PAGE 2 – Uses, Adverse Effects, Contraindications, Key Points
# ─────────────────────────────────────────────────────────────────────────────
c.setFillColor(BG)
c.rect(0, 0, W, H, fill=1, stroke=0)
for pos in [(20,820),(570,820),(20,40),(570,40)]:
draw_star(c, pos[0], pos[1], r=4, col=HexColor("#E0D0FF"))
# Page title
title_bar(c, 20, H-45, W-40, 34, "AT1 RECEPTOR BLOCKERS (ARBs) – Uses, Adverse Effects & Key Points",
bg=TITLE_BG, fontsize=11)
# ── USES ─────────────────────────────────────────────────────────────────────
yu = H - 68
section_box(c, 20, yu, W-40, 18, "CLINICAL USES / THERAPEUTIC INDICATIONS", bg=H1_BG, fontsize=11)
uses = [
("1", "Hypertension", "First-line agent; equal efficacy to ACEIs & CCBs; use when ACEI not tolerated", PILL_BLUE),
("2", "Heart Failure (HFrEF)", "When ACEI not tolerated; Candesartan (CHARM) & Valsartan (Val-HeFT) reduce mortality", PILL_GREEN),
("3", "Diabetic Nephropathy", "↓ Proteinuria, slows CKD in Type 2 DM; Losartan (RENAAL: ↓ ESKD 28%); Irbesartan (IDNT)", PILL_ORANGE),
("4", "CKD with Proteinuria", "Dilates efferent arteriole → ↓ intraglomerular pressure → slows CKD progression", PILL_PINK),
("5", "Post-MI + LV Dysfunction", "Valsartan non-inferior to captopril (VALIANT trial); use when ACEI not tolerated", PILL_BLUE),
("6", "Left Ventricular Hypertrophy", "Causes LVH regression; Losartan better than atenolol (LIFE trial)", PILL_GREEN),
("7", "Prevention of Stroke", "Losartan reduced stroke risk in hypertensive patients with LVH", PILL_ORANGE),
("8", "Marfan Syndrome", "Losartan reduces aortic root dilation (as effective as atenolol)", PILL_PINK),
]
uy = yu - 12
for num, heading, detail, bg_col in uses:
draw_rounded_rect(c, 22, uy-14, 22, 14, r=7, fill_color=HexColor("#6C63FF"), stroke_color=None)
c.setFillColor(colors.white); c.setFont("Helvetica-Bold", 9)
c.drawCentredString(33, uy-7, num)
draw_rounded_rect(c, 48, uy-14, 100, 14, r=4, fill_color=bg_col, stroke_color=None)
c.setFillColor(TEXT_DARK); c.setFont("Helvetica-Bold", 8)
c.drawString(51, uy-7, heading)
c.setFillColor(TEXT_MUTED); c.setFont("Helvetica", 7.5)
c.drawString(155, uy-7, detail)
uy -= 17
# ── ADVERSE EFFECTS ───────────────────────────────────────────────────────────
ya = uy - 8
section_box(c, 20, ya, (W-45)/2, 18, "ADVERSE EFFECTS", bg=HexColor("#E74C3C"), fg=colors.white, fontsize=11)
adv_items = [
("Hypotension", "First-dose; especially in volume-depleted patients", RED_TEXT),
("Hyperkalemia ★", "↓ Aldosterone → ↓ K+ excretion; risk ↑ in renal impairment", RED_TEXT),
("Dizziness / Headache", "Due to BP lowering; usually mild and transient", TEXT_DARK),
("↑ Serum Creatinine", "Initial ↑ due to ↓ GFR; monitor renal function; usually stabilizes", HexColor("#7B3F00")),
("Rare Angioedema", "Much rarer than ACEI; non-bradykinin pathway; risk ~0.1%", TEXT_DARK),
("Sprue-like enteropathy", "Mainly olmesartan; chronic diarrhea, weight loss, villous atrophy", RED_TEXT),
("Fetotoxicity ★★", "ABSOLUTE C/I in pregnancy – oligohydramnios, fetal renal dysgenesis", RED_TEXT),
]
ax = 22; ay = ya - 12
for name, detail, col in adv_items:
highlight_box(c, ax, ay-13, (W-45)/2 - 4, 13, bg=HexColor("#FDECEA"), stroke=HexColor("#E74C3C"))
c.setFillColor(col); c.setFont("Helvetica-Bold", 8)
c.drawString(ax+4, ay-6, name)
c.setFillColor(TEXT_MUTED); c.setFont("Helvetica", 7)
c.drawString(ax+130, ay-6, detail)
ay -= 16
# Comparison box at the bottom of adverse effects
comp_y = ay - 4
highlight_box(c, ax, comp_y-26, (W-45)/2 - 4, 26, bg=HexColor("#FFF3CD"), stroke=HexColor("#F0A500"))
c.setFillColor(HexColor("#7B3F00")); c.setFont("Helvetica-Bold", 8)
c.drawString(ax+5, comp_y-5, "ARBs vs ACE Inhibitors:")
c.setFont("Helvetica", 7.5)
c.setFillColor(GREEN_TEXT)
c.drawString(ax+5, comp_y-15, "✓ No cough ✓ Rarer angioedema ✓ AT2 stimulation intact")
c.setFillColor(RED_TEXT)
c.drawString(ax+5, comp_y-23, "✗ No difference in BP efficacy ✗ Same pregnancy risk")
# ── CONTRAINDICATIONS ─────────────────────────────────────────────────────────
ci_x = (W-45)/2 + 27; ci_w = (W-45)/2
section_box(c, ci_x, ya, ci_w, 18, "CONTRAINDICATIONS", bg=HexColor("#8E44AD"), fg=colors.white, fontsize=11)
ci_items = [
"Pregnancy (absolute – fetotoxic / teratogenic)",
"Bilateral Renal Artery Stenosis (→ acute renal failure)",
"Severe Hyperkalemia (K+ > 5.5 mEq/L)",
"Hypersensitivity to any ARB",
"Triple RAAS blockade (ACEI + ARB + Aliskiren) – not recommended",
]
ciy = ya - 12
for ci in ci_items:
highlight_box(c, ci_x+2, ciy-13, ci_w-4, 13, bg=HexColor("#F3E5F5"), stroke=HexColor("#8E44AD"))
c.setFillColor(HexColor("#6C3483")); c.setFont("Helvetica", 8)
c.drawString(ci_x+8, ciy-6, "⊘ " + ci)
ciy -= 16
# Drug interactions box
di_y = ciy - 5
highlight_box(c, ci_x+2, di_y-55, ci_w-4, 54, bg=HexColor("#E8F5E9"), stroke=HexColor("#388E3C"))
c.setFillColor(GREEN_TEXT); c.setFont("Helvetica-Bold", 8.5)
c.drawString(ci_x+8, di_y-7, "DRUG INTERACTIONS")
ddi = [
"K+-sparing diuretics → ↑↑ Hyperkalemia",
"NSAIDs → ↓ antihypertensive effect + ↑ renal toxicity",
"Lithium → ARBs ↑ lithium levels (toxicity risk)",
"K+ supplements → ↑ hyperkalemia risk",
]
diy = di_y - 19
for d in ddi:
bullet_line(c, ci_x+8, diy, d, fontsize=7.5)
diy -= 11
# ── PHARMACOLOGICAL EFFECTS TABLE ────────────────────────────────────────────
pe_y = min(comp_y-35, di_y-65) - 10
section_box(c, 20, pe_y, W-40, 18, "PHARMACOLOGICAL EFFECTS – ORGAN WISE", bg=HexColor("#2980B9"), fontsize=11)
org_data = [
("Blood Vessels", "Vasodilation → ↓ Peripheral resistance → ↓ BP", PILL_BLUE),
("Heart", "↓ Preload & afterload → ↓ cardiac workload; prevents hypertrophy/fibrosis", PILL_PINK),
("Kidneys", "Dilates efferent arteriole → ↓ intraglomerular pressure → ↓ proteinuria → renoprotection", PILL_GREEN),
("Adrenal Gland", "↓ Aldosterone secretion → ↓ Na+/H2O retention; mild K+-sparing effect", PILL_ORANGE),
("Brain", "↓ Sympathetic outflow; possible benefit in stroke prevention", HexColor("#E8D5FF")),
]
ow = (W-40)/5
ox = 22
oy = pe_y - 5
for organ, effect, bg_col in org_data:
draw_rounded_rect(c, ox, oy-38, ow-4, 38, r=5, fill_color=bg_col, stroke_color=HexColor("#AAAAAA"), lw=0.5)
c.setFillColor(BLUE_TEXT); c.setFont("Helvetica-Bold", 8)
c.drawCentredString(ox+ow/2-2, oy-9, organ)
dashed_line(c, ox+4, oy-13, ox+ow-8, oy-13)
c.setFillColor(TEXT_DARK); c.setFont("Helvetica", 7)
# Word wrap simple
words = effect.split(); line = ""; ly2 = oy-22
for w2 in words:
test = line + " " + w2 if line else w2
if len(test) > 22:
c.drawCentredString(ox+ow/2-2, ly2, line); ly2 -= 9; line = w2
else:
line = test
if line:
c.drawCentredString(ox+ow/2-2, ly2, line)
ox += ow
# ── KEY EXAM POINTS ───────────────────────────────────────────────────────────
kp_y = pe_y - 52
section_box(c, 20, kp_y, W-40, 18, "KEY EXAM POINTS (GTU Most Important)", bg=HexColor("#E74C3C"), fontsize=11)
key_pts = [
('ARBs = "Sartans" – all end in "-sartan"; Prototype = Losartan', DECO_STAR),
('Block AT1 receptor (NOT ACE enzyme); allow beneficial AT2 stimulation', DECO_STAR),
('NO DRY COUGH (most tested MCQ) – because no bradykinin accumulation', HexColor("#E74C3C")),
('ABSOLUTE C/I in pregnancy – fetotoxic (oligohydramnios, renal dysgenesis)', HexColor("#E74C3C")),
('Drug of choice in hypertension + diabetic nephropathy', HexColor("#1A7A1A")),
('Telmisartan = longest half-life; also has PPARγ agonist activity', HexColor("#6C3483")),
('Olmesartan-specific ADR = sprue-like enteropathy (villous atrophy)', HexColor("#7B3F00")),
('Do NOT combine ARB + ACEI routinely (ONTARGET trial showed no extra benefit)', HexColor("#C0392B")),
('Bilateral RAS = contraindicated – both ARBs and ACEIs', HexColor("#C0392B")),
('Hyperkalemia risk ↑ with K+-sparing diuretics, NSAIDs, renal impairment', HexColor("#7B3F00")),
]
kx = 22; ky = kp_y - 10
half = len(key_pts) // 2
for i, (pt, col) in enumerate(key_pts):
kxi = kx if i < half else W/2 + 5
kyi = ky - (i % half)*16
c.setFillColor(col)
c.setFont("Helvetica-Bold", 8)
c.drawString(kxi, kyi, "★ ")
c.setFont("Helvetica", 8)
c.drawString(kxi+14, kyi, pt)
# ── Footer ────────────────────────────────────────────────────────────────────
# bottom border strip
draw_rounded_rect(c, 20, 10, W-40, 18, r=9, fill_color=HexColor("#6C63FF"), stroke_color=None)
c.setFillColor(colors.white); c.setFont("Helvetica", 7.5)
c.drawCentredString(W/2, 16, "Page 2 of 2 | GTU B.Pharm Pharmacology II – BP502TP | AT1 Receptor Blockers (ARBs/Sartans) | Classification + MOA + Uses + ADR + Contraindications")
c.save()
print("PDF created:", OUTPUT)