~/cns-pharmacology/generate_pdf.py
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import cm, mm
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus import (
SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
PageBreak, HRFlowable, KeepTogether
)
from reportlab.platypus.flowables import HRFlowable
from reportlab.lib.colors import HexColor
# ── Colour palette ──────────────────────────────────────────────────
C_NAVY = HexColor("#1a237e")
C_BLUE = HexColor("#1565c0")
C_LBLUE = HexColor("#bbdefb")
C_TEAL = HexColor("#00695c")
C_LTEAL = HexColor("#b2dfdb")
C_RED = HexColor("#b71c1c")
C_LRED = HexColor("#ffcdd2")
C_AMBER = HexColor("#e65100")
C_LAMBER = HexColor("#ffe0b2")
C_PURPLE = HexColor("#4a148c")
C_LPURP = HexColor("#e1bee7")
C_GREY = HexColor("#37474f")
C_LGREY = HexColor("#eceff1")
C_YELLOW = HexColor("#fff9c4")
C_WHITE = colors.white
C_BLACK = colors.black
PAGE_W, PAGE_H = A4
MARGIN = 1.5 * cm
# ── Document ────────────────────────────────────────────────────────
OUTPUT = "/home/daytona/workspace/cns-pharmacology/CNS_Pharmacology_Study_Guide.pdf"
doc = SimpleDocTemplate(
OUTPUT, pagesize=A4,
leftMargin=MARGIN, rightMargin=MARGIN,
topMargin=MARGIN, bottomMargin=MARGIN,
title="CNS Pharmacology - MBBS 2nd Year Quick Reference",
author="Orris Medical"
)
# ── Styles ───────────────────────────────────────────────────────────
base = getSampleStyleSheet()
def style(name, parent="Normal", **kw):
s = ParagraphStyle(name, parent=base[parent], **kw)
return s
S_COVER_TITLE = style("CoverTitle", fontSize=26, textColor=C_WHITE,
alignment=TA_CENTER, spaceAfter=8, leading=32,
fontName="Helvetica-Bold")
S_COVER_SUB = style("CoverSub", fontSize=13, textColor=HexColor("#e3f2fd"),
alignment=TA_CENTER, spaceAfter=4, leading=16)
S_COVER_NOTE = style("CoverNote", fontSize=10, textColor=HexColor("#bbdefb"),
alignment=TA_CENTER, spaceAfter=4)
S_SECTION = style("Section", fontSize=13, textColor=C_WHITE,
fontName="Helvetica-Bold", leading=18,
leftIndent=0, spaceAfter=2)
S_TOPIC = style("Topic", fontSize=11, textColor=C_NAVY,
fontName="Helvetica-Bold", leading=15,
spaceBefore=8, spaceAfter=3)
S_BODY = style("Body", fontSize=8.5, textColor=C_GREY,
leading=12, spaceAfter=2)
S_NOTE = style("Note", fontSize=8, textColor=C_AMBER,
fontName="Helvetica-Bold", leading=11)
S_MNEMONIC = style("Mnemonic", fontSize=8.5, textColor=C_TEAL,
fontName="Helvetica-Bold", leading=11,
backColor=C_LTEAL, leftIndent=4, rightIndent=4,
borderPad=4)
S_EXAM = style("Exam", fontSize=8, textColor=C_RED,
fontName="Helvetica-Bold")
S_TH = style("TH", fontSize=8, textColor=C_WHITE,
fontName="Helvetica-Bold", alignment=TA_CENTER, leading=10)
S_TD = style("TD", fontSize=7.8, textColor=C_GREY,
leading=10, alignment=TA_LEFT)
S_TD_C = style("TDC", fontSize=7.8, textColor=C_GREY,
leading=10, alignment=TA_CENTER)
S_ONELINER = style("Oneliner", fontSize=8, textColor=C_GREY,
leading=11, leftIndent=6)
S_FOOTER = style("Footer", fontSize=7, textColor=HexColor("#90a4ae"),
alignment=TA_CENTER)
# ── Helper builders ──────────────────────────────────────────────────
def section_banner(text, bg=C_NAVY):
tbl = Table([[Paragraph(text, S_SECTION)]], colWidths=[PAGE_W - 2*MARGIN])
tbl.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), bg),
("TOPPADDING", (0,0), (-1,-1), 5),
("BOTTOMPADDING", (0,0), (-1,-1), 5),
("LEFTPADDING", (0,0), (-1,-1), 8),
("ROUNDEDCORNERS", [4]),
]))
return tbl
def make_table(headers, rows, col_widths, header_bg=C_BLUE,
alt_bg=C_LGREY, note_rows=None):
"""note_rows: set of row indices (0-indexed data rows) to highlight."""
note_rows = note_rows or set()
header_cells = [Paragraph(h, S_TH) for h in headers]
data = [header_cells]
for r in rows:
data.append([Paragraph(str(c), S_TD) for c in r])
tbl = Table(data, colWidths=col_widths, repeatRows=1)
style_cmds = [
("BACKGROUND", (0, 0), (-1, 0), header_bg),
("ROWBACKGROUNDS",(0, 1), (-1, -1), [C_WHITE, alt_bg]),
("GRID", (0, 0), (-1, -1), 0.4, HexColor("#cfd8dc")),
("TOPPADDING", (0, 0), (-1, -1), 3),
("BOTTOMPADDING", (0, 0), (-1, -1), 3),
("LEFTPADDING", (0, 0), (-1, -1), 4),
("RIGHTPADDING", (0, 0), (-1, -1), 4),
("VALIGN", (0, 0), (-1, -1), "TOP"),
]
for ri in note_rows:
style_cmds.append(("BACKGROUND", (0, ri+1), (-1, ri+1), C_YELLOW))
tbl.setStyle(TableStyle(style_cmds))
return tbl
def spacer(h=0.25): return Spacer(1, h*cm)
def hr(): return HRFlowable(width="100%", thickness=0.5,
color=HexColor("#cfd8dc"), spaceAfter=4)
def exam_box(text):
tbl = Table([[Paragraph("★ EXAM FAVOURITE: " + text, S_EXAM)]],
colWidths=[PAGE_W - 2*MARGIN])
tbl.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), C_LRED),
("LEFTPADDING", (0,0), (-1,-1), 6),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("BOX", (0,0), (-1,-1), 0.8, C_RED),
]))
return tbl
def mnemonic_box(text):
tbl = Table([[Paragraph("💡 " + text, S_MNEMONIC)]],
colWidths=[PAGE_W - 2*MARGIN])
tbl.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), C_LTEAL),
("LEFTPADDING", (0,0), (-1,-1), 6),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("BOX", (0,0), (-1,-1), 0.8, C_TEAL),
]))
return tbl
# ════════════════════════════════════════════════════════════════════
# CONTENT
# ════════════════════════════════════════════════════════════════════
story = []
# ── COVER PAGE ───────────────────────────────────────────────────────
cover_bg = Table(
[[Paragraph("CNS PHARMACOLOGY", S_COVER_TITLE)],
[Paragraph("MBBS 2nd Year — Quick Reference Study Guide", S_COVER_SUB)],
[Paragraph("All KDT-aligned topics • Prof Exam Ready • Print-Friendly", S_COVER_NOTE)],
[Spacer(1, 0.6*cm)],
[Paragraph("Sedatives • Antiepileptics • Antipsychotics • Antidepressants", S_COVER_NOTE)],
[Paragraph("Parkinson's Drugs • Opioids • General Anaesthesia", S_COVER_NOTE)],
[Spacer(1, 1*cm)],
[Paragraph("Orris Medical Education", S_COVER_NOTE)],
],
colWidths=[PAGE_W - 2*MARGIN]
)
cover_bg.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), C_NAVY),
("TOPPADDING", (0,0), (-1,-1), 12),
("BOTTOMPADDING", (0,0), (-1,-1), 6),
("LEFTPADDING", (0,0), (-1,-1), 20),
("RIGHTPADDING", (0,0), (-1,-1), 20),
("ROUNDEDCORNERS", [8]),
]))
story.append(spacer(1))
story.append(cover_bg)
story.append(PageBreak())
# ════════════════════════════════════════════════════════════════════
# SECTION 1: SEDATIVES & HYPNOTICS
# ════════════════════════════════════════════════════════════════════
story.append(section_banner("1. SEDATIVES & HYPNOTICS", C_NAVY))
story.append(spacer(0.2))
story.append(Paragraph("BZD vs BARBITURATE — Core Mechanism Comparison", S_TOPIC))
story.append(make_table(
["Feature", "Benzodiazepines", "Barbiturates"],
[
["Cl⁻ channel effect", "↑ FREQUENCY of opening", "↑ DURATION of opening"],
["Needs GABA?", "Yes (modulators only)", "No at high dose (direct)"],
["Safety margin", "Wide — safer", "Narrow — dangerous"],
["Respiratory depression", "Less", "More (dose-dependent)"],
["Enzyme induction", "No", "Yes — induces CYP450"],
["Dependence liability", "Yes (moderate)", "Yes (severe)"],
["Antidote", "Flumazenil (IV)", "None"],
["Overdose urine trick", "—", "Alkalinize urine (phenobarb)"],
],
[5.5*cm, 6.5*cm, 6.5*cm], header_bg=C_BLUE, note_rows={0}
))
story.append(mnemonic_box("BZDs = Frequency | Barbiturates = Duration (B before D alphabetically)"))
story.append(spacer(0.3))
story.append(Paragraph("Benzodiazepine Drug Reference", S_TOPIC))
story.append(make_table(
["Drug", "Half-life", "Key Use / Note"],
[
["Diazepam", "20–100 h (very long)", "Anxiety, status epilepticus, muscle spasm, alcohol withdrawal"],
["Lorazepam", "10–20 h", "Status epilepticus IV (FIRST CHOICE), premedication"],
["Midazolam", "1–4 h (very short)", "Anaesthesia premedication, endoscopy, anterograde amnesia"],
["Clonazepam", "20–50 h", "Absence & myoclonic epilepsy"],
["Alprazolam", "12–15 h", "Panic disorder"],
["Nitrazepam", "24–36 h", "Insomnia"],
["Triazolam", "2–4 h", "Insomnia — causes rebound anxiety; very short"],
["Chlordiazepoxide","5–30 h", "Alcohol withdrawal (longest acting → smooth detox)"],
["Oxazepam / Lorazepam / Temazepam", "Short-intermediate", "SAFE in liver disease — direct glucuronidation (no phase-I)"],
],
[3.8*cm, 3.8*cm, 11*cm], header_bg=C_BLUE, note_rows={8}
))
story.append(mnemonic_box("'LOT' safe in liver disease: Lorazepam, Oxazepam, Temazepam"))
story.append(spacer(0.2))
story.append(exam_box("Flumazenil = BZD antidote. Competitive antagonist. IV. Short t½ ~1h. Repeat doses may be needed. Precipitates withdrawal seizures in BZD-dependent patients."))
story.append(spacer(0.3))
story.append(Paragraph("Barbiturates Quick Reference", S_TOPIC))
story.append(make_table(
["Drug", "Duration", "Key Use"],
[
["Phenobarbital", "Long (t½ 80–120 h)", "Epilepsy, febrile seizure prophylaxis, neonatal seizures"],
["Thiopentone (Thiopental)", "Ultra-short (redistribution)", "IV anaesthesia induction — NO analgesia — contraindicated in porphyria"],
["Secobarbital", "Short", "Insomnia (rarely used now)"],
["Amobarbital", "Intermediate", "Rarely used clinically"],
],
[4.5*cm, 4.5*cm, 9.5*cm], header_bg=C_GREY
))
story.append(spacer(0.2))
story.append(Paragraph("Z-Drugs (Newer Hypnotics)", S_TOPIC))
story.append(make_table(
["Drug", "Feature"],
[
["Zolpidem, Zaleplon, Eszopiclone", "Selective BZD-1 (omega-1) receptor agonists — primarily hypnotic, less anxiolytic/anticonvulsant"],
["Action", "Shorter t½, less hangover — BUT still cause dependence"],
["Antidote", "Flumazenil works for Z-drugs too!"],
["Use", "Sleep-onset insomnia"],
],
[4.5*cm, 14*cm], header_bg=C_TEAL
))
story.append(PageBreak())
# ════════════════════════════════════════════════════════════════════
# SECTION 2: ANTIEPILEPTICS
# ════════════════════════════════════════════════════════════════════
story.append(section_banner("2. ANTIEPILEPTIC DRUGS (AEDs)", C_TEAL))
story.append(spacer(0.2))
story.append(Paragraph("Drug of Choice by Seizure Type", S_TOPIC))
story.append(exam_box("Most-asked table in pharmacology Prof exams — memorize every row!"))
story.append(spacer(0.15))
story.append(make_table(
["Seizure Type", "Drug of Choice", "Alternatives"],
[
["Tonic-clonic (Grand mal)", "Valproate / Phenytoin / Carbamazepine", "Phenobarbital, Lamotrigine"],
["Absence (Petit mal) — ONLY absence", "Ethosuximide", "Clonazepam"],
["Absence + Tonic-clonic (mixed)", "Valproate", "Clonazepam + Ethosuximide"],
["Focal / Partial seizures", "Carbamazepine", "Phenytoin, Valproate, Lamotrigine"],
["Myoclonic", "Valproate", "Clonazepam, Levetiracetam"],
["Status Epilepticus (acute)", "IV Lorazepam (1st) → IV Phenytoin → IV Phenobarbital", "Midazolam"],
["Febrile seizures (acute)", "Rectal / IV Diazepam", "Phenobarbital (prophylaxis)"],
["Infantile spasms (West syndrome)", "ACTH, Vigabatrin", "—"],
["Trigeminal Neuralgia", "Carbamazepine (DRUG OF CHOICE!)", "Phenytoin"],
["Bipolar disorder (mood stabilizer)", "Valproate, Carbamazepine, Lamotrigine", "—"],
],
[5*cm, 7*cm, 6.5*cm], header_bg=C_TEAL, note_rows={5}
))
story.append(spacer(0.3))
story.append(Paragraph("Individual AED Profiles — Adverse Effects & Key Points", S_TOPIC))
story.append(make_table(
["Drug", "Mechanism", "Distinctive Adverse Effects", "Important Facts"],
[
["Phenytoin",
"Blocks Na⁺ channels\n(inactivated state)",
"Nystagmus (1st toxicity sign)\nAtaxia, diplopia\nGingival hyperplasia ★\nHirsutism\nFolate deficiency → megaloblastic anaemia\nVit D def → osteomalacia\nFetal hydantoin syndrome (teratogenic)",
"Zero-order kinetics!\nCYP450 inducer\nGive IV only (not IM)\nContraindicated: Absence, pregnancy, porphyria"],
["Carbamazepine",
"Blocks Na⁺ channels\nAuto-induction",
"Diplopia, ataxia, drowsiness\nSIADH (hyponatremia) ★\nAplastic anaemia (rare — check CBC)\nStevens-Johnson (HLA-B*1502)\nNeural tube defects (teratogenic)",
"DOC: Focal seizures & Trigeminal neuralgia\nMood stabilizer in bipolar\nReduces OCP/warfarin efficacy"],
["Valproate",
"Na⁺ block + GABA ↑\n+ T-type Ca²⁺ block\n(broad spectrum)",
"GI upset\nWeight gain, alopecia (reversible)\nTremor\nHepatotoxicity (fatal <2 yrs) ★\nPancreatitis\nNeural tube defects (MOST teratogenic AED)\nHyperammonaemia",
"Works for ALL seizure types\nContraindicated: Pregnancy, liver disease, children <2 yrs\nInhibits lamotrigine metabolism"],
["Ethosuximide",
"Blocks T-type\n(thalamic) Ca²⁺ channels",
"GI: Nausea, anorexia (most common)\nDrowsiness, headache\nRare: SJS, agranulocytosis, SLE-like",
"ONLY for Absence seizures\nNO effect on tonic-clonic\nNo enzyme induction"],
["Phenobarbital",
"Enhances GABA-A\n(↑ Cl⁻ duration)",
"Sedation (major issue)\nCognitive impairment (avoid in children)\nDependence",
"Oldest AED\nStrong CYP450 inducer\nFebrile seizure prophylaxis\nNeonatal seizures"],
],
[2.8*cm, 3.2*cm, 5.5*cm, 7*cm], header_bg=C_TEAL
))
story.append(spacer(0.2))
story.append(Paragraph("Newer AEDs — Quick Summary", S_TOPIC))
story.append(make_table(
["Drug", "Mechanism", "Key Point / Use"],
[
["Lamotrigine", "Na⁺ block + ↓ glutamate", "Rash (go slow titration); broad spectrum; relatively safe in pregnancy"],
["Levetiracetam", "Binds SV2A (synaptic vesicle protein)", "Fewest drug interactions; IV available; broad spectrum"],
["Gabapentin", "Blocks Ca²⁺ (α2δ subunit)", "Neuropathic pain, focal seizures; no drug interactions"],
["Topiramate", "Na⁺ block + GABA ↑ + AMPA block", "Weight LOSS (unique!); cognitive slowing; kidney stones; migraine prophylaxis"],
["Vigabatrin", "Irreversible GABA transaminase inhibitor", "PERMANENT visual field defects; infantile spasms"],
["Pregabalin", "Blocks Ca²⁺ (α2δ subunit)", "Neuropathic pain, fibromyalgia, GAD"],
["Clonazepam", "BZD (GABA-A modulator)", "Absence, myoclonic seizures; long-acting"],
],
[3*cm, 5*cm, 10.5*cm], header_bg=C_GREY
))
story.append(PageBreak())
# ════════════════════════════════════════════════════════════════════
# SECTION 3: ANTIPSYCHOTICS
# ════════════════════════════════════════════════════════════════════
story.append(section_banner("3. ANTIPSYCHOTICS (Neuroleptics)", C_PURPLE))
story.append(spacer(0.2))
story.append(Paragraph("Dopamine Pathways — Must Know!", S_TOPIC))
story.append(make_table(
["Pathway", "Function", "Effect of D2 Blockade"],
[
["Mesolimbic", "Reward, emotion, motivation", "✔ ANTIPSYCHOTIC effect — reduces positive symptoms"],
["Mesocortical", "Cognition, planning", "✘ Worsens negative symptoms; cognitive blunting"],
["Nigrostriatal", "Movement coordination", "✘ Extrapyramidal Side Effects (EPS)"],
["Tuberoinfundibular", "Inhibits prolactin secretion", "✘ Hyperprolactinaemia → galactorrhoea, amenorrhoea, gynaecomastia"],
],
[4*cm, 5*cm, 9.5*cm], header_bg=C_PURPLE, note_rows={0}
))
story.append(spacer(0.25))
story.append(Paragraph("Extrapyramidal Side Effects (EPS) — Onset & Treatment", S_TOPIC))
story.append(exam_box("EPS types, timing and treatment — classic exam question"))
story.append(spacer(0.15))
story.append(make_table(
["EPS Type", "Onset", "Features", "Treatment"],
[
["Acute Dystonia", "Hours to days", "Painful muscle spasms, torticollis, oculogyric crisis", "Benztropine / Diphenhydramine IM/IV"],
["Akathisia", "Days to weeks", "Inner restlessness, can't sit still", "Propranolol / BZDs"],
["Drug-induced Parkinsonism", "Weeks to months", "Tremor, rigidity, bradykinesia", "Anticholinergics (Trihexyphenidyl)"],
["Tardive Dyskinesia", "Months to years", "Repetitive orofacial movements (lip-smacking) — IRREVERSIBLE!", "Stop drug; Switch to Clozapine / Tetrabenazine"],
],
[3.5*cm, 3*cm, 5.5*cm, 6.5*cm], header_bg=C_PURPLE, note_rows={3}
))
story.append(spacer(0.2))
story.append(exam_box("NMS (Neuroleptic Malignant Syndrome): Fever + Rigidity + Autonomic instability + ↑CPK → STOP drug → Dantrolene + Bromocriptine"))
story.append(spacer(0.25))
story.append(Paragraph("Antipsychotic Drug Comparison", S_TOPIC))
story.append(make_table(
["Drug", "Class", "Key Features", "Important ADRs"],
[
["Chlorpromazine (CPZ)", "Typical (low potency)", "Prototype; blocks D2, H1, M1, α1; sedating; anti-emetic (CTZ)", "Sedation, postural hypotension, anticholinergic effects, photosensitivity, cholestatic jaundice, EPS"],
["Haloperidol", "Typical (high potency)", "Less sedation, less hypotension — BUT MORE EPS than CPZ; depot form available (monthly)", "High EPS risk; ↑ prolactin; QT prolongation"],
["Thioridazine", "Typical (low potency)", "Low EPS; unique ADR: pigmentary retinopathy", "Pigmentary retinopathy ★; QT prolongation — avoid cardiac patients"],
["Clozapine", "Atypical", "Treatment-RESISTANT schizophrenia; NO EPS; NO tardive dyskinesia; blocks D4/5-HT2/H1/M/α1", "AGRANULOCYTOSIS (1-2%) — WEEKLY WBC!\nSeizures (dose-related); weight gain; hypersalivation"],
["Olanzapine", "Atypical", "Similar to clozapine but NO agranulocytosis; good for bipolar mania", "METABOLIC SYNDROME — weight gain, hyperglycaemia, dyslipidaemia ★"],
["Risperidone", "Atypical", "D2 + 5-HT2A block; highest hyperprolactinaemia among atypicals; long-acting injectable", "Hyperprolactinaemia; EPS at high doses"],
["Aripiprazole", "Atypical (partial D2 agonist)", "Stabilizes DA system; least metabolic effects; no QT prolongation; weight neutral", "Insomnia, nausea, akathisia; generally well tolerated"],
["Quetiapine", "Atypical", "Very sedating; also used for bipolar depression", "Sedation, weight gain, hyperglycaemia"],
],
[3*cm, 3*cm, 5.5*cm, 7*cm], header_bg=C_PURPLE, note_rows={3}
))
story.append(PageBreak())
# ════════════════════════════════════════════════════════════════════
# SECTION 4: ANTIDEPRESSANTS
# ════════════════════════════════════════════════════════════════════
story.append(section_banner("4. ANTIDEPRESSANTS", HexColor("#004d40")))
story.append(spacer(0.2))
story.append(Paragraph("Core Concept: Monoamine Hypothesis — Depression = ↓ NA and/or ↓ 5-HT at CNS synapses. All antidepressants increase synaptic monoamines. Onset of action: 2–4 weeks (warn patients!)", S_BODY))
story.append(spacer(0.2))
story.append(Paragraph("Antidepressant Classification & Drug-Specific Uses", S_TOPIC))
story.append(make_table(
["Class / Drug", "Mechanism", "Special Uses", "Key ADRs"],
[
["TCAs\n(Imipramine, Amitriptyline, Clomipramine, Nortriptyline)", "Block 5-HT + NA reuptake\n+ H1/M1/α1 block", "Imipramine → Nocturnal enuresis (bedwetting) ★\nClomipramine → OCD (best TCA!) ★\nAmitriptyline → Neuropathic pain, Migraine prophylaxis, Fibromyalgia", "Anticholinergic: dry mouth, urinary retention, constipation\nCardiac arrhythmias (wide QRS in overdose — treat with NaHCO₃)\nSeizures in overdose\nContraindicated: glaucoma, BPH, recent MI, elderly"],
["SSRIs\n(Fluoxetine, Sertraline, Paroxetine, Citalopram, Escitalopram, Fluvoxamine)", "Selective 5-HT reuptake block (SERT)", "1st line for depression\nOCD: Fluvoxamine, Fluoxetine\nPanic/PTSD/Social anxiety: Sertraline\nBulimia nervosa: Fluoxetine (only FDA-approved) ★\nPremature ejaculation: Dapoxetine (short-acting SSRI)", "GI nausea/diarrhoea (early)\nSexual dysfunction (most common discontinuation reason)\nSIADH (hyponatraemia — elderly)\nSerotonin syndrome (with MAOIs/Tramadol)\nFluoxetine = longest t½ (2–6 days); least withdrawal"],
["SNRIs\n(Venlafaxine, Duloxetine)", "Block SERT + NET", "Depression, GAD\nDuloxetine: neuropathic pain, fibromyalgia, stress urinary incontinence", "Nausea, hypertension (Venlafaxine at high doses)\nSweating, insomnia"],
["MAOIs\n(Phenelzine, Tranylcypromine — irreversible;\nMoclobemide — reversible RIMA)", "Inhibit MAO → ↑ 5-HT/NA/DA", "Atypical depression (↑sleep, ↑appetite)\nSSRI-resistant cases\nPhenelzine: Social phobia", "TYRAMINE REACTION (Cheese reaction) ★: hypertensive crisis with aged cheese, wine, fermented foods\nSerotonin syndrome with SSRIs, TCAs, Pethidine\nWait 14 days when switching (5 weeks after Fluoxetine)"],
["Mirtazapine", "α2 block (↑ NA+5HT release)\n+ 5-HT2 + H1 block", "Depression + insomnia\nDepression + poor appetite", "Sedation, weight gain (H1 block) — useful features in some patients"],
["Bupropion", "DA + NA reuptake inhibitor", "Depression\nSmoking cessation (Zyban) ★", "No sexual dysfunction ★; Lowers seizure threshold; Insomnia"],
["Trazodone", "5-HT2 block + weak SERT inhibitor", "Depression + insomnia (very sedating)", "Priapism (painful sustained erection — rare but dangerous) ★"],
],
[3.5*cm, 3.5*cm, 5*cm, 6.5*cm], header_bg=HexColor("#004d40"), note_rows={3}
))
story.append(spacer(0.2))
story.append(exam_box("Serotonin Syndrome = SSRIs + MAOIs (or Tramadol, Linezolid): Hyperthermia + Clonus + Agitation + Autonomic instability → Treatment: Cyproheptadine (5-HT2 antagonist)"))
story.append(PageBreak())
# ════════════════════════════════════════════════════════════════════
# SECTION 5: PARKINSON'S DISEASE DRUGS
# ════════════════════════════════════════════════════════════════════
story.append(section_banner("5. ANTI-PARKINSON'S DRUGS", HexColor("#4e342e")))
story.append(spacer(0.2))
story.append(Paragraph("Core Concept: Loss of DA neurons in substantia nigra → ↓ Dopamine + relatively ↑ ACh in striatum → TRAP (Tremor-Rigidity-Akinesia-Postural instability). Treatment = Restore DA or Reduce ACh.", S_BODY))
story.append(spacer(0.2))
story.append(Paragraph("Anti-Parkinson Drug Summary Table", S_TOPIC))
story.append(make_table(
["Drug / Class", "Mechanism", "Best For", "Key ADRs & Notes"],
[
["Levodopa + Carbidopa\n(Syndopa, Sinemet) ★",
"L-DOPA crosses BBB → converted to DA\nCarbidopa = peripheral DDI (stays outside BBB)",
"Best overall efficacy\nEspecially bradykinesia/akinesia",
"Early: Nausea, postural hypotension\nLate (3–5 yrs): Wearing off, On-Off fluctuations, Dyskinesias\nPsychosis (DA excess in mesolimbic)\nContraindicated: psychosis, narrow-angle glaucoma, non-selective MAOIs, antipsychotics\nVit B6 reduces effect (abolished by carbidopa)"],
["DA Agonists\nBromocriptine (ergot, D2)\nPramipexole, Ropinirole (non-ergot) ★",
"Act directly on DA receptors in brain",
"Young patients — delay L-DOPA complications\nEarly PD monotherapy\nAdjunct to L-DOPA",
"Nausea, postural hypotension\nCompulsive behaviors (gambling, hypersexuality) — Pramipexole/Ropinirole ★\nBromocriptine also for: hyperprolactinaemia, acromegaly"],
["MAO-B Inhibitors\nSelegiline, Rasagiline",
"Block MAO-B (DA-degrading enzyme in brain)\nSelective → less cheese reaction",
"Early PD (possible neuroprotection)\nAdjunct to L-DOPA (reduces wearing off)",
"Selegiline → amphetamine metabolite → insomnia (give in morning!)\nAvoid with SSRIs (serotonin syndrome risk)"],
["COMT Inhibitors\nEntacapone (peripheral)\nTolcapone (central + peripheral)",
"Block COMT → ↓ L-DOPA breakdown → more reaches brain",
"Wearing off phenomenon (adjunct to L-DOPA)",
"Tolcapone → HEPATOTOXICITY — monitor LFTs ★\nDyskinesias (L-DOPA effect enhanced → reduce L-DOPA dose)"],
["Anticholinergics\nTrihexyphenidyl (Benzhexol)\nBenztropine, Biperiden",
"Block muscarinic ACh receptors → restore DA:ACh balance",
"Tremor & rigidity ★\nDrug-induced Parkinsonism (from antipsychotics)",
"Anticholinergic effects: dry mouth, blurred vision, urinary retention, constipation\nConfusion, memory impairment — AVOID IN ELDERLY ★"],
["Amantadine",
"NMDA glutamate receptor block\n+ releases DA from terminals",
"Early PD\nReduces L-DOPA-induced dyskinesias ★\nDrug-induced Parkinsonism",
"Livedo reticularis (mottled skin) ★\nAnkle oedema, confusion\nAlso: antiviral (Influenza A)"],
],
[3.5*cm, 3.5*cm, 3.5*cm, 8*cm], header_bg=HexColor("#4e342e"), note_rows={0}
))
story.append(PageBreak())
# ════════════════════════════════════════════════════════════════════
# SECTION 6: OPIOID ANALGESICS
# ════════════════════════════════════════════════════════════════════
story.append(section_banner("6. OPIOID ANALGESICS", C_RED))
story.append(spacer(0.2))
story.append(Paragraph("Opioid Receptor Types", S_TOPIC))
story.append(make_table(
["Receptor", "Key Effects"],
[
["Mu (μ1)", "Supraspinal analgesia, euphoria, dependence"],
["Mu (μ2)", "Respiratory depression, constipation, bradycardia"],
["Kappa (κ)", "Spinal analgesia, sedation, DYSPHORIA, miosis"],
["Delta (δ)", "Modulates mu receptor, analgesia"],
],
[4*cm, 14.5*cm], header_bg=C_RED
))
story.append(spacer(0.2))
story.append(Paragraph("Morphine — The Prototype (All effects must be memorized)", S_TOPIC))
story.append(make_table(
["System", "Effect", "Tolerance develops?"],
[
["CNS", "Analgesia, euphoria → sedation → sleep", "Yes"],
["CNS", "Nausea & vomiting (CTZ stimulation)", "Yes (early)"],
["CNS", "MIOSIS (pin-point pupils) — kappa + mu", "NO ★"],
["CNS", "Respiratory depression (↓ CO2 sensitivity)", "Yes"],
["CNS", "Cough suppression (antitussive)", "Yes"],
["GIT", "CONSTIPATION (↓ GI motility)", "NO ★"],
["GIT", "Biliary spasm (sphincter of Oddi contraction)", "Partial"],
["Urinary", "Urinary retention (↑ sphincter tone)", "Partial"],
["CVS", "Bradycardia, hypotension (histamine release)", "Yes"],
["Respiratory", "Bronchospasm (histamine)", "—"],
],
[3*cm, 11*cm, 4.5*cm], header_bg=C_RED, note_rows={2, 5}
))
story.append(mnemonic_box("Morphine Overdose TRIAD: Coma + Miosis + Respiratory Depression → IV Naloxone"))
story.append(spacer(0.2))
story.append(Paragraph("Opioid Drug Comparison", S_TOPIC))
story.append(make_table(
["Drug", "Type", "Key Points"],
[
["Morphine", "Full μ agonist", "Prototype; poor oral bioavailability (25%); M6G active metabolite accumulates in renal failure; DOC for pain in MI + Acute pulmonary oedema"],
["Codeine", "Full μ agonist (prodrug)", "Prodrug → Morphine by CYP2D6; antitussive (cough); antidiarrhoeal; weak analgesic; in compound cough syrups"],
["Pethidine (Meperidine)", "Full μ agonist", "Atropine-like: NO miosis, NO bradycardia, causes TACHYCARDIA; Norpethidine metabolite → SEIZURES in renal failure; AVOID with MAOIs (serotonin syndrome); Used: obstetric analgesia, biliary/renal colic (less sphincter of Oddi spasm)"],
["Fentanyl", "Full μ agonist", "100× more potent than morphine; transdermal patch (chronic cancer pain); IV for anaesthesia; rapid onset, short duration"],
["Methadone", "Full μ agonist", "Long-acting; oral; opioid substitution therapy (heroin addiction); also NMDA antagonist action"],
["Tramadol", "Weak μ + SNRI", "Moderate pain, neuropathic pain; SEROTONIN SYNDROME with SSRIs/MAOIs ★; lowers seizure threshold"],
["Buprenorphine", "Partial μ agonist + κ antagonist", "Ceiling effect for respiratory depression (safer); sublingual; opioid dependence treatment; combined with Naloxone = Suboxone"],
["Pentazocine", "κ agonist + μ antagonist", "Causes DYSPHORIA, hallucinations; precipitates withdrawal in opioid-dependent patients; less analgesic than morphine"],
["Naloxone", "Pure antagonist (all receptors)", "IV only; t½ ~30–60 min (shorter than most opioids — may need repeat doses!); reverses opioid overdose"],
["Naltrexone", "Pure antagonist (oral)", "Maintenance treatment of opioid dependence; alcohol dependence (blocks euphoria from alcohol)"],
],
[3*cm, 3.5*cm, 12*cm], header_bg=C_RED, note_rows={2}
))
story.append(PageBreak())
# ════════════════════════════════════════════════════════════════════
# SECTION 7: GENERAL ANAESTHESIA
# ════════════════════════════════════════════════════════════════════
story.append(section_banner("7. GENERAL ANAESTHESIA", C_GREY))
story.append(spacer(0.2))
story.append(Paragraph("Guedel's Stages (conceptual — for ether/old agents): Stage 1 = Analgesia | Stage 2 = Excitement (cross quickly!) | Stage 3 = Surgical anaesthesia | Stage 4 = Medullary depression (DEATH)", S_BODY))
story.append(spacer(0.2))
story.append(Paragraph("Inhalational Agents", S_TOPIC))
story.append(Paragraph("MAC (Minimum Alveolar Concentration) = alveolar conc preventing movement in 50% of patients. LOWER MAC = MORE potent.", S_BODY))
story.append(spacer(0.1))
story.append(make_table(
["Agent", "MAC", "Key Features / Adverse Effects"],
[
["Halothane", "0.75%", "HEPATOTOXICITY ('halothane hepatitis') ★; Sensitizes heart to catecholamines → arrhythmias; Triggers MALIGNANT HYPERTHERMIA; Bronchodilator"],
["Isoflurane", "1.15%", "Most widely used agent; pungent smell; coronary steal (theoretical); minimal hepatotoxicity"],
["Sevoflurane", "2%", "Sweet smell; smooth induction — preferred for PAEDIATRIC induction ★; minimal airway irritation"],
["Desflurane", "6–7%", "Most rapid onset/recovery; VERY pungent (cannot use for mask induction); OR pollution concern; used for maintenance only"],
["Nitrous Oxide (N₂O)", ">100% (weakest!)", "Analgesic ('laughing gas'); must be mixed with O₂; EXPANDS air-filled cavities ★ — avoid in pneumothorax, bowel obstruction, middle ear surgery; prolonged use → megaloblastic anaemia (B₁₂ inactivation)"],
],
[3*cm, 2*cm, 13.5*cm], header_bg=C_GREY, note_rows={0, 4}
))
story.append(exam_box("Malignant Hyperthermia: Triggered by halothane/succinylcholine. Genetic defect in ryanodine receptor → uncontrolled Ca²⁺ release → hyperthermia + rigidity + rhabdomyolysis. Treatment: DANTROLENE"))
story.append(spacer(0.2))
story.append(Paragraph("IV Anaesthetic Agents", S_TOPIC))
story.append(make_table(
["Drug", "Mechanism", "Key Features"],
[
["Thiopentone (Thiopental)", "Barbiturate — GABA-A", "Ultra-short (redistribution); IV induction only; NO analgesia; Contraindicated: PORPHYRIA; Myocardial depression"],
["Propofol", "GABA-A enhancement", "Most used IV agent today; 'milk of anaesthesia' (white emulsion); rapid recovery; antiemetic; Propofol infusion syndrome with prolonged high dose ★; pain on injection"],
["Ketamine ★", "NMDA receptor antagonist\n(dissociative anaesthesia)", "INCREASES BP & HR (sympathomimetic) — use in shock/trauma ★; ONLY IV anaesthetic with ANALGESIC action ★; eyes remain open; emergence hallucinations (co-give BZD); BRONCHODILATOR — safe in asthma ★; Contraindicated: hypertension, raised ICP, psychiatric illness"],
["Etomidate", "GABA-A", "Least CVS depression — preferred in cardiac patients; adrenocortical suppression (avoid prolonged infusion) ★"],
["Midazolam", "BZD — GABA-A", "Premedication/sedation; anterograde amnesia; anxiolysis"],
],
[3.5*cm, 3.5*cm, 11.5*cm], header_bg=C_GREY, note_rows={2}
))
story.append(spacer(0.2))
story.append(Paragraph("Neuromuscular Blockers (NMBs)", S_TOPIC))
story.append(make_table(
["Drug", "Type", "Onset / Duration", "Key Notes"],
[
["Succinylcholine (Suxamethonium)", "DEPOLARIZING", "Fastest (60–90 sec) / Ultra-short (5–10 min)", "Mimics ACh → persistent depolarization → fasciculations then paralysis; metabolized by plasma cholinesterase; Hyperkalemia ★ (burns, crush injury — DANGEROUS); Triggers malignant hyperthermia; ↑ IOP, ↑ ICP, ↑ intragastric pressure; Pseudocholinesterase deficiency → prolonged apnea; Antidote: FFP"],
["Rocuronium", "Non-depolarizing", "Fastest non-depolarizing / Intermediate", "Reversed by SUGAMMADEX (specific); alternative to succinylcholine for rapid intubation"],
["Atracurium", "Non-depolarizing", "Intermediate", "Hofmann elimination (spontaneous — does NOT need liver or kidney); SAFEST in renal/liver failure ★"],
["Vecuronium", "Non-depolarizing", "Intermediate", "Minimal CVS effects; caution in liver/kidney disease"],
["Pancuronium", "Non-depolarizing", "Long", "Tachycardia (vagolytic); avoid in cardiac patients"],
["Reversal of non-depol. block", "—", "—", "Neostigmine (anticholinesterase) + Atropine (to block muscarinic SE of neostigmine). OR Sugammadex for rocuronium/vecuronium."],
],
[3.5*cm, 2.8*cm, 3.5*cm, 8.7*cm], header_bg=C_GREY, note_rows={0, 2}
))
story.append(PageBreak())
# ════════════════════════════════════════════════════════════════════
# SECTION 8: 30 HIGH-YIELD ONE-LINERS
# ════════════════════════════════════════════════════════════════════
story.append(section_banner("8. TOP 30 ONE-LINERS FOR PROF EXAMS", C_AMBER))
story.append(spacer(0.2))
oneliners = [
("1", "BZDs → ↑ FREQUENCY of Cl⁻ channel opening. Barbiturates → ↑ DURATION."),
("2", "BZD overdose antidote = Flumazenil (IV, short t½ ~1h, may need repeat doses)."),
("3", "Opioid overdose antidote = Naloxone (IV). Classic triad: Coma + Miosis + Respiratory depression."),
("4", "Status epilepticus Rx: IV Lorazepam (1st) → IV Phenytoin → IV Phenobarbital."),
("5", "DOC absence ONLY = Ethosuximide. DOC absence + tonic-clonic = Valproate."),
("6", "DOC focal/partial seizures = Carbamazepine. DOC trigeminal neuralgia = Carbamazepine."),
("7", "Phenytoin: Zero-order kinetics! Nystagmus (1st toxicity sign), gingival hyperplasia, hirsutism, fetal hydantoin syndrome."),
("8", "Valproate = most teratogenic AED. Neural tube defects (spina bifida). Give folate!"),
("9", "Carbamazepine unique ADR = SIADH (hyponatraemia). Also causes Stevens-Johnson."),
("10", "Vigabatrin: irreversible GABA-T inhibitor → permanent visual field defects."),
("11", "Topiramate: only AED that causes WEIGHT LOSS. Also causes cognitive slowing, kidney stones."),
("12", "Levetiracetam: binds SV2A. Fewest drug interactions. Safe and effective broad-spectrum AED."),
("13", "Dopamine hypothesis: excess DA in mesolimbic pathway → schizophrenia. All antipsychotics block D2."),
("14", "EPS timeline: Acute dystonia (hrs) → Akathisia (days-wks) → Drug Parkinsonism (wks-months) → Tardive dyskinesia (months-yrs, IRREVERSIBLE)."),
("15", "NMS: Fever + Rigidity + Autonomic instability + ↑CPK → Stop drug → Dantrolene + Bromocriptine."),
("16", "Clozapine = treatment-resistant schizophrenia. WEEKLY CBC for agranulocytosis. No EPS/tardive dyskinesia."),
("17", "Thioridazine = low EPS BUT pigmentary retinopathy + QT prolongation. Avoid in cardiac patients."),
("18", "Aripiprazole = partial D2 agonist. Least metabolic effects. No QT prolongation. Weight neutral."),
("19", "TCAs overdose: wide QRS arrhythmias + seizures + anticholinergic syndrome → treat arrhythmia with IV NaHCO₃."),
("20", "Imipramine (TCA) = DOC nocturnal enuresis. Clomipramine (TCA) = best TCA for OCD."),
("21", "Fluoxetine (SSRI) = only SSRI FDA-approved for bulimia nervosa. Also longest half-life (avoid cheese reaction after stopping)."),
("22", "Cheese reaction = MAOI + tyramine → hypertensive crisis. Wait 14 days when switching FROM MAOIs (5 weeks after Fluoxetine)."),
("23", "Serotonin syndrome = SSRIs + MAOIs/Tramadol/Linezolid → Hyperthermia + Clonus → Cyproheptadine."),
("24", "Bupropion: DA+NA reuptake blocker. Used for depression AND smoking cessation. NO sexual dysfunction."),
("25", "L-DOPA always given WITH Carbidopa (peripheral DDI). Pyridoxine (B6) reduces L-DOPA effect (abolished by carbidopa)."),
("26", "Selegiline = MAO-B inhibitor → amphetamine metabolite → give in MORNING (insomnia if evening)."),
("27", "Amantadine: NMDA blocker → reduces L-DOPA dyskinesias. Unique ADR: livedo reticularis."),
("28", "Pethidine: atropine-like (tachycardia, no miosis). Norpethidine → seizures in renal failure. NEVER with MAOIs."),
("29", "Ketamine: Dissociative (NMDA block). Only IV agent with analgesia. INCREASES BP. Safe in asthma. Causes emergence hallucinations."),
("30", "Malignant hyperthermia: Halothane/Succinylcholine → ryanodine receptor defect → ↑↑Ca²⁺ → hyperthermia + rigidity. Rx: Dantrolene."),
]
ol_rows = [[Paragraph(f"<b>{n}.</b>", S_ONELINER), Paragraph(text, S_ONELINER)] for n, text in oneliners]
ol_tbl = Table(ol_rows, colWidths=[1*cm, 17.5*cm])
ol_tbl.setStyle(TableStyle([
("ROWBACKGROUNDS", (0,0), (-1,-1), [C_WHITE, C_YELLOW]),
("TOPPADDING", (0,0), (-1,-1), 3),
("BOTTOMPADDING", (0,0), (-1,-1), 3),
("LEFTPADDING", (0,0), (-1,-1), 4),
("VALIGN", (0,0), (-1,-1), "TOP"),
("GRID", (0,0), (-1,-1), 0.3, HexColor("#e0e0e0")),
]))
story.append(ol_tbl)
story.append(spacer(0.4))
# ── FOOTER ─────────────────────────────────────────────────────────
story.append(hr())
story.append(Paragraph("CNS Pharmacology Quick Reference | MBBS 2nd Year Prof Exams | Based on KDT, Katzung, Lippincott & Goodman-Gilman | Orris Medical Education", S_FOOTER))
# ── BUILD ───────────────────────────────────────────────────────────
doc.build(story)
print(f"PDF saved to: {OUTPUT}")