POWERPOINT PRESENTATION FOR POSTGRADUATE IMED STUDENTS ON Hypothalamus & Pituitary * Hypothalamus & Pituitary * Hypothalamic releasing hormones, pituitary anatomy, Growth hormone physiology, IGF-1 WITH CLINICAL CORRELATIONS

Reading File
Reading File
Reading File
Finding Sources
Finding Sources
Searching Images

hypothalamus pituitary axis anatomy diagram

Finding Sources
Finding Sources
Finding Sources
Searching Images

growth hormone IGF-1 axis somatotropin

Reading File
Reading File
Reading File
Reading File
Reading File
Loading Image
Loading Image
Loading Image
Running Command

mkdir -p /tmp/workspace/hypothalamus-pituitary-pptx && ls /tmp/workspace/

Writing File

~/hypothalamus-pituitary-pptx/build_pptx.py

#!/usr/bin/env python3
"""
Build: Hypothalamus & Pituitary - Postgraduate IMED Presentation
"""

import json, subprocess, base64
from io import BytesIO
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

# ── Colour palette ──────────────────────────────────────────────
DEEP_BLUE    = RGBColor(0x1A, 0x3A, 0x6B)   # title bg / headers
TEAL         = RGBColor(0x00, 0x7B, 0x8A)   # accent
AMBER        = RGBColor(0xE8, 0x8C, 0x00)   # clinical highlight
WHITE        = RGBColor(0xFF, 0xFF, 0xFF)
LIGHT_GREY   = RGBColor(0xF2, 0xF4, 0xF8)
DARK_TEXT    = RGBColor(0x1C, 0x1C, 0x2E)
GREEN        = RGBColor(0x19, 0x7A, 0x3E)
RED          = RGBColor(0xC0, 0x39, 0x2B)

W = Inches(13.333)
H = Inches(7.5)

prs = Presentation()
prs.slide_width  = W
prs.slide_height = H
blank = prs.slide_layouts[6]

# ── Image downloader ─────────────────────────────────────────────
IMAGE_URLS = {
    "hp_org":    "https://cdn.orris.care/cdss_images/fc834bd4a357e8c725291d5c219224ffd2a39c3bb77a3081f5347b840c2e226e.png",
    "gh_signal": "https://cdn.orris.care/cdss_images/782a2aebbc7185a538262cd3dae5fde2b143ee24e95693ad82d23bc7eb3d1770.png",
    "anatomy":   "https://cdn.orris.care/cdss_images/afb5273aafe5273150313cba7dcafaa56fc35b8c6537fc711ad879bc2bb51c9a.png",
}

def fetch_images(urls_dict):
    url_list = list(urls_dict.values())
    result = json.loads(subprocess.check_output(
        ["python", "/tmp/skills/shared/scripts/fetch_images.py"] + url_list
    ))
    out = {}
    for key, url in urls_dict.items():
        for item in result:
            if item["url"] == url and item.get("base64"):
                raw = base64.b64decode(item["base64"].split(",",1)[-1])
                out[key] = BytesIO(raw)
    return out

imgs = fetch_images(IMAGE_URLS)

# ── Helpers ──────────────────────────────────────────────────────
def add_rect(slide, x, y, w, h, fill_rgb):
    shape = slide.shapes.add_shape(1, x, y, w, h)
    shape.fill.solid()
    shape.fill.fore_color.rgb = fill_rgb
    shape.line.fill.background()
    return shape

def add_tb(slide, text, x, y, w, h, size=18, bold=False, color=DARK_TEXT,
           align=PP_ALIGN.LEFT, wrap=True, italic=False):
    tb = slide.shapes.add_textbox(x, y, w, h)
    tf = tb.text_frame
    tf.word_wrap = wrap
    tf.margin_left  = 0
    tf.margin_right = 0
    tf.margin_top   = 0
    tf.margin_bottom= 0
    p = tf.paragraphs[0]
    p.alignment = align
    run = p.add_run()
    run.text = text
    run.font.size   = Pt(size)
    run.font.bold   = bold
    run.font.italic = italic
    run.font.color.rgb = color
    run.font.name   = "Calibri"
    return tb

def add_multiline_tb(slide, lines, x, y, w, h, size=16, color=DARK_TEXT,
                     line_space=1.15, wrap=True, bold_first=False):
    """lines = list of (text, bold, color_override)"""
    tb = slide.shapes.add_textbox(x, y, w, h)
    tf = tb.text_frame
    tf.word_wrap = wrap
    tf.margin_left   = Pt(4)
    tf.margin_right  = Pt(2)
    tf.margin_top    = Pt(2)
    tf.margin_bottom = Pt(2)
    for i, item in enumerate(lines):
        if isinstance(item, str):
            text, bold_, col_ = item, False, color
        else:
            text = item[0]
            bold_ = item[1] if len(item) > 1 else False
            col_  = item[2] if len(item) > 2 else color
        if i == 0:
            p = tf.paragraphs[0]
        else:
            p = tf.add_paragraph()
        p.space_before = Pt(2)
        run = p.add_run()
        run.text = text
        run.font.size  = Pt(size)
        run.font.bold  = bold_
        run.font.color.rgb = col_
        run.font.name  = "Calibri"
    return tb

def header_bar(slide, title, subtitle=None):
    add_rect(slide, 0, 0, W, Inches(1.15), DEEP_BLUE)
    add_tb(slide, title,
           Inches(0.35), Inches(0.12), Inches(12.0), Inches(0.65),
           size=30, bold=True, color=WHITE)
    if subtitle:
        add_tb(slide, subtitle,
               Inches(0.35), Inches(0.72), Inches(11), Inches(0.38),
               size=15, color=RGBColor(0xB8, 0xD4, 0xF5))

def footer(slide, text="Hypothalamus & Pituitary  |  Postgraduate Internal Medicine"):
    add_rect(slide, 0, Inches(7.2), W, Inches(0.3), DEEP_BLUE)
    add_tb(slide, text, Inches(0.3), Inches(7.21), Inches(11), Inches(0.28),
           size=9, color=WHITE)

