Need ppt regarding hypothyroid drugs mechanism of action onset duration and side effects

Reading File
Reading File
Reading File
Finding Sources
Finding Sources
Reading File
Finding Sources
Reading File
Reading File
Reading File
Running Command

mkdir -p /tmp/workspace/hypothyroid-ppt && ls /tmp/workspace/hypothyroid-ppt/

Writing File

~/hypothyroid-ppt/create_ppt.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
from io import BytesIO

prs = Presentation()
prs.slide_width = Inches(13.333)
prs.slide_height = Inches(7.5)

blank = prs.slide_layouts[6]

# Color palette
DARK_BLUE   = RGBColor(0x0D, 0x47, 0xA1)   # deep blue header
TEAL        = RGBColor(0x00, 0x89, 0x7B)   # teal accent
LIGHT_TEAL  = RGBColor(0xB2, 0xDF, 0xDB)   # light teal bg for cells
LIGHT_BLUE  = RGBColor(0xE3, 0xF2, 0xFD)   # slide background
WHITE       = RGBColor(0xFF, 0xFF, 0xFF)
DARK_GRAY   = RGBColor(0x21, 0x21, 0x21)
MED_GRAY    = RGBColor(0x55, 0x55, 0x55)
ACCENT_RED  = RGBColor(0xC6, 0x28, 0x28)
AMBER       = RGBColor(0xFF, 0x8F, 0x00)
HEADING_BG  = RGBColor(0x1A, 0x23, 0x7E)   # indigo dark for header bars


def set_bg(slide, color):
    """Fill slide background with a solid color."""
    background = slide.background
    fill = background.fill
    fill.solid()
    fill.fore_color.rgb = color


def add_rect(slide, x, y, w, h, fill_color, line_color=None, line_width=Pt(0)):
    shape = slide.shapes.add_shape(
        1,  # MSO_SHAPE_TYPE.RECTANGLE
        Inches(x), Inches(y), Inches(w), Inches(h)
    )
    shape.fill.solid()
    shape.fill.fore_color.rgb = fill_color
    if line_color:
        shape.line.color.rgb = line_color
        shape.line.width = line_width
    else:
        shape.line.fill.background()
    return shape


def add_text(slide, text, x, y, w, h, font_size, bold=False, color=DARK_GRAY,
             align=PP_ALIGN.LEFT, italic=False, wrap=True):
    tb = slide.shapes.add_textbox(Inches(x), Inches(y), Inches(w), Inches(h))
    tf = tb.text_frame
    tf.word_wrap = 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.size = Pt(font_size)
    run.font.bold = bold
    run.font.italic = italic
    run.font.color.rgb = color
    run.font.name = "Calibri"
    return tb


def add_bullet_box(slide, items, x, y, w, h, font_size=13, title=None,
                   title_color=DARK_BLUE, bullet_color=DARK_GRAY, bg_color=None,
                   title_size=14):
    if bg_color:
        add_rect(slide, x, y, w, h, bg_color)
    if title:
        add_text(slide, title, x+0.05, y+0.05, w-0.1, 0.32,
                 title_size, bold=True, color=title_color)
        start_y = y + 0.38
        box_h = h - 0.38
    else:
        start_y = y + 0.05
        box_h = h - 0.1

    tb = slide.shapes.add_textbox(
        Inches(x+0.1), Inches(start_y), Inches(w-0.2), Inches(box_h))
    tf = tb.text_frame
    tf.word_wrap = True
    tf.margin_left = Pt(2)
    tf.margin_right = Pt(2)
    tf.margin_top = Pt(2)
    tf.margin_bottom = Pt(2)
    for i, item in enumerate(items):
        if i == 0:
            p = tf.paragraphs[0]
        else:
            p = tf.add_paragraph()
        p.text = f"\u2022  {item}"
        p.space_before = Pt(3)
        p.space_after = Pt(2)
        for run in p.runs:
            run.font.size = Pt(font_size)
            run.font.color.rgb = bullet_color
            run.font.name = "Calibri"
    return tb


def header_bar(slide, title, subtitle=None):
    """Add a dark header bar at the top of a content slide."""
    add_rect(slide, 0, 0, 13.333, 1.1, HEADING_BG)
    add_text(slide, title, 0.3, 0.1, 12.5, 0.6,
             28, bold=True, color=WHITE, align=PP_ALIGN.LEFT)
    if subtitle:
        add_text(slide, subtitle, 0.3, 0.65, 12.5, 0.38,
                 14, color=RGBColor(0xBB, 0xDE, 0xFB), align=PP_ALIGN.LEFT)
    # teal accent line
    add_rect(slide, 0, 1.08, 13.333, 0.06, TEAL)


def footer(slide, text="Hypothyroid Drugs | Pharmacology"):
    add_rect(slide, 0, 7.2, 13.333, 0.3, HEADING_BG)
    add_text(slide, text, 0.3, 7.2, 12.5, 0.3,
             10, color=RGBColor(0xBB, 0xDE, 0xFB), align=PP_ALIGN.LEFT)


