Create the slide for my presentation on 2 slide for the topic of the anti depression drugs 2 year mbbs take the reference from godman gillman and other standard books.
mkdir -p /tmp/workspace/antidepressants-pptx && ls /tmp/workspace/antidepressants-pptx/
~/antidepressants-pptx/create_slides.py
from pptx import Presentation
from pptx.util import Inches, Pt, Emu
from pptx.dml.color import RGBColor
from pptx.enum.text import PP_ALIGN, MSO_ANCHOR
from pptx.oxml.ns import qn
from lxml import etree
# ─── Color Palette ────────────────────────────────────────────────
DARK_BLUE = RGBColor(0x0D, 0x3B, 0x66) # header background
MED_BLUE = RGBColor(0x16, 0x6B, 0xA0) # section headers
LIGHT_BLUE = RGBColor(0xD6, 0xEC, 0xF8) # content box backgrounds
ACCENT = RGBColor(0xE8, 0x49, 0x3C) # red accent
GOLD = RGBColor(0xF5, 0xA6, 0x23) # gold highlight
WHITE = RGBColor(0xFF, 0xFF, 0xFF)
DARK_TEXT = RGBColor(0x1A, 0x1A, 0x2E)
GRAY_BG = RGBColor(0xF0, 0xF4, 0xF8)
GREEN = RGBColor(0x27, 0xAE, 0x60)
prs = Presentation()
prs.slide_width = Inches(13.333)
prs.slide_height = Inches(7.5)
blank_layout = prs.slide_layouts[6]
# ═══════════════════════════════════════════════════════════════════
# HELPER FUNCTIONS
# ═══════════════════════════════════════════════════════════════════
def add_rect(slide, left, top, width, height, fill_color, alpha=None):
shape = slide.shapes.add_shape(
1, # MSO_SHAPE_TYPE.RECTANGLE
Inches(left), Inches(top), Inches(width), Inches(height)
)
shape.line.fill.background()
shape.fill.solid()
shape.fill.fore_color.rgb = fill_color
return shape
def add_textbox(slide, left, top, width, height, text, font_size,
bold=False, color=DARK_TEXT, align=PP_ALIGN.LEFT,
word_wrap=True, italic=False):
tb = slide.shapes.add_textbox(
Inches(left), Inches(top), Inches(width), Inches(height)
)
tf = tb.text_frame
tf.word_wrap = word_wrap
tf.margin_left = Pt(4)
tf.margin_right = Pt(4)
tf.margin_top = Pt(2)
tf.margin_bottom = Pt(2)
p = tf.paragraphs[0]
p.alignment = align
run = p.add_run()
run.text = text
run.font.name = "Calibri"
run.font.size = Pt(font_size)
run.font.bold = bold
run.font.italic = italic
run.font.color.rgb = color
return tb
def add_paragraph(tf, text, font_size, bold=False, color=DARK_TEXT,
align=PP_ALIGN.LEFT, space_before=Pt(3), italic=False,
bullet=False):
p = tf.add_paragraph()
p.alignment = align
p.space_before = space_before
if bullet:
p.level = 1
run = p.add_run()
run.text = text
run.font.name = "Calibri"
run.font.size = Pt(font_size)
run.font.bold = bold
run.font.italic = italic
run.font.color.rgb = color
return p
def add_colored_rect_with_text(slide, left, top, width, height,
fill_color, text, font_size,
text_color=WHITE, bold=True, align=PP_ALIGN.CENTER):
"""Add a colored rectangle with centered text over it."""
add_rect(slide, left, top, width, height, fill_color)
add_textbox(slide, left, top, width, height, text, font_size,
bold=bold, color=text_color, align=align)
# ═══════════════════════════════════════════════════════════════════
# SLIDE 1 – Classification & Mechanism of Action
# ═══════════════════════════════════════════════════════════════════
s1 = prs.slides.add_slide(blank_layout)
# Full background
add_rect(s1, 0, 0, 13.333, 7.5, GRAY_BG)
# Top header bar
add_rect(s1, 0, 0, 13.333, 1.05, DARK_BLUE)
# Header text
add_textbox(s1, 0.2, 0.05, 9, 0.55,
"ANTIDEPRESSANT DRUGS", 32,
bold=True, color=WHITE, align=PP_ALIGN.LEFT)
add_textbox(s1, 0.2, 0.6, 9, 0.4,
"Classification & Mechanisms of Action | 2nd Year MBBS Pharmacology", 13,
bold=False, color=RGBColor(0xB0, 0xD4, 0xF1), align=PP_ALIGN.LEFT)
# Reference badge top right
add_rect(s1, 10.5, 0.12, 2.6, 0.45, MED_BLUE)
add_textbox(s1, 10.5, 0.12, 2.6, 0.45,
"Ref: Goodman & Gilman's 14e", 8,
bold=False, color=WHITE, align=PP_ALIGN.CENTER)
# ── Column layout (3 columns) ─────────────────────────────────────
col_w = 4.0
gap = 0.17
c1x = 0.22
c2x = c1x + col_w + gap
c3x = c2x + col_w + gap
col_y = 1.15
col_h = 5.65
for cx in [c1x, c2x, c3x]:
add_rect(s1, cx, col_y, col_w, col_h, WHITE)
# ── COLUMN 1: Classification ─────────────────────────────────────
add_rect(s1, c1x, col_y, col_w, 0.45, MED_BLUE)
add_textbox(s1, c1x, col_y, col_w, 0.45,
"CLASSIFICATION", 13, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
tb1 = s1.shapes.add_textbox(
Inches(c1x + 0.1), Inches(col_y + 0.5),
Inches(col_w - 0.2), Inches(col_h - 0.6)
)
tf1 = tb1.text_frame
tf1.word_wrap = True
tf1.margin_left = Pt(4)
tf1.margin_top = Pt(4)
classes = [
("1. TRICYCLIC ANTIDEPRESSANTS (TCAs)", MED_BLUE, [
"Imipramine, Amitriptyline",
"Clomipramine, Nortriptyline",
"Desipramine"
]),
("2. SSRIs (Selective Serotonin\n Reuptake Inhibitors)", MED_BLUE, [
"Fluoxetine, Sertraline",
"Paroxetine, Citalopram",
"Escitalopram, Fluvoxamine"
]),
("3. SNRIs (Serotonin-NE\n Reuptake Inhibitors)", MED_BLUE, [
"Venlafaxine, Duloxetine",
"Desvenlafaxine, Milnacipran",
"Levomilnacipran"
]),
("4. MAO INHIBITORS (MAOIs)", MED_BLUE, [
"Phenelzine, Tranylcypromine",
"Selegiline (selective MAO-B)",
"Moclobemide (reversible RIMA)"
]),
("5. ATYPICALS / OTHERS", MED_BLUE, [
"Bupropion (NE+DA reuptake inhibitor)",
"Mirtazapine (NaSSA)",
"Trazodone, Vortioxetine",
"Vilazodone (SSRI + 5HT1A partial agonist)"
]),
]
first = True
for heading, hc, drugs in classes:
p = tf1.paragraphs[0] if first else tf1.add_paragraph()
first = False
p.alignment = PP_ALIGN.LEFT
p.space_before = Pt(6) if not first else Pt(0)
r = p.add_run()
r.text = heading
r.font.name = "Calibri"
r.font.size = Pt(9.5)
r.font.bold = True
r.font.color.rgb = MED_BLUE
for d in drugs:
pd = tf1.add_paragraph()
pd.alignment = PP_ALIGN.LEFT
pd.space_before = Pt(1)
rd = pd.add_run()
rd.text = " • " + d
rd.font.name = "Calibri"
rd.font.size = Pt(8.5)
rd.font.color.rgb = DARK_TEXT
# ── COLUMN 2: Mechanisms of Action ───────────────────────────────
add_rect(s1, c2x, col_y, col_w, 0.45, ACCENT)
add_textbox(s1, c2x, col_y, col_w, 0.45,
"MECHANISMS OF ACTION", 13, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
tb2 = s1.shapes.add_textbox(
Inches(c2x + 0.1), Inches(col_y + 0.5),
Inches(col_w - 0.2), Inches(col_h - 0.6)
)
tf2 = tb2.text_frame
tf2.word_wrap = True
tf2.margin_left = Pt(4)
tf2.margin_top = Pt(4)
mechs = [
("TCAs", DARK_BLUE, [
"Block NE & 5HT reuptake (NET + SERT)",
"Also block H1, muscarinic, α1-adrenoceptors",
"→ Broad spectrum but significant side effects",
"(G&G Fig 18-1: presynaptic terminal blockade)"
]),
("SSRIs", DARK_BLUE, [
"Selectively block SERT (5HT transporter)",
"↑ Synaptic serotonin → mood elevation",
"Initial: stimulates autoreceptors → ↓ 5HT release",
"Chronic: autoreceptor desensitization → ↑↑ 5HT",
"Therapeutic lag: 3–4 weeks (G&G Ch 18)"
]),
("SNRIs", DARK_BLUE, [
"Block both SERT and NET",
"↑ 5HT + ↑ NE neurotransmission",
"Useful in pain (neuropathic), anxiety"
]),
("MAOIs", DARK_BLUE, [
"Inhibit MAO-A (5HT, NE) ± MAO-B (DA)",
"↑ Monoamine availability in synapse",
"Risk: hypertensive crisis (tyramine)",
"Drug-free interval 1–2 wks before MAOIs"
]),
("Bupropion", DARK_BLUE, [
"Inhibits NE + Dopamine reuptake",
"No sexual dysfunction; used in smoking"
]),
("Mirtazapine", DARK_BLUE, [
"Blocks α2 autoreceptors → ↑ NE + 5HT release",
"5HT2, 5HT3 block → fewer GI/sexual SE"
]),
]
first2 = True
for heading, hc, pts in mechs:
p = tf2.paragraphs[0] if first2 else tf2.add_paragraph()
first2 = False
p.alignment = PP_ALIGN.LEFT
p.space_before = Pt(6)
r = p.add_run()
r.text = heading
r.font.name = "Calibri"
r.font.size = Pt(9.5)
r.font.bold = True
r.font.color.rgb = ACCENT
for pt in pts:
pd = tf2.add_paragraph()
pd.space_before = Pt(1)
rd = pd.add_run()
rd.text = " • " + pt
rd.font.name = "Calibri"
rd.font.size = Pt(8)
rd.font.color.rgb = DARK_TEXT
# ── COLUMN 3: Indications + Therapeutic Lag ──────────────────────
add_rect(s1, c3x, col_y, col_w, 0.45, GREEN)
add_textbox(s1, c3x, col_y, col_w, 0.45,
"INDICATIONS & KEY FACTS", 13, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
tb3 = s1.shapes.add_textbox(
Inches(c3x + 0.1), Inches(col_y + 0.5),
Inches(col_w - 0.2), Inches(col_h - 0.6)
)
tf3 = tb3.text_frame
tf3.word_wrap = True
tf3.margin_left = Pt(4)
tf3.margin_top = Pt(4)
indications = [
("Primary Indications", GREEN, [
"Major Depressive Disorder (MDD)",
"Generalised Anxiety Disorder (GAD)",
"OCD – SSRIs (1st line); Clomipramine",
"Panic Disorder – SSRIs, TCAs",
"PTSD – Sertraline, Paroxetine (FDA-approved)",
"Neuropathic pain – TCAs, Duloxetine",
"Bulimia Nervosa – Fluoxetine",
"Premenstrual Dysphoric Disorder – SSRIs",
"Enuresis – Imipramine",
"Smoking Cessation – Bupropion"
]),
("Therapeutic Lag", GREEN, [
"Onset of antidepressant effect: 3–4 weeks",
"Sleep improves sooner than mood",
"Adequate trial: 4–6 weeks at full dose",
"Maintenance: 6–12 months after remission",
"Chronic depression (>2 yrs): lifelong Rx"
]),
("Important Cautions", GREEN, [
"TCAs: avoid in cardiac disease (arrhythmia)",
"MAOIs: tyramine-free diet mandatory",
"SSRIs in children: black-box FDA warning",
"All: monitor suicidal ideation early on",
"TCAs can switch bipolar → mania"
]),
]
first3 = True
for heading, hc, pts in indications:
p = tf3.paragraphs[0] if first3 else tf3.add_paragraph()
first3 = False
p.space_before = Pt(6)
r = p.add_run()
r.text = heading
r.font.name = "Calibri"
r.font.size = Pt(9.5)
r.font.bold = True
r.font.color.rgb = GREEN
for pt in pts:
pd = tf3.add_paragraph()
pd.space_before = Pt(1)
rd = pd.add_run()
rd.text = " • " + pt
rd.font.name = "Calibri"
rd.font.size = Pt(8)
rd.font.color.rgb = DARK_TEXT
# Footer bar
add_rect(s1, 0, 7.2, 13.333, 0.3, DARK_BLUE)
add_textbox(s1, 0.2, 7.2, 13, 0.3,
"Sources: Goodman & Gilman's Pharmacological Basis of Therapeutics 14e (Ch 18) | "
"Kaplan & Sadock's Comprehensive Textbook of Psychiatry | Stahl's Essential Psychopharmacology",
7, bold=False, color=RGBColor(0xB0, 0xD4, 0xF1), align=PP_ALIGN.CENTER)
# ═══════════════════════════════════════════════════════════════════
# SLIDE 2 – Adverse Effects, Drug Interactions & Clinical Pearls
# ═══════════════════════════════════════════════════════════════════
s2 = prs.slides.add_slide(blank_layout)
add_rect(s2, 0, 0, 13.333, 7.5, GRAY_BG)
# Header
add_rect(s2, 0, 0, 13.333, 1.05, DARK_BLUE)
add_textbox(s2, 0.2, 0.05, 9, 0.55,
"ANTIDEPRESSANT DRUGS", 32,
bold=True, color=WHITE, align=PP_ALIGN.LEFT)
add_textbox(s2, 0.2, 0.6, 9, 0.4,
"Adverse Effects, Drug Interactions & Clinical Pearls | 2nd Year MBBS Pharmacology", 13,
bold=False, color=RGBColor(0xB0, 0xD4, 0xF1), align=PP_ALIGN.LEFT)
add_rect(s2, 10.5, 0.12, 2.6, 0.45, MED_BLUE)
add_textbox(s2, 10.5, 0.12, 2.6, 0.45,
"Ref: Goodman & Gilman's 14e", 8,
bold=False, color=WHITE, align=PP_ALIGN.CENTER)
# ── Row 1: 3 adverse-effect boxes ─────────────────────────────────
bx_w = 4.1
bx_h = 2.55
bx_y = 1.15
bx1x = 0.22
bx2x = 4.60
bx3x = 8.98
for bx in [bx1x, bx2x, bx3x]:
add_rect(s2, bx, bx_y, bx_w, bx_h, WHITE)
# --- Box 1: TCA Side Effects ---
add_rect(s2, bx1x, bx_y, bx_w, 0.4, DARK_BLUE)
add_textbox(s2, bx1x, bx_y, bx_w, 0.4,
"TCA ADVERSE EFFECTS", 11, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
tb_tca = s2.shapes.add_textbox(
Inches(bx1x+0.1), Inches(bx_y+0.42),
Inches(bx_w-0.2), Inches(bx_h-0.5)
)
tf_tca = tb_tca.text_frame
tf_tca.word_wrap = True
tf_tca.margin_left = Pt(4)
tca_se = [
"Anticholinergic: dry mouth, constipation,",
" urinary retention, blurred vision",
"Antihistaminic: sedation, weight gain",
"α1-block: orthostatic hypotension",
"Cardiac: arrhythmia, heart block",
" (avoid in ischemic heart disease)",
"Overdose: 3Cs – Convulsions, Coma,",
" Cardiotoxicity (wide QRS, QTc prolongation)"
]
first_t = True
for line in tca_se:
p = tf_tca.paragraphs[0] if first_t else tf_tca.add_paragraph()
first_t = False
r = p.add_run()
r.text = line
r.font.name = "Calibri"
r.font.size = Pt(8.5)
r.font.color.rgb = DARK_TEXT
# --- Box 2: SSRI Side Effects ---
add_rect(s2, bx2x, bx_y, bx_w, 0.4, MED_BLUE)
add_textbox(s2, bx2x, bx_y, bx_w, 0.4,
"SSRI ADVERSE EFFECTS", 11, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
tb_ssri = s2.shapes.add_textbox(
Inches(bx2x+0.1), Inches(bx_y+0.42),
Inches(bx_w-0.2), Inches(bx_h-0.5)
)
tf_ssri = tb_ssri.text_frame
tf_ssri.word_wrap = True
tf_ssri.margin_left = Pt(4)
ssri_se = [
"GI: nausea, diarrhoea (most common early)",
"Sexual: anorgasmia, ↓ libido, erectile dysfunction",
"CNS: insomnia or hypersomnia, headache",
"Weight change (gain or loss)",
"Anxiety / akathisia (early treatment)",
"Discontinuation syndrome (paroxetine > others)",
"Serotonin Syndrome (overdose / drug combo):",
" Hyperthermia, myoclonus, clonus, delirium"
]
first_s = True
for line in ssri_se:
p = tf_ssri.paragraphs[0] if first_s else tf_ssri.add_paragraph()
first_s = False
r = p.add_run()
r.text = line
r.font.name = "Calibri"
r.font.size = Pt(8.5)
r.font.color.rgb = DARK_TEXT
# --- Box 3: MAOI Side Effects ---
add_rect(s2, bx3x, bx_y, bx_w, 0.4, ACCENT)
add_textbox(s2, bx3x, bx_y, bx_w, 0.4,
"MAOI / OTHER ADVERSE EFFECTS", 11, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
tb_maoi = s2.shapes.add_textbox(
Inches(bx3x+0.1), Inches(bx_y+0.42),
Inches(bx_w-0.2), Inches(bx_h-0.5)
)
tf_maoi = tb_maoi.text_frame
tf_maoi.word_wrap = True
tf_maoi.margin_left = Pt(4)
maoi_se = [
"MAOIs: Hypertensive crisis (tyramine interaction)",
" → Severe headache, intracerebral haemorrhage",
" Cheese reaction – avoid aged cheese, wine",
"MAOIs: Insomnia, orthostatic hypotension",
"Bupropion: Seizure risk (dose-dependent)",
"Mirtazapine: Sedation, weight gain",
"Trazodone: Priapism (rare but serious)",
"SNRIs: ↑ BP (especially venlafaxine at high dose)"
]
first_m = True
for line in maoi_se:
p = tf_maoi.paragraphs[0] if first_m else tf_maoi.add_paragraph()
first_m = False
r = p.add_run()
r.text = line
r.font.name = "Calibri"
r.font.size = Pt(8.5)
r.font.color.rgb = DARK_TEXT
# ── Row 2: Drug Interactions + Clinical Pearls (2 wide boxes) ─────
r2_y = bx_y + bx_h + 0.12
r2_h = 2.55
di_w = 6.0
cp_w = 7.0
add_rect(s2, 0.22, r2_y, di_w, r2_h, WHITE)
add_rect(s2, 0.22 + di_w + 0.15, r2_y, cp_w - 0.22, r2_h, WHITE)
# --- Drug Interactions ---
add_rect(s2, 0.22, r2_y, di_w, 0.4, GOLD)
add_textbox(s2, 0.22, r2_y, di_w, 0.4,
"DRUG INTERACTIONS", 12, bold=True, color=DARK_BLUE, align=PP_ALIGN.CENTER)
tb_di = s2.shapes.add_textbox(
Inches(0.32), Inches(r2_y + 0.42),
Inches(di_w - 0.2), Inches(r2_h - 0.5)
)
tf_di = tb_di.text_frame
tf_di.word_wrap = True
tf_di.margin_left = Pt(4)
di_lines = [
("SSRIs + MAOIs", ACCENT, "→ SEROTONIN SYNDROME (potentially fatal) – interval of 2 wks needed"),
("SSRIs + Tramadol / Triptans", ACCENT, "→ Serotonin Syndrome"),
("TCAs + MAOIs", ACCENT, "→ Serotonin Syndrome / Hypertensive crisis"),
("MAOIs + Tyramine-rich foods", ACCENT, "→ Hypertensive crisis (cheese, red wine)"),
("Fluoxetine (CYP2D6 inhibitor)", MED_BLUE, "→ ↑ levels of codeine, TCAs, antipsychotics"),
("SSRIs + NSAIDs / Anticoagulants", MED_BLUE, "→ ↑ Bleeding risk (platelet serotonin depletion)"),
("Citalopram + QTc-prolonging drugs", MED_BLUE, "→ Risk of Torsades de Pointes"),
]
first_di = True
for drug, c, effect in di_lines:
p = tf_di.paragraphs[0] if first_di else tf_di.add_paragraph()
first_di = False
p.space_before = Pt(2)
r1 = p.add_run()
r1.text = drug + ": "
r1.font.name = "Calibri"
r1.font.size = Pt(8.5)
r1.font.bold = True
r1.font.color.rgb = c
r2 = p.add_run()
r2.text = effect
r2.font.name = "Calibri"
r2.font.size = Pt(8.5)
r2.font.color.rgb = DARK_TEXT
# --- Clinical Pearls ---
cp_x = 0.22 + di_w + 0.15
add_rect(s2, cp_x, r2_y, cp_w - 0.22, 0.4, GREEN)
add_textbox(s2, cp_x, r2_y, cp_w - 0.22, 0.4,
"CLINICAL PEARLS (2nd MBBS Key Points)", 12, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
tb_cp = s2.shapes.add_textbox(
Inches(cp_x + 0.1), Inches(r2_y + 0.42),
Inches(cp_w - 0.22 - 0.2), Inches(r2_h - 0.5)
)
tf_cp = tb_cp.text_frame
tf_cp.word_wrap = True
tf_cp.margin_left = Pt(4)
pearl_lines = [
"1st LINE for MDD: SSRIs (best safety profile) – G&G Ch 18",
"Fluoxetine: longest half-life (7 days), least discontinuation syndrome",
"Paroxetine: most anticholinergic SSRI; shortest half-life → worst discontinuation",
"Amitriptyline: most sedating TCA; Imipramine: prototype TCA",
"Therapeutic lag 3–4 wks: explain to patient before starting therapy",
"OCD: Higher SSRI doses needed vs. depression; Clomipramine is most effective TCA",
"Pregnancy: SSRIs generally preferred; neonatal pulmonary HTN risk if used near term",
"ECT: consider if drug therapy fails (treatment-resistant depression)",
"SNRI (Duloxetine): dual use – depression AND neuropathic pain / fibromyalgia",
"TCA overdose antidote: IV Sodium Bicarbonate (reverses wide QRS / arrhythmia)"
]
first_cp = True
for line in pearl_lines:
p = tf_cp.paragraphs[0] if first_cp else tf_cp.add_paragraph()
first_cp = False
p.space_before = Pt(2)
r = p.add_run()
r.text = "★ " + line
r.font.name = "Calibri"
r.font.size = Pt(8.2)
r.font.color.rgb = DARK_TEXT
# Footer
add_rect(s2, 0, 7.2, 13.333, 0.3, DARK_BLUE)
add_textbox(s2, 0.2, 7.2, 13, 0.3,
"Sources: Goodman & Gilman's Pharmacological Basis of Therapeutics 14e (Ch 18) | "
"Kaplan & Sadock's Comprehensive Textbook of Psychiatry | Adams & Victor's Principles of Neurology 12e",
7, bold=False, color=RGBColor(0xB0, 0xD4, 0xF1), align=PP_ALIGN.CENTER)
# ═══════════════════════════════════════════════════════════════════
outpath = "/tmp/workspace/antidepressants-pptx/Antidepressant_Drugs_2ndMBBS.pptx"
prs.save(outpath)
print(f"Saved: {outpath}")
python /tmp/workspace/antidepressants-pptx/create_slides.py
python -c " from pptx import Presentation prs = Presentation('/tmp/workspace/antidepressants-pptx/Antidepressant_Drugs_2ndMBBS.pptx') print(f'Total slides: {len(prs.slides)}') for i, slide in enumerate(prs.slides, 1): print(f'--- Slide {i} ---') for shape in slide.shapes: if shape.has_text_frame and shape.text_frame.text.strip(): print(' >', shape.text_frame.text[:80].replace(chr(10),' | ')) "
Antidepressant Drugs 2ndMBBS
Presentation · PPTX
| Column | Content |
|---|---|
| Classification (Blue) | TCAs, SSRIs, SNRIs, MAOIs, Atypicals - with all key drug names |
| Mechanisms of Action (Red) | SERT/NET blockade (TCAs), selective SERT (SSRIs), autoreceptor desensitization, MAOI mechanism, Bupropion (NE+DA), Mirtazapine (α2 block) |
| Indications & Key Facts (Green) | MDD, OCD, Panic, PTSD, Neuropathic pain, Enuresis, Bulimia + Therapeutic lag (3-4 weeks) + Important cautions |
| Section | Content |
|---|---|
| TCA ADRs | Anticholinergic (dry mouth, urinary retention), 3Cs overdose - Convulsions/Coma/Cardiotoxicity |
| SSRI ADRs | GI upset, sexual dysfunction, serotonin syndrome, discontinuation syndrome |
| MAOI/Others | Hypertensive crisis/cheese reaction, Bupropion seizures, Trazodone priapism |
| Drug Interactions | SSRIs + MAOIs (Serotonin Syndrome), Fluoxetine CYP2D6 inhibition, bleeding with NSAIDs |
| Clinical Pearls | 10 high-yield exam points - Fluoxetine longest t1/2, Paroxetine worst discontinuation, TCA OD antidote = IV NaHCO3, etc. |
Fully coloured slide for presentation.
~/antidepressants-pptx/create_coloured_slides.py
from pptx import Presentation
from pptx.util import Inches, Pt, Emu
from pptx.dml.color import RGBColor
from pptx.enum.text import PP_ALIGN, MSO_ANCHOR
prs = Presentation()
prs.slide_width = Inches(13.333)
prs.slide_height = Inches(7.5)
blank = prs.slide_layouts[6]
# ── Palette ────────────────────────────────────────────────────────
NAVY = RGBColor(0x0A, 0x23, 0x42)
DEEP_BLUE = RGBColor(0x10, 0x3F, 0x6E)
SKY = RGBColor(0x14, 0x7A, 0xB8)
TEAL = RGBColor(0x0B, 0x8A, 0x7A)
EMERALD = RGBColor(0x0E, 0x6B, 0x45)
PURPLE = RGBColor(0x5C, 0x2D, 0x91)
WINE = RGBColor(0x8B, 0x1A, 0x2E)
CRIMSON = RGBColor(0xC0, 0x1F, 0x2E)
ORANGE = RGBColor(0xD9, 0x6A, 0x0A)
GOLD = RGBColor(0xC8, 0x9A, 0x0B)
WHITE = RGBColor(0xFF, 0xFF, 0xFF)
OFF_WHITE = RGBColor(0xF5, 0xF5, 0xF5)
PALE_YELLOW = RGBColor(0xFF, 0xF9, 0xE6)
L_BLUE = RGBColor(0xD0, 0xE8, 0xF8)
L_TEAL = RGBColor(0xC8, 0xF0, 0xEB)
L_GREEN = RGBColor(0xC8, 0xEC, 0xD8)
L_PURPLE = RGBColor(0xE8, 0xD8, 0xF8)
L_ORANGE = RGBColor(0xFC, 0xE8, 0xCC)
L_WINE = RGBColor(0xF8, 0xD4, 0xDA)
DARK_TEXT = RGBColor(0x12, 0x12, 0x20)
LIGHT_GRAY = RGBColor(0xE8, 0xEC, 0xF2)
def rect(slide, l, t, w, h, fill, line_color=None):
shp = slide.shapes.add_shape(1,
Inches(l), Inches(t), Inches(w), Inches(h))
shp.fill.solid()
shp.fill.fore_color.rgb = fill
if line_color:
shp.line.color.rgb = line_color
shp.line.width = Pt(0.75)
else:
shp.line.fill.background()
return shp
def tb(slide, l, t, w, h, text, size, bold=False, color=DARK_TEXT,
align=PP_ALIGN.LEFT, italic=False, wrap=True):
box = slide.shapes.add_textbox(Inches(l), Inches(t), Inches(w), Inches(h))
tf = box.text_frame
tf.word_wrap = wrap
tf.margin_left = Pt(5)
tf.margin_right = Pt(5)
tf.margin_top = Pt(3)
tf.margin_bottom = Pt(3)
p = tf.paragraphs[0]
p.alignment = align
r = p.add_run()
r.text = text
r.font.name = "Calibri"
r.font.size = Pt(size)
r.font.bold = bold
r.font.italic = italic
r.font.color.rgb = color
return box, tf
def add_para(tf, text, size, bold=False, color=DARK_TEXT,
align=PP_ALIGN.LEFT, space_pt=2, italic=False):
p = tf.add_paragraph()
p.alignment = align
p.space_before = Pt(space_pt)
r = p.add_run()
r.text = text
r.font.name = "Calibri"
r.font.size = Pt(size)
r.font.bold = bold
r.font.italic = italic
r.font.color.rgb = color
# ═══════════════════════════════════════════════════════════════════════════
# SLIDE 1
# ═══════════════════════════════════════════════════════════════════════════
s1 = prs.slides.add_slide(blank)
# Full deep-navy background
rect(s1, 0, 0, 13.333, 7.5, NAVY)
# Decorative top stripe
rect(s1, 0, 0, 13.333, 0.08, SKY)
# Header band gradient simulation (2 layers)
rect(s1, 0, 0.08, 13.333, 1.1, DEEP_BLUE)
rect(s1, 0, 0.08, 6.5, 1.1, RGBColor(0x0D, 0x4F, 0x8A)) # slightly lighter left
# Title
tb(s1, 0.28, 0.10, 8.5, 0.62,
"ANTIDEPRESSANT DRUGS", 34, bold=True, color=WHITE)
tb(s1, 0.28, 0.70, 9.5, 0.42,
"Classification & Mechanisms of Action | 2nd Year MBBS Pharmacology",
12.5, color=L_BLUE)
# Badge
rect(s1, 10.65, 0.18, 2.45, 0.52, SKY)
tb(s1, 10.65, 0.18, 2.45, 0.52,
"Goodman & Gilman's 14e\nKaplan & Sadock's", 8,
bold=True, color=WHITE, align=PP_ALIGN.CENTER)
# ── 3 column cards ─────────────────────────────────────────────────
# Column x positions and widths
cols = [
(0.18, 4.18, DEEP_BLUE, SKY, L_BLUE, DARK_TEXT),
(4.54, 4.18, RGBColor(0x0B,0x55,0x45), TEAL, L_TEAL, DARK_TEXT),
(8.90, 4.24, RGBColor(0x42,0x1C,0x6B), PURPLE, L_PURPLE, DARK_TEXT),
]
cy = 1.30
ch = 5.98
for (cx, cw, bg, hdr_col, body_col, txt_col) in cols:
# Card body
rect(s1, cx, cy, cw, ch, bg)
# Top accent bar
rect(s1, cx, cy, cw, 0.44, hdr_col)
# ── Col 1: Classification ──────────────────────────────────────────
tb(s1, 0.18, 1.30, 4.18, 0.44,
" CLASSIFICATION", 13, bold=True, color=WHITE)
box1, tf1 = tb(s1, 0.28, 1.80, 4.0, 5.35,
"", 1, color=DARK_TEXT)
tf1.word_wrap = True
tf1.margin_left = Pt(4)
tf1.margin_top = Pt(4)
groups = [
("1. TRICYCLIC ANTIDEPRESSANTS (TCAs)",
["Imipramine, Amitriptyline",
"Clomipramine, Nortriptyline, Desipramine"],
GOLD),
("2. SSRIs – Selective Serotonin RI",
["Fluoxetine, Sertraline, Paroxetine",
"Citalopram, Escitalopram, Fluvoxamine"],
RGBColor(0x40,0xC8,0xF0)),
("3. SNRIs – Serotonin-NE RI",
["Venlafaxine, Duloxetine",
"Desvenlafaxine, Milnacipran"],
RGBColor(0x6EF0B8)),
("4. MAO INHIBITORS (MAOIs)",
["Phenelzine, Tranylcypromine (irreversible)",
"Moclobemide (RIMA – reversible)",
"Selegiline (selective MAO-B)"],
RGBColor(0xF8,0xB4,0x3A)),
("5. ATYPICALS / OTHERS",
["Bupropion – NE + DA reuptake inhibitor",
"Mirtazapine – NaSSA (α2 blocker)",
"Trazodone, Vortioxetine, Vilazodone"],
RGBColor(0xE8,0x80,0xD0)),
]
first = True
for (heading, drugs, hc) in groups:
p = tf1.paragraphs[0] if first else tf1.add_paragraph()
first = False
p.space_before = Pt(7)
r = p.add_run()
r.text = heading
r.font.name = "Calibri"; r.font.size = Pt(9); r.font.bold = True
r.font.color.rgb = hc
for d in drugs:
pd = tf1.add_paragraph(); pd.space_before = Pt(1)
rd = pd.add_run(); rd.text = " • " + d
rd.font.name = "Calibri"; rd.font.size = Pt(8.2)
rd.font.color.rgb = OFF_WHITE
# ── Col 2: Mechanisms ─────────────────────────────────────────────
tb(s1, 4.54, 1.30, 4.18, 0.44,
" MECHANISMS OF ACTION", 13, bold=True, color=WHITE)
box2, tf2 = tb(s1, 4.64, 1.80, 4.0, 5.35,
"", 1, color=DARK_TEXT)
tf2.word_wrap = True
tf2.margin_left = Pt(4)
tf2.margin_top = Pt(4)
mechs = [
("TCAs", RGBColor(0xF8,0xB4,0x3A), [
"Block NE & 5HT reuptake (NET + SERT)",
"Also block H1, muscarinic, α1 receptors",
"↑ NE & 5HT in synapse (G&G Fig 18-1)"
]),
("SSRIs", RGBColor(0x40,0xC8,0xF0), [
"Selectively block SERT (5HT transporter)",
"Initially ↑ 5HT1A autoreceptor stimulation",
"Chronic use → autoreceptor desensitization",
"Net result: ↑↑ synaptic 5HT",
"Therapeutic lag: 3–4 weeks"
]),
("SNRIs", RGBColor(0x6EF0B8), [
"Block both SERT and NET",
"↑ 5HT + ↑ NE neurotransmission",
"Higher doses → greater NE effect"
]),
("MAOIs", RGBColor(0xF8,0xD4,0x60), [
"Inhibit MAO-A (5HT, NE) ± MAO-B (DA)",
"↑ Monoamine availability in terminals",
"DRUG-FREE interval: 2 wks before MAOIs"
]),
("Bupropion", RGBColor(0xE8,0x80,0xD0), [
"Inhibits NE + Dopamine reuptake",
"No serotonergic activity → no sexual SE"
]),
("Mirtazapine", RGBColor(0xA8,0xD8,0xFF), [
"Blocks α2 autoreceptors → ↑ NE & 5HT",
"5HT2 & 5HT3 blockade → fewer GI/sexual SE"
]),
]
first2 = True
for (heading, hc, pts) in mechs:
p = tf2.paragraphs[0] if first2 else tf2.add_paragraph()
first2 = False
p.space_before = Pt(7)
r = p.add_run()
r.text = heading
r.font.name = "Calibri"; r.font.size = Pt(9); r.font.bold = True
r.font.color.rgb = hc
for pt in pts:
pd = tf2.add_paragraph(); pd.space_before = Pt(1)
rd = pd.add_run(); rd.text = " • " + pt
rd.font.name = "Calibri"; rd.font.size = Pt(8)
rd.font.color.rgb = OFF_WHITE
# ── Col 3: Indications & Key Facts ────────────────────────────────
tb(s1, 8.90, 1.30, 4.24, 0.44,
" INDICATIONS & KEY FACTS", 13, bold=True, color=WHITE)
box3, tf3 = tb(s1, 9.00, 1.80, 4.05, 5.35,
"", 1, color=DARK_TEXT)
tf3.word_wrap = True
tf3.margin_left = Pt(4)
tf3.margin_top = Pt(4)
ind_groups = [
("Primary Indications", RGBColor(0x90,0xE8,0xC0), [
"Major Depressive Disorder (MDD) – 1st line SSRIs",
"Generalised Anxiety Disorder (GAD)",
"OCD – SSRIs (high dose); Clomipramine",
"Panic Disorder – SSRIs, TCAs",
"PTSD – Sertraline, Paroxetine (FDA approved)",
"Neuropathic Pain – TCAs, Duloxetine",
"Bulimia Nervosa – Fluoxetine (FDA approved)",
"Enuresis – Imipramine",
"Smoking Cessation – Bupropion"
]),
("Therapeutic Lag", RGBColor(0xF8,0xD4,0x60), [
"Clinical response: 3–4 weeks",
"Sleep & appetite improve before mood",
"Full trial: 4–6 weeks at adequate dose",
"Maintenance: 6–12 months post-remission"
]),
("Key Cautions", RGBColor(0xFF,0x90,0x90), [
"TCAs: avoid in cardiac disease",
"FDA black-box: SSRIs in children/adolescents",
"All: monitor suicidal ideation early on",
"TCAs/SNRIs → may precipitate mania in bipolar"
]),
]
first3 = True
for (heading, hc, pts) in ind_groups:
p = tf3.paragraphs[0] if first3 else tf3.add_paragraph()
first3 = False
p.space_before = Pt(7)
r = p.add_run()
r.text = heading
r.font.name = "Calibri"; r.font.size = Pt(9); r.font.bold = True
r.font.color.rgb = hc
for pt in pts:
pd = tf3.add_paragraph(); pd.space_before = Pt(1)
rd = pd.add_run(); rd.text = " • " + pt
rd.font.name = "Calibri"; rd.font.size = Pt(8)
rd.font.color.rgb = OFF_WHITE
# Footer
rect(s1, 0, 7.22, 13.333, 0.28, RGBColor(0x07,0x1A,0x2E))
rect(s1, 0, 7.22, 13.333, 0.03, SKY)
tb(s1, 0.2, 7.24, 13.0, 0.26,
"Sources: Goodman & Gilman's 14e (Ch 18) | Kaplan & Sadock's Comprehensive Textbook of Psychiatry | Stahl's Essential Psychopharmacology",
7.5, color=L_BLUE, align=PP_ALIGN.CENTER)
# ═══════════════════════════════════════════════════════════════════════════
# SLIDE 2
# ═══════════════════════════════════════════════════════════════════════════
s2 = prs.slides.add_slide(blank)
# Background
rect(s2, 0, 0, 13.333, 7.5, NAVY)
rect(s2, 0, 0, 13.333, 0.08, CRIMSON)
# Header
rect(s2, 0, 0.08, 13.333, 1.10, RGBColor(0x45,0x0C,0x18))
rect(s2, 0, 0.08, 6.5, 1.10, RGBColor(0x6A,0x12,0x22))
tb(s2, 0.28, 0.10, 9.0, 0.62,
"ANTIDEPRESSANT DRUGS", 34, bold=True, color=WHITE)
tb(s2, 0.28, 0.70, 9.5, 0.42,
"Adverse Effects, Drug Interactions & Clinical Pearls | 2nd Year MBBS Pharmacology",
12.5, color=RGBColor(0xFF,0xCC,0xCC))
rect(s2, 10.65, 0.18, 2.45, 0.52, CRIMSON)
tb(s2, 10.65, 0.18, 2.45, 0.52,
"Goodman & Gilman's 14e\nAdams & Victor 12e", 8,
bold=True, color=WHITE, align=PP_ALIGN.CENTER)
# ── Row 1: 3 adverse effect cards ─────────────────────────────────
r1y = 1.30
r1h = 2.55
r1w = 4.18
gaps = [0.18, 4.54, 8.90]
hdr_cols = [RGBColor(0x0A,0x50,0x8A), WINE, TEAL]
bg_cols = [DEEP_BLUE, RGBColor(0x55,0x0F,0x1E), RGBColor(0x08,0x4A,0x3E)]
hdr_texts = ["TCA ADVERSE EFFECTS", "SSRI ADVERSE EFFECTS", "MAOI / OTHER ADRs"]
for gx, hc, bgc, ht in zip(gaps, hdr_cols, bg_cols, hdr_texts):
rect(s2, gx, r1y, r1w, r1h, bgc)
rect(s2, gx, r1y, r1w, 0.42, hc)
tb(s2, gx, r1y, r1w, 0.42, " " + ht, 11.5, bold=True, color=WHITE)
# TCA content
_, tftca = tb(s2, 0.28, r1y+0.46, 4.0, r1h-0.52, "", 1)
tftca.word_wrap = True; tftca.margin_left = Pt(4)
tca_lines = [
("Anticholinergic (ABCD):", RGBColor(0xF8,0xD0,0x60),
"Anorexia, Blurred vision, Constipation/urinary retention, Dry mouth"),
("Antihistaminic:", RGBColor(0xA0,0xD8,0xFF),
"Sedation, Weight gain"),
("α1 Blockade:", RGBColor(0xA0,0xFF,0xC0),
"Orthostatic hypotension, dizziness"),
("Cardiac:", RGBColor(0xFF,0x88,0x88),
"Arrhythmia, heart block – avoid in IHD/elderly"),
("Overdose – 3Cs:", RGBColor(0xFF,0x60,0x60),
"Convulsions, Coma, Cardiotoxicity (wide QRS)\nRx: IV Sodium Bicarbonate"),
]
f = True
for label, lc, detail in tca_lines:
p = tftca.paragraphs[0] if f else tftca.add_paragraph()
f = False; p.space_before = Pt(4)
r = p.add_run(); r.text = label + " "
r.font.name = "Calibri"; r.font.size = Pt(8.2); r.font.bold = True
r.font.color.rgb = lc
r2 = p.add_run(); r2.text = detail
r2.font.name = "Calibri"; r2.font.size = Pt(8)
r2.font.color.rgb = OFF_WHITE
# SSRI content
_, tfssri = tb(s2, 4.64, r1y+0.46, 4.0, r1h-0.52, "", 1)
tfssri.word_wrap = True; tfssri.margin_left = Pt(4)
ssri_lines = [
("GI effects:", RGBColor(0xF8,0xD0,0x60), "Nausea, diarrhoea (most common, early)"),
("Sexual dysfunction:", RGBColor(0xFF,0xA0,0xC0), "Anorgasmia, ↓ libido, erectile dysfunction"),
("CNS:", RGBColor(0xA0,0xD8,0xFF), "Insomnia/hypersomnia, headache, anxiety"),
("Discontinuation syndrome:", RGBColor(0xFF,0xC8,0x60),
"Paroxetine > others\n('FINISH' – Flu-like, Insomnia, Nausea, Sensory, Imbalance, Hyperarousal)"),
("Serotonin Syndrome:", RGBColor(0xFF,0x60,0x60),
"Hyperthermia, myoclonus, clonus,\ndelirium, diaphoresis – overdose/combo"),
("QTc prolongation:", RGBColor(0xFF,0x98,0x60), "Citalopram > others"),
]
f = True
for label, lc, detail in ssri_lines:
p = tfssri.paragraphs[0] if f else tfssri.add_paragraph()
f = False; p.space_before = Pt(3)
r = p.add_run(); r.text = label + " "
r.font.name = "Calibri"; r.font.size = Pt(8.2); r.font.bold = True
r.font.color.rgb = lc
r2 = p.add_run(); r2.text = detail
r2.font.name = "Calibri"; r2.font.size = Pt(8)
r2.font.color.rgb = OFF_WHITE
# MAOI/Others content
_, tfmaoi = tb(s2, 9.00, r1y+0.46, 4.05, r1h-0.52, "", 1)
tfmaoi.word_wrap = True; tfmaoi.margin_left = Pt(4)
maoi_lines = [
("MAOIs – Hypertensive Crisis:", RGBColor(0xFF,0x60,0x60),
"Tyramine-rich food (cheese, red wine)\n→ Severe HTN, intracranial haemorrhage"),
("MAOIs:", RGBColor(0xF8,0xD0,0x60), "Insomnia, orthostatic hypotension"),
("Bupropion:", RGBColor(0xA0,0xFF,0xC0), "Seizures (dose-dependent) – avoid in epilepsy"),
("Mirtazapine:", RGBColor(0xA0,0xD8,0xFF), "Sedation, significant weight gain"),
("Trazodone:", RGBColor(0xFF,0xA0,0xC0), "Priapism (rare but serious emergency)"),
("SNRIs:", RGBColor(0xF8,0xC8,0x60), "↑ BP at high doses (venlafaxine)"),
]
f = True
for label, lc, detail in maoi_lines:
p = tfmaoi.paragraphs[0] if f else tfmaoi.add_paragraph()
f = False; p.space_before = Pt(3)
r = p.add_run(); r.text = label + " "
r.font.name = "Calibri"; r.font.size = Pt(8.2); r.font.bold = True
r.font.color.rgb = lc
r2 = p.add_run(); r2.text = detail
r2.font.name = "Calibri"; r2.font.size = Pt(8)
r2.font.color.rgb = OFF_WHITE
# ── Row 2: Drug Interactions + Clinical Pearls ─────────────────────
r2y = r1y + r1h + 0.13
r2h = 2.55
di_w = 5.85
cp_w = 7.05
di_x = 0.18
cp_x = di_x + di_w + 0.15
rect(s2, di_x, r2y, di_w, r2h, RGBColor(0x3A,0x1A,0x55))
rect(s2, di_x, r2y, di_w, 0.42, PURPLE)
tb(s2, di_x, r2y, di_w, 0.42,
" ⚠ DRUG INTERACTIONS", 12, bold=True, color=WHITE)
rect(s2, cp_x, r2y, cp_w, r2h, RGBColor(0x05,0x3A,0x28))
rect(s2, cp_x, r2y, cp_w, 0.42, EMERALD)
tb(s2, cp_x, r2y, cp_w, 0.42,
" ★ CLINICAL PEARLS (High-Yield 2nd MBBS)", 12, bold=True, color=WHITE)
# Drug interactions
_, tfdi = tb(s2, di_x+0.10, r2y+0.46, di_w-0.20, r2h-0.52, "", 1)
tfdi.word_wrap = True; tfdi.margin_left = Pt(4)
di_pairs = [
("SSRIs + MAOIs →", RGBColor(0xFF,0x60,0x60),
"SEROTONIN SYNDROME (potentially fatal)\n2-week washout required between drugs"),
("SSRIs + Tramadol / Triptans →", RGBColor(0xFF,0xA0,0x60),
"Serotonin Syndrome"),
("TCAs + MAOIs →", RGBColor(0xFF,0x80,0x80),
"Serotonin Syndrome / Hypertensive crisis"),
("MAOIs + Tyramine foods →", RGBColor(0xF8,0xD4,0x60),
"Hypertensive crisis (cheese, red wine, beer)"),
("Fluoxetine (CYP2D6 inhibitor) →", RGBColor(0xC0,0xA0,0xFF),
"↑ levels of codeine, TCAs, antipsychotics"),
("SSRIs + NSAIDs / Warfarin →", RGBColor(0xA0,0xD8,0xFF),
"↑ Bleeding risk (platelet 5HT depletion)"),
("Citalopram + QTc drugs →", RGBColor(0x90,0xFF,0xD0),
"Torsades de Pointes risk"),
]
f = True
for label, lc, detail in di_pairs:
p = tfdi.paragraphs[0] if f else tfdi.add_paragraph()
f = False; p.space_before = Pt(4)
r = p.add_run(); r.text = label + " "
r.font.name = "Calibri"; r.font.size = Pt(8.2); r.font.bold = True
r.font.color.rgb = lc
r2 = p.add_run(); r2.text = detail
r2.font.name = "Calibri"; r2.font.size = Pt(8)
r2.font.color.rgb = OFF_WHITE
# Clinical Pearls
_, tfcp = tb(s2, cp_x+0.10, r2y+0.46, cp_w-0.20, r2h-0.52, "", 1)
tfcp.word_wrap = True; tfcp.margin_left = Pt(4)
pearls = [
(RGBColor(0x90,0xFF,0xD0),
"1st LINE for MDD: SSRIs (best safety/tolerability) – G&G Ch 18"),
(RGBColor(0xF8,0xD4,0x60),
"Fluoxetine: longest half-life (~7 days) – least discontinuation syndrome"),
(RGBColor(0xFF,0xA0,0xC0),
"Paroxetine: most anticholinergic SSRI; worst discontinuation syndrome"),
(RGBColor(0xA0,0xD8,0xFF),
"Amitriptyline: most sedating TCA | Imipramine: prototype TCA"),
(RGBColor(0xFF,0xC8,0x60),
"OCD: SSRIs needed at higher doses than for depression; Clomipramine most effective TCA for OCD"),
(RGBColor(0xC0,0xA0,0xFF),
"Duloxetine (SNRI): dual use – depression AND neuropathic pain/fibromyalgia"),
(RGBColor(0xA0,0xFF,0xC0),
"TCA overdose antidote: IV Sodium Bicarbonate (reverses wide QRS & arrhythmia)"),
(RGBColor(0xFF,0xA0,0x80),
"Pregnancy: SSRIs generally preferred; neonatal pulmonary HTN risk (near term)"),
(RGBColor(0xA8,0xE8,0xFF),
"Therapeutic lag 3–4 wks – ALWAYS explain to patient before starting therapy"),
(RGBColor(0xFF,0xE0,0x80),
"ECT: gold standard for treatment-resistant depression or severe suicidality"),
]
f = True
for pc, ptxt in pearls:
p = tfcp.paragraphs[0] if f else tfcp.add_paragraph()
f = False; p.space_before = Pt(3)
r = p.add_run(); r.text = "★ "
r.font.name = "Calibri"; r.font.size = Pt(8.5); r.font.bold = True
r.font.color.rgb = pc
r2 = p.add_run(); r2.text = ptxt
r2.font.name = "Calibri"; r2.font.size = Pt(8)
r2.font.color.rgb = OFF_WHITE
# Footer
rect(s2, 0, 7.22, 13.333, 0.28, RGBColor(0x20,0x06,0x0C))
rect(s2, 0, 7.22, 13.333, 0.03, CRIMSON)
tb(s2, 0.2, 7.24, 13.0, 0.26,
"Sources: Goodman & Gilman's 14e (Ch 18) | Kaplan & Sadock's Comprehensive Textbook of Psychiatry | Adams & Victor's Principles of Neurology 12e",
7.5, color=RGBColor(0xFF,0xCC,0xCC), align=PP_ALIGN.CENTER)
# ── Save ────────────────────────────────────────────────────────────
out = "/tmp/workspace/antidepressants-pptx/Antidepressant_Drugs_Coloured.pptx"
prs.save(out)
print("Saved:", out)
python /tmp/workspace/antidepressants-pptx/create_coloured_slides.py
~/antidepressants-pptx/create_coloured_slides.py
Successfully replaced 1 instance(s) of the string in '/tmp/workspace/antidepressants-pptx/create_coloured_slides.py'
grep -n "RGBColor(0x6E" /tmp/workspace/antidepressants-pptx/create_coloured_slides.py
~/antidepressants-pptx/create_coloured_slides.py
Successfully replaced 1 instance(s) of the string in '/tmp/workspace/antidepressants-pptx/create_coloured_slides.py'
python /tmp/workspace/antidepressants-pptx/create_coloured_slides.py 2>&1
python -c " from pptx import Presentation prs = Presentation('/tmp/workspace/antidepressants-pptx/Antidepressant_Drugs_Coloured.pptx') print(f'Slides: {len(prs.slides)}') for i, slide in enumerate(prs.slides, 1): print(f'--- Slide {i} shapes: {len(slide.shapes)} ---') for shape in slide.shapes: if shape.has_text_frame and shape.text_frame.text.strip(): print(' >', shape.text_frame.text[:70].replace(chr(10),' | ')) "
Antidepressant Drugs Coloured
Presentation · PPTX
Diagram of mechanism of action form colour full
~/antidepressants-pptx/create_moa_diagram.py
"""
Antidepressant Mechanism of Action – fully coloured diagram slide
Uses matplotlib to draw a rich synapse diagram, saves as PNG,
then embeds into a python-pptx slide.
"""
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from matplotlib.patches import FancyArrowPatch, FancyBboxPatch, Circle, Arc
from matplotlib.patches import FancyArrow
import matplotlib.patheffects as pe
import numpy as np
from io import BytesIO
# ── helpers ────────────────────────────────────────────────────────────────
def rounded_box(ax, x, y, w, h, fc, ec, lw=1.5, radius=0.04, alpha=1.0, zorder=3):
box = FancyBboxPatch((x - w/2, y - h/2), w, h,
boxstyle=f"round,pad={radius}",
facecolor=fc, edgecolor=ec,
linewidth=lw, alpha=alpha, zorder=zorder)
ax.add_patch(box)
return box
def arrow(ax, x1, y1, x2, y2, col, lw=2, style="-|>", zorder=5, size=12):
ax.annotate("", xy=(x2, y2), xytext=(x1, y1),
arrowprops=dict(arrowstyle=style,
color=col, lw=lw,
mutation_scale=size),
zorder=zorder)
def label(ax, x, y, txt, fs=9, col="white", bold=False, ha="center", va="center",
zorder=6, wrap=False):
weight = "bold" if bold else "normal"
ax.text(x, y, txt, fontsize=fs, color=col, fontweight=weight,
ha=ha, va=va, zorder=zorder,
fontfamily="DejaVu Sans")
def vesicle(ax, cx, cy, r, fc, ec, zorder=4):
c = Circle((cx, cy), r, facecolor=fc, edgecolor=ec, linewidth=1.2, zorder=zorder)
ax.add_patch(c)
# ═══════════════════════════════════════════════════════════════════════════
fig, ax = plt.subplots(figsize=(18, 10))
fig.patch.set_facecolor("#0A1628")
ax.set_facecolor("#0A1628")
ax.set_xlim(0, 18)
ax.set_ylim(0, 10)
ax.axis("off")
# ── Title ───────────────────────────────────────────────────────────────────
ax.text(9, 9.55, "ANTIDEPRESSANT DRUGS – MECHANISM OF ACTION",
fontsize=18, color="white", fontweight="bold",
ha="center", va="center",
bbox=dict(boxstyle="round,pad=0.4", facecolor="#10305A", edgecolor="#2E86C1", lw=2))
ax.text(9, 9.10, "Ref: Goodman & Gilman's Pharmacological Basis of Therapeutics, 14e | Stahl's Essential Psychopharmacology",
fontsize=8, color="#7FB3D3", ha="center", va="center")
# ═══════════════════════════════════════════════════════════════════════════
# PRE-SYNAPTIC NEURON (large rounded rect)
# ═══════════════════════════════════════════════════════════════════════════
pre_fc = "#0D3B66"
pre_ec = "#2980B9"
rounded_box(ax, 9, 7.0, 16.0, 2.50, pre_fc, pre_ec, lw=2.5, radius=0.12, zorder=2)
label(ax, 1.45, 7.80, "PRE-SYNAPTIC\nNEURON", fs=9, col="#85C1E9", bold=True, ha="center")
# Neuron body label
label(ax, 9, 7.95, "MONOAMINERGIC NEURON (Serotonergic / Noradrenergic)",
fs=10, col="#AED6F1", bold=True)
# ── Synthesis pathway ──────────────────────────────────────────────────────
rounded_box(ax, 2.8, 7.25, 2.2, 0.70, "#1A5276", "#5DADE2", lw=1.5, radius=0.06, zorder=4)
label(ax, 2.8, 7.25, "Tryptophan / Tyrosine\n→ 5-HT / NE Synthesis", fs=7.5, col="#AED6F1")
# MAO inside presynaptic
rounded_box(ax, 6.2, 6.82, 1.8, 0.58, "#6E2F2F", "#E74C3C", lw=1.5, radius=0.06, zorder=4)
label(ax, 6.2, 6.82, "MAO\n(degrades NE/5HT)", fs=7.5, col="#FADBD8")
# MAOI label
rounded_box(ax, 6.2, 6.18, 2.2, 0.52, "#922B21", "#FF5733", lw=2, radius=0.06, zorder=5)
label(ax, 6.2, 6.18, "MAO INHIBITORS (MAOIs)\nPhenelzine, Tranylcypromine", fs=7.5, col="white", bold=True)
arrow(ax, 6.2, 6.44, 6.2, 6.55, "#FF5733", lw=2)
# inhibition X
ax.text(6.35, 6.60, "✕", fontsize=12, color="#FF5733", ha="center", va="center",
fontweight="bold", zorder=6)
# ── Storage vesicles ───────────────────────────────────────────────────────
ves_y = 7.28
for vx in [8.0, 8.5, 9.0, 9.5, 10.0, 10.5, 11.0]:
vesicle(ax, vx, ves_y, 0.22, "#F1C40F", "#F39C12", zorder=5)
# neurotransmitter dot inside
vesicle(ax, vx, ves_y, 0.09, "#E74C3C", "#C0392B", zorder=6)
label(ax, 9.5, 7.65, "Storage Vesicles (5-HT / NE)", fs=8, col="#F9E79F")
# ── Reuptake transporter (SERT/NET) ───────────────────────────────────────
# Draw as a membrane protein channel
for tx in [7.8, 10.8]:
rounded_box(ax, tx, 6.44, 0.55, 0.85, "#1F618D", "#3498DB", lw=2, radius=0.08, zorder=6)
label(ax, tx, 6.70, "SERT\n/NET", fs=6.5, col="#AED6F1", bold=True)
# arrow showing reuptake (upward)
arrow(ax, tx, 6.05, tx, 6.02, "#3498DB", lw=1.8, style="-|>", size=10)
label(ax, 9.3, 5.70, "Reuptake transporters\n(SERT = 5-HT | NET = Norepinephrine)",
fs=7.5, col="#7FB3D3", ha="center")
# ── Autoreceptors (α2 / 5-HT1A) ────────────────────────────────────────────
rounded_box(ax, 14.0, 6.82, 1.6, 0.55, "#1E4D2B", "#27AE60", lw=1.5, radius=0.06, zorder=4)
label(ax, 14.0, 6.82, "α2 / 5-HT1A\nAutoreceptor", fs=7.5, col="#ABEBC6")
# Negative feedback arrow (autoreceptor → less release)
arrow(ax, 13.2, 6.55, 12.5, 6.20, "#27AE60", lw=1.5, style="-|>")
label(ax, 12.85, 6.35, "↓ NE/5HT\nRelease", fs=7, col="#82E0AA", ha="center")
# Mirtazapine blocks autoreceptor
rounded_box(ax, 15.7, 6.82, 1.75, 0.52, "#145A32", "#58D68D", lw=2, radius=0.06, zorder=5)
label(ax, 15.7, 6.82, "Mirtazapine\n(α2 blocker → ↑↑ NE+5HT)", fs=7.5, col="white", bold=True)
arrow(ax, 14.8, 6.82, 14.82, 6.82, "#58D68D", lw=2)
ax.text(14.90, 6.95, "✕", fontsize=12, color="#58D68D", ha="center", va="center",
fontweight="bold", zorder=7)
# ═══════════════════════════════════════════════════════════════════════════
# SYNAPTIC CLEFT
# ═══════════════════════════════════════════════════════════════════════════
# Gradient-like cleft (draw multiple horizontal bands)
for i, alpha in enumerate(np.linspace(0.18, 0.35, 6)):
cleft_strip = mpatches.Rectangle((1.0, 5.90 - i*0.04), 16, 0.07,
facecolor="#1A6FA8", alpha=alpha, zorder=1)
ax.add_patch(cleft_strip)
ax.text(0.45, 6.05, "SYNAPTIC\nCLEFT", fontsize=7.5, color="#85C1E9",
fontweight="bold", ha="center", va="center", rotation=90)
# Neurotransmitter dots in cleft
for dx, dy in [(7.5,6.10),(8.2,6.05),(8.9,6.15),(9.6,6.08),(10.3,6.12),(11.0,6.05),(11.7,6.10)]:
vesicle(ax, dx, dy, 0.14, "#E74C3C", "#922B21", zorder=5)
label(ax, 9.0, 6.28, "5-HT / NE / DA (released neurotransmitters)", fs=8, col="#F1948A")
# ── Release arrows (pre → cleft) ──────────────────────────────────────────
for rx in [8.5, 9.5, 10.5]:
arrow(ax, rx, 6.88, rx, 6.28, "#F39C12", lw=1.5, style="-|>", size=10)
# ═══════════════════════════════════════════════════════════════════════════
# DRUG BLOCK ANNOTATIONS on SERT/NET
# ═══════════════════════════════════════════════════════════════════════════
# SSRIs block SERT
rounded_box(ax, 7.8, 5.28, 2.8, 0.90, "#1A3A5C", "#2E86C1", lw=2.2, radius=0.08, zorder=7)
label(ax, 7.8, 5.52, "SSRIs", fs=9, col="#3498DB", bold=True)
label(ax, 7.8, 5.28, "Fluoxetine, Sertraline\nParoxetine, Citalopram", fs=7.5, col="#AED6F1")
label(ax, 7.8, 5.05, "↑↑ Synaptic 5-HT", fs=7.5, col="#82E0AA", bold=True)
arrow(ax, 7.8, 5.73, 7.8, 6.04, "#2E86C1", lw=2.2, style="-|>")
ax.text(7.95, 5.82, "BLOCK", fontsize=7, color="#2E86C1", ha="center", fontweight="bold", zorder=8)
# SNRIs block both
rounded_box(ax, 10.8, 5.28, 2.8, 0.90, "#1A3A5C", "#8E44AD", lw=2.2, radius=0.08, zorder=7)
label(ax, 10.8, 5.52, "SNRIs", fs=9, col="#A569BD", bold=True)
label(ax, 10.8, 5.28, "Venlafaxine, Duloxetine\nDesvenlafaxine", fs=7.5, col="#D7BDE2")
label(ax, 10.8, 5.05, "↑↑ 5-HT + ↑↑ NE", fs=7.5, col="#82E0AA", bold=True)
arrow(ax, 10.8, 5.73, 10.8, 6.04, "#8E44AD", lw=2.2, style="-|>")
ax.text(10.95, 5.82, "BLOCK", fontsize=7, color="#8E44AD", ha="center", fontweight="bold", zorder=8)
# TCAs block both – bridge arrow
rounded_box(ax, 9.3, 4.48, 3.2, 0.72, "#2D1B00", "#E67E22", lw=2.2, radius=0.08, zorder=7)
label(ax, 9.3, 4.68, "TCAs", fs=9, col="#F0A500", bold=True)
label(ax, 9.3, 4.48, "Imipramine, Amitriptyline\nClomipramine, Nortriptyline", fs=7.5, col="#FAD7A0")
label(ax, 9.3, 4.28, "Block NET + SERT + H1 + mAChR + α1", fs=7.5, col="#F8C471", bold=False)
# Bridge line from TCA box to both transporters
ax.annotate("", xy=(7.8, 5.0), xytext=(8.7, 4.85),
arrowprops=dict(arrowstyle="-|>", color="#E67E22", lw=2), zorder=7)
ax.annotate("", xy=(10.8, 5.0), xytext=(9.9, 4.85),
arrowprops=dict(arrowstyle="-|>", color="#E67E22", lw=2), zorder=7)
# Bupropion – DAT/NET
rounded_box(ax, 4.5, 5.28, 2.6, 0.90, "#1A2D1A", "#27AE60", lw=2.2, radius=0.08, zorder=7)
label(ax, 4.5, 5.52, "Bupropion", fs=9, col="#2ECC71", bold=True)
label(ax, 4.5, 5.28, "Blocks DAT + NET\n(↑↑ DA + NE)", fs=7.8, col="#ABEBC6")
label(ax, 4.5, 5.05, "No 5-HT → No sexual SE", fs=7.5, col="#82E0AA", bold=False)
arrow(ax, 4.5, 5.73, 5.5, 6.10, "#27AE60", lw=2.0, style="-|>")
# ═══════════════════════════════════════════════════════════════════════════
# POST-SYNAPTIC NEURON
# ═══════════════════════════════════════════════════════════════════════════
rounded_box(ax, 9, 3.30, 16.0, 2.12, "#1C0B2E", "#7D3C98", lw=2.5, radius=0.12, zorder=2)
label(ax, 1.45, 3.25, "POST-SYNAPTIC\nNEURON", fs=9, col="#C39BD3", bold=True, ha="center")
label(ax, 9, 4.08, "POST-SYNAPTIC MEMBRANE – Receptor Activation → Downstream Effects",
fs=10, col="#D7BDE2", bold=True)
# Post-synaptic receptors
receptors = [
(5.0, 3.42, "5-HT1A\nReceptor", "#1ABC9C", "#1ABC9C"),
(7.0, 3.42, "5-HT2A\nReceptor", "#8E44AD", "#D2B4DE"),
(9.0, 3.42, "β-AR\nReceptor", "#E74C3C", "#F1948A"),
(11.0, 3.42, "NET\nReceptor", "#E67E22", "#FAD7A0"),
(13.0, 3.42, "D2\nReceptor", "#3498DB", "#AED6F1"),
]
for rx, ry, rtxt, rfc, rec in receptors:
rounded_box(ax, rx, ry, 1.55, 0.68, rfc, rec, lw=1.5, radius=0.06, alpha=0.85, zorder=4)
label(ax, rx, ry, rtxt, fs=7.5, col="white", bold=True)
# Arrow from cleft to receptor
arrow(ax, rx, 6.0, rx, 3.77, rfc, lw=1.4, style="-|>", size=9, zorder=3)
# Downstream effect box
rounded_box(ax, 9, 2.72, 14.0, 0.75, "#0B0B1E", "#5B2C6F", lw=2, radius=0.08, zorder=4)
label(ax, 9, 2.88, "Downstream Effects: ↑ cAMP → PKA → CREB phosphorylation → ↑ BDNF expression", fs=8.5, col="#D7BDE2", bold=True)
label(ax, 9, 2.62, "→ Neuroplasticity | Hippocampal neurogenesis | Mood elevation | Therapeutic lag: 3–4 weeks",
fs=8, col="#A9CCE3")
# ── Trazodone / 5-HT2A block annotation ─────────────────────────────────
rounded_box(ax, 14.8, 3.28, 2.5, 0.72, "#2E1A0E", "#D35400", lw=2, radius=0.07, zorder=7)
label(ax, 14.8, 3.48, "Trazodone / Vortioxetine", fs=7.5, col="#FAD7A0", bold=True)
label(ax, 14.8, 3.22, "5-HT2A antagonist\n↓ Sexual SE, ↑ Sleep", fs=7.2, col="#F0B27A")
arrow(ax, 14.8, 3.64, 13.7, 3.70, "#D35400", lw=1.8, style="-|>")
ax.text(14.2, 3.78, "BLOCK", fontsize=7, color="#D35400", ha="center", fontweight="bold", zorder=8)
# ═══════════════════════════════════════════════════════════════════════════
# LEGEND (bottom strip)
# ═══════════════════════════════════════════════════════════════════════════
rounded_box(ax, 9, 1.50, 17.2, 1.55, "#050D1A", "#1A3A5C", lw=2, radius=0.08, zorder=3)
label(ax, 9, 2.15, "DRUG CLASS LEGEND", fs=9.5, col="white", bold=True)
legend_items = [
(1.4, 1.75, "#3498DB", "SSRIs (SERT block)\nFluoxetine, Sertraline, Paroxetine, Citalopram, Escitalopram"),
(5.2, 1.75, "#8E44AD", "SNRIs (SERT + NET block)\nVenlafaxine, Duloxetine, Desvenlafaxine"),
(9.0, 1.75, "#E67E22", "TCAs (NET + SERT + H1 + mAChR + α1 block)\nImipramine, Amitriptyline, Clomipramine"),
(12.9, 1.75, "#C0392B", "MAOIs (MAO inhibition)\nPhenelzine, Tranylcypromine, Moclobemide"),
(16.2, 1.75, "#27AE60", "Others\nBupropion, Mirtazapine, Trazodone"),
]
for lx, ly, lc, ltxt in legend_items:
vesicle(ax, lx - 0.5, ly + 0.12, 0.15, lc, "white", zorder=5)
lines = ltxt.split("\n")
ax.text(lx - 0.28, ly + 0.18, lines[0], fontsize=7.5, color=lc,
fontweight="bold", va="center")
ax.text(lx - 0.28, ly - 0.02, lines[1], fontsize=6.5, color="#BDC3C7", va="center")
# ═══════════════════════════════════════════════════════════════════════════
plt.tight_layout(pad=0)
buf = BytesIO()
fig.savefig(buf, format="png", dpi=150, bbox_inches="tight",
facecolor=fig.get_facecolor())
buf.seek(0)
# ── Embed into PPTX ─────────────────────────────────────────────────────────
from pptx import Presentation
from pptx.util import Inches, Pt
from pptx.dml.color import RGBColor
from pptx.enum.text import PP_ALIGN
prs = Presentation()
prs.slide_width = Inches(13.333)
prs.slide_height = Inches(7.5)
blank = prs.slide_layouts[6]
slide = prs.slides.add_slide(blank)
# Background
bg = slide.shapes.add_shape(1, Inches(0), Inches(0), Inches(13.333), Inches(7.5))
bg.fill.solid(); bg.fill.fore_color.rgb = RGBColor(0x0A, 0x16, 0x28)
bg.line.fill.background()
# Embed diagram image
slide.shapes.add_picture(buf, Inches(0), Inches(0),
width=Inches(13.333), height=Inches(7.5))
out = "/tmp/workspace/antidepressants-pptx/Antidepressant_MOA_Diagram.pptx"
prs.save(out)
# Also save the PNG separately
buf.seek(0)
with open("/tmp/workspace/antidepressants-pptx/Antidepressant_MOA_Diagram.png", "wb") as f:
f.write(buf.read())
print("Saved PPTX:", out)
print("Saved PNG: /tmp/workspace/antidepressants-pptx/Antidepressant_MOA_Diagram.png")
python /tmp/workspace/antidepressants-pptx/create_moa_diagram.py 2>&1
python -c " from PIL import Image img = Image.open('/tmp/workspace/antidepressants-pptx/Antidepressant_MOA_Diagram.png') print('Size:', img.size, '| Mode:', img.mode) # Check it's not blank import numpy as np arr = np.array(img) print('Min pixel:', arr.min(), '| Max pixel:', arr.max()) print('Non-background pixels:', (arr != arr[0,0]).sum()) "
python -c " from pptx import Presentation prs = Presentation('/tmp/workspace/antidepressants-pptx/Antidepressant_MOA_Diagram.pptx') print('Slides:', len(prs.slides)) s = prs.slides[0] print('Shapes:', len(s.shapes)) for sh in s.shapes: print(' -', sh.shape_type, sh.name, sh.width, sh.height) "
Antidepressant MOA Diagram
Presentation · PPTX
Antidepressant MOA Diagram
Image · PNG