def bullet_box(slide, items, x, y, w, h, size=15, head=None, head_color=TEAL,
               bullet="•  ", bg=None):
    if bg:
        add_rect(slide, x, y, w, h, bg)
    top = y
    if head:
        add_tb(slide, head, x+Inches(0.08), top+Inches(0.06), w-Inches(0.16),
               Inches(0.38), size=14, bold=True, color=head_color)
        top += Inches(0.42)
    tb = slide.shapes.add_textbox(x+Inches(0.12), top+Inches(0.04),
                                  w-Inches(0.24), h - (top-y) - Inches(0.08))
    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 isinstance(item, tuple):
            txt, bld = item
        else:
            txt, bld = item, False
        p = tf.paragraphs[0] if i == 0 else tf.add_paragraph()
        p.space_before = Pt(3)
        run = p.add_run()
        run.text = bullet + txt
        run.font.size  = Pt(size)
        run.font.bold  = bld
        run.font.color.rgb = DARK_TEXT
        run.font.name  = "Calibri"

def clinical_box(slide, title, points, x, y, w, h, size=13):
    add_rect(slide, x, y, w, h, RGBColor(0xFF, 0xF3, 0xCD))
    # amber left bar
    add_rect(slide, x, y, Inches(0.07), h, AMBER)
    add_tb(slide, f"⚕ {title}", x+Inches(0.12), y+Inches(0.06),
           w-Inches(0.2), Inches(0.35), size=13, bold=True, color=AMBER)
    tb = slide.shapes.add_textbox(x+Inches(0.12), y+Inches(0.38),
                                  w-Inches(0.2), h-Inches(0.44))
    tf = tb.text_frame; tf.word_wrap = True
    tf.margin_left = Pt(2); tf.margin_right = Pt(2)
    tf.margin_top = Pt(1); tf.margin_bottom = Pt(1)
    for i, pt in enumerate(points):
        p = tf.paragraphs[0] if i == 0 else tf.add_paragraph()
        p.space_before = Pt(2)
        run = p.add_run()
        run.text = "• " + pt
        run.font.size = Pt(size)
        run.font.color.rgb = RGBColor(0x5A, 0x3E, 0x00)
        run.font.name = "Calibri"

# ════════════════════════════════════════════════════════════════
# SLIDE 1 — TITLE
# ════════════════════════════════════════════════════════════════
sl = prs.slides.add_slide(blank)
add_rect(sl, 0, 0, W, H, DEEP_BLUE)
# decorative teal stripe
add_rect(sl, 0, Inches(2.7), W, Inches(0.08), TEAL)
add_rect(sl, 0, Inches(5.4), W, Inches(0.08), TEAL)

