Make a list of all reasoning questions in previous mbbs mb examination for Pharma subject chapter wise and all answer according to kd tripathy mbbs pharmacology book
MBBS pharmacology previous year reasoning questions all India university KD Tripathi
MBBS pharmacology previous year reasoning questions India university exams chapter wise 2nd year
| Type of Question | How It Appears in Exam |
|---|---|
| "Explain why..." | Justify mechanism-based reasoning |
| "Give reasons for..." | Clinical pharmacology rationale |
| "Write a note on..." | May include reasoning within answer |
| Short answer (2-3 marks) | State drug, receptor/mechanism, reason |
Generate a PDF quick reference sheet with mechanism diagrams (drug classes, receptors, pathways)
mkdir -p /tmp/workspace/pharma-quickref && ls /tmp/workspace/pharma-quickref/
~/pharma-quickref/generate_pdf.py
"""
MBBS Pharmacology Quick Reference Sheet
Mechanism Diagrams - Drug Classes, Receptors, Pathways
Based on KD Tripathi Essentials of Medical Pharmacology
"""
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import cm, mm
from reportlab.platypus import (
SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
HRFlowable, KeepTogether
)
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_RIGHT
from reportlab.graphics.shapes import (
Drawing, Rect, String, Arrow, Line, Circle, Polygon,
Group, ArcPath
)
from reportlab.graphics import renderPDF
from reportlab.graphics.shapes import Drawing, Rect, String, Line, Circle, Arrow, Polygon
from reportlab.platypus import Flowable
from reportlab.lib.colors import (
HexColor, white, black, red, blue, green, orange, purple,
lightblue, lightyellow, lightgreen, lightgrey, darkblue
)
import math
# ─── Color Palette ───────────────────────────────────────────────────────────
C_HEADER = HexColor("#1a3a5c") # dark navy
C_SUBHEAD = HexColor("#2e6da4") # medium blue
C_ACC1 = HexColor("#e8532b") # orange-red (antagonist)
C_ACC2 = HexColor("#27ae60") # green (agonist / activates)
C_ACC3 = HexColor("#8e44ad") # purple (inhibits)
C_ACC4 = HexColor("#e67e22") # orange
C_LIGHT = HexColor("#eaf4fb") # very light blue
C_LIGHT2 = HexColor("#fef9e7") # very light yellow
C_LIGHT3 = HexColor("#f0fff0") # very light green
C_LIGHT4 = HexColor("#fdf2f8") # very light pink
C_BORDER = HexColor("#aed6f1")
C_TEXT = HexColor("#1a1a1a")
C_GRAY = HexColor("#7f8c8d")
C_RECEPTOR = HexColor("#2980b9")
C_DRUG = HexColor("#c0392b")
C_EFFECT = HexColor("#16a085")
C_BOX_BG = HexColor("#f7fbff")
W, H = A4 # 595.27 x 841.89
# ─── Custom Flowable: Pathway Diagram ────────────────────────────────────────
class PathwayDiagram(Flowable):
"""Generic pathway box - renders a multi-step arrow diagram."""
def __init__(self, steps, width=500, height=80, title="", colors_list=None):
Flowable.__init__(self)
self.steps = steps # list of (label, sublabel)
self.width = width
self.height = height
self.title = title
self.colors_list = colors_list or [C_SUBHEAD] * len(steps)
self.hAlign = 'CENTER'
def wrap(self, availW, availH):
return self.width, self.height + 20
def draw(self):
canvas = self.canv
n = len(self.steps)
box_w = (self.width - 20 * (n - 1)) / n
box_h = 50
y0 = 0
if self.title:
canvas.setFont("Helvetica-Bold", 8)
canvas.setFillColor(C_HEADER)
canvas.drawString(0, box_h + 10, self.title)
for i, (label, sub) in enumerate(self.steps):
x = i * (box_w + 20)
col = self.colors_list[i % len(self.colors_list)]
# Box
canvas.setFillColor(col)
canvas.setStrokeColor(col)
canvas.roundRect(x, y0, box_w, box_h, 5, fill=1, stroke=0)
# Label
canvas.setFillColor(white)
canvas.setFont("Helvetica-Bold", 8)
canvas.drawCentredString(x + box_w / 2, y0 + box_h - 15, label)
if sub:
canvas.setFont("Helvetica", 6.5)
canvas.drawCentredString(x + box_w / 2, y0 + box_h - 28, sub)
# Arrow
if i < n - 1:
ax = x + box_w + 2
ay = y0 + box_h / 2
canvas.setFillColor(C_ACC4)
canvas.setStrokeColor(C_ACC4)
canvas.setLineWidth(1.5)
canvas.line(ax, ay, ax + 14, ay)
# arrowhead
canvas.setFillColor(C_ACC4)
p = canvas.beginPath()
p.moveTo(ax + 14, ay - 4)
p.lineTo(ax + 20, ay)
p.lineTo(ax + 14, ay + 4)
p.close()
canvas.drawPath(p, fill=1, stroke=0)
class ReceptorDiagram(Flowable):
"""Draws a receptor-drug-effect schematic."""
def __init__(self, drug, receptor, effect, drug_action="AGONIST",
width=500, height=100):
Flowable.__init__(self)
self.drug = drug
self.receptor = receptor
self.effect = effect
self.drug_action = drug_action
self.width = width
self.height = height
self.hAlign = 'CENTER'
def wrap(self, availW, availH):
return self.width, self.height
def draw(self):
c = self.canv
w, h = self.width, self.height
box_h = 44
y0 = (h - box_h) / 2
# Drug box
col_d = C_ACC2 if "AGONIST" in self.drug_action else C_ACC1
c.setFillColor(col_d)
c.roundRect(0, y0, 130, box_h, 6, fill=1, stroke=0)
c.setFillColor(white)
c.setFont("Helvetica-Bold", 8)
c.drawCentredString(65, y0 + box_h - 16, "DRUG")
c.setFont("Helvetica", 7)
for j, line in enumerate(self.drug.split("\n")):
c.drawCentredString(65, y0 + box_h - 27 - j * 10, line)
# Action label
c.setFillColor(col_d)
c.setFont("Helvetica-Bold", 7)
c.drawCentredString(200, y0 + box_h / 2 + 14, self.drug_action)
# Arrow drug -> receptor
c.setStrokeColor(col_d)
c.setLineWidth(2)
c.line(130, y0 + box_h / 2, 268, y0 + box_h / 2)
p = c.beginPath()
p.moveTo(268, y0 + box_h / 2 - 5)
p.lineTo(276, y0 + box_h / 2)
p.lineTo(268, y0 + box_h / 2 + 5)
p.close()
c.setFillColor(col_d)
c.drawPath(p, fill=1, stroke=0)
# Receptor box
c.setFillColor(C_RECEPTOR)
c.roundRect(276, y0, 130, box_h, 6, fill=1, stroke=0)
c.setFillColor(white)
c.setFont("Helvetica-Bold", 8)
c.drawCentredString(341, y0 + box_h - 16, "RECEPTOR")
c.setFont("Helvetica", 7)
for j, line in enumerate(self.receptor.split("\n")):
c.drawCentredString(341, y0 + box_h - 27 - j * 10, line)
# Arrow receptor -> effect
c.setStrokeColor(C_EFFECT)
c.setLineWidth(2)
c.line(406, y0 + box_h / 2, 496, y0 + box_h / 2)
p = c.beginPath()
p.moveTo(496, y0 + box_h / 2 - 5)
p.lineTo(504, y0 + box_h / 2)
p.lineTo(496, y0 + box_h / 2 + 5)
p.close()
c.setFillColor(C_EFFECT)
c.drawPath(p, fill=1, stroke=0)
# Effect box
c.setFillColor(C_EFFECT)
c.roundRect(504, y0, 130, box_h, 6, fill=1, stroke=0)
c.setFillColor(white)
c.setFont("Helvetica-Bold", 8)
c.drawCentredString(569, y0 + box_h - 16, "CLINICAL EFFECT")
c.setFont("Helvetica", 7)
for j, line in enumerate(self.effect.split("\n")):
c.drawCentredString(569, y0 + box_h - 27 - j * 10, line)
class MiniTable(Flowable):
"""Small info table: Drug | Receptor | Mechanism | Use"""
def __init__(self, rows, col_headers, col_widths, bg_color=C_LIGHT, width=500):
Flowable.__init__(self)
self.rows = rows
self.col_headers = col_headers
self.col_widths = col_widths
self.bg_color = bg_color
self.width = width
def wrap(self, availW, availH):
self.table = self._build()
return self.table.wrap(availW, availH)
def _build(self):
data = [self.col_headers] + self.rows
t = Table(data, colWidths=self.col_widths)
style = TableStyle([
('BACKGROUND', (0, 0), (-1, 0), C_SUBHEAD),
('TEXTCOLOR', (0, 0), (-1, 0), white),
('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'),
('FONTSIZE', (0, 0), (-1, 0), 7.5),
('BACKGROUND', (0, 1), (-1, -1), self.bg_color),
('FONTNAME', (0, 1), (-1, -1), 'Helvetica'),
('FONTSIZE', (0, 1), (-1, -1), 7),
('ROWBACKGROUNDS', (0, 1), (-1, -1), [self.bg_color, white]),
('GRID', (0, 0), (-1, -1), 0.4, C_BORDER),
('ALIGN', (0, 0), (-1, -1), 'LEFT'),
('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
('LEFTPADDING', (0, 0), (-1, -1), 4),
('RIGHTPADDING', (0, 0), (-1, -1), 4),
('TOPPADDING', (0, 0), (-1, -1), 3),
('BOTTOMPADDING', (0, 0), (-1, -1), 3),
('WORDWRAP', (0, 0), (-1, -1), True),
])
t.setStyle(style)
return t
def draw(self):
self.table.drawOn(self.canv, 0, 0)
# ─── Build Document ──────────────────────────────────────────────────────────
def build_pdf(out_path):
doc = SimpleDocTemplate(
out_path,
pagesize=A4,
leftMargin=1.5 * cm, rightMargin=1.5 * cm,
topMargin=1.8 * cm, bottomMargin=1.8 * cm,
title="MBBS Pharmacology Quick Reference",
author="KD Tripathi Framework"
)
styles = getSampleStyleSheet()
USABLE_W = W - 3 * cm
# Custom styles
s_title = ParagraphStyle("Title2", parent=styles["Normal"],
fontSize=18, fontName="Helvetica-Bold", textColor=white,
alignment=TA_CENTER, spaceAfter=2)
s_sub_title = ParagraphStyle("SubTitle", parent=styles["Normal"],
fontSize=9, fontName="Helvetica", textColor=HexColor("#cce0f0"),
alignment=TA_CENTER, spaceAfter=4)
s_h1 = ParagraphStyle("H1", parent=styles["Normal"],
fontSize=11, fontName="Helvetica-Bold", textColor=white,
backColor=C_HEADER, borderPad=5, leading=16,
spaceBefore=10, spaceAfter=4, leftIndent=6)
s_h2 = ParagraphStyle("H2", parent=styles["Normal"],
fontSize=9.5, fontName="Helvetica-Bold", textColor=C_SUBHEAD,
spaceBefore=8, spaceAfter=3, borderWidth=0,
borderColor=C_SUBHEAD, leftIndent=0)
s_body = ParagraphStyle("Body", parent=styles["Normal"],
fontSize=7.5, fontName="Helvetica", textColor=C_TEXT,
leading=11, spaceBefore=1, spaceAfter=1)
s_bullet = ParagraphStyle("Bullet", parent=styles["Normal"],
fontSize=7, fontName="Helvetica", textColor=C_TEXT,
leading=10, leftIndent=12, bulletIndent=4, spaceBefore=1)
s_note = ParagraphStyle("Note", parent=styles["Normal"],
fontSize=6.5, fontName="Helvetica-Oblique", textColor=C_GRAY,
leading=9, spaceBefore=2)
s_tag_g = ParagraphStyle("TagG", parent=styles["Normal"],
fontSize=7, fontName="Helvetica-Bold", textColor=white,
backColor=C_ACC2, borderPad=2, alignment=TA_CENTER)
s_tag_r = ParagraphStyle("TagR", parent=styles["Normal"],
fontSize=7, fontName="Helvetica-Bold", textColor=white,
backColor=C_ACC1, borderPad=2, alignment=TA_CENTER)
def sp(h=4): return Spacer(1, h)
def hr(): return HRFlowable(width="100%", thickness=0.5, color=C_BORDER,
spaceAfter=4, spaceBefore=2)
def h1(t): return Paragraph(f" {t}", s_h1)
def h2(t): return Paragraph(t, s_h2)
def body(t): return Paragraph(t, s_body)
def note(t): return Paragraph(t, s_note)
def bul(t): return Paragraph(f"• {t}", s_bullet)
story = []
# ── COVER BANNER ──────────────────────────────────────────────────────────
banner_data = [[Paragraph(
"<font color='white'><b>MBBS PHARMACOLOGY</b></font><br/>"
"<font color='#cce0f0' size=10>Quick Reference Sheet - Mechanisms, Receptors & Pathways</font><br/>"
"<font color='#aed6f1' size=8>Based on KD Tripathi Essentials of Medical Pharmacology | 2nd MBBS Prof Exams</font>",
ParagraphStyle("ban", alignment=TA_CENTER, fontSize=16,
fontName="Helvetica-Bold", textColor=white, leading=22))]]
banner = Table(banner_data, colWidths=[USABLE_W])
banner.setStyle(TableStyle([
('BACKGROUND', (0, 0), (-1, -1), C_HEADER),
('TOPPADDING', (0, 0), (-1, -1), 14),
('BOTTOMPADDING', (0, 0), (-1, -1), 14),
('LEFTPADDING', (0, 0), (-1, -1), 10),
('RIGHTPADDING', (0, 0), (-1, -1), 10),
('ROUNDEDCORNERS', [6, 6, 6, 6]),
]))
story.append(banner)
story.append(sp(10))
# Legend
leg_data = [[
Paragraph("<font color='white'><b> AGONIST / ACTIVATES </b></font>",
ParagraphStyle("l1", backColor=C_ACC2, fontSize=7,
fontName="Helvetica-Bold", textColor=white,
alignment=TA_CENTER, borderPad=3)),
Paragraph("<font color='white'><b> ANTAGONIST / BLOCKS </b></font>",
ParagraphStyle("l2", backColor=C_ACC1, fontSize=7,
fontName="Helvetica-Bold", textColor=white,
alignment=TA_CENTER, borderPad=3)),
Paragraph("<font color='white'><b> INHIBITS ENZYME </b></font>",
ParagraphStyle("l3", backColor=C_ACC3, fontSize=7,
fontName="Helvetica-Bold", textColor=white,
alignment=TA_CENTER, borderPad=3)),
Paragraph("<font color='white'><b> CLINICAL EFFECT </b></font>",
ParagraphStyle("l4", backColor=C_EFFECT, fontSize=7,
fontName="Helvetica-Bold", textColor=white,
alignment=TA_CENTER, borderPad=3)),
]]
leg = Table(leg_data, colWidths=[USABLE_W / 4] * 4)
leg.setStyle(TableStyle([
('TOPPADDING', (0, 0), (-1, -1), 4),
('BOTTOMPADDING', (0, 0), (-1, -1), 4),
('LEFTPADDING', (0, 0), (-1, -1), 2),
('RIGHTPADDING', (0, 0), (-1, -1), 2),
]))
story.append(leg)
story.append(sp(10))
# ═══════════════════════════════════════════════════════════════
# SECTION 1 - GENERAL PHARMACOLOGY
# ═══════════════════════════════════════════════════════════════
story.append(h1("SECTION 1 — GENERAL PHARMACOLOGY"))
story.append(sp(4))
story.append(h2("1.1 Routes of Drug Administration — Summary"))
routes_data = [
["Route", "Absorption", "Bioavailability", "Key Feature", "Example"],
["Oral (PO)", "GI tract", "Variable (10-100%)", "First-pass effect", "Most drugs"],
["Sublingual (SL)", "Oral mucosa", "High (~90%)", "Avoids first-pass", "GTN, buprenorphine"],
["Rectal (PR)", "Rectal mucosa", "Partial first-pass", "Useful if vomiting", "Diazepam"],
["Intravenous (IV)", "Direct", "100%", "No absorption step", "Emergencies"],
["Intramuscular (IM)", "Muscle capillaries", "~75-100%", "Depot possible", "Vaccines, penicillin"],
["Subcutaneous (SC)", "Slow", "~75-100%", "Depot for proteins", "Insulin, heparin"],
["Inhalation", "Pulmonary alveoli", "High (for gases)", "Rapid CNS entry", "General anaesthetics"],
["Transdermal", "Skin", "Slow, sustained", "Avoids first-pass", "GTN patch, fentanyl"],
]
routes_t = Table(routes_data,
colWidths=[70, 90, 90, 110, 100])
routes_t.setStyle(TableStyle([
('BACKGROUND', (0, 0), (-1, 0), C_SUBHEAD),
('TEXTCOLOR', (0, 0), (-1, 0), white),
('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'),
('FONTSIZE', (0, 0), (-1, 0), 7.5),
('ROWBACKGROUNDS', (0, 1), (-1, -1), [C_LIGHT, white]),
('FONTNAME', (0, 1), (-1, -1), 'Helvetica'),
('FONTSIZE', (0, 1), (-1, -1), 7),
('GRID', (0, 0), (-1, -1), 0.4, C_BORDER),
('ALIGN', (0, 0), (-1, -1), 'LEFT'),
('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
('LEFTPADDING', (0, 0), (-1, -1), 4),
('TOPPADDING', (0, 0), (-1, -1), 3),
('BOTTOMPADDING', (0, 0), (-1, -1), 3),
]))
story.append(routes_t)
story.append(sp(6))
story.append(h2("1.2 Pharmacokinetics Pathway"))
story.append(PathwayDiagram(
steps=[
("ABSORPTION", "GI/skin/lung"),
("DISTRIBUTION", "Plasma protein\nbinding + Vd"),
("METABOLISM", "Liver CYP450\nPhase I & II"),
("EXCRETION", "Kidney, bile,\nlungs"),
],
width=USABLE_W, height=60,
colors_list=[C_SUBHEAD, C_ACC4, C_ACC3, C_ACC1]
))
story.append(sp(4))
story.append(note("Key equation: Steady state achieved after 4-5 half-lives (t½). Loading dose = Vd × target conc. Maintenance dose = Cl × target conc."))
story.append(sp(6))
story.append(h2("1.3 Receptor Types and Signal Transduction"))
rec_data = [
["Receptor Type", "Mechanism", "Speed", "Examples", "Drug Class"],
["Ionotropic (Ligand-gated ion channel)", "Opens ion channel directly", "Milliseconds", "nAChR, GABA-A, NMDA", "BZDs, neuromuscular blockers"],
["G-protein coupled (GPCR)", "G-protein → 2nd messenger (cAMP, IP3, DAG)", "Seconds", "Beta-AR, M2, Alpha-AR", "Beta blockers, atropine, adrenaline"],
["Tyrosine kinase linked", "Phosphorylation cascade", "Minutes-hours", "Insulin-R, growth factors", "Insulin, imatinib"],
["Nuclear / Intracellular", "Regulates gene transcription", "Hours-days", "Glucocorticoid-R, thyroid-R", "Steroids, thyroid hormones"],
]
rec_t = Table(rec_data, colWidths=[110, 110, 65, 110, 105])
rec_t.setStyle(TableStyle([
('BACKGROUND', (0, 0), (-1, 0), C_SUBHEAD),
('TEXTCOLOR', (0, 0), (-1, 0), white),
('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'),
('FONTSIZE', (0, 0), (-1, 0), 7.5),
('ROWBACKGROUNDS', (0, 1), (-1, -1), [C_LIGHT, white]),
('FONTNAME', (0, 1), (-1, -1), 'Helvetica'),
('FONTSIZE', (0, 1), (-1, -1), 7),
('GRID', (0, 0), (-1, -1), 0.4, C_BORDER),
('ALIGN', (0, 0), (-1, -1), 'LEFT'),
('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
('LEFTPADDING', (0, 0), (-1, -1), 4),
('TOPPADDING', (0, 0), (-1, -1), 3),
('BOTTOMPADDING', (0, 0), (-1, -1), 3),
('WORDWRAP', (0, 0), (-1, -1), True),
]))
story.append(rec_t)
story.append(sp(8))
# ═══════════════════════════════════════════════════════════════
# SECTION 2 - AUTONOMIC PHARMACOLOGY
# ═══════════════════════════════════════════════════════════════
story.append(h1("SECTION 2 — AUTONOMIC PHARMACOLOGY"))
story.append(sp(4))
story.append(h2("2.1 Autonomic Receptor Map"))
aut_data = [
["Receptor", "Location", "Agonist Effect", "Key Drugs (Agonists)", "Key Drugs (Antagonists)"],
["Alpha-1 (α1)", "Blood vessels, iris, bladder", "Vasoconstriction, mydriasis", "Noradrenaline, phenylephrine", "Prazosin, phentolamine"],
["Alpha-2 (α2)", "Pre-synaptic, pancreas", "↓NA release, ↓insulin", "Clonidine, methyldopa", "Yohimbine"],
["Beta-1 (β1)", "Heart, kidney JGA", "↑HR, ↑contractility, ↑renin", "Dobutamine, isoprenaline", "Metoprolol, atenolol"],
["Beta-2 (β2)", "Bronchi, uterus, vessels", "Bronchodilation, uterine relax", "Salbutamol, terbutaline", "Propranolol (non-selective)"],
["M1 (Muscarinic)", "CNS, gastric parietal", "CNS effects, ↑acid", "Pilocarpine (all M)", "Pirenzepine (M1 selective)"],
["M2 (Muscarinic)", "Heart (SA, AV node)", "Bradycardia, ↓AV conduction", "Muscarine, acetylcholine", "Atropine (all M)"],
["M3 (Muscarinic)", "Smooth muscle, glands, eye", "Contraction, secretions, miosis", "Pilocarpine, bethanechol", "Ipratropium, glycopyrrolate"],
["Nm (Nicotinic-NMJ)", "Neuromuscular junction", "Muscle contraction", "Suxamethonium", "Tubocurarine, rocuronium"],
["Nn (Nicotinic-Ganglion)", "Autonomic ganglia", "Ganglionic stimulation", "Nicotine", "Hexamethonium, trimetaphan"],
]
aut_t = Table(aut_data, colWidths=[75, 100, 105, 115, 105])
aut_t.setStyle(TableStyle([
('BACKGROUND', (0, 0), (-1, 0), C_SUBHEAD),
('TEXTCOLOR', (0, 0), (-1, 0), white),
('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'),
('FONTSIZE', (0, 0), (-1, 0), 7.5),
('ROWBACKGROUNDS', (0, 1), (-1, -1), [C_LIGHT, white]),
('FONTNAME', (0, 1), (-1, -1), 'Helvetica'),
('FONTSIZE', (0, 1), (-1, -1), 7),
('GRID', (0, 0), (-1, -1), 0.4, C_BORDER),
('ALIGN', (0, 0), (-1, -1), 'LEFT'),
('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
('LEFTPADDING', (0, 0), (-1, -1), 4),
('TOPPADDING', (0, 0), (-1, -1), 3),
('BOTTOMPADDING', (0, 0), (-1, -1), 3),
('WORDWRAP', (0, 0), (-1, -1), True),
]))
story.append(aut_t)
story.append(sp(6))
story.append(h2("2.2 Cholinergic Synapse Pathway"))
story.append(PathwayDiagram(
steps=[
("Choline +\nAcetyl-CoA", "ChAT enzyme"),
("ACh stored\nin vesicles", "Nerve terminal"),
("ACh released\ninto synapse", "Action potential"),
("ACh binds\nM or N receptor", "Post-synaptic"),
("Effect\n(PS response)", "SLUD + NMJ"),
],
width=USABLE_W, height=60, title="Cholinergic Synapse (ACh Pathway)",
colors_list=[C_SUBHEAD, C_SUBHEAD, C_ACC2, C_RECEPTOR, C_EFFECT]
))
story.append(note("ACh is degraded by AChE (acetylcholinesterase). Anticholinesterases (neostigmine, physostigmine) block AChE → ↑ACh at synapse."))
story.append(sp(4))
story.append(h2("2.3 Adrenergic Synapse Pathway"))
story.append(PathwayDiagram(
steps=[
("Tyrosine\n→ DOPA → DA", "TH enzyme"),
("DA → NA\nstored in vesicles", "DBH enzyme"),
("NA released\ninto synapse", "Action potential"),
("NA binds\nα or β receptor", "Post-synaptic"),
("Effect\n(SNS response)", "↑HR, vasoconstric"),
],
width=USABLE_W, height=60, title="Adrenergic Synapse (Noradrenaline Pathway)",
colors_list=[C_ACC4, C_ACC4, C_ACC1, C_RECEPTOR, C_EFFECT]
))
story.append(note("NA reuptake by NET (norepinephrine transporter). Cocaine, TCAs block NET. MAO/COMT degrade catecholamines."))
story.append(sp(8))
# ═══════════════════════════════════════════════════════════════
# SECTION 3 - CARDIOVASCULAR PHARMACOLOGY
# ═══════════════════════════════════════════════════════════════
story.append(h1("SECTION 3 — CARDIOVASCULAR PHARMACOLOGY"))
story.append(sp(4))
story.append(h2("3.1 Antihypertensive Drug Classes — Mechanism Map"))
ah_data = [
["Drug Class", "Target / Mechanism", "Key Effect", "Examples", "Key Caution"],
["ACE Inhibitors", "Block ACE → ↓Angiotensin II\n→ ↓Aldosterone", "Vasodilation +\n↓Na retention", "Enalapril, Ramipril,\nLisinopril", "Dry cough (↑bradykinin)\nContraindicated in pregnancy"],
["ARBs", "Block AT1 receptor\n→ ↓AT-II effects", "Vasodilation +\n↓aldosterone", "Losartan, Valsartan,\nTelmisartan", "No cough; OK if ACEi\ncough occurs"],
["Beta Blockers", "Block β1 → ↓HR,\n↓contractility, ↓renin", "↓Cardiac output", "Atenolol, Metoprolol,\nBisoprolol", "Avoid in asthma,\nPVD, heart block"],
["Calcium Channel\nBlockers (CCB)", "Block L-type Ca2+\nchannels", "Vasodilation ±\n↓HR (non-DHP)", "Amlodipine (DHP)\nDiltiazem, Verapamil", "Verapamil: avoid\nwith beta blockers"],
["Thiazide Diuretics", "Block NCC in DCT\n→ ↓Na+ reabsorption", "↓Blood volume", "Hydrochlorothiazide,\nIndapamide", "Hypokalemia,\nhyperglycemia"],
["Alpha-1 Blockers", "Block α1 → vasodilation", "↓Peripheral\nresistance", "Prazosin, Doxazosin,\nTerazosin", "First-dose\northostatic hypotension"],
["Centrally acting", "α2 agonist → ↓SNS\noutflow from brain", "↓BP + ↓HR", "Clonidine,\nMethyldopa", "Methyldopa: drug of\nchoice in pregnancy HTN"],
]
ah_t = Table(ah_data, colWidths=[80, 110, 70, 110, 90])
ah_t.setStyle(TableStyle([
('BACKGROUND', (0, 0), (-1, 0), C_SUBHEAD),
('TEXTCOLOR', (0, 0), (-1, 0), white),
('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'),
('FONTSIZE', (0, 0), (-1, 0), 7.5),
('ROWBACKGROUNDS', (0, 1), (-1, -1), [C_LIGHT, white]),
('FONTNAME', (0, 1), (-1, -1), 'Helvetica'),
('FONTSIZE', (0, 1), (-1, -1), 7),
('GRID', (0, 0), (-1, -1), 0.4, C_BORDER),
('ALIGN', (0, 0), (-1, -1), 'LEFT'),
('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
('LEFTPADDING', (0, 0), (-1, -1), 4),
('TOPPADDING', (0, 0), (-1, -1), 3),
('BOTTOMPADDING', (0, 0), (-1, -1), 3),
('WORDWRAP', (0, 0), (-1, -1), True),
]))
story.append(ah_t)
story.append(sp(6))
story.append(h2("3.2 RAAS Pathway (Renin-Angiotensin-Aldosterone System)"))
story.append(PathwayDiagram(
steps=[
("Renin\n(Kidney JGA)", "↓BP/↓Na/SNS"),
("Angiotensinogen\n→ Angiotensin I", "Liver substrate"),
("Angiotensin I\n→ Angiotensin II", "ACE (lung)"),
("AT-II binds\nAT1 receptor", "Vasoconstriction\n+ aldosterone"),
("Na+ retention\n↑Blood pressure", "Adrenal cortex"),
],
width=USABLE_W, height=65,
colors_list=[C_SUBHEAD, C_ACC4, C_ACC3, C_ACC1, C_EFFECT],
title="RAAS Pathway — ACE inhibitors block Step 3; ARBs block Step 4"
))
story.append(sp(6))
story.append(h2("3.3 Anti-anginal Drugs — Mechanism Comparison"))
ang_data = [
["Drug Class", "Mechanism", "Preload", "Afterload", "HR/Contractility", "O2 Demand"],
["Organic Nitrates\n(GTN, ISDN)", "Release NO → cGMP\n→ venodilation", "↓↓", "↓", "↑ (reflex)", "↓"],
["Beta Blockers", "↓HR and contractility\n(β1 block)", "→", "↓", "↓↓ HR, ↓↓ cont.", "↓↓"],
["CCB (DHP)\nAmlodipine", "L-Ca2+ block →\nArterial vasodilation", "→", "↓↓", "↑ (reflex)", "↓"],
["CCB (non-DHP)\nVerapamil", "L-Ca2+ block + rate\ncontrol", "→", "↓", "↓ HR, ↓ cont.", "↓↓"],
["Nicorandil", "K+ ATP channel opener\n+ nitrate effect", "↓", "↓", "→", "↓"],
]
ang_t = Table(ang_data, colWidths=[85, 115, 48, 58, 100, 54])
ang_t.setStyle(TableStyle([
('BACKGROUND', (0, 0), (-1, 0), C_SUBHEAD),
('TEXTCOLOR', (0, 0), (-1, 0), white),
('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'),
('FONTSIZE', (0, 0), (-1, 0), 7.5),
('ROWBACKGROUNDS', (0, 1), (-1, -1), [C_LIGHT, white]),
('FONTNAME', (0, 1), (-1, -1), 'Helvetica'),
('FONTSIZE', (0, 1), (-1, -1), 7),
('GRID', (0, 0), (-1, -1), 0.4, C_BORDER),
('ALIGN', (0, 0), (-1, -1), 'LEFT'),
('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
('LEFTPADDING', (0, 0), (-1, -1), 4),
('TOPPADDING', (0, 0), (-1, -1), 3),
('BOTTOMPADDING', (0, 0), (-1, -1), 3),
('WORDWRAP', (0, 0), (-1, -1), True),
]))
story.append(ang_t)
story.append(sp(6))
story.append(h2("3.4 Digoxin — Mechanism of Action"))
story.append(PathwayDiagram(
steps=[
("Digoxin inhibits\nNa+/K+-ATPase", "Pump blocked"),
("↑Intracellular\nNa+", "Cell accumulates Na"),
("Na+/Ca2+\nexchanger reverses", "Less Ca2+ exit"),
("↑Intracellular\nCa2+", "Stores fill"),
("↑Myocardial\nContractility", "+ve Inotrope"),
],
width=USABLE_W, height=60, title="Digoxin Mechanism — Positive Inotropy",
colors_list=[C_ACC3, C_ACC4, C_SUBHEAD, C_ACC1, C_EFFECT]
))
story.append(note("Vagal effect: Digoxin also enhances vagal tone → ↓HR and ↓AV conduction (useful in AF). Hypokalemia potentiates toxicity (competes with K+ at Na+/K+-ATPase)."))
story.append(sp(8))
# ═══════════════════════════════════════════════════════════════
# SECTION 4 - CNS PHARMACOLOGY
# ═══════════════════════════════════════════════════════════════
story.append(h1("SECTION 4 — CNS PHARMACOLOGY"))
story.append(sp(4))
story.append(h2("4.1 Opioid Receptor Pathway"))
story.append(ReceptorDiagram(
drug="Morphine\nCodeine\nFentanyl\nPethidine",
receptor="μ (Mu) opioid\nreceptor\n(GPCR - Gi)",
effect="Analgesia\nRespiratory depression\nConstipation\nEuphoria",
drug_action="AGONIST",
width=USABLE_W, height=90
))
story.append(note("Naloxone/Naltrexone = opioid receptor ANTAGONISTS (reversal agents). Contraindicated: morphine in head injury (↑ICP via CO2 retention), asthma, hepatic failure."))
story.append(sp(6))
story.append(h2("4.2 GABA-A Receptor — BZD vs Barbiturate"))
gaba_data = [
["Property", "Benzodiazepines (BZDs)", "Barbiturates"],
["Binding site", "Specific BZD site (α subunit)", "Barbiturate site (β subunit)"],
["Mechanism", "↑Frequency of Cl- channel opening", "↑Duration of Cl- channel opening"],
["Ceiling effect", "Yes — safer overdose profile", "No — can cause respiratory arrest"],
["Reversal agent", "Flumazenil (BZD antagonist)", "None available"],
["Uses", "Anxiety, epilepsy, alcohol withdrawal,\npre-med, insomnia", "Induction of anaesthesia, epilepsy\n(now limited use)"],
["Examples", "Diazepam, Midazolam, Lorazepam,\nAlprazolam", "Thiopentone (IV anaesthesia),\nPhenobarbital (epilepsy)"],
]
gaba_t = Table(gaba_data, colWidths=[95, 215, 190])
gaba_t.setStyle(TableStyle([
('BACKGROUND', (0, 0), (-1, 0), C_SUBHEAD),
('TEXTCOLOR', (0, 0), (-1, 0), white),
('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'),
('FONTSIZE', (0, 0), (-1, 0), 7.5),
('ROWBACKGROUNDS', (0, 1), (-1, -1), [C_LIGHT, white]),
('FONTNAME', (0, 1), (-1, -1), 'Helvetica'),
('FONTSIZE', (0, 1), (-1, -1), 7),
('GRID', (0, 0), (-1, -1), 0.4, C_BORDER),
('ALIGN', (0, 0), (-1, -1), 'LEFT'),
('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
('LEFTPADDING', (0, 0), (-1, -1), 4),
('TOPPADDING', (0, 0), (-1, -1), 3),
('BOTTOMPADDING', (0, 0), (-1, -1), 3),
('WORDWRAP', (0, 0), (-1, -1), True),
]))
story.append(gaba_t)
story.append(sp(6))
story.append(h2("4.3 Antiepileptic Drugs — Mechanism Table"))
aed_data = [
["Drug", "Mechanism", "Seizure Type", "Key Side Effects"],
["Phenytoin", "Block fast Na+ channels\n(frequency-dependent)", "Tonic-clonic, Focal", "Gingival hyperplasia, hirsutism,\nnystagmus, teratogenic"],
["Carbamazepine", "Block Na+ channels\n(use-dependent)", "Focal, tonic-clonic,\ntrigeminal neuralgia", "Diplopia, aplastic anaemia,\nSJS, enzyme inducer"],
["Valproate", "Block Na+ channels +\n↑GABA (GABA-T inhibitor)", "All seizure types\n(broad spectrum)", "Hepatotoxic, teratogenic (NTD),\nweight gain, hair loss"],
["Phenobarbital", "Potentiates GABA-A\n(↑Cl- channel duration)", "Tonic-clonic, neonatal\nseizures", "Sedation, enzyme inducer,\ndependence"],
["Ethosuximide", "Block T-type Ca2+ channels\nin thalamus", "Absence seizures\n(ONLY)", "GI symptoms, headache"],
["Benzodiazepines\n(Diazepam)", "↑GABA-A Cl- channel\nfrequency", "Status epilepticus\n(acute)", "Sedation, tolerance"],
["Lamotrigine", "Block Na+ channels +\n↓glutamate release", "Focal, absence, broad", "Stevens-Johnson syndrome"],
["Levetiracetam", "Binds SV2A vesicle protein\n→ ↓neurotransmitter release", "Broad spectrum, focal", "Mood changes, behavioural"],
]
aed_t = Table(aed_data, colWidths=[85, 140, 115, 160])
aed_t.setStyle(TableStyle([
('BACKGROUND', (0, 0), (-1, 0), C_SUBHEAD),
('TEXTCOLOR', (0, 0), (-1, 0), white),
('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'),
('FONTSIZE', (0, 0), (-1, 0), 7.5),
('ROWBACKGROUNDS', (0, 1), (-1, -1), [C_LIGHT, white]),
('FONTNAME', (0, 1), (-1, -1), 'Helvetica'),
('FONTSIZE', (0, 1), (-1, -1), 7),
('GRID', (0, 0), (-1, -1), 0.4, C_BORDER),
('ALIGN', (0, 0), (-1, -1), 'LEFT'),
('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
('LEFTPADDING', (0, 0), (-1, -1), 4),
('TOPPADDING', (0, 0), (-1, -1), 3),
('BOTTOMPADDING', (0, 0), (-1, -1), 3),
('WORDWRAP', (0, 0), (-1, -1), True),
]))
story.append(aed_t)
story.append(sp(6))
story.append(h2("4.4 Antipsychotic Drugs — Dopamine Pathway Diagram"))
story.append(PathwayDiagram(
steps=[
("Mesolimbic\npathway", "D2 block\n→ antipsychotic"),
("Mesocortical\npathway", "D2 block\n→ cognitive ↓"),
("Nigrostriatal\npathway", "D2 block\n→ EPS"),
("Tuberoinfundibular\npathway", "D2 block\n→ hyperprolactin"),
],
width=USABLE_W, height=65, title="Dopamine Pathways — D2 Blockade Effects (Typical Antipsychotics)",
colors_list=[C_ACC2, C_ACC4, C_ACC1, C_ACC3]
))
story.append(note("Atypical antipsychotics (clozapine, olanzapine): higher 5-HT2A/D2 ratio → less EPS. Clozapine: agranulocytosis risk (monitor WBC). Risperidone: highest prolactin elevation among atypicals."))
story.append(sp(4))
ap_data = [
["Drug", "Class", "D2", "5HT2A", "Key SE", "Use"],
["Chlorpromazine", "Typical (low potency)", "++", "+", "Sedation, hypotension", "Schizophrenia"],
["Haloperidol", "Typical (high potency)", "+++", "+", "High EPS, akathisia", "Schizophrenia, delirium"],
["Clozapine", "Atypical", "+", "+++", "Agranulocytosis, seizures", "Refractory schizophrenia"],
["Olanzapine", "Atypical", "++", "+++", "Weight gain, metabolic", "Schizophrenia, bipolar"],
["Risperidone", "Atypical", "+++", "+++", "Hyperprolactinemia, EPS at high dose", "Schizophrenia, autism"],
["Quetiapine", "Atypical", "+", "++", "Sedation, weight gain", "Schizo, bipolar depression"],
]
ap_t = Table(ap_data, colWidths=[80, 95, 30, 45, 160, 90])
ap_t.setStyle(TableStyle([
('BACKGROUND', (0, 0), (-1, 0), C_SUBHEAD),
('TEXTCOLOR', (0, 0), (-1, 0), white),
('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'),
('FONTSIZE', (0, 0), (-1, 0), 7.5),
('ROWBACKGROUNDS', (0, 1), (-1, -1), [C_LIGHT, white]),
('FONTNAME', (0, 1), (-1, -1), 'Helvetica'),
('FONTSIZE', (0, 1), (-1, -1), 7),
('GRID', (0, 0), (-1, -1), 0.4, C_BORDER),
('ALIGN', (0, 0), (-1, -1), 'LEFT'),
('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
('LEFTPADDING', (0, 0), (-1, -1), 4),
('TOPPADDING', (0, 0), (-1, -1), 3),
('BOTTOMPADDING', (0, 0), (-1, -1), 3),
('WORDWRAP', (0, 0), (-1, -1), True),
]))
story.append(ap_t)
story.append(sp(8))
# ═══════════════════════════════════════════════════════════════
# SECTION 5 - ANALGESICS / NSAIDs
# ═══════════════════════════════════════════════════════════════
story.append(h1("SECTION 5 — ANALGESICS, NSAIDs & ANTI-INFLAMMATORY"))
story.append(sp(4))
story.append(h2("5.1 Arachidonic Acid Pathway (COX Pathway)"))
story.append(PathwayDiagram(
steps=[
("Cell Membrane\nPhospholipids", "Injury/stimulus"),
("Arachidonic\nAcid", "Phospholipase A2\n(blocked by steroids)"),
("PGG2 / PGH2", "COX-1 / COX-2\n(blocked by NSAIDs)"),
("Prostaglandins\nThromboxane A2", "TXA2: platelet agg.\nPGE2: fever, pain"),
("Inflammation\nPain, Fever", "Clinical effects"),
],
width=USABLE_W, height=65, title="Arachidonic Acid → COX Pathway",
colors_list=[C_ACC4, C_ACC4, C_ACC3, C_ACC1, C_EFFECT]
))
story.append(note("Lipoxygenase (LOX) pathway → Leukotrienes → Bronchoconstriction (asthma). Aspirin-exacerbated respiratory disease: COX inhibition shunts AA towards LOX → more leukotrienes."))
story.append(sp(4))
nsaid_data = [
["Drug", "COX Selectivity", "Key Use", "Key Adverse Effect", "Note"],
["Aspirin (low dose)", "COX-1 selective\n(irreversible)", "Antiplatelet", "GI bleed, Reye's syndrome", "Irreversible - platelets can't\nresynthesize COX"],
["Aspirin (high dose)", "COX-1 > COX-2", "Anti-inflammatory,\nantipyretic", "GI ulcer, tinnitus,\nsalicylism", "Hepatotoxic in children\nwith viral fever"],
["Ibuprofen", "COX-1 + COX-2\n(reversible)", "Pain, fever,\narthritis", "GI irritation, renal", "Safest OTC NSAID"],
["Diclofenac", "Mild COX-2 pref.", "Pain, dysmenorrhea", "GI, hepatotoxic", "Topical gel available"],
["Indomethacin", "COX-1 + COX-2", "Gout, PDA closure", "GI ulcers, headache", "Used to close PDA in neonates"],
["Celecoxib", "COX-2 selective", "Arthritis, less GI SE", "↑Cardiovascular risk", "Avoid in CV disease"],
["Paracetamol\n(Acetaminophen)", "Central COX-3?\n(not classical NSAID)", "Antipyretic, mild pain", "Hepatotoxic in overdose\n(NAPQI mechanism)", "No anti-inflammatory;\nno GI ulcer risk"],
]
nsaid_t = Table(nsaid_data, colWidths=[75, 90, 80, 115, 100])
nsaid_t.setStyle(TableStyle([
('BACKGROUND', (0, 0), (-1, 0), C_SUBHEAD),
('TEXTCOLOR', (0, 0), (-1, 0), white),
('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'),
('FONTSIZE', (0, 0), (-1, 0), 7.5),
('ROWBACKGROUNDS', (0, 1), (-1, -1), [C_LIGHT, white]),
('FONTNAME', (0, 1), (-1, -1), 'Helvetica'),
('FONTSIZE', (0, 1), (-1, -1), 7),
('GRID', (0, 0), (-1, -1), 0.4, C_BORDER),
('ALIGN', (0, 0), (-1, -1), 'LEFT'),
('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
('LEFTPADDING', (0, 0), (-1, -1), 4),
('TOPPADDING', (0, 0), (-1, -1), 3),
('BOTTOMPADDING', (0, 0), (-1, -1), 3),
('WORDWRAP', (0, 0), (-1, -1), True),
]))
story.append(nsaid_t)
story.append(sp(8))
# ═══════════════════════════════════════════════════════════════
# SECTION 6 - ANTIMICROBIALS
# ═══════════════════════════════════════════════════════════════
story.append(h1("SECTION 6 — ANTIMICROBIAL PHARMACOLOGY"))
story.append(sp(4))
story.append(h2("6.1 Antibiotic Mechanisms — Overview Diagram"))
story.append(PathwayDiagram(
steps=[
("Cell Wall\nSynthesis\nInhibitors", "Penicillins,\nCephalosporins,\nVancomycin"),
("Protein\nSynthesis\n30S (tRNA)", "Aminoglycosides,\nTetracyclines"),
("Protein\nSynthesis\n50S (transpep)", "Macrolides,\nChloramphenicol,\nClindamycin"),
("DNA\nSynthesis /\nGyrase", "Fluoroquinolones\nMetronidazole"),
("Folate\nSynthesis\npathway", "Sulfonamides,\nTrimethoprim"),
],
width=USABLE_W, height=80, title="Sites of Antibiotic Action",
colors_list=[C_ACC1, C_ACC3, C_ACC3, C_SUBHEAD, C_ACC2]
))
story.append(sp(5))
story.append(h2("6.2 Beta-Lactam Antibiotic Mechanism"))
story.append(ReceptorDiagram(
drug="Penicillins\nCephalosporins\nCarbapenems",
receptor="Penicillin-Binding\nProteins (PBPs)\n= Transpeptidase",
effect="Cell wall synthesis\nblocked → lysis\n(Bactericidal)",
drug_action="IRREVERSIBLE INHIBITOR",
width=USABLE_W, height=90
))
story.append(note("Beta-lactamase resistance: bacteria produce enzymes that cleave beta-lactam ring. Overcome with beta-lactamase inhibitors: clavulanic acid (co-amoxiclav), sulbactam (ampicillin-sulbactam), tazobactam (piperacillin-tazobactam)."))
story.append(sp(4))
story.append(h2("6.3 Antibiotic Classification by Action"))
ab_data = [
["Category", "Drugs", "Mechanism", "Key Indication"],
["BACTERICIDAL", "", "", ""],
["Cell wall", "Penicillins, Cephalosporins,\nVancomycin, Carbapenems", "PBP inhibition / glycopeptide\nbinding to D-Ala-D-Ala", "Pneumonia, meningitis,\nendocarditis"],
["DNA/RNA", "Fluoroquinolones (ciprofloxacin,\nlevofloxacin)", "Inhibit DNA gyrase (GyrA)\n+ topoisomerase IV", "UTI, respiratory, enteric,\nanthrax"],
["Cell membrane", "Polymyxins (Colistin)", "Disrupt bacterial\nouter membrane", "MDR gram-negative\n(last resort)"],
["BACTERIOSTATIC", "", "", ""],
["30S ribosome", "Tetracyclines, Aminoglycosides*", "Block tRNA entry\n(30S A-site)", "Acne, Lyme, plague,\nMAC infection"],
["50S ribosome", "Macrolides, Chloramphenicol,\nClindamycin", "Block transpeptidation/\ntranslocation", "Resp infections, anaerobes,\nSTIs"],
["Folate pathway", "Sulfonamides, Trimethoprim", "Sequential blockade\nof DHPS + DHFR", "UTI, PCP prophylaxis,\ntoxoplasma"],
]
ab_t = Table(ab_data, colWidths=[90, 135, 135, 100])
ab_t.setStyle(TableStyle([
('BACKGROUND', (0, 0), (-1, 0), C_SUBHEAD),
('TEXTCOLOR', (0, 0), (-1, 0), white),
('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'),
('FONTSIZE', (0, 0), (-1, 0), 7.5),
('BACKGROUND', (0, 1), (-1, 1), C_ACC2),
('TEXTCOLOR', (0, 1), (-1, 1), white),
('FONTNAME', (0, 1), (-1, 1), 'Helvetica-Bold'),
('BACKGROUND', (0, 5), (-1, 5), C_ACC3),
('TEXTCOLOR', (0, 5), (-1, 5), white),
('FONTNAME', (0, 5), (-1, 5), 'Helvetica-Bold'),
('ROWBACKGROUNDS', (0, 2), (-1, 4), [C_LIGHT3, white]),
('ROWBACKGROUNDS', (0, 6), (-1, -1), [C_LIGHT4, white]),
('FONTNAME', (0, 2), (-1, -1), 'Helvetica'),
('FONTSIZE', (0, 2), (-1, -1), 7),
('GRID', (0, 0), (-1, -1), 0.4, C_BORDER),
('ALIGN', (0, 0), (-1, -1), 'LEFT'),
('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
('LEFTPADDING', (0, 0), (-1, -1), 4),
('TOPPADDING', (0, 0), (-1, -1), 3),
('BOTTOMPADDING', (0, 0), (-1, -1), 3),
('WORDWRAP', (0, 0), (-1, -1), True),
('SPAN', (1, 1), (3, 1)),
('SPAN', (1, 5), (3, 5)),
]))
story.append(ab_t)
story.append(note("*Aminoglycosides are bactericidal despite 30S binding — due to mistranslation leading to faulty proteins that disrupt cell membrane integrity."))
story.append(sp(6))
story.append(h2("6.4 Anti-TB Drug Mechanisms (HRZE Regimen)"))
tb_data = [
["Drug", "Abbreviation", "Mechanism", "Unique Toxicity", "Note"],
["Isoniazid", "H", "Inhibits InhA → blocks mycolic\nacid synthesis (active bacteria)", "Peripheral neuropathy\n(pyridoxine deficiency)", "Prophylaxis drug; hepatotoxic;\nhepatic acetylator status matters"],
["Rifampicin", "R", "Inhibits bacterial DNA-dependent\nRNA polymerase (β subunit)", "Orange-red body fluids;\nhepatotoxic; enzyme inducer", "Most potent sterilizing agent;\nshortens treatment to 6 months"],
["Pyrazinamide", "Z", "Active in acidic pH of macrophage\n→ disrupts membrane potential", "Hyperuricemia, gout;\nhepatotoxic", "Kills semi-dormant organisms\nin macrophages"],
["Ethambutol", "E", "Inhibits arabinosyl transferase\n→ blocks arabinogalactan synthesis", "Optic neuritis\n(↓red-green color vision)", "Monitor vision; dose-dependent"],
["Streptomycin", "S", "Binds 30S → inhibits protein\nsynthesis (aminoglycoside)", "Ototoxicity, nephrotoxicity", "Replaced by ethambutol in HRZE;\nIM only"],
]
tb_t = Table(tb_data, colWidths=[65, 45, 145, 110, 95])
tb_t.setStyle(TableStyle([
('BACKGROUND', (0, 0), (-1, 0), C_SUBHEAD),
('TEXTCOLOR', (0, 0), (-1, 0), white),
('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'),
('FONTSIZE', (0, 0), (-1, 0), 7.5),
('ROWBACKGROUNDS', (0, 1), (-1, -1), [C_LIGHT, white]),
('FONTNAME', (0, 1), (-1, -1), 'Helvetica'),
('FONTSIZE', (0, 1), (-1, -1), 7),
('GRID', (0, 0), (-1, -1), 0.4, C_BORDER),
('ALIGN', (0, 0), (-1, -1), 'LEFT'),
('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
('LEFTPADDING', (0, 0), (-1, -1), 4),
('TOPPADDING', (0, 0), (-1, -1), 3),
('BOTTOMPADDING', (0, 0), (-1, -1), 3),
('WORDWRAP', (0, 0), (-1, -1), True),
]))
story.append(tb_t)
story.append(sp(8))
# ═══════════════════════════════════════════════════════════════
# SECTION 7 - ENDOCRINE PHARMACOLOGY
# ═══════════════════════════════════════════════════════════════
story.append(h1("SECTION 7 — ENDOCRINE PHARMACOLOGY"))
story.append(sp(4))
story.append(h2("7.1 Insulin Action Pathway"))
story.append(PathwayDiagram(
steps=[
("Insulin binds\nInsulin Receptor", "Tyrosine kinase"),
("IRS-1 / PI3K\nactivation", "Signal cascade"),
("GLUT-4 vesicle\ntranslocation", "→ cell surface"),
("↑Glucose uptake\nmuscle/fat", "Glucose enters cell"),
("↓Blood glucose\nGlycogen synthesis", "Metabolic effects"),
],
width=USABLE_W, height=65, title="Insulin Mechanism of Action",
colors_list=[C_SUBHEAD, C_ACC4, C_ACC2, C_EFFECT, C_EFFECT]
))
story.append(sp(4))
ins_data = [
["Insulin Type", "Onset", "Peak", "Duration", "Use"],
["Rapid-acting (Lispro, Aspart)", "10-15 min", "1-2 h", "3-5 h", "Meal-time bolus"],
["Short-acting (Regular/Soluble)", "30-60 min", "2-4 h", "6-8 h", "Meal-time, DKA IV"],
["Intermediate (NPH/Isophane)", "1-2 h", "4-8 h", "12-18 h", "Twice daily basal"],
["Long-acting (Glargine, Detemir)", "1-2 h", "No peak", "20-24 h", "Once daily basal"],
["Biphasic (Mixtard 30/70)", "30-60 min", "Dual peak", "12-18 h", "Twice daily combo"],
]
ins_t = Table(ins_data, colWidths=[140, 60, 60, 60, 140])
ins_t.setStyle(TableStyle([
('BACKGROUND', (0, 0), (-1, 0), C_SUBHEAD),
('TEXTCOLOR', (0, 0), (-1, 0), white),
('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'),
('FONTSIZE', (0, 0), (-1, 0), 7.5),
('ROWBACKGROUNDS', (0, 1), (-1, -1), [C_LIGHT, white]),
('FONTNAME', (0, 1), (-1, -1), 'Helvetica'),
('FONTSIZE', (0, 1), (-1, -1), 7),
('GRID', (0, 0), (-1, -1), 0.4, C_BORDER),
('ALIGN', (0, 0), (-1, -1), 'LEFT'),
('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
('LEFTPADDING', (0, 0), (-1, -1), 4),
('TOPPADDING', (0, 0), (-1, -1), 3),
('BOTTOMPADDING', (0, 0), (-1, -1), 3),
]))
story.append(ins_t)
story.append(sp(5))
story.append(h2("7.2 Oral Antidiabetic Drugs — Mechanisms"))
oad_data = [
["Drug Class", "Mechanism", "Key Feature", "Examples", "SE"],
["Biguanides", "↓Hepatic glucose output\n(AMPK activation)", "DOC for type 2 DM;\nno hypoglycemia", "Metformin", "Lactic acidosis;\nGI upset; stop in RF"],
["Sulfonylureas", "Close K-ATP channel in β-cell\n→ ↑insulin secretion", "Cause hypoglycemia;\nrequire functioning β-cells", "Glibenclamide,\nGlipizide, Glimepiride", "Hypoglycemia,\nweight gain"],
["Meglitinides", "Close K-ATP channel (rapid)\n→ short-acting insulin", "Post-prandial control;\nshort acting", "Repaglinide,\nNateglinide", "Hypoglycemia\n(less than SU)"],
["Thiazolidinediones\n(TZDs)", "PPARγ agonist → ↑insulin\nsensitivity in fat/muscle", "Insulin sensitizer;\nno hypoglycemia", "Pioglitazone,\nRosiglitazone", "Weight gain, fluid\nretention, fractures"],
["DPP-4 inhibitors", "Inhibit DPP-4 → ↑GLP-1 & GIP\n→ ↑insulin, ↓glucagon", "Glucose-dependent;\nnot weight-neutral", "Sitagliptin,\nVildagliptin", "Nasopharyngitis,\npancreatitis risk"],
["GLP-1 agonists", "GLP-1 receptor agonist →\n↑insulin, ↓glucagon, ↓appetite", "↓Weight; CV benefit", "Exenatide, Liraglutide,\nSemaglutide", "Nausea, vomiting;\ninjectable"],
["SGLT-2 inhibitors", "Inhibit renal SGLT-2 →\nglucosuria", "↓BP, ↓weight,\ncardio+renal protection", "Empagliflozin,\nDapagliflozin", "UTI, genital mycosis,\nDKA (rare)"],
["Alpha-glucosidase\ninhibitors", "Inhibit intestinal α-glucosidase\n→ ↓postprandial glucose", "Post-prandial only;\nno systemic absorption", "Acarbose,\nMiglitol", "Flatulence, GI"],
]
oad_t = Table(oad_data, colWidths=[85, 130, 90, 90, 65])
oad_t.setStyle(TableStyle([
('BACKGROUND', (0, 0), (-1, 0), C_SUBHEAD),
('TEXTCOLOR', (0, 0), (-1, 0), white),
('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'),
('FONTSIZE', (0, 0), (-1, 0), 7.5),
('ROWBACKGROUNDS', (0, 1), (-1, -1), [C_LIGHT, white]),
('FONTNAME', (0, 1), (-1, -1), 'Helvetica'),
('FONTSIZE', (0, 1), (-1, -1), 7),
('GRID', (0, 0), (-1, -1), 0.4, C_BORDER),
('ALIGN', (0, 0), (-1, -1), 'LEFT'),
('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
('LEFTPADDING', (0, 0), (-1, -1), 4),
('TOPPADDING', (0, 0), (-1, -1), 3),
('BOTTOMPADDING', (0, 0), (-1, -1), 3),
('WORDWRAP', (0, 0), (-1, -1), True),
]))
story.append(oad_t)
story.append(sp(8))
# ═══════════════════════════════════════════════════════════════
# SECTION 8 - ANTICOAGULANTS / HAEMATOLOGY
# ═══════════════════════════════════════════════════════════════
story.append(h1("SECTION 8 — ANTICOAGULANTS & HAEMATOLOGY"))
story.append(sp(4))
story.append(h2("8.1 Coagulation Cascade and Drug Targets"))
story.append(PathwayDiagram(
steps=[
("Extrinsic\nPathway\nFactor VII", "Tissue factor\ntrigger"),
("Common\nPathway\nFactor X → Xa", "Prothrombin →\nThrombin"),
("Fibrinogen →\nFibrin\n(clot formed)", "Thrombin action"),
("Platelet\nActivation\n& aggregation", "TXA2, ADP, PAF"),
],
width=USABLE_W, height=65,
title="Coagulation Cascade — Drug Intervention Points",
colors_list=[C_ACC1, C_ACC3, C_SUBHEAD, C_ACC4]
))
story.append(sp(3))
ac_data = [
["Drug", "Mechanism", "Route", "Monitoring", "Reversal", "Key Notes"],
["Heparin (UFH)", "Binds antithrombin III →\n↑inhibition of Xa + IIa", "IV/SC", "aPTT (1.5-2.5x)", "Protamine sulfate", "HIT (thrombocytopenia);\ncheck platelets"],
["LMWH\n(Enoxaparin)", "AT-III → mainly anti-Xa\n(some anti-IIa)", "SC", "Anti-Xa levels\n(if needed)", "Protamine (partial)", "More predictable;\nused in pregnancy"],
["Warfarin", "Inhibits Vit K reductase\n→ ↓Factors II,VII,IX,X", "Oral", "PT / INR\n(target 2-3)", "Vitamin K,\nFFP, PCC", "Slow onset (3-5d);\nmany drug interactions"],
["Dabigatran", "Direct thrombin (IIa)\ninhibitor", "Oral", "Not routinely", "Idarucizumab\n(specific antidote)", "DOAC; less monitoring;\nrenal excretion"],
["Rivaroxaban\nApixaban", "Direct Factor Xa\ninhibitor", "Oral", "Not routinely", "Andexanet alfa", "DOAC; avoid in\nsevere renal failure"],
["Aspirin", "Irreversible COX-1 inhibition\n→ ↓TXA2 (antiplatelet)", "Oral", "None", "Transfuse platelets", "Used 75-150mg for\ncardiovascular prophylaxis"],
["Clopidogrel", "P2Y12 ADP receptor\nantagonist (irreversible)", "Oral", "None", "Transfuse platelets", "Prodrug → CYP2C19\nactivation; dual therapy"],
["Streptokinase", "Combines with plasminogen\n→ plasmin → fibrinolysis", "IV", "Fibrinogen level", "Tranexamic acid\naprotinin", "Antigenic; cannot\nrepeat within 6-12 mo"],
]
ac_t = Table(ac_data, colWidths=[65, 120, 35, 65, 80, 95])
ac_t.setStyle(TableStyle([
('BACKGROUND', (0, 0), (-1, 0), C_SUBHEAD),
('TEXTCOLOR', (0, 0), (-1, 0), white),
('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'),
('FONTSIZE', (0, 0), (-1, 0), 7.5),
('ROWBACKGROUNDS', (0, 1), (-1, -1), [C_LIGHT, white]),
('FONTNAME', (0, 1), (-1, -1), 'Helvetica'),
('FONTSIZE', (0, 1), (-1, -1), 7),
('GRID', (0, 0), (-1, -1), 0.4, C_BORDER),
('ALIGN', (0, 0), (-1, -1), 'LEFT'),
('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
('LEFTPADDING', (0, 0), (-1, -1), 4),
('TOPPADDING', (0, 0), (-1, -1), 3),
('BOTTOMPADDING', (0, 0), (-1, -1), 3),
('WORDWRAP', (0, 0), (-1, -1), True),
]))
story.append(ac_t)
story.append(sp(8))
# ═══════════════════════════════════════════════════════════════
# SECTION 9 - HIGH-YIELD QUICK REFERENCE BOX
# ═══════════════════════════════════════════════════════════════
story.append(h1("SECTION 9 — HIGH-YIELD CONTRAINDICATIONS & EXAM TIPS"))
story.append(sp(4))
story.append(h2("9.1 Drugs Contraindicated in Specific Conditions"))
ci_data = [
["Condition", "Contraindicated Drug", "Reason"],
["Bronchial Asthma", "Non-selective beta blockers\n(propranolol)", "Beta-2 blockade → bronchoconstriction"],
["Angle-closure Glaucoma", "Atropine, antimuscarinics", "Mydriasis → blocks aqueous drainage → ↑IOP"],
["Head Injury", "Morphine", "CO2 retention → cerebral vasodilation → ↑ICP"],
["Pregnancy (1st trim.)", "Carbamazepine, Valproate,\nMethotrexate, Thalidomide", "Teratogenicity (neural tube defects, limb defects)"],
["Children with viral fever", "Aspirin", "Reye's syndrome (hepatic failure + encephalopathy)"],
["Neonates", "Chloramphenicol", "Grey Baby Syndrome (immature glucuronyl transferase)"],
["Pheochromocytoma", "Beta blockers alone", "Unopposed alpha → hypertensive crisis"],
["MAOI use", "SSRIs, Pethidine, TCAs", "Serotonin syndrome (potentially fatal)"],
["Hepatic failure", "Paracetamol (high dose),\nMethotrexate", "Further hepatotoxicity"],
["Renal failure", "NSAIDs, Aminoglycosides,\nMetformin (lactic acidosis)", "Drug accumulation / worsening renal function"],
["Myasthenia Gravis", "Aminoglycosides, Magnesium,\nChloroquine", "Worsen NMJ blockade"],
["Porphyria", "Barbiturates, Griseofulvin", "Induce ALA synthase → precipitate attack"],
]
ci_t = Table(ci_data, colWidths=[110, 130, 220])
ci_t.setStyle(TableStyle([
('BACKGROUND', (0, 0), (-1, 0), C_SUBHEAD),
('TEXTCOLOR', (0, 0), (-1, 0), white),
('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'),
('FONTSIZE', (0, 0), (-1, 0), 7.5),
('ROWBACKGROUNDS', (0, 1), (-1, -1), [C_LIGHT4, white]),
('FONTNAME', (0, 1), (-1, -1), 'Helvetica'),
('FONTSIZE', (0, 1), (-1, -1), 7),
('GRID', (0, 0), (-1, -1), 0.4, C_BORDER),
('ALIGN', (0, 0), (-1, -1), 'LEFT'),
('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
('LEFTPADDING', (0, 0), (-1, -1), 4),
('TOPPADDING', (0, 0), (-1, -1), 3),
('BOTTOMPADDING', (0, 0), (-1, -1), 3),
('WORDWRAP', (0, 0), (-1, -1), True),
]))
story.append(ci_t)
story.append(sp(6))
story.append(h2("9.2 Drug of Choice (DOC) — Key Exam List"))
doc_data = [
["Condition", "Drug of Choice", "Backup / Notes"],
["Type 2 Diabetes", "Metformin", "Add SGLT-2i or GLP-1 if CV risk"],
["Hypertension in pregnancy", "Methyldopa (1st line), Labetalol", "ACEi/ARB contraindicated"],
["Status epilepticus", "IV Diazepam (Lorazepam)", "Then IV phenytoin or phenobarbital"],
["Absence seizures", "Ethosuximide (if pure absence)\nValproate (if mixed seizures)", "Phenytoin worsens absence"],
["Anaphylaxis", "IM Adrenaline (Epinephrine)", "1:1000, 0.5 mg IM anterolateral thigh"],
["Malaria - P. falciparum", "Artemisinin combination therapy (ACT)", "Artesunate IV for severe malaria"],
["Malaria - P. vivax", "Chloroquine + Primaquine", "Primaquine eradicates hypnozoites"],
["H. pylori eradication", "PPI + Clarithromycin + Amoxicillin\n(Triple therapy)", "Quadruple if resistance"],
["MRSA", "Vancomycin (IV), Linezolid", "Teicoplanin alternative"],
["Opioid overdose", "Naloxone IV", "Repeat PRN; short half-life"],
["Warfarin over-anticoagulation", "Vitamin K (oral/IV)\n+ PCC if major bleed", "Stop warfarin, monitor INR"],
["Digoxin toxicity arrhythmia", "Digoxin-specific antibody\nfragments (Digibind/DigiFab)", "Correct hypokalemia; monitor ECG"],
["Pulmonary edema (acute LVF)", "IV Furosemide + IV Morphine\n+ O2 + GTN", "PEEP/NIV if severe"],
["Acute gout attack", "Colchicine / NSAIDs\n(Indomethacin)", "Allopurinol: prophylaxis only, not acute"],
["Trigeminal neuralgia", "Carbamazepine", "Phenytoin 2nd line"],
]
doc_t = Table(doc_data, colWidths=[135, 155, 170])
doc_t.setStyle(TableStyle([
('BACKGROUND', (0, 0), (-1, 0), C_SUBHEAD),
('TEXTCOLOR', (0, 0), (-1, 0), white),
('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'),
('FONTSIZE', (0, 0), (-1, 0), 7.5),
('ROWBACKGROUNDS', (0, 1), (-1, -1), [C_LIGHT2, white]),
('FONTNAME', (0, 1), (-1, -1), 'Helvetica'),
('FONTSIZE', (0, 1), (-1, -1), 7),
('GRID', (0, 0), (-1, -1), 0.4, C_BORDER),
('ALIGN', (0, 0), (-1, -1), 'LEFT'),
('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
('LEFTPADDING', (0, 0), (-1, -1), 4),
('TOPPADDING', (0, 0), (-1, -1), 3),
('BOTTOMPADDING', (0, 0), (-1, -1), 3),
('WORDWRAP', (0, 0), (-1, -1), True),
]))
story.append(doc_t)
story.append(sp(8))
# Footer note
footer_data = [[Paragraph(
"<b>Reference:</b> KD Tripathi — Essentials of Medical Pharmacology (7th/8th Ed.) | "
"Compiled for 2nd MBBS Prof Examination preparation | All India University Pattern | "
"<i>For educational use only. Verify dosages with current clinical guidelines before clinical application.</i>",
ParagraphStyle("foot", fontSize=6.5, fontName="Helvetica-Oblique",
textColor=C_GRAY, alignment=TA_CENTER, leading=9))]]
footer = Table(footer_data, colWidths=[USABLE_W])
footer.setStyle(TableStyle([
('BACKGROUND', (0, 0), (-1, -1), HexColor("#f0f4f8")),
('TOPPADDING', (0, 0), (-1, -1), 6),
('BOTTOMPADDING', (0, 0), (-1, -1), 6),
('LEFTPADDING', (0, 0), (-1, -1), 8),
('BOX', (0, 0), (-1, -1), 0.5, C_BORDER),
]))
story.append(footer)
doc.build(story)
print(f"PDF created: {out_path}")
if __name__ == "__main__":
out = "/tmp/workspace/pharma-quickref/MBBS_Pharmacology_Quick_Reference.pdf"
build_pdf(out)
cd /tmp/workspace/pharma-quickref && python generate_pdf.py 2>&1
~/pharma-quickref/generate_pdf.py
Successfully replaced 1 instance(s) of the string in '/tmp/workspace/pharma-quickref/generate_pdf.py'
cd /tmp/workspace/pharma-quickref && python generate_pdf.py 2>&1
ls -lh /tmp/workspace/pharma-quickref/MBBS_Pharmacology_Quick_Reference.pdf
MBBS Pharmacology Quick Reference
PDF Document · PDF
| Section | Content |
|---|---|
| 1 - General Pharmacology | Routes table, PK pathway diagram (Absorption → Distribution → Metabolism → Excretion), Receptor types & signal transduction table |
| 2 - Autonomic Pharmacology | Full receptor map (α1, α2, β1, β2, M1-M3, Nm, Nn), Cholinergic synapse pathway diagram, Adrenergic synapse pathway diagram |
| 3 - Cardiovascular | Antihypertensive drug class table, RAAS pathway diagram, Anti-anginal comparison table, Digoxin mechanism pathway |
| 4 - CNS | Opioid receptor diagram, BZD vs Barbiturate GABA-A table, Antiepileptic mechanisms table, Dopamine pathway diagram + Antipsychotic comparison |
| 5 - Analgesics/NSAIDs | COX pathway diagram, Full NSAID classification table with SE |
| 6 - Antimicrobials | Antibiotic target diagram, Beta-lactam receptor diagram, Bactericidal vs Bacteriostatic classification, Anti-TB (HRZE) mechanism table |
| 7 - Endocrine | Insulin action pathway, Insulin types onset/duration table, Oral antidiabetics (8 classes) mechanism table |
| 8 - Anticoagulants | Coagulation cascade diagram, Full anticoagulant/antiplatelet comparison table with reversal agents |
| 9 - High-Yield Exam Tips | Contraindications table (12 conditions), Drug of Choice (DOC) list (15 conditions) |