# ─────────────────────────────────────────────
# SLIDE 1 – Title Slide
# ─────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
set_bg(slide, RGBColor(0xE8, 0xEA, 0xF6))

# Big dark band
add_rect(slide, 0, 1.5, 13.333, 3.5, HEADING_BG)
add_rect(slide, 0, 4.95, 13.333, 0.1, TEAL)

add_text(slide, "HYPOTHYROID DRUGS", 0.5, 1.7, 12.3, 1.2,
         44, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
add_text(slide, "Mechanism of Action  |  Onset & Duration  |  Side Effects",
         0.5, 2.9, 12.3, 0.8, 20, color=RGBColor(0xBB, 0xDE, 0xFB),
         align=PP_ALIGN.CENTER)
add_text(slide, "Pharmacology Reference — Lippincott & Goodman & Gilman",
         0.5, 3.7, 12.3, 0.55, 13,
         color=RGBColor(0xCC, 0xCC, 0xCC), align=PP_ALIGN.CENTER)

# decorative teal squares
for xi in [0.5, 1.1, 1.7]:
    add_rect(slide, xi, 5.2, 0.45, 0.45, TEAL)
add_rect(slide, 0.5, 5.8, 1.7, 0.08, TEAL)

add_text(slide, "Prepared for Educational Use", 0.5, 6.5, 12.3, 0.5,
         12, color=MED_GRAY, align=PP_ALIGN.CENTER, italic=True)

# ─────────────────────────────────────────────
# SLIDE 2 – Overview of Thyroid Axis
# ─────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
set_bg(slide, RGBColor(0xF5, 0xF5, 0xF5))
header_bar(slide, "Thyroid Axis & Hypothyroidism",
           "Understanding the feedback axis is key to drug targeting")
footer(slide)

add_rect(slide, 0.3, 1.25, 12.7, 5.75, WHITE,
         line_color=RGBColor(0xDD, 0xDD, 0xDD), line_width=Pt(1))

# Left: Axis box
add_rect(slide, 0.5, 1.45, 5.5, 4.9, RGBColor(0xE8, 0xF5, 0xE9))
add_text(slide, "HPT Axis (Normal)", 0.55, 1.5, 5.4, 0.4, 15,
         bold=True, color=TEAL)

axis_steps = [
    "1.  Hypothalamus secretes TRH (thyrotropin-releasing hormone)",
    "2.  Anterior pituitary releases TSH (thyroid-stimulating hormone)",
    "3.  TSH stimulates thyroid → synthesis & release of T3 and T4",
    "4.  T3/T4 exert negative feedback on hypothalamus & pituitary",
    "5.  T4 (thyroxine) is peripheral reservoir → converted to active T3",
]
add_bullet_box(slide, axis_steps, 0.5, 1.95, 5.5, 3.5, font_size=12,
               bullet_color=DARK_GRAY)

# Right: Hypothyroidism
add_rect(slide, 6.3, 1.45, 6.3, 2.3, RGBColor(0xFF, 0xEB, 0xEE))
add_text(slide, "Hypothyroidism — Features", 6.35, 1.5, 6.2, 0.4, 15,
         bold=True, color=ACCENT_RED)
hypo_feat = [
    "Elevated TSH (most sensitive marker)",
    "Low free T4 / T3",
    "Bradycardia, cold intolerance, weight gain",
    "Fatigue, constipation, dry skin",
    "Myxedema in severe cases; cretinism if congenital",
]
add_bullet_box(slide, hypo_feat, 6.3, 1.95, 6.3, 1.75, font_size=12,
               bullet_color=DARK_GRAY)

# Right-bottom: Causes
add_rect(slide, 6.3, 3.85, 6.3, 2.0, RGBColor(0xFFF, 0xF8, 0xE1))
add_rect(slide, 6.3, 3.85, 6.3, 2.0, RGBColor(0xFF, 0xF9, 0xC4))
add_text(slide, "Common Causes", 6.35, 3.9, 6.2, 0.4, 15,
         bold=True, color=AMBER)
causes = [
    "Hashimoto's thyroiditis (autoimmune — most common)",
    "Post-radioiodine / post-surgical",
    "Iodine deficiency",
    "Drugs: amiodarone, lithium, interferon",
    "Central (hypothalamic/pituitary) — rare",
]
add_bullet_box(slide, causes, 6.3, 4.35, 6.3, 1.45, font_size=12,
               bullet_color=DARK_GRAY)

# ─────────────────────────────────────────────
# SLIDE 3 – Drug Classification
# ─────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
set_bg(slide, RGBColor(0xF5, 0xF5, 0xF5))
header_bar(slide, "Classification of Drugs Used in Hypothyroidism",
           "Replacement therapy is primary; adjuncts address specific situations")
footer(slide)

classes = [
    ("THYROID HORMONE REPLACEMENT\n(PRIMARY THERAPY)",
     DARK_BLUE,
     RGBColor(0xE3, 0xF2, 0xFD),
     ["Levothyroxine (T4) — first-line", "Liothyronine (T3)", "Liotrix (T3 + T4 combo)", "Desiccated thyroid extract (historical/alt)"]),
    ("ADJUNCT / SPECIAL SITUATIONS",
     TEAL,
     RGBColor(0xE0, 0xF2, 0xF1),
     ["β-Blockers (propranolol) — for symptoms in thyroid storm", "Iodide supplements (severe deficiency)", "Selenium supplementation", "Vitamin D (associated deficiency)"]),
    ("DRUGS CAUSING HYPOTHYROIDISM\n(Awareness — not treatment)",
     ACCENT_RED,
     RGBColor(0xFF, 0xEB, 0xEE),
     ["Amiodarone (iodine-rich)", "Lithium (inhibits thyroid secretion)", "Interferon-alpha", "Thioamides (PTU, methimazole) — when over-treated"]),
]

x_positions = [0.4, 4.65, 8.9]
for i, (title, title_col, bg_col, items) in enumerate(classes):
    x = x_positions[i]
    add_rect(slide, x, 1.25, 4.1, 5.85, bg_col,
             line_color=title_col, line_width=Pt(1.5))
    add_rect(slide, x, 1.25, 4.1, 0.7, title_col)
    add_text(slide, title, x+0.1, 1.28, 3.9, 0.65,
             11.5, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
    add_bullet_box(slide, items, x, 1.98, 4.1, 4.4,
                   font_size=12.5, bullet_color=DARK_GRAY)

# ─────────────────────────────────────────────
# SLIDE 4 – Levothyroxine (T4)
# ─────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
set_bg(slide, RGBColor(0xF5, 0xF5, 0xF5))
header_bar(slide, "Levothyroxine (T4)  —  First-Line Drug",
           "Synthetic L-thyroxine · Most widely prescribed thyroid preparation")
footer(slide)

# 4 info boxes
boxes = [
    ("MECHANISM OF ACTION", DARK_BLUE, RGBColor(0xE3, 0xF2, 0xFD),
     ["Synthetic form of T4 — identical to endogenous thyroxine",
      "Absorbed orally → distributed to peripheral tissues",
      "Converted to active T3 by 5'-deiodinase in liver, kidney, and periphery",
      "T3 enters the nucleus → binds thyroid hormone receptors (TRα, TRβ)",
      "Activates gene transcription → raises basal metabolic rate",
      "Stimulates protein synthesis, cardiac output, CNS development",
      "Exerts negative feedback on TSH and TRH"]),
    ("ONSET & DURATION", TEAL, RGBColor(0xE0, 0xF2, 0xF1),
     ["Oral bioavailability: ~70–80% (take on empty stomach)",
      "Onset of effect: 3–5 days (T4 half-life ~7 days)",
      "Symptom improvement: within 2–4 weeks",
      "Steady state: achieved in ~6–8 weeks",
      "Duration of action: 1–2 weeks after last dose",
      "TSH should be re-checked 6–8 weeks post-initiation or dose change",
      "Dose: individualized; usual 1.6 mcg/kg/day"]),
    ("SIDE EFFECTS / TOXICITY", ACCENT_RED, RGBColor(0xFF, 0xEB, 0xEE),
     ["Toxicity mirrors hyperthyroidism (from over-replacement):",
      "Palpitations, tachycardia, arrhythmia (AF risk in elderly)",
      "Heat intolerance, excessive sweating",
      "Weight loss, increased appetite",
      "Tremors, anxiety, insomnia, irritability",
      "Osteoporosis with prolonged over-treatment",
      "Angina in patients with CAD (start low, go slow)"]),
    ("DRUG INTERACTIONS & NOTES", AMBER, RGBColor(0xFF, 0xF9, 0xC4),
     ["Absorption reduced by: Ca²⁺, Fe²⁺, Al³⁺ antacids, food (take 30 min before meals)",
      "Metabolism increased by: phenytoin, rifampin, phenobarbital (CYP450 inducers)",
      "Cholestyramine reduces absorption — separate by 4 h",
      "Warfarin sensitivity increased — monitor INR",
      "Avoid biotin supplements at time of TSH testing (false results)",
      "Pregnancy: dose requirement increases ~30–50%"]),
]

positions = [(0.3, 1.2, 6.4, 5.9), (6.85, 1.2, 6.15, 5.9),
             (0.3, 4.1, 6.4, 3.0), (6.85, 4.1, 6.15, 3.0)]

for (title, title_col, bg_col, items), (x, y, w, h) in zip(boxes[:2], positions[:2]):
    add_rect(slide, x, y, w, h, bg_col,
             line_color=title_col, line_width=Pt(1.2))
    add_rect(slide, x, y, w, 0.45, title_col)
    add_text(slide, title, x+0.1, y+0.04, w-0.2, 0.38,
             12, bold=True, color=WHITE)
    add_bullet_box(slide, items, x, y+0.48, w, h-0.55,
                   font_size=11.5, bullet_color=DARK_GRAY)

# ─────────────────────────────────────────────
# SLIDE 5 – Liothyronine (T3) & Liotrix
# ─────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
set_bg(slide, RGBColor(0xF5, 0xF5, 0xF5))
header_bar(slide, "Liothyronine (T3) & Liotrix (T3/T4 Combination)",
           "Alternative thyroid hormone preparations")
footer(slide)

# Liothyronine box LEFT
add_rect(slide, 0.3, 1.25, 6.2, 5.9, RGBColor(0xE8, 0xF5, 0xE9),
         line_color=TEAL, line_width=Pt(1.5))
add_rect(slide, 0.3, 1.25, 6.2, 0.5, TEAL)
add_text(slide, "LIOTHYRONINE (T3)  —  Cytomel", 0.4, 1.28, 6.0, 0.45,
         14, bold=True, color=WHITE)

t3_sections = [
    ("Mechanism of Action:",
     ["Synthetic T3 — the biologically active form",
      "Directly binds nuclear thyroid hormone receptors (TRα, TRβ)",
      "No conversion required (unlike T4 → T3 conversion step)",
      "Activates gene transcription → metabolic effects faster than T4"]),
    ("Onset & Duration:",
     ["Rapid onset: within 2–4 hours of oral dose",
      "Peak effect: 2–3 days",
      "Half-life: ~1 day (much shorter than T4)",
      "Duration: short; requires 2–3x daily dosing",
      "Steady state: 1–2 weeks"]),
    ("Side Effects:",
     ["Greater cardiovascular risk than T4 (rapid T3 surges)",
      "Palpitations, angina, arrhythmias",
      "Anxiety, insomnia, sweating, weight loss",
      "Harder to maintain stable levels than T4",
      "NOT preferred for routine hypothyroidism"]),
    ("Indications:",
     ["Myxedema coma (IV form — rapid action needed)",
      "Thyroid suppression testing",
      "Patients with T4-to-T3 conversion defects",
      "Some adjunct use in refractory depression"]),
]

y_pos = 1.85
for sec_title, items in t3_sections:
    add_text(slide, sec_title, 0.4, y_pos, 6.0, 0.3, 12,
             bold=True, color=TEAL)
    add_bullet_box(slide, items, 0.4, y_pos+0.3, 6.0, len(items)*0.28+0.1,
                   font_size=11, bullet_color=DARK_GRAY)
    y_pos += len(items)*0.28 + 0.48

# Liotrix box RIGHT
add_rect(slide, 6.85, 1.25, 6.15, 5.9, RGBColor(0xFFF, 0xF8, 0xE1),
         line_color=AMBER, line_width=Pt(1.5))
add_rect(slide, 6.85, 1.25, 6.15, 0.5, AMBER)
add_text(slide, "LIOTRIX (T3 + T4 COMBO)  —  Thyrolar", 6.95, 1.28, 5.95, 0.45,
         13, bold=True, color=WHITE)

liotrix_data = [
    ("What is it?",
     ["Fixed ratio combination of T3:T4 = 1:4",
      "Attempts to mimic physiological hormone secretion",
      "Contains both T4 (slow) and T3 (fast-acting) components"]),
    ("Mechanism:",
     ["Combined nuclear receptor activation by both T3 and T4",
      "T4 component provides sustained baseline effect",
      "T3 component provides rapid onset supplementation"]),
    ("Onset & Duration:",
     ["Onset: faster than levothyroxine alone (T3 component)",
      "Duration: intermediate — daily dosing",
      "Steady state: ~1–2 weeks"]),
    ("Side Effects:",
     ["Greater CV risk vs. levothyroxine alone",
      "T3 peaks can cause palpitations, anxiety",
      "Difficult to fine-tune dosing"]),
    ("Current Status:",
     ["Rarely preferred over levothyroxine monotherapy",
      "No consistent evidence of superiority in RCTs",
      "May suit patients with persistent symptoms on T4 alone",
      "Desiccated thyroid extract (DTE) similar concept — porcine-derived"]),
]

y_pos = 1.85
for sec_title, items in liotrix_data:
    add_text(slide, sec_title, 6.95, y_pos, 5.95, 0.3, 12,
             bold=True, color=AMBER)
    add_bullet_box(slide, items, 6.95, y_pos+0.3, 5.95, len(items)*0.27+0.1,
                   font_size=11, bullet_color=DARK_GRAY)
    y_pos += len(items)*0.27 + 0.48

# ─────────────────────────────────────────────
# SLIDE 6 – Comparison Table
# ─────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
set_bg(slide, RGBColor(0xF5, 0xF5, 0xF5))
header_bar(slide, "Comparative Summary — Hypothyroid Drugs",
           "At-a-glance reference for all major thyroid hormone preparations")
footer(slide)

# Table via shapes
table_data = [
    ["Feature", "Levothyroxine (T4)", "Liothyronine (T3)", "Liotrix (T3+T4)", "Desiccated Thyroid"],
    ["Class", "Synthetic T4", "Synthetic T3", "T3:T4 = 1:4", "Animal-derived (porcine)"],
    ["Mechanism", "T4 → T3 conversion\n→ nuclear TRα/TRβ", "Direct TRα/TRβ activation\n(no conversion needed)", "Both T4 & T3\nnuclear activation", "Both T4 & T3\n+ calcitonin"],
    ["Onset", "3–5 days\n(symptom: 2–4 wks)", "2–4 hours\n(peak: 2–3 days)", "Faster than T4\n(T3 component)", "Similar to liotrix"],
    ["Half-life", "~7 days", "~1 day", "Mixed: ~1d / 7d", "Mixed"],
    ["Duration", "Long (~1–2 wks)", "Short (~24 h)", "Intermediate", "Intermediate"],
    ["Dosing", "Once daily", "2–3× daily", "Once daily", "Once–twice daily"],
    ["Preferred for", "Routine hypothyroidism\n(First-line)", "Myxedema coma\nT4 conversion defect", "Persistent symptoms\non T4 alone", "Patient preference\n(alternative)"],
    ["Side Effects", "Tachycardia, anxiety,\nosteoporosis (excess)", "High CV risk\nArrhythmia, angina", "CV risk from T3\npeaks", "Unpredictable T3\nlevels"],
    ["Monitoring", "TSH (q6–8 wks)", "Free T3, TSH", "TSH + free T3", "TSH + free T3/T4"],
]

col_widths = [1.8, 2.3, 2.3, 2.3, 2.3]
col_colors = [HEADING_BG, RGBColor(0xE3, 0xF2, 0xFD), RGBColor(0xE0, 0xF2, 0xF1),
              RGBColor(0xFF, 0xF9, 0xC4), RGBColor(0xFB, 0xE9, 0xE7)]
header_text_colors = [WHITE, DARK_BLUE, TEAL, AMBER, ACCENT_RED]

start_x = 0.35
row_height = 0.57
start_y = 1.2

for row_i, row in enumerate(table_data):
    x = start_x
    for col_i, cell_text in enumerate(row):
        w = col_widths[col_i]
        if row_i == 0:
            bg = HEADING_BG if col_i == 0 else [DARK_BLUE, TEAL, AMBER, ACCENT_RED][col_i-1]
            tc = WHITE
            fs = 11
            bold = True
        else:
            bg = RGBColor(0xEE, 0xEE, 0xEE) if col_i == 0 else (
                WHITE if row_i % 2 == 0 else col_colors[col_i])
            tc = DARK_GRAY if col_i > 0 else DARK_BLUE
            fs = 10
            bold = col_i == 0

        add_rect(slide, x, start_y + row_i * row_height, w, row_height,
                 bg, line_color=RGBColor(0xBB, 0xBB, 0xBB), line_width=Pt(0.5))
        add_text(slide, cell_text,
                 x+0.04, start_y + row_i * row_height + 0.04,
                 w-0.08, row_height-0.08, fs, bold=bold, color=tc,
                 align=PP_ALIGN.CENTER, wrap=True)
        x += w

# ─────────────────────────────────────────────
# SLIDE 7 – Special Situations
# ─────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
set_bg(slide, RGBColor(0xF5, 0xF5, 0xF5))
header_bar(slide, "Special Clinical Situations",
           "Dose adjustments, monitoring, and cautions in key populations")
footer(slide)

situations = [
    ("PREGNANCY", TEAL, RGBColor(0xE0, 0xF2, 0xF1),
     ["T4 requirement increases 30–50% during pregnancy (especially 1st trimester)",
      "Untreated hypothyroidism → fetal neurological impairment, preterm birth",
      "Goal: maintain TSH in trimester-specific ranges (1st trim: 0.1–2.5 mIU/L)",
      "TSH should be monitored every 4 weeks during early pregnancy",
      "IV levothyroxine if unable to take orally (1/2 oral dose)",
      "Postpartum: dose usually returns to pre-pregnancy level"]),
    ("MYXEDEMA COMA", ACCENT_RED, RGBColor(0xFF, 0xEB, 0xEE),
     ["Life-threatening; mortality up to 50% without treatment",
      "IV levothyroxine 200–400 mcg loading dose + 50–100 mcg/day maintenance",
      "OR IV liothyronine (T3): 5–20 mcg; faster onset — preferred by some",
      "Combination T3 + T4 IV often used initially",
      "Concurrent IV hydrocortisone (exclude adrenal insufficiency first)",
      "Supportive: warming, ventilatory support, treat precipitants"]),
    ("ELDERLY PATIENTS", DARK_BLUE, RGBColor(0xE3, 0xF2, 0xFD),
     ["Start at low dose: 12.5–25 mcg/day levothyroxine",
      "Titrate slowly (q4–6 weeks) — higher AF and angina risk",
      "Target TSH may be higher (1–4 mIU/L) in elderly",
      "Osteoporosis risk with over-replacement — monitor bone density",
      "Review for polypharmacy interactions (digoxin, warfarin, Ca²⁺)"]),
    ("CARDIAC DISEASE", AMBER, RGBColor(0xFF, 0xF9, 0xC4),
     ["Start very low: 12.5 mcg/day",
      "Rapid normalization of thyroid function can precipitate angina/MI",
      "Avoid T3 preparations (rapid CV effects)",
      "β-Blockers may be co-administered to control heart rate initially",
      "Goal TSH: within normal range but err slightly on higher side"]),
]

xs = [0.3, 0.3, 6.85, 6.85]
ys = [1.25, 4.15, 1.25, 4.15]
ws = [6.25, 6.25, 6.15, 6.15]
hs = [2.75, 2.75, 2.75, 2.75]

for (title, title_col, bg_col, items), x, y, w, h in zip(situations, xs, ys, ws, hs):
    add_rect(slide, x, y, w, h, bg_col,
             line_color=title_col, line_width=Pt(1.2))
    add_rect(slide, x, y, w, 0.42, title_col)
    add_text(slide, title, x+0.1, y+0.04, w-0.2, 0.38,
             13, bold=True, color=WHITE)
    add_bullet_box(slide, items, x, y+0.45, w, h-0.5,
                   font_size=10.5, bullet_color=DARK_GRAY)

# ─────────────────────────────────────────────
# SLIDE 8 – Side Effects Deep Dive
# ─────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
set_bg(slide, RGBColor(0xF5, 0xF5, 0xF5))
header_bar(slide, "Side Effects — Detailed Overview",
           "Effects reflect over-replacement (iatrogenic hyperthyroidism)")
footer(slide)

systems = [
    ("CARDIOVASCULAR", ACCENT_RED,
     ["Tachycardia, palpitations",
      "Atrial fibrillation (especially elderly)",
      "Angina pectoris / worsening IHD",
      "Hypertension", "Cardiac hypertrophy with chronic excess"]),
    ("NEUROLOGICAL / PSYCHIATRIC", DARK_BLUE,
     ["Tremors (fine intentional tremor)",
      "Anxiety, restlessness, irritability",
      "Insomnia", "Headache", "Seizures (rare, very high doses)"]),
    ("MUSCULOSKELETAL", TEAL,
     ["Osteoporosis / decreased BMD (chronic over-treatment)",
      "Muscle weakness, myopathy",
      "Joint pain",
      "Fracture risk increased"]),
    ("METABOLIC / GI", AMBER,
     ["Weight loss, increased appetite",
      "Heat intolerance, diaphoresis",
      "Diarrhea / increased bowel frequency",
      "Menstrual irregularities",
      "Impaired glucose tolerance"]),
    ("PAEDIATRIC / OBSTETRIC", RGBColor(0x6A, 0x1B, 0x9A),
     ["Craniosynostosis with over-treatment in neonates",
      "Advanced bone age in children",
      "Miscarriage / fetal growth restriction if over-dosed",
      "Maternal arrhythmia"]),
    ("UNDER-TREATMENT\n(Residual hypothyroidism)", MED_GRAY,
     ["Persistent fatigue, cognitive slowing",
      "Continued weight gain",
      "Hyperlipidemia",
      "Worsening myxedema",
      "Increased cardiovascular risk"]),
]

x_positions2 = [0.3, 4.65, 8.95]
y_positions2 = [1.25, 1.25, 1.25, 4.35, 4.35, 4.35]
x_pos3 = [0.3, 4.65, 8.95, 0.3, 4.65, 8.95]
widths3 = [4.2, 4.2, 4.1, 4.2, 4.2, 4.1]

for i, (title, col, items) in enumerate(systems):
    x = x_pos3[i]
    y = y_positions2[i]
    w = widths3[i]
    h = 2.9
    bg = RGBColor(0xFF, 0xEB, 0xEE) if col == ACCENT_RED else \
         RGBColor(0xE3, 0xF2, 0xFD) if col == DARK_BLUE else \
         RGBColor(0xE0, 0xF2, 0xF1) if col == TEAL else \
         RGBColor(0xFF, 0xF9, 0xC4) if col == AMBER else \
         RGBColor(0xF3, 0xE5, 0xF5) if col == RGBColor(0x6A, 0x1B, 0x9A) else \
         RGBColor(0xF5, 0xF5, 0xF5)
    add_rect(slide, x, y, w, h, bg, line_color=col, line_width=Pt(1.2))
    add_rect(slide, x, y, w, 0.42, col)
    add_text(slide, title, x+0.08, y+0.03, w-0.15, 0.4, 11.5, bold=True, color=WHITE)
    add_bullet_box(slide, items, x, y+0.44, w, h-0.5, font_size=11,
                   bullet_color=DARK_GRAY)

# ─────────────────────────────────────────────
# SLIDE 9 – Drug Interactions
# ─────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
set_bg(slide, RGBColor(0xF5, 0xF5, 0xF5))
header_bar(slide, "Drug Interactions with Thyroid Hormone Preparations",
           "Many common drugs significantly alter thyroid hormone levels")
footer(slide)

# Three columns
int_data = [
    ("REDUCED ABSORPTION\n(Give T4 at least 30 min before / 4h after)", ACCENT_RED,
     RGBColor(0xFF, 0xEB, 0xEE),
     [("Calcium carbonate / Ca²⁺ supplements", "Form insoluble complex with T4"),
      ("Ferrous sulfate (Fe²⁺)", "Chelation → reduced absorption"),
      ("Aluminum hydroxide antacids", "Adsorb T4 in gut"),
      ("Cholestyramine / colestipol", "Bind T4 in intestine"),
      ("Proton pump inhibitors", "Reduce gastric acid needed for absorption"),
      ("Sucralfate", "Physical binding"),
      ("Soy-based formulas (infants)", "Interfere with enteric absorption")]),
    ("INCREASED METABOLISM\n(CYP450 Inducers — may need ↑ T4 dose)", AMBER,
     RGBColor(0xFF, 0xF9, 0xC4),
     [("Rifampin", "Strong CYP3A4 inducer"),
      ("Phenytoin", "Induces CYP450 + displaces T4 from TBG"),
      ("Phenobarbital / carbamazepine", "CYP450 induction"),
      ("Sertraline (SSRIs)", "Accelerate T4 clearance"),
      ("Tyrosine kinase inhibitors\n(imatinib, sunitinib)", "Reduce T4 efficacy"),
      ("Lopinavir/ritonavir (HIV)", "CYP induction")]),
    ("PHARMACODYNAMIC\n& MISCELLANEOUS INTERACTIONS", DARK_BLUE,
     RGBColor(0xE3, 0xF2, 0xFD),
     [("Warfarin", "T4 ↑ catabolism of coag factors → ↑ INR; monitor closely"),
      ("Digoxin", "Hypothyroidism ↑ digoxin toxicity; T4 may need dose adjustment"),
      ("β-Blockers", "Reduce T3/T4 conversion peripherally"),
      ("Amiodarone", "Inhibits T4→T3 conversion; contains iodine"),
      ("Lithium", "Inhibits thyroid secretion → hypothyroidism"),
      ("Estrogen / OCP", "↑ TBG → apparent ↑ T4 need"),
      ("Biotin supplements", "Interfere with TSH immunoassay (falsely low TSH)")]),
]

x_cols = [0.3, 4.7, 9.0]
col_ws = [4.3, 4.2, 4.15]
for i, (title, col, bg, pairs) in enumerate(int_data):
    x = x_cols[i]
    w = col_ws[i]
    h = 5.8
    add_rect(slide, x, 1.25, w, h, bg, line_color=col, line_width=Pt(1.2))
    add_rect(slide, x, 1.25, w, 0.55, col)
    add_text(slide, title, x+0.08, 1.27, w-0.15, 0.52, 11, bold=True, color=WHITE)
    tb = slide.shapes.add_textbox(
        Inches(x+0.12), Inches(1.88), Inches(w-0.22), Inches(h-0.72))
    tf = tb.text_frame
    tf.word_wrap = True
    tf.margin_left = Pt(2)
    tf.margin_top = Pt(2)
    for j, (drug, effect) in enumerate(pairs):
        if j == 0:
            p = tf.paragraphs[0]
        else:
            p = tf.add_paragraph()
        run1 = p.add_run()
        run1.text = f"• {drug}: "
        run1.font.bold = True
        run1.font.size = Pt(10.5)
        run1.font.color.rgb = col
        run1.font.name = "Calibri"
        run2 = p.add_run()
        run2.text = effect
        run2.font.bold = False
        run2.font.size = Pt(10.5)
        run2.font.color.rgb = DARK_GRAY
        run2.font.name = "Calibri"
        p.space_before = Pt(4)
        p.space_after = Pt(2)

# ─────────────────────────────────────────────
# SLIDE 10 – Monitoring & Key Points
# ─────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
set_bg(slide, RGBColor(0xF5, 0xF5, 0xF5))
header_bar(slide, "Monitoring Parameters & Key Clinical Points",
           "Evidence-based targets and practical management pearls")
footer(slide)

add_rect(slide, 0.3, 1.25, 6.2, 5.9, RGBColor(0xE3, 0xF2, 0xFD),
         line_color=DARK_BLUE, line_width=Pt(1.2))
add_rect(slide, 0.3, 1.25, 6.2, 0.48, DARK_BLUE)
add_text(slide, "MONITORING PARAMETERS", 0.4, 1.28, 6.0, 0.42,
         14, bold=True, color=WHITE)

monitoring = [
    "TSH (Thyroid Stimulating Hormone) — PRIMARY marker",
    "  • Normal range: 0.4 – 4.0 mIU/L (lab-dependent)",
    "  • Check at 6–8 weeks after any dose change",
    "  • Annual monitoring once stable",
    "Free T4 — useful if pituitary disease (central hypothyroidism)",
    "  • Central hypothyroidism: TSH may be low/normal despite low T4",
    "Free T3 — monitor with liothyronine use",
    "Lipid panel — hypothyroidism → hyperlipidemia; improves with T4",
    "Bone mineral density (DEXA) — if prolonged use or elderly",
    "ECG / Holter — if cardiac symptoms develop",
    "CBC — rare thyroid hormone-related anemia",
    "Symptom assessment — fatigue, weight, HR, bowel habits",
    "Anti-TPO antibodies — diagnose Hashimoto's, not routine monitoring",
]

tb = slide.shapes.add_textbox(Inches(0.42), Inches(1.8), Inches(6.0), Inches(5.2))
tf = tb.text_frame
tf.word_wrap = True
for i, item in enumerate(monitoring):
    if i == 0:
        p = tf.paragraphs[0]
    else:
        p = tf.add_paragraph()
    run = p.add_run()
    run.text = item
    run.font.size = Pt(11)
    run.font.name = "Calibri"
    if item.startswith("  •"):
        run.font.color.rgb = MED_GRAY
        run.font.italic = True
        p.space_before = Pt(1)
    else:
        run.font.color.rgb = DARK_GRAY
        run.font.bold = True
        p.space_before = Pt(5)

# Right panel – key points
add_rect(slide, 6.85, 1.25, 6.15, 5.9, RGBColor(0xE8, 0xF5, 0xE9),
         line_color=TEAL, line_width=Pt(1.2))
add_rect(slide, 6.85, 1.25, 6.15, 0.48, TEAL)
add_text(slide, "KEY CLINICAL PEARLS", 6.95, 1.28, 5.95, 0.42,
         14, bold=True, color=WHITE)

pearls = [
    "Always take levothyroxine on empty stomach (30–60 min before breakfast) for consistent absorption",
    "TSH is the best single test — NOT free T4 or T3 alone for routine monitoring",
    "Do NOT check TSH within 6 weeks of a dose change — it lags behind T4 changes",
    "Biotin supplements interfere with TSH assay → stop for 48–72 h before blood draw",
    "In elderly / cardiac patients: START LOW (25 mcg), GO SLOW — re-check in 6–8 weeks",
    "Levothyroxine half-life = 7 days → missing 1–2 doses has minimal clinical impact",
    "T3 (liothyronine) has no role in routine hypothyroidism — reserve for myxedema coma",
    "Subclinical hypothyroidism (elevated TSH, normal T4): treat if TSH > 10 or symptomatic",
    "Thyroid nodules do NOT require TSH suppression therapy unless malignant",
    "Adequate selenium and iodine intake important for thyroid health alongside pharmacotherapy",
]

tb2 = slide.shapes.add_textbox(Inches(6.97), Inches(1.82), Inches(5.93), Inches(5.22))
tf2 = tb2.text_frame
tf2.word_wrap = True
for i, pearl in enumerate(pearls):
    if i == 0:
        p = tf2.paragraphs[0]
    else:
        p = tf2.add_paragraph()
    p.text = f"{i+1}.  {pearl}"
    p.space_before = Pt(5)
    p.space_after = Pt(2)
    for run in p.runs:
        run.font.size = Pt(11)
        run.font.color.rgb = DARK_GRAY
        run.font.name = "Calibri"

# ─────────────────────────────────────────────
# SLIDE 11 – Thank You / References
# ─────────────────────────────────────────────
slide = prs.slides.add_slide(blank)
set_bg(slide, RGBColor(0xE8, 0xEA, 0xF6))

add_rect(slide, 0, 2.0, 13.333, 3.0, HEADING_BG)
add_rect(slide, 0, 4.95, 13.333, 0.12, TEAL)

add_text(slide, "Thank You", 0.5, 2.15, 12.3, 1.1,
         52, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
add_text(slide, "Questions & Discussion Welcome",
         0.5, 3.2, 12.3, 0.65, 22,
         color=RGBColor(0xBB, 0xDE, 0xFB), align=PP_ALIGN.CENTER)

add_text(slide, "References", 0.5, 5.25, 12.3, 0.4, 14, bold=True, color=DARK_BLUE)
refs = [
    "1.  Brunton LL, Knollmann BC. Goodman & Gilman's The Pharmacological Basis of Therapeutics, 14th Ed. McGraw-Hill, 2023. Ch. 47.",
    "2.  Whalen K. Lippincott Illustrated Reviews: Pharmacology, 7th Ed. Wolters Kluwer, 2019. Ch. 23.",
    "3.  Harrison's Principles of Internal Medicine, 22nd Ed. McGraw-Hill, 2025.",
    "4.  Tietz Textbook of Laboratory Medicine, 7th Ed. Elsevier, 2023.",
]
add_bullet_box(slide, refs, 0.5, 5.65, 12.3, 1.5,
               font_size=10.5, bullet_color=MED_GRAY)


# ─────────────────────────────────────────────
# SAVE
# ─────────────────────────────────────────────
out_path = "/tmp/workspace/hypothyroid-ppt/Hypothyroid_Drugs_Pharmacology.pptx"
buf = BytesIO()
prs.save(buf)
with open(out_path, "wb") as f:
    f.write(buf.getvalue())

print(f"Saved: {out_path}")
print(f"Total slides: {len(prs.slides)}")
Your credits are exhausted. You can purchase a top-up or subscribe to a plan to continue using Orris. If you're already subscribed, your daily credits will reset tomorrow.
This is a shared conversation. Sign in to Orris to start your own chat.