add_tb(sl, "HYPOTHALAMUS & PITUITARY",
       Inches(1.0), Inches(1.2), Inches(11.3), Inches(1.1),
       size=44, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
add_tb(sl, "Anatomy · Releasing Hormones · Growth Hormone Physiology · IGF-1",
       Inches(1.0), Inches(2.4), Inches(11.3), Inches(0.5),
       size=18, color=RGBColor(0xB8, 0xD4, 0xF5), align=PP_ALIGN.CENTER)
add_tb(sl, "Postgraduate Internal Medicine",
       Inches(1.0), Inches(2.9), Inches(11.3), Inches(0.45),
       size=16, color=TEAL, align=PP_ALIGN.CENTER, italic=True)
add_tb(sl, "Sources: Goodman & Gilman's Pharmacological Basis of Therapeutics · Neuroanatomy through Clinical Cases (3rd Ed)",
       Inches(1.0), Inches(6.8), Inches(11.3), Inches(0.4),
       size=10, color=RGBColor(0x80, 0xA8, 0xD0), align=PP_ALIGN.CENTER, italic=True)

# ════════════════════════════════════════════════════════════════
# SLIDE 2 — OVERVIEW & LEARNING OBJECTIVES
# ════════════════════════════════════════════════════════════════
sl = prs.slides.add_slide(blank)
add_rect(sl, 0, 0, W, H, LIGHT_GREY)
header_bar(sl, "Learning Objectives", "What you will master in this session")

# Two columns
left_items = [
    ("Describe the embryology & anatomy of the hypothalamus and pituitary", False),
    ("List all major hypothalamic releasing / inhibiting hormones", False),
    ("Trace the hypothalamic-pituitary portal system", False),
    ("Explain anterior vs posterior pituitary differences", False),
    ("Outline GH secretion, regulation & signalling (JAK-STAT)", False),
    ("Describe IGF-1 synthesis, transport & tissue actions", False),
]
right_items = [
    ("Recognise clinical syndromes of GH excess (acromegaly/gigantism)", False),
    ("Recognise clinical syndromes of GH deficiency", False),
    ("Apply investigations: GH stimulation/suppression, IGF-1", False),
    ("Understand pharmacological targets (octreotide, pegvisomant)", False),
    ("Correlate pituitary anatomy with visual field defects", False),
    ("Integrate feedback loops for exam scenarios", False),
]
add_rect(sl, Inches(0.4), Inches(1.3), Inches(6.0), Inches(5.7), WHITE)
add_rect(sl, Inches(6.7), Inches(1.3), Inches(6.0), Inches(5.7), WHITE)

bullet_box(sl, left_items, Inches(0.4), Inches(1.3), Inches(6.0), Inches(5.7),
           size=14, head="By the end of this lecture you will:", head_color=TEAL)
bullet_box(sl, right_items, Inches(6.7), Inches(1.3), Inches(6.0), Inches(5.7),
           size=14, head="Clinical Correlations covered:", head_color=TEAL)

footer(sl)

# ════════════════════════════════════════════════════════════════
# SLIDE 3 — HYPOTHALAMUS ANATOMY
# ════════════════════════════════════════════════════════════════
sl = prs.slides.add_slide(blank)
add_rect(sl, 0, 0, W, H, LIGHT_GREY)
header_bar(sl, "Hypothalamus — Anatomy & Position",
           "Diencephalon · Floor & walls of 3rd ventricle")

# Image left
if "anatomy" in imgs:
    imgs["anatomy"].seek(0)
    sl.shapes.add_picture(imgs["anatomy"], Inches(0.3), Inches(1.3),
                          Inches(5.6), Inches(5.9))

# Text right
add_rect(sl, Inches(6.2), Inches(1.3), Inches(6.8), Inches(5.9), WHITE)
bullet_box(sl, [
    ("Part of the diencephalon, beneath the thalamus", False),
    ("Forms floor & lateral walls of the inferior 3rd ventricle", False),
    ("Separated from thalamus by the hypothalamic sulcus", False),
    ("Ventral landmarks: optic chiasm → tuber cinereum → mammillary bodies", False),
    ("Infundibulum (pituitary stalk) connects it to the pituitary", False),
    ("Contains several named nuclei: supraoptic (SON), paraventricular (PVN), arcuate (ARC), ventromedial, lateral, anterior & posterior", False),
    ("Central regulator of homeostasis (mnemonic HEAL):", False),
    ("  H – Homeostatic (hunger, thirst, temperature, circadian)", False),
    ("  E – Endocrine control via pituitary", False),
    ("  A – Autonomic control", False),
    ("  L – Limbic mechanisms", False),
], Inches(6.2), Inches(1.3), Inches(6.8), Inches(5.9), size=13,
   head="Key Anatomical Facts", head_color=TEAL)

footer(sl)

# ════════════════════════════════════════════════════════════════
# SLIDE 4 — PITUITARY ANATOMY & EMBRYOLOGY
# ════════════════════════════════════════════════════════════════
sl = prs.slides.add_slide(blank)
add_rect(sl, 0, 0, W, H, LIGHT_GREY)
header_bar(sl, "Pituitary Gland — Anatomy & Embryology",
           "Anterior (adenohypophysis) vs Posterior (neurohypophysis)")

# Top half: two boxes
add_rect(sl, Inches(0.3), Inches(1.3), Inches(6.2), Inches(2.8), WHITE)
add_rect(sl, Inches(6.7), Inches(1.3), Inches(6.3), Inches(2.8), WHITE)

bullet_box(sl, [
    ("Anterior pituitary = adenohypophysis", True),
    ("Embryology: oral ectoderm → Rathke's pouch invagination", False),
    ("Contains glandular secretory cells", False),
    ("Controlled by hypothalamus via portal blood (not direct innervation)", False),
    ("Hormones: GH, TSH, ACTH, FSH, LH, Prolactin", False),
    ("Intermediate lobe (pars intermedia) — rudimentary in adults", False),
], Inches(0.3), Inches(1.3), Inches(6.2), Inches(2.8), size=13,
   head="Anterior Pituitary", head_color=TEAL)

bullet_box(sl, [
    ("Posterior pituitary = neurohypophysis", True),
    ("Embryology: downward evagination of diencephalon floor", False),
    ("No glandular cells — contains axon terminals only", False),
    ("Cell bodies in SON & PVN nuclei of hypothalamus", False),
    ("Hormones stored & released: ADH (vasopressin) + Oxytocin", False),
    ("Direct neurosecretion into systemic circulation", False),
], Inches(6.7), Inches(1.3), Inches(6.3), Inches(2.8), size=13,
   head="Posterior Pituitary", head_color=DEEP_BLUE)

# Middle: relations table
add_rect(sl, Inches(0.3), Inches(4.25), Inches(12.7), Inches(0.35), DEEP_BLUE)
add_tb(sl, "  KEY ANATOMICAL RELATIONS — CLINICAL IMPORTANCE",
       Inches(0.3), Inches(4.25), Inches(12.7), Inches(0.35),
       size=12, bold=True, color=WHITE)

relations = [
    ("Superior", "Optic chiasm", "Bitemporal hemianopia — classic pituitary mass sign"),
    ("Lateral", "Cavernous sinus (CN III, IV, V1, V2, VI)", "Cavernous sinus syndrome"),
    ("Inferior", "Sphenoid sinus / sella turcica", "Trans-sphenoidal surgical access"),
    ("Posterior", "Basilar artery, pons", "Stroke risk with large lesions"),
]
col_x = [Inches(0.35), Inches(2.0), Inches(5.5), Inches(8.5)]
col_w = [Inches(1.6),  Inches(3.3), Inches(2.8), Inches(4.5)]
for ri, row in enumerate(relations):
    ry = Inches(4.65) + ri * Inches(0.58)
    bg = LIGHT_GREY if ri % 2 == 0 else WHITE
    add_rect(sl, Inches(0.3), ry, Inches(12.7), Inches(0.56), bg)
    for ci, cell in enumerate(row):
        add_tb(sl, cell, col_x[ci]+Inches(0.05), ry+Inches(0.05),
               col_w[ci]-Inches(0.1), Inches(0.46),
               size=12, bold=(ci==0))

footer(sl)

# ════════════════════════════════════════════════════════════════
# SLIDE 5 — HYPOTHALAMIC-PITUITARY ORGANISATION (with image)
# ════════════════════════════════════════════════════════════════
sl = prs.slides.add_slide(blank)
add_rect(sl, 0, 0, W, H, LIGHT_GREY)
header_bar(sl, "Hypothalamic-Pituitary Organisation",
           "Portal system · Nucleus-specific hormone release")

# Image centre-left
if "hp_org" in imgs:
    imgs["hp_org"].seek(0)
    sl.shapes.add_picture(imgs["hp_org"], Inches(0.3), Inches(1.25),
                          Inches(5.2), Inches(5.85))

# Right: description
add_rect(sl, Inches(5.7), Inches(1.25), Inches(7.3), Inches(5.85), WHITE)
bullet_box(sl, [
    ("Hypothalamic neurons → median eminence → portal capillaries", False),
    ("Portal blood delivers releasing hormones to anterior pituitary", False),
    ("Anterior pituitary cells respond by secreting trophic hormones", False),
    ("Trophic hormones → target endocrine organs → feedback to both hypothalamus & pituitary", False),
    ("", False),
    ("SON & PVN nuclei → posterior pituitary via direct axonal transport", True),
    ("PVN & ARC nuclei → anterior pituitary via portal system", True),
    ("", False),
    ("Key: dopamine inhibits prolactin (tonically — loss of stalk = hyperprolactinaemia)", False),
    ("Key: somatostatin inhibits both GH and TSH", False),
], Inches(5.7), Inches(1.25), Inches(7.3), Inches(5.85), size=13,
   head="The Portal Connection", head_color=TEAL)

footer(sl)

# ════════════════════════════════════════════════════════════════
# SLIDE 6 — HYPOTHALAMIC RELEASING HORMONES TABLE
# ════════════════════════════════════════════════════════════════
sl = prs.slides.add_slide(blank)
add_rect(sl, 0, 0, W, H, LIGHT_GREY)
header_bar(sl, "Hypothalamic Releasing & Inhibiting Hormones",
           "Complete reference table — Goodman & Gilman, Table 46-1")

table_data = [
    ("GHRH", "Growth hormone-releasing hormone", "ARC nucleus", "↑ GH secretion", "IGF-1", TEAL),
    ("Somatostatin (SST)", "Somatotropin release-inhibiting hormone", "PVN & periventricular", "↓ GH  ↓ TSH", "—", RGBColor(0x6A,0x1B,0x9A)),
    ("Dopamine (DA)", "Prolactin inhibitory factor", "ARC / tuberoinfundibular", "↓ Prolactin (tonic)", "—", RGBColor(0x1B,0x5E,0x20)),
    ("TRH", "Thyrotropin-releasing hormone", "PVN", "↑ TSH  ↑ Prolactin", "Thyroid hormone", RGBColor(0x0D,0x47,0xA1)),
    ("CRH", "Corticotropin-releasing hormone", "PVN", "↑ ACTH", "Cortisol", RED),
    ("GnRH", "Gonadotropin-releasing hormone", "Preoptic area", "↑ LH  ↑ FSH", "Oestrogen / Testosterone", RGBColor(0x4A,0x14,0x86)),
    ("Oxytocin / ADH", "Posterior pituitary peptides", "SON & PVN", "Direct release (not portal)", "Kidney / uterus / breast", DEEP_BLUE),
]

# header row
hdr_x = [Inches(0.3), Inches(1.65), Inches(3.45), Inches(5.65), Inches(7.95), Inches(10.15)]
hdr_w = [Inches(1.3),  Inches(1.75), Inches(2.15), Inches(2.25), Inches(2.15), Inches(2.9)]
hdr_labels = ["Hormone", "Full Name", "Origin Nucleus", "Pituitary Effect", "Target Hormone", ""]
add_rect(sl, Inches(0.3), Inches(1.25), Inches(12.7), Inches(0.42), DEEP_BLUE)
for ci, lbl in enumerate(hdr_labels[:-1]):
    add_tb(sl, lbl, hdr_x[ci]+Inches(0.04), Inches(1.27), hdr_w[ci], Inches(0.38),
           size=12, bold=True, color=WHITE)

row_h = Inches(0.72)
for ri, row in enumerate(table_data):
    abb, full, nucleus, effect, target, accent = row
    ry = Inches(1.68) + ri * row_h
    bg = LIGHT_GREY if ri % 2 == 0 else WHITE
    add_rect(sl, Inches(0.3), ry, Inches(12.7), row_h, bg)
    add_rect(sl, Inches(0.3), ry, Inches(0.05), row_h, accent)
    texts = [abb, full, nucleus, effect, target]
    for ci, txt in enumerate(texts):
        bold_ = ci == 0
        add_tb(sl, txt, hdr_x[ci]+Inches(0.08), ry+Inches(0.06),
               hdr_w[ci]-Inches(0.12), row_h-Inches(0.1),
               size=11, bold=bold_, color=accent if ci==0 else DARK_TEXT,
               wrap=True)

footer(sl)

# ════════════════════════════════════════════════════════════════
# SLIDE 7 — GH PHYSIOLOGY: SECRETION & REGULATION
# ════════════════════════════════════════════════════════════════
sl = prs.slides.add_slide(blank)
add_rect(sl, 0, 0, W, H, LIGHT_GREY)
header_bar(sl, "Growth Hormone — Secretion & Regulation",
           "191 amino-acid peptide · Pulsatile · GHRH vs Somatostatin balance")

# 3-column layout
col_w = Inches(4.1)
cols = [Inches(0.3), Inches(4.55), Inches(8.8)]

boxes = [
    ("GH Stimulators", GREEN, [
        "GHRH (from ARC nucleus)",
        "Deep sleep (slow-wave, stage 3-4)",
        "Hypoglycaemia / fasting / exercise",
        "Amino acids (arginine, leucine)",
        "Oestrogens, testosterone",
        "Ghrelin (acylated — potent stimulus)",
        "α-adrenergic agonists, dopamine",
        "Stress (physical & psychological)",
    ]),
    ("GH Inhibitors", RED, [
        "Somatostatin (SRIH) — main brake",
        "IGF-1 (long-loop negative feedback)",
        "GH itself (short-loop feedback)",
        "Hyperglycaemia",
        "Free fatty acids",
        "β-adrenergic agonists",
        "Glucocorticoid excess",
        "Hypothyroidism",
    ]),
    ("Secretion Pattern", TEAL, [
        "Pulsatile: 3-5 pulses per day",
        "Peak secretion at night (slow-wave sleep)",
        "Liver is primary target → IGF-1",
        "Half-life of GH ~15-20 min",
        "IGF-1 has longer half-life (~15-20 h)",
        "98% of IGF-1 bound to IGFBP-3 + ALS",
        "IGF-1 is the best single marker of GH status",
        "Pulsatility makes random GH unreliable",
    ]),
]
for ci, (head, col, items) in enumerate(boxes):
    add_rect(sl, cols[ci], Inches(1.25), col_w, Inches(5.85), WHITE)
    add_rect(sl, cols[ci], Inches(1.25), col_w, Inches(0.38), col)
    add_tb(sl, head, cols[ci]+Inches(0.1), Inches(1.28), col_w-Inches(0.2), Inches(0.32),
           size=13, bold=True, color=WHITE)
    bullet_box(sl, items, cols[ci], Inches(1.63), col_w, Inches(4.85), size=12)

footer(sl)

# ════════════════════════════════════════════════════════════════
# SLIDE 8 — GH RECEPTOR SIGNALLING (with image)
# ════════════════════════════════════════════════════════════════
sl = prs.slides.add_slide(blank)
add_rect(sl, 0, 0, W, H, LIGHT_GREY)
header_bar(sl, "GH Receptor Signalling — JAK-STAT Pathway",
           "Cytokine superfamily receptor · Downstream effectors · Drug targets")

if "gh_signal" in imgs:
    imgs["gh_signal"].seek(0)
    sl.shapes.add_picture(imgs["gh_signal"], Inches(0.3), Inches(1.25),
                          Inches(5.6), Inches(5.8))

add_rect(sl, Inches(6.1), Inches(1.25), Inches(6.95), Inches(5.8), WHITE)
bullet_box(sl, [
    ("GH binds GH receptor (GHR) — forms 1:2 GH-GHR ternary complex", True),
    ("GHR is a cytokine superfamily receptor (no intrinsic kinase)", False),
    ("Dimerisation → recruitment & auto-phosphorylation of JAK2", False),
    ("JAK2 phosphorylates STAT5 → nucleus → IGF-1 gene expression", False),
    ("Also activates: MAPK (SHC pathway) → mitogenic effects", False),
    ("IRS-1 pathway → glucose transporter expression", False),
    ("", False),
    ("Key metabolic effects of GH:", True),
    ("  ↑ Lipolysis (anti-insulin in adipose)", False),
    ("  ↑ Gluconeogenesis (diabetogenic)", False),
    ("  ↑ Protein synthesis (anabolic)", False),
    ("  Most growth-promoting effects → INDIRECT via IGF-1", False),
    ("", False),
    ("Pharmacological target — Pegvisomant:", True),
    ("  Mutant GH analogue → blocks GHR dimerisation → no JAK2 activation", False),
    ("  Used in acromegaly refractory to somatostatin analogues", False),
], Inches(6.1), Inches(1.25), Inches(6.95), Inches(5.8), size=12,
   head="Signalling Cascade", head_color=TEAL)

footer(sl)

# ════════════════════════════════════════════════════════════════
# SLIDE 9 — IGF-1 PHYSIOLOGY
# ════════════════════════════════════════════════════════════════
sl = prs.slides.add_slide(blank)
add_rect(sl, 0, 0, W, H, LIGHT_GREY)
header_bar(sl, "IGF-1 (Insulin-like Growth Factor-1)",
           "Somatomedin C · GH mediator · Liver-derived · Autocrine/Paracrine actions")

# 4 panels
panel_cfg = [
    (Inches(0.3),  Inches(1.25), Inches(6.2), Inches(2.75), "Structure & Source", TEAL, [
        "70 amino acid single-chain peptide",
        "Structural similarity to insulin (hence 'insulin-like')",
        "Synthesised primarily in the liver (GH-dependent)",
        "Also produced locally in most tissues (autocrine/paracrine)",
        "GH-independent IGF-1 production in early foetal development",
    ]),
    (Inches(6.7),  Inches(1.25), Inches(6.3), Inches(2.75), "Transport & Binding Proteins", DEEP_BLUE, [
        "98% circulates bound to IGF binding proteins (IGFBPs)",
        "IGFBP-3 + Acid-Labile Subunit (ALS): forms ternary complex",
        "Half-life extended from minutes to ~15-20 hours",
        "IGFBP-3 itself is GH-dependent — used as IGF-1 status marker",
        "Free IGF-1 (<2%) is biologically active",
    ]),
    (Inches(0.3),  Inches(4.15), Inches(6.2), Inches(2.95), "Tissue Actions", GREEN, [
        "Bone: stimulates chondrocyte proliferation → longitudinal growth",
        "Muscle: protein synthesis, satellite cell activation, anti-apoptotic",
        "Liver: anti-apoptotic, metabolic regulation",
        "Kidney: ↑ glomerular filtration rate",
        "Adipose: preadipocyte differentiation",
        "CNS: neuronal survival and differentiation",
    ]),
    (Inches(6.7),  Inches(4.15), Inches(6.3), Inches(2.95), "IGF-1 Receptor Signalling", AMBER, [
        "IGF-1R: receptor tyrosine kinase (α2β2 tetramer)",
        "Activates PI3K/AKT → cell survival & growth",
        "Activates MAPK/ERK → proliferation",
        "Overlaps with insulin signalling → hypoglycaemia risk with excess",
        "Key growth proof: biallelic IGF1 gene mutations → severe growth retardation unresponsive to GH but responsive to rh-IGF-1",
    ]),
]

for (px, py, pw, ph, ptitle, pcol, pitems) in panel_cfg:
    add_rect(sl, px, py, pw, ph, WHITE)
    add_rect(sl, px, py, pw, Inches(0.37), pcol)
    add_tb(sl, ptitle, px+Inches(0.08), py+Inches(0.04), pw-Inches(0.16), Inches(0.29),
           size=13, bold=True, color=WHITE)
    bullet_box(sl, pitems, px, py+Inches(0.37), pw, ph-Inches(0.37), size=11)

footer(sl)

# ════════════════════════════════════════════════════════════════
# SLIDE 10 — GH EXCESS: ACROMEGALY & GIGANTISM
# ════════════════════════════════════════════════════════════════
sl = prs.slides.add_slide(blank)
add_rect(sl, 0, 0, W, H, LIGHT_GREY)
header_bar(sl, "GH Excess — Gigantism & Acromegaly",
           "Somatotrope adenoma · Pre-epiphyseal vs Post-epiphyseal fusion")

# Left: pathophysiology
add_rect(sl, Inches(0.3), Inches(1.25), Inches(6.1), Inches(5.85), WHITE)
bullet_box(sl, [
    ("Cause: somatotrope adenoma (>95%); rare: ectopic GHRH", True),
    ("Pre-pubertal (open epiphyses) → GIGANTISM", False),
    ("Post-pubertal (fused epiphyses) → ACROMEGALY", False),
    ("", False),
    ("Cardinal features of acromegaly:", True),
    ("  Acral enlargement: hands, feet, jaw (prognathism)", False),
    ("  Coarsening facial features, macroglossia", False),
    ("  Skin: hyperhidrosis, oily, skin tags", False),
    ("  Organomegaly: cardiomegaly, hepatomegaly", False),
    ("  Arthropathy, carpal tunnel syndrome", False),
    ("  Hypertension, LVH — major cause of mortality", False),
    ("  Diabetes mellitus (GH diabetogenic effect)", False),
    ("  Sleep apnoea (upper airway soft tissue)", False),
    ("  Visual field defects if tumour compresses chiasm", False),
], Inches(0.3), Inches(1.25), Inches(6.1), Inches(5.85), size=12,
   head="Pathophysiology & Features", head_color=RED)

# Right top: investigations
add_rect(sl, Inches(6.6), Inches(1.25), Inches(6.4), Inches(2.9), WHITE)
bullet_box(sl, [
    ("Screening: serum IGF-1 (age & sex-matched)", False),
    ("Confirmation: Oral Glucose Tolerance Test (OGTT)", False),
    ("  — Normal: GH suppresses to <0.4 μg/L at 2 h", False),
    ("  — Acromegaly: GH fails to suppress (paradoxical ↑)", False),
    ("MRI pituitary (gadolinium) — macroadenoma >1 cm usually", False),
    ("Screen for co-secretion: prolactin, TSH, alpha-subunit", False),
], Inches(6.6), Inches(1.25), Inches(6.4), Inches(2.9), size=12,
   head="Investigations", head_color=TEAL)

# Right bottom: treatment
add_rect(sl, Inches(6.6), Inches(4.3), Inches(6.4), Inches(2.8), WHITE)
bullet_box(sl, [
    ("Surgery: trans-sphenoidal resection (1st line)", True),
    ("Medical therapy:", False),
    ("  Somatostatin analogues (octreotide, lanreotide)", False),
    ("  Dopamine agonist (cabergoline) — modest effect", False),
    ("  GHR antagonist: pegvisomant (blocks GHR dimerisation)", False),
    ("Radiotherapy: adjunct for persistent disease", False),
    ("Aim: IGF-1 normalisation + GH <1 μg/L on OGTT", False),
], Inches(6.6), Inches(4.3), Inches(6.4), Inches(2.8), size=12,
   head="Treatment Ladder", head_color=AMBER)

footer(sl)

# ════════════════════════════════════════════════════════════════
# SLIDE 11 — GH DEFICIENCY
# ════════════════════════════════════════════════════════════════
sl = prs.slides.add_slide(blank)
add_rect(sl, 0, 0, W, H, LIGHT_GREY)
header_bar(sl, "GH Deficiency (GHD)",
           "Children vs Adults · Diagnosis · IGF-1 Deficiency States")

add_rect(sl, Inches(0.3), Inches(1.25), Inches(6.1), Inches(5.85), WHITE)
bullet_box(sl, [
    ("Childhood GHD:", True),
    ("  Short stature (height velocity < 4-5 cm/yr)", False),
    ("  Delayed bone age", False),
    ("  Truncal adiposity, cherubic face", False),
    ("  Micropenis in males", False),
    ("  Causes: pituitary aplasia/hypoplasia, craniopharyngioma, irradiation", False),
    ("", False),
    ("Adult GHD:", True),
    ("  ↑ Fat mass (central), ↓ muscle mass, ↓ exercise capacity", False),
    ("  Dyslipidaemia: ↑ LDL, ↓ HDL", False),
    ("  Reduced bone mineral density", False),
    ("  Fatigue, impaired quality of life, depression", False),
    ("  ↑ Cardiovascular risk", False),
    ("  Causes: pituitary adenoma / surgery / irradiation", False),
], Inches(0.3), Inches(1.25), Inches(6.1), Inches(5.85), size=12,
   head="Clinical Features", head_color=DEEP_BLUE)

add_rect(sl, Inches(6.6), Inches(1.25), Inches(6.4), Inches(2.85), WHITE)
bullet_box(sl, [
    ("IGF-1 low for age/sex — screening test", False),
    ("GH stimulation tests (insulin tolerance test / glucagon):", False),
    ("  Peak GH < 3 μg/L = severe GHD", False),
    ("  Peak GH 3-7 μg/L = partial GHD (context-dependent)", False),
    ("IGFBP-3 — complements IGF-1, especially in children < 3 yrs", False),
    ("MRI: pituitary/hypothalamic pathology", False),
], Inches(6.6), Inches(1.25), Inches(6.4), Inches(2.85), size=12,
   head="Investigations", head_color=TEAL)

add_rect(sl, Inches(6.6), Inches(4.25), Inches(6.4), Inches(2.85), WHITE)
bullet_box(sl, [
    ("Primary IGF-1 deficiency (Laron syndrome):", True),
    ("  GH receptor mutations → ↑↑ GH + ↓ IGF-1", False),
    ("  Phenotype similar to GHD — unresponsive to GH", False),
    ("  Treat with recombinant human IGF-1 (mecasermin)", False),
    ("", False),
    ("Treatment of GHD: recombinant hGH (somatropin)", False),
    ("Titrate to IGF-1 in mid-normal range for age", False),
], Inches(6.6), Inches(4.25), Inches(6.4), Inches(2.85), size=12,
   head="Laron Syndrome & Treatment", head_color=AMBER)

footer(sl)

# ════════════════════════════════════════════════════════════════
# SLIDE 12 — CLINICAL CORRELATIONS SUMMARY
# ════════════════════════════════════════════════════════════════
sl = prs.slides.add_slide(blank)
add_rect(sl, 0, 0, W, H, LIGHT_GREY)
header_bar(sl, "Clinical Correlations & Exam Pearls",
           "High-yield IMED scenarios")

cases = [
    ("Bitemporal Hemianopia",
     ["Pituitary macroadenoma compresses optic chiasm",
      "Classic: loss of temporal fields bilaterally",
      "Urgent investigation: MRI pituitary + formal perimetry",
      "Stalk compression → hyperprolactinaemia (dopamine interruption)"]),
    ("Acromegaly Diagnosis Trap",
     ["Random GH is unreliable — always use OGTT",
      "IGF-1 correlates best with disease activity",
      "GH co-secretion with TSH → thyrotoxicosis + acromegaly",
      "Skin tags + colonic polyps → screen with colonoscopy"]),
    ("Empty Sella Syndrome",
     ["CSF herniates through diaphragma sellae → flattens pituitary",
      "Usually incidental; pituitary function often preserved",
      "Secondary: post-surgery, apoplexy, Sheehan's syndrome",
      "Investigate all pituitary axes before assuming benign"]),
    ("Pituitary Apoplexy",
     ["Haemorrhage/infarction into pituitary adenoma",
      "Sudden headache + ophthalmoplegia + visual loss",
      "Emergency: IV glucocorticoids (adrenal crisis risk)",
      "MRI confirms; neurosurgical opinion urgently"]),
    ("Sheehan's Syndrome",
     ["Postpartum pituitary infarction — obstetric haemorrhage",
      "Failure to lactate is first clue",
      "Presents months–years later: panhypopituitarism",
      "Diagnose: all axes affected; MRI shows empty sella"]),
    ("Craniopharyngioma",
     ["Most common pituitary region tumour in children",
      "Calcified suprasellar mass on CT",
      "GHD first, then panhypopituitarism",
      "Diabetes insipidus common (hypothalamic involvement)"]),
]

px_starts = [Inches(0.3), Inches(4.55), Inches(8.8)]
py_starts = [Inches(1.25), Inches(4.2)]
pw = Inches(4.1); ph = Inches(2.7)
for i, (title, pts) in enumerate(cases):
    col = i % 3; row = i // 3
    cx = px_starts[col]; cy = py_starts[row]
    clinical_box(sl, title, pts, cx, cy, pw, ph, size=11)

footer(sl)

# ════════════════════════════════════════════════════════════════
# SLIDE 13 — PHARMACOLOGY OF H-P AXIS
# ════════════════════════════════════════════════════════════════
sl = prs.slides.add_slide(blank)
add_rect(sl, 0, 0, W, H, LIGHT_GREY)
header_bar(sl, "Pharmacology of the Hypothalamic-Pituitary Axis",
           "Therapeutic and diagnostic agents — mechanisms, indications, key notes")

drug_table = [
    ("Octreotide / Lanreotide", "Somatostatin analogue", "Inhibit GH secretion from somatotrope; ↓ portal blood flow", "Acromegaly; carcinoid; VIPoma; TSH-oma", "Gallstones; diarrhoea; ↓ insulin → hyperglycaemia"),
    ("Pegvisomant", "GH receptor antagonist", "Blocks GHR dimerisation → no JAK2 activation → ↓ IGF-1", "Acromegaly refractory to SSA", "↑ Liver enzymes; monitor IGF-1; GH levels rise (not a marker)"),
    ("Cabergoline", "D2 agonist (dopaminergic)", "Suppresses GH and prolactin secretion", "Prolactinoma (1st line); some acromegaly", "Nausea; valvulopathy (high dose); impulse control"),
    ("Somatropin (rh-GH)", "Recombinant GH", "Replaces endogenous GH; induces hepatic IGF-1", "GHD (child/adult); Turner; Prader-Willi; SGA", "Intracranial HTN; slipped capital femoral epiphysis; insulin resistance"),
    ("Mecasermin (rh-IGF-1)", "Recombinant IGF-1", "Bypasses GH axis — direct IGF-1 receptor agonism", "Laron syndrome; primary IGF-1 deficiency", "Hypoglycaemia; lipohypertrophy at injection sites"),
    ("Octreotide (GH stimulation test)", "Diagnostic (suppression)", "Oral glucose suppresses GH in normals; fails in acromegaly", "OGTT-GH suppression test", "Perform after 10h fast; measure GH at 0,30,60,90,120 min"),
]

hdr_cols = ["Drug", "Class", "Mechanism", "Indication", "Key Side-effects / Notes"]
col_x2 = [Inches(0.3), Inches(2.3), Inches(3.85), Inches(6.7), Inches(9.4)]
col_w2 = [Inches(1.95), Inches(1.5), Inches(2.8),  Inches(2.65), Inches(3.6)]

add_rect(sl, Inches(0.3), Inches(1.25), Inches(12.7), Inches(0.42), DEEP_BLUE)
for ci, lbl in enumerate(hdr_cols):
    add_tb(sl, lbl, col_x2[ci]+Inches(0.05), Inches(1.27), col_w2[ci], Inches(0.38),
           size=11, bold=True, color=WHITE)

for ri, row in enumerate(drug_table):
    ry = Inches(1.68) + ri * Inches(0.92)
    bg = LIGHT_GREY if ri % 2 == 0 else WHITE
    add_rect(sl, Inches(0.3), ry, Inches(12.7), Inches(0.9), bg)
    for ci, cell in enumerate(row):
        add_tb(sl, cell, col_x2[ci]+Inches(0.06), ry+Inches(0.04),
               col_w2[ci]-Inches(0.1), Inches(0.84),
               size=10, bold=(ci==0), wrap=True,
               color=TEAL if ci==0 else DARK_TEXT)

footer(sl)

# ════════════════════════════════════════════════════════════════
# SLIDE 14 — FEEDBACK LOOPS & INTEGRATION
# ════════════════════════════════════════════════════════════════
sl = prs.slides.add_slide(blank)
add_rect(sl, 0, 0, W, H, LIGHT_GREY)
header_bar(sl, "Feedback Regulation — GH/IGF-1 Axis",
           "Long-loop, short-loop & ultrashort feedback mechanisms")

# Flow diagram using shapes
def flow_box(slide, text, x, y, w, h, fill, text_col=WHITE, size=13, bold=True):
    add_rect(slide, x, y, w, h, fill)
    add_tb(slide, text, x+Inches(0.06), y+Inches(0.06),
           w-Inches(0.12), h-Inches(0.12),
           size=size, bold=bold, color=text_col, align=PP_ALIGN.CENTER, wrap=True)

def arrow(slide, x1, y1, x2, y2):
    # Draw using a narrow rectangle as arrow line
    from pptx.util import Emu
    import math
    # Simple horizontal or vertical arrows using shapes
    if abs(y2-y1) < abs(x2-x1):
        # horizontal
        mid_y = (y1+y2)/2
        w_ = abs(x2-x1)
        x_ = min(x1,x2)
        add_rect(slide, x_, mid_y-Inches(0.02), w_, Inches(0.04), DARK_TEXT)
    else:
        # vertical
        mid_x = (x1+x2)/2
        h_ = abs(y2-y1)
        y_ = min(y1,y2)
        add_rect(slide, mid_x-Inches(0.02), y_, Inches(0.04), h_, DARK_TEXT)

# GH-IGF-1 axis flow diagram
bw = Inches(2.6); bh = Inches(0.55)
cx = Inches(5.3)  # centre x

flow_box(sl, "Hypothalamus: GHRH ↑ / Somatostatin ↓",
         Inches(3.5), Inches(1.3), Inches(6.2), bh, DEEP_BLUE)
arrow(sl, cx+Inches(1.1), Inches(1.85), cx+Inches(1.1), Inches(2.2))
flow_box(sl, "Anterior Pituitary Somatotrope → GH",
         Inches(3.5), Inches(2.2), Inches(6.2), bh, TEAL)
arrow(sl, cx+Inches(1.1), Inches(2.75), cx+Inches(1.1), Inches(3.1))
flow_box(sl, "Liver + Peripheral Tissues → IGF-1",
         Inches(3.5), Inches(3.1), Inches(6.2), bh, GREEN)
arrow(sl, cx+Inches(1.1), Inches(3.65), cx+Inches(1.1), Inches(4.0))
flow_box(sl, "Target Tissues: Bone · Muscle · Kidney · Adipose",
         Inches(3.5), Inches(4.0), Inches(6.2), bh, RGBColor(0x2E,0x7D,0x32))

# Feedback arrows (text boxes)
add_tb(sl, "⬅ Long-loop feedback: IGF-1 inhibits Hypothalamus & Pituitary",
       Inches(0.3), Inches(3.1), Inches(3.0), Inches(0.7),
       size=11, color=RED, italic=True, wrap=True)
add_tb(sl, "⬅ Short-loop feedback: GH inhibits its own release from Hypothalamus",
       Inches(0.3), Inches(2.2), Inches(3.0), Inches(0.7),
       size=11, color=RED, italic=True, wrap=True)
add_tb(sl, "⬅ Ultra-short: GHRH & SST autoregulation",
       Inches(0.3), Inches(1.3), Inches(3.0), Inches(0.55),
       size=11, color=RED, italic=True, wrap=True)

# Right side: key points
add_rect(sl, Inches(9.9), Inches(1.3), Inches(3.15), Inches(5.9), WHITE)
bullet_box(sl, [
    ("Negative feedback is the key principle on all pituitary axes", False),
    ("IGF-1 → both hypothalamus (↑SST, ↓GHRH) and pituitary (direct)", False),
    ("GH has anti-insulin actions → poor metabolic control → ↑SST", False),
    ("Sleep deprivation → blunted nocturnal GH pulse", False),
    ("Obesity → ↓ amplitude of GH pulses (SST ↑)", False),
    ("In starvation: GH ↑↑ but IGF-1 ↓ (hepatic resistance)", False),
    ("Exam trap: ↑ GH + ↓ IGF-1 = starvation/liver disease", False),
    ("Not GH excess!", False),
], Inches(9.9), Inches(1.3), Inches(3.15), Inches(5.9), size=12,
   head="Key Integration Points", head_color=TEAL)

footer(sl)

# ════════════════════════════════════════════════════════════════
# SLIDE 15 — SUMMARY & EXAM MNEMONICS
# ════════════════════════════════════════════════════════════════
sl = prs.slides.add_slide(blank)
add_rect(sl, 0, 0, W, H, DEEP_BLUE)
add_rect(sl, 0, Inches(1.1), W, Inches(0.05), TEAL)
add_rect(sl, 0, Inches(6.9), W, Inches(0.05), TEAL)

add_tb(sl, "Summary & Exam High-Yield Mnemonics",
       Inches(0.5), Inches(0.15), Inches(12.3), Inches(0.85),
       size=30, bold=True, color=WHITE)

mnems = [
    ("HEAL", "Hypothalamus functions:\nHomeostasis · Endocrine · Autonomic · Limbic"),
    ("GH UP", "GH stimulators:\nGhrelin/GHRH · Hypoglycaemia · Unfit (exercise) · Puberty/Oestrogen"),
    ("IGF-1 Triple Rule", "1) Best single GH-status marker\n2) Normal = active disease excluded\n3) ↑ GH + ↓ IGF-1 = not acromegaly (starvation/liver)"),
    ("OGTT Flip", "Normal: GH suppresses below 0.4 μg/L\nAcromegaly: GH does NOT suppress (may paradoxically rise)"),
    ("Pituitary Neighbours", "Superior = Chiasm (vision)\nLateral = Cavernous sinus (CN III,IV,VI)\nInferior = Sphenoid (surgery)"),
    ("3 Ps of Acromegaly", "Prognathism · Perspiration (hyperhidrosis) · Polyps (colonic screening)"),
]

cols2 = [Inches(0.4), Inches(4.55), Inches(8.7)]
rh = Inches(2.6)
for i, (title, body) in enumerate(mnems):
    col = i % 3; row = i // 3
    cx_ = cols2[col]; cy_ = Inches(1.25) + row * rh
    add_rect(sl, cx_, cy_, Inches(3.9), rh-Inches(0.1), RGBColor(0x12,0x28,0x4E))
    add_rect(sl, cx_, cy_, Inches(3.9), Inches(0.42), TEAL)
    add_tb(sl, title, cx_+Inches(0.08), cy_+Inches(0.05),
           Inches(3.74), Inches(0.32), size=14, bold=True, color=WHITE)
    add_tb(sl, body, cx_+Inches(0.1), cy_+Inches(0.46),
           Inches(3.7), rh-Inches(0.62),
           size=12, color=RGBColor(0xD0,0xE8,0xFF), wrap=True)

add_tb(sl, "Sources: Goodman & Gilman's Pharmacological Basis of Therapeutics (14e)  |  Neuroanatomy through Clinical Cases (3rd Ed, Blumenfeld)  |  Adams & Victor's Principles of Neurology (12th Ed)",
       Inches(0.4), Inches(7.05), Inches(12.5), Inches(0.35),
       size=9, color=RGBColor(0x70,0x98,0xC0), italic=True)

# Save
out_path = "/tmp/workspace/hypothalamus-pituitary-pptx/Hypothalamus_Pituitary_IMED.pptx"
buf = BytesIO()
prs.save(buf)
with open(out_path, "wb") as f:
    f.write(buf.getvalue())
print(f"Saved: {out_path}")
print(f"Slides: {len(prs.slides)}")
Running Command

cd /tmp/workspace/hypothalamus-pituitary-pptx && python build_pptx.py 2>&1

Finding Files

fetch_images.py in /tmp/skills

Running Command

python /tmp/skills/shared/scripts/fetch_images.py "https://cdn.orris.care/cdss_images/fc834bd4a357e8c725291d5c219224ffd2a39c3bb77a3081f5347b840c2e226e.png" 2>&1 | head -5

Running Command

cd /tmp/workspace/hypothalamus-pituitary-pptx && python build_pptx.py 2>&1

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.