Harmones secreted by pancreas

Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Loading Image
Reading File
Here is a complete, textbook-sourced summary of hormones secreted by the pancreas.

Hormones Secreted by the Pancreas

The pancreas has two functional components. The exocrine component secretes digestive enzymes into the gut. The endocrine component - the islets of Langerhans - secretes hormones directly into the bloodstream. There are approximately 1 million islets in the adult pancreas, each containing 3,000-4,000 cells of five major types.
Hormones of the endocrine pancreas - islet of Langerhans showing alpha (glucagon), beta (insulin), and delta (somatostatin) cells

Islet Cell Types and Their Hormones

Cell Type% of IsletHormoneLocation in Islet
Beta (β)~60-65%Insulin + Amylin (IAPP)Central core
Alpha (α)~20-30%GlucagonOuter rim
Delta (δ)~5-10%SomatostatinInterposed between α and β
PP / F cellsRarePancreatic Polypeptide (PP)Scattered
Epsilon (ε)Very rareGhrelinScattered

1. Insulin (Beta cells)

  • Structure: Peptide dimer (A-chain: 21 amino acids + B-chain), MW ~5700-6000 Da
  • Stimulus: High blood glucose, amino acids, GLP-1, parasympathetic activity
  • Actions (hormone of "abundance"):
    • Increases glucose uptake into cells (via GLUT4 insertion) → lowers blood glucose
    • Promotes glycogen synthesis, inhibits glycogenolysis and gluconeogenesis
    • Promotes fat deposition, inhibits lipolysis
    • Promotes protein synthesis (anabolic)
    • Drives K⁺ into cells (lowers blood K⁺)
  • Clinical note: Deficiency or resistance causes diabetes mellitus

2. Glucagon (Alpha cells)

  • Structure: Polypeptide, ~3500 Da
  • Stimulus: Low blood glucose, amino acids, sympathetic activity
  • Actions (opposite of insulin):
    • Stimulates hepatic glycogenolysis and gluconeogenesis → raises blood glucose
    • Promotes lipolysis and ketogenesis
    • Mobilizes energy stores during fasting
  • Clinical note: Glucagonoma causes hyperglycemia, weight loss, necrolytic migratory erythema

3. Somatostatin (Delta cells)

  • Structure: Polypeptide, ~1650 Da
  • Actions (universal inhibitor):
    • Inhibits secretion of both insulin and glucagon (paracrine effect)
    • Inhibits exocrine pancreatic secretion
    • Inhibits GH and TSH release from the anterior pituitary
    • Inhibits gastric HCl secretion
    • Inhibits gut motility and other GI hormones
  • Clinical note: Somatostatin analogs (e.g., octreotide) are used therapeutically for acromegaly, carcinoid syndrome, and variceal bleeding

4. Pancreatic Polypeptide - PP (PP / F cells)

  • Structure: Polypeptide, ~4200 Da
  • Actions:
    • Inhibits pancreatic exocrine secretion (enzymes and bicarbonate)
    • Inhibits bile secretion and intestinal motility
    • Facilitates hepatic action of insulin
    • Stimulates gastric chief cell activity
  • Released after a meal, especially a protein-rich meal

5. Ghrelin (Epsilon cells)

  • Actions:
    • Decreases insulin secretion and action
    • Stimulates appetite (hunger hormone)
    • Also produced by the stomach

6. Amylin / IAPP (Beta cells, co-secreted with insulin)

  • Also called Islet Amyloid Polypeptide
  • Co-secreted with insulin from beta cells
  • Counter-regulates insulin secretion and function
  • Slows gastric emptying, suppresses glucagon
  • In type 2 diabetes, amylin deposits form islet amyloid plaques
  • Clinical use: Pramlintide is a synthetic amylin analog used in diabetes treatment

7. Pancreastatin (Beta cells)

  • Decreases insulin and somatostatin secretion
  • Increases glucagon secretion
  • Decreases exocrine pancreatic secretion

8. Peptide YY - PYY

  • Increases insulin secretion and promotes beta-cell growth

Key Regulatory Relationships

  • High glucose → stimulates β cells (insulin ↑) + inhibits α cells (glucagon ↓)
  • Low glucose → stimulates α cells (glucagon ↑) + inhibits β cells (insulin ↓)
  • Somatostatin from δ cells inhibits both insulin and glucagon (paracrine)
  • Sympathetic nerves → increase glucagon, inhibit insulin
  • Parasympathetic nerves → increase both insulin and glucagon

Sources: Schwartz's Principles of Surgery 11e; Costanzo Physiology 7e; Junqueira's Basic Histology 17e; Lippincott Pharmacology

Create a summary document on pancreatic hormones and their clinical significance

Asking for Preferences
Reading File
Running Command

mkdir -p /home/daytona/workspace/pancreatic-hormones && ls /home/daytona/workspa…

Writing File

~/pancreatic-hormones/generate_pdf.py

from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm, mm
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    HRFlowable, KeepTogether
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus import PageBreak

OUTPUT = "/home/daytona/workspace/pancreatic-hormones/Pancreatic_Hormones_Summary.pdf"

# ── Colour palette ──────────────────────────────────────────────
C_BLUE_DARK  = colors.HexColor("#1A3A5C")   # header / title
C_BLUE_MED   = colors.HexColor("#2E6DA4")   # section titles
C_BLUE_LIGHT = colors.HexColor("#D6E8F7")   # section header bg
C_TEAL       = colors.HexColor("#1B7A7A")   # hormone name band
C_TEAL_LIGHT = colors.HexColor("#D0EFEF")   # hormone row bg
C_AMBER      = colors.HexColor("#E67E22")   # clinical box accent
C_AMBER_LIGHT= colors.HexColor("#FEF3E2")   # clinical box bg
C_GREEN_DARK = colors.HexColor("#1E6B3C")   # key fact label
C_GREEN_LIGHT= colors.HexColor("#D4EDDA")   # key fact bg
C_GRAY       = colors.HexColor("#F4F6F8")   # alt row bg
C_WHITE      = colors.white
C_BLACK      = colors.HexColor("#1C1C1C")

doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=A4,
    leftMargin=1.8*cm, rightMargin=1.8*cm,
    topMargin=2*cm, bottomMargin=2*cm,
)

W = A4[0] - 3.6*cm   # usable width

styles = getSampleStyleSheet()

# Custom styles
def sty(name, **kw):
    return ParagraphStyle(name, **kw)

title_style = sty("DocTitle",
    fontSize=22, fontName="Helvetica-Bold",
    textColor=C_WHITE, alignment=TA_CENTER, spaceAfter=4)

subtitle_style = sty("DocSub",
    fontSize=11, fontName="Helvetica",
    textColor=colors.HexColor("#BDE0FF"), alignment=TA_CENTER, spaceAfter=2)

section_style = sty("Section",
    fontSize=13, fontName="Helvetica-Bold",
    textColor=C_BLUE_DARK, spaceBefore=14, spaceAfter=6)

hormone_name_style = sty("HormoneName",
    fontSize=12, fontName="Helvetica-Bold",
    textColor=C_WHITE, alignment=TA_LEFT)

body_style = sty("Body",
    fontSize=9.5, fontName="Helvetica",
    textColor=C_BLACK, leading=14, spaceAfter=3)

small_style = sty("Small",
    fontSize=8.5, fontName="Helvetica",
    textColor=C_BLACK, leading=13)

bold_style = sty("Bold",
    fontSize=9.5, fontName="Helvetica-Bold",
    textColor=C_BLACK, leading=14)

clinical_title_style = sty("ClinTitle",
    fontSize=9.5, fontName="Helvetica-Bold",
    textColor=C_AMBER)

table_header_style = sty("TblHdr",
    fontSize=9, fontName="Helvetica-Bold",
    textColor=C_WHITE, alignment=TA_CENTER)

table_cell_style = sty("TblCell",
    fontSize=8.5, fontName="Helvetica",
    textColor=C_BLACK, leading=12, alignment=TA_LEFT)

footer_style = sty("Footer",
    fontSize=7.5, fontName="Helvetica",
    textColor=colors.HexColor("#999999"), alignment=TA_CENTER)

story = []

# ════════════════════════════════════════════════════════════════
# TITLE BLOCK
# ════════════════════════════════════════════════════════════════
title_data = [[
    Paragraph("HORMONES OF THE PANCREAS", title_style),
],[
    Paragraph("Clinical Summary for Medical Students", subtitle_style),
],[
    Paragraph("Islets of Langerhans · Endocrine Pancreas", subtitle_style),
]]
title_tbl = Table(title_data, colWidths=[W])
title_tbl.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), C_BLUE_DARK),
    ("TOPPADDING",  (0,0), (-1,-1), 10),
    ("BOTTOMPADDING",(0,0),(-1,-1), 10),
    ("ROUNDEDCORNERS", [8]),
]))
story.append(title_tbl)
story.append(Spacer(1, 0.4*cm))

# ════════════════════════════════════════════════════════════════
# OVERVIEW BOX
# ════════════════════════════════════════════════════════════════
overview_text = (
    "The pancreas is both an <b>exocrine</b> gland (secreting digestive enzymes into the duodenum) "
    "and an <b>endocrine</b> gland. The endocrine function resides in the <b>Islets of Langerhans</b>, "
    "which make up 1-2% of pancreatic mass (~1 million islets, each with 2,500-4,000 cells). "
    "Five distinct cell types secrete hormones that regulate glucose, fat, amino acid metabolism, "
    "and GI function."
)
overview_para = Paragraph(overview_text, ParagraphStyle("ov",
    fontSize=9.5, fontName="Helvetica", textColor=C_BLACK, leading=14,
    leftIndent=8, rightIndent=8))
overview_tbl = Table([[overview_para]], colWidths=[W])
overview_tbl.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), C_BLUE_LIGHT),
    ("BOX", (0,0), (-1,-1), 1, C_BLUE_MED),
    ("TOPPADDING",  (0,0),(-1,-1), 8),
    ("BOTTOMPADDING",(0,0),(-1,-1), 8),
    ("LEFTPADDING", (0,0),(-1,-1), 8),
    ("RIGHTPADDING",(0,0),(-1,-1), 8),
]))
story.append(overview_tbl)
story.append(Spacer(1, 0.5*cm))

# ════════════════════════════════════════════════════════════════
# QUICK-REFERENCE TABLE — Islet cell types
# ════════════════════════════════════════════════════════════════
story.append(Paragraph("Islet Cell Types at a Glance", section_style))
story.append(HRFlowable(width=W, thickness=1.5, color=C_BLUE_MED, spaceAfter=6))

qr_headers = [
    Paragraph("Cell", table_header_style),
    Paragraph("% Islet", table_header_style),
    Paragraph("Location", table_header_style),
    Paragraph("Hormone(s)", table_header_style),
    Paragraph("Mnemonic", table_header_style),
]

qr_rows = [
    ["β (Beta)", "60-65%", "Central core", "Insulin, Amylin (IAPP)", "β = Both insulin & amylin; B for Blood sugar ↓"],
    ["α (Alpha)", "20-30%", "Outer rim", "Glucagon", "A for Away — glucose goes Away from liver"],
    ["δ (Delta)", "5-10%", "Interposed", "Somatostatin", "D for Dampen — dampens all"],
    ["PP / F", "<5%", "Scattered", "Pancreatic Polypeptide", "PP = Pause Pancreas (inhibits exocrine)"],
    ["ε (Epsilon)", "Rare", "Scattered", "Ghrelin", "E for Eat — hunger signal"],
]

def make_qr_row(row_data, bg):
    return [Paragraph(cell, ParagraphStyle("qrc",
        fontSize=8.5, fontName="Helvetica", textColor=C_BLACK,
        leading=12)) for cell in row_data]

col_widths = [W*0.11, W*0.09, W*0.12, W*0.22, W*0.46]
qr_table_data = [qr_headers] + [make_qr_row(r, C_GRAY) for r in qr_rows]

qr_table = Table(qr_table_data, colWidths=col_widths)
qr_table.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), C_BLUE_DARK),
    ("BACKGROUND", (0,1), (-1,1), C_WHITE),
    ("BACKGROUND", (0,2), (-1,2), C_GRAY),
    ("BACKGROUND", (0,3), (-1,3), C_WHITE),
    ("BACKGROUND", (0,4), (-1,4), C_GRAY),
    ("BACKGROUND", (0,5), (-1,5), C_WHITE),
    ("GRID", (0,0), (-1,-1), 0.5, colors.HexColor("#CCCCCC")),
    ("TOPPADDING",  (0,0),(-1,-1), 5),
    ("BOTTOMPADDING",(0,0),(-1,-1), 5),
    ("LEFTPADDING", (0,0),(-1,-1), 6),
    ("RIGHTPADDING",(0,0),(-1,-1), 6),
    ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
    ("ROWBACKGROUNDS", (0,1),(-1,-1), [C_WHITE, C_GRAY]),
]))
story.append(qr_table)
story.append(Spacer(1, 0.5*cm))

# ════════════════════════════════════════════════════════════════
# HELPER: hormone section card
# ════════════════════════════════════════════════════════════════
def hormone_card(number, name, cell, structure,
                 stimulus_list, actions_list, clinical_list,
                 drug_note=None):
    """Returns a list of flowables forming a coloured hormone card."""
    elements = []

    # Header band
    header_data = [[
        Paragraph(f"{number}. {name}", hormone_name_style),
        Paragraph(f"Cell: {cell}  |  {structure}", ParagraphStyle("hs2",
            fontSize=9, fontName="Helvetica", textColor=colors.HexColor("#CCE5FF"),
            alignment=TA_LEFT)),
    ]]
    header_tbl = Table(header_data, colWidths=[W*0.5, W*0.5])
    header_tbl.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), C_TEAL),
        ("TOPPADDING",  (0,0),(-1,-1), 7),
        ("BOTTOMPADDING",(0,0),(-1,-1), 7),
        ("LEFTPADDING", (0,0),(-1,-1), 10),
        ("VALIGN", (0,0),(-1,-1), "MIDDLE"),
    ]))

    # Build inner content: stimulus | actions | clinical
    def bullet_list(items, color=C_BLACK):
        return "\n".join(f"• {i}" for i in items)

    stim_para = Paragraph(
        "<b>Secretion Stimulated By:</b><br/>" +
        "  ".join(f"• {s}" for s in stimulus_list),
        ParagraphStyle("sp", fontSize=8.5, fontName="Helvetica",
                       textColor=C_BLACK, leading=13))

    action_para = Paragraph(
        "<b>Key Actions:</b><br/>" +
        "<br/>".join(f"• {a}" for a in actions_list),
        ParagraphStyle("ap", fontSize=8.5, fontName="Helvetica",
                       textColor=C_BLACK, leading=13))

    clinical_content = "<b>Clinical Significance:</b><br/>" + \
        "<br/>".join(f"▸ {c}" for c in clinical_list)
    if drug_note:
        clinical_content += f"<br/><b>Drug:</b> {drug_note}"

    clin_para = Paragraph(clinical_content,
        ParagraphStyle("cp", fontSize=8.5, fontName="Helvetica",
                       textColor=C_BLACK, leading=13))

    body_data = [[stim_para, action_para, clin_para]]
    col_w = [W*0.27, W*0.36, W*0.37]
    body_tbl = Table(body_data, colWidths=col_w)
    body_tbl.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), C_TEAL_LIGHT),
        ("TOPPADDING",  (0,0),(-1,-1), 7),
        ("BOTTOMPADDING",(0,0),(-1,-1), 7),
        ("LEFTPADDING", (0,0),(-1,-1), 8),
        ("RIGHTPADDING",(0,0),(-1,-1), 6),
        ("VALIGN", (0,0),(-1,-1), "TOP"),
        ("LINEAFTER", (0,0),(1,-1), 0.5, colors.HexColor("#A0CFCF")),
    ]))

    wrapper = Table([[header_tbl],[body_tbl]], colWidths=[W])
    wrapper.setStyle(TableStyle([
        ("BOX", (0,0),(-1,-1), 1, C_TEAL),
        ("TOPPADDING",(0,0),(-1,-1), 0),
        ("BOTTOMPADDING",(0,0),(-1,-1), 0),
        ("LEFTPADDING",(0,0),(-1,-1), 0),
        ("RIGHTPADDING",(0,0),(-1,-1), 0),
    ]))

    elements.append(KeepTogether([wrapper, Spacer(1, 0.3*cm)]))
    return elements

# ════════════════════════════════════════════════════════════════
# HORMONE CARDS
# ════════════════════════════════════════════════════════════════
story.append(Paragraph("Individual Hormone Profiles", section_style))
story.append(HRFlowable(width=W, thickness=1.5, color=C_BLUE_MED, spaceAfter=8))

# 1. INSULIN
story += hormone_card(
    1, "INSULIN", "Beta (β) cells", "Peptide; 51 AA (A+B chains linked by S-S); MW ~6000 Da",
    stimulus_list=[
        "↑ Blood glucose (primary)", "Amino acids (arginine, leucine)",
        "GLP-1 & GIP (incretins)", "Parasympathetic (vagal) stimulation",
        "Sulphonylureas (drug)"
    ],
    actions_list=[
        "↑ Glucose uptake into muscle & fat (GLUT4 insertion)",
        "↑ Glycogen synthesis; ↓ Glycogenolysis & gluconeogenesis",
        "↑ Protein synthesis (anabolic); ↓ Proteolysis",
        "↑ Lipogenesis; ↓ Lipolysis & ketogenesis",
        "Drives K⁺ into cells → lowers serum K⁺",
        "Down-regulates its own receptor (obesity/T2DM)"
    ],
    clinical_list=[
        "Type 1 DM: absolute insulin deficiency (autoimmune β-cell destruction)",
        "Type 2 DM: relative deficiency + peripheral insulin resistance",
        "Insulinoma: excess secretion → hypoglycemia (Whipple's triad)",
        "DKA: insulin deficiency → ketoacidosis (Type 1)",
        "HHS: severe hyperglycemia without ketosis (Type 2)",
        "Insulin in hyperkalaemia: drives K⁺ into cells (with dextrose)"
    ],
    drug_note="Insulin analogues (rapid: lispro/aspart; long: glargine/detemir); Sulphonylureas stimulate release; Metformin improves sensitivity"
)

# 2. GLUCAGON
story += hormone_card(
    2, "GLUCAGON", "Alpha (α) cells", "Polypeptide; 29 AA; MW ~3500 Da",
    stimulus_list=[
        "↓ Blood glucose (primary)", "Amino acids (protein meal)",
        "Sympathetic stimulation / catecholamines", "Fasting / exercise",
        "Somatostatin inhibits it"
    ],
    actions_list=[
        "↑ Hepatic glycogenolysis → raises blood glucose",
        "↑ Gluconeogenesis (liver)",
        "↑ Lipolysis & ketogenesis (adipose tissue)",
        "↑ cAMP (acts via Gs-protein coupled receptor)",
        "Opposite effects to insulin — counter-regulatory hormone"
    ],
    clinical_list=[
        "Glucagonoma (4 D's): Dermatitis (necrolytic migratory erythema), Diabetes, DVT, Depression",
        "Hypoglycaemia rescue: glucagon 1 mg IM (diabetics, unconscious)",
        "Beta-blocker overdose: glucagon bypasses β-receptor to restore cardiac contractility",
        "DKA: excess glucagon worsens ketogenesis",
        "Somatostatin analogues (octreotide) suppress glucagonoma symptoms"
    ],
    drug_note="Glucagon kit (hypoglycaemia rescue); GLP-1 agonists (liraglutide, semaglutide) mimic incretin axis"
)

# 3. SOMATOSTATIN
story += hormone_card(
    3, "SOMATOSTATIN (SST)", "Delta (δ) cells", "Polypeptide; SST-14 or SST-28; MW ~1650 Da",
    stimulus_list=[
        "High glucose, amino acids, fatty acids",
        "GIP, glucagon, CCK",
        "Paracrine signals from neighbouring islet cells"
    ],
    actions_list=[
        "Inhibits BOTH insulin AND glucagon secretion (paracrine)",
        "Inhibits GH and TSH release (anterior pituitary)",
        "Inhibits gastric acid (HCl) & pepsin secretion",
        "Inhibits pancreatic exocrine secretion",
        "Inhibits intestinal motility & nutrient absorption",
        "Inhibits virtually all GI hormones (universal inhibitor)"
    ],
    clinical_list=[
        "Somatostatinoma: triad of diabetes, cholelithiasis, steatorrhoea",
        "Carcinoid syndrome: octreotide controls flushing and diarrhoea",
        "Acromegaly: octreotide suppresses GH",
        "Oesophageal varices: octreotide reduces portal pressure",
        "Post-op pancreatic fistulae: octreotide reduces secretion"
    ],
    drug_note="Octreotide (short-acting SST analogue); Lanreotide, Pasireotide (long-acting)"
)

# 4. PANCREATIC POLYPEPTIDE
story += hormone_card(
    4, "PANCREATIC POLYPEPTIDE (PP)", "PP / F cells", "Polypeptide; 36 AA; MW ~4200 Da",
    stimulus_list=[
        "Protein-rich meal", "Fasting / hypoglycaemia",
        "Vagal (cholinergic) stimulation", "Exercise"
    ],
    actions_list=[
        "↓ Pancreatic exocrine enzyme & bicarbonate secretion",
        "↓ Bile secretion & gallbladder motility",
        "↓ Intestinal motility",
        "Facilitates hepatic action of insulin",
        "Stimulates gastric chief cell secretion"
    ],
    clinical_list=[
        "PP-oma: rare functional islet tumour; watery diarrhoea",
        "PP levels used as marker for pancreatic endocrine tumour activity",
        "Elevated in MEN-1 related pancreatic tumours",
        "Low PP response to hypoglycaemia seen in autonomic neuropathy (diabetic)"
    ],
    drug_note="No approved PP-based drugs currently; research ongoing in obesity (PP suppresses appetite)"
)

# 5. GHRELIN
story += hormone_card(
    5, "GHRELIN", "Epsilon (ε) cells (also stomach)", "Peptide; 28 AA; acylated form is active",
    stimulus_list=[
        "Fasting / empty stomach", "Hypoglycaemia",
        "Low body weight / caloric restriction"
    ],
    actions_list=[
        "Stimulates appetite (orexigenic — 'hunger hormone')",
        "Stimulates GH release (GH secretagogue)",
        "↓ Insulin secretion and action",
        "↑ Gastric motility and acid secretion",
        "Promotes fat storage (anti-lipolytic)"
    ],
    clinical_list=[
        "Prader-Willi syndrome: very high ghrelin → uncontrollable hunger",
        "Post-bariatric surgery (sleeve gastrectomy): ghrelin falls → appetite suppression",
        "Cachexia / cancer anorexia: ghrelin analogues (anamorelin) investigated",
        "Type 2 DM: elevated fasting ghrelin worsens insulin resistance"
    ],
    drug_note="Anamorelin (ghrelin receptor agonist) — approved in Japan for cancer cachexia"
)

# 6. AMYLIN
story += hormone_card(
    6, "AMYLIN (IAPP)", "Beta (β) cells — co-secreted with insulin", "Polypeptide; 37 AA; forms amyloid fibrils",
    stimulus_list=[
        "Meals (co-released with insulin)", "High glucose",
        "Protein / fat ingestion"
    ],
    actions_list=[
        "Slows gastric emptying → blunts post-meal glucose spike",
        "Suppresses post-meal glucagon secretion",
        "Reduces food intake (satiety signal via hypothalamus)",
        "Complements insulin in post-prandial glucose control"
    ],
    clinical_list=[
        "Type 2 DM: amylin fibrils (IAPP aggregates) deposit in islets → β-cell loss",
        "Amyloid deposits are a hallmark of pancreatic histology in T2DM",
        "Type 1 DM: amylin is also deficient (alongside insulin)",
        "Alzheimer's disease: IAPP amyloid structurally similar to Aβ plaque"
    ],
    drug_note="Pramlintide (synthetic amylin analogue) — adjunct to insulin in T1DM and T2DM; reduces HbA1c and weight"
)

story.append(Spacer(1, 0.3*cm))

# ════════════════════════════════════════════════════════════════
# GLUCOSE REGULATION SUMMARY TABLE
# ════════════════════════════════════════════════════════════════
story.append(Paragraph("Glucose Regulation — Insulin vs. Glucagon", section_style))
story.append(HRFlowable(width=W, thickness=1.5, color=C_BLUE_MED, spaceAfter=8))

reg_headers = [
    Paragraph("Parameter", table_header_style),
    Paragraph("INSULIN (β-cell)", table_header_style),
    Paragraph("GLUCAGON (α-cell)", table_header_style),
]
reg_rows = [
    ["Trigger", "↑ Blood glucose, amino acids, incretins", "↓ Blood glucose, amino acids, stress"],
    ["Blood glucose effect", "↓ (hypoglycaemic)", "↑ (hyperglycaemic)"],
    ["Glycogenolysis", "↓ Inhibits", "↑ Stimulates"],
    ["Gluconeogenesis", "↓ Inhibits", "↑ Stimulates"],
    ["Glycogen synthesis", "↑ Stimulates", "↓ Inhibits"],
    ["Lipolysis / Ketogenesis", "↓ Inhibits", "↑ Stimulates"],
    ["Protein synthesis", "↑ Stimulates (anabolic)", "↓ Inhibits (catabolic)"],
    ["Receptor / Pathway", "Tyrosine kinase receptor → PI3K/Akt", "GPCR (Gs) → cAMP → PKA"],
    ["State", "'Fed' / Anabolic state", "'Fasted' / Catabolic state"],
]

def make_reg_cell(text, bold=False):
    style = ParagraphStyle("rc",
        fontSize=8.5, fontName="Helvetica-Bold" if bold else "Helvetica",
        textColor=C_BLACK, leading=12)
    return Paragraph(text, style)

reg_data = [reg_headers]
for i, row in enumerate(reg_rows):
    cells = [make_reg_cell(row[0], bold=True),
             make_reg_cell(row[1]),
             make_reg_cell(row[2])]
    reg_data.append(cells)

reg_col_w = [W*0.22, W*0.39, W*0.39]
reg_tbl = Table(reg_data, colWidths=reg_col_w)
reg_tbl.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), C_BLUE_DARK),
    ("ROWBACKGROUNDS", (0,1),(-1,-1), [C_WHITE, C_GRAY]),
    ("GRID", (0,0),(-1,-1), 0.4, colors.HexColor("#CCCCCC")),
    ("TOPPADDING",(0,0),(-1,-1), 5),
    ("BOTTOMPADDING",(0,0),(-1,-1), 5),
    ("LEFTPADDING",(0,0),(-1,-1), 6),
    ("RIGHTPADDING",(0,0),(-1,-1), 6),
    ("VALIGN",(0,0),(-1,-1), "MIDDLE"),
]))
story.append(reg_tbl)
story.append(Spacer(1, 0.4*cm))

# ════════════════════════════════════════════════════════════════
# KEY CLINICAL CONDITIONS TABLE
# ════════════════════════════════════════════════════════════════
story.append(Paragraph("Key Clinical Conditions — Quick Reference", section_style))
story.append(HRFlowable(width=W, thickness=1.5, color=C_BLUE_MED, spaceAfter=8))

clin_headers = [
    Paragraph("Condition", table_header_style),
    Paragraph("Hormone Involved", table_header_style),
    Paragraph("Pathophysiology", table_header_style),
    Paragraph("Key Features", table_header_style),
    Paragraph("Treatment Principle", table_header_style),
]

clin_rows = [
    ["Type 1 DM", "↓ Insulin (absolute)", "Autoimmune β-cell destruction (anti-GAD, anti-IA2 Ab)",
     "Polyuria, polydipsia, weight loss; DKA prone", "Insulin replacement (basal-bolus)"],
    ["Type 2 DM", "↓ Insulin (relative) + resistance", "Insulin resistance → β-cell exhaustion; amyloid deposits",
     "Gradual onset; obesity, acanthosis nigricans", "Metformin → stepwise; insulin when needed"],
    ["DKA", "Severe ↓ Insulin, ↑ Glucagon", "Unrestrained lipolysis → ketoacid production; anion gap metabolic acidosis",
     "Kussmaul breathing, fruity breath, pH <7.3", "IV insulin + fluids + K⁺ replacement"],
    ["Insulinoma", "↑ Insulin (autonomous)", "Benign β-cell tumour (>90%); inappropriate insulin secretion",
     "Whipple's triad: hypoglycaemia, symptoms, relief with glucose", "Surgical resection; diazoxide pre-op"],
    ["Glucagonoma", "↑ Glucagon (autonomous)", "Malignant α-cell tumour; part of MEN-1",
     "4 D's: Dermatitis (NME), DM, DVT, Depression", "Octreotide; surgery; streptozocin"],
    ["Somatostatinoma", "↑ Somatostatin", "Rare δ-cell tumour; inhibits insulin, glucagon, exocrine",
     "Triad: DM, gallstones, steatorrhoea", "Surgery; octreotide for symptoms"],
    ["Acromegaly", "↑ GH (SST insufficient)", "Excess GH from pituitary; normally inhibited by SST",
     "Enlarged hands/feet, coarse features, DM", "Octreotide/lanreotide; surgery/radiotherapy"],
]

def make_clin_cell(text):
    return Paragraph(text, ParagraphStyle("clc",
        fontSize=7.8, fontName="Helvetica", textColor=C_BLACK, leading=11))

clin_data = [clin_headers]
for i, row in enumerate(clin_rows):
    clin_data.append([make_clin_cell(c) for c in row])

clin_col_w = [W*0.14, W*0.15, W*0.24, W*0.23, W*0.24]
clin_tbl = Table(clin_data, colWidths=clin_col_w)
clin_tbl.setStyle(TableStyle([
    ("BACKGROUND", (0,0),(-1,0), colors.HexColor("#8B1A1A")),
    ("TEXTCOLOR", (0,0),(-1,0), C_WHITE),
    ("ROWBACKGROUNDS", (0,1),(-1,-1), [C_AMBER_LIGHT, C_WHITE]),
    ("GRID", (0,0),(-1,-1), 0.4, colors.HexColor("#CCCCCC")),
    ("TOPPADDING",(0,0),(-1,-1), 4),
    ("BOTTOMPADDING",(0,0),(-1,-1), 4),
    ("LEFTPADDING",(0,0),(-1,-1), 5),
    ("RIGHTPADDING",(0,0),(-1,-1), 5),
    ("VALIGN",(0,0),(-1,-1), "TOP"),
]))
story.append(clin_tbl)
story.append(Spacer(1, 0.4*cm))

# ════════════════════════════════════════════════════════════════
# HIGH-YIELD EXAM FACTS BOX
# ════════════════════════════════════════════════════════════════
story.append(Paragraph("High-Yield Exam Points", section_style))
story.append(HRFlowable(width=W, thickness=1.5, color=C_BLUE_MED, spaceAfter=8))

hyfacts = [
    "Insulin is the ONLY hormone that LOWERS blood glucose.",
    "Glucagon, cortisol, adrenaline, and GH are all counter-regulatory (hyperglycaemic).",
    "Somatostatin is a universal inhibitor — it suppresses insulin, glucagon, GH, TSH, and GI hormones.",
    "C-peptide is co-secreted with insulin in equimolar amounts and has a longer half-life — used to distinguish endogenous insulin from exogenous injection.",
    "Proinsulin → insulin + C-peptide (cleavage of connecting peptide by prohormone convertase).",
    "GLUT2 (high-Km) is the glucose sensor on β-cells; GLUT4 is the insulin-dependent transporter in muscle/fat.",
    "Sulphonylureas (e.g., glibenclamide) close K-ATP channels on β-cells → depolarisation → Ca²⁺ entry → insulin release.",
    "GLP-1 (glucagon-like peptide-1) is an incretin from L-cells; it enhances glucose-dependent insulin secretion — basis for GLP-1 agonists (semaglutide).",
    "Insulinoma: measure serum insulin, C-peptide, and proinsulin simultaneously during a 72-hour fast.",
    "MEN-1 (Wermer's syndrome): Parathyroid + Pituitary + Pancreatic islet tumours (3 P's).",
    "Whipple's triad (insulinoma): symptoms of hypoglycaemia + documented low glucose + relief with glucose administration.",
    "Ghrelin is the only gut peptide that INCREASES appetite (all others — GLP-1, PYY, CCK — decrease it).",
    "Amylin (IAPP) aggregates form islet amyloid — hallmark histology in Type 2 DM.",
    "Diazoxide opens K-ATP channels on β-cells → hyperpolarisation → inhibits insulin release (used in insulinoma pre-op).",
]

hy_rows = [[Paragraph(f"{'★'} {f}", ParagraphStyle("hyf",
    fontSize=8.5, fontName="Helvetica", textColor=C_BLACK, leading=13))]
           for f in hyfacts]

hy_tbl = Table(hy_rows, colWidths=[W])
hy_tbl.setStyle(TableStyle([
    ("BACKGROUND", (0,0),(-1,-1), C_GREEN_LIGHT),
    ("ROWBACKGROUNDS", (0,0),(-1,-1), [C_GREEN_LIGHT, colors.HexColor("#EAF7EE")]),
    ("TOPPADDING",(0,0),(-1,-1), 4),
    ("BOTTOMPADDING",(0,0),(-1,-1), 4),
    ("LEFTPADDING",(0,0),(-1,-1), 10),
    ("RIGHTPADDING",(0,0),(-1,-1), 8),
    ("BOX",(0,0),(-1,-1), 1, C_GREEN_DARK),
    ("LINEBELOW",(0,0),(-1,-2), 0.3, colors.HexColor("#B0DFBF")),
]))
story.append(hy_tbl)
story.append(Spacer(1, 0.4*cm))

# ════════════════════════════════════════════════════════════════
# PHARMACOLOGY TABLE
# ════════════════════════════════════════════════════════════════
story.append(Paragraph("Pharmacology Summary — Drugs Targeting Pancreatic Hormones", section_style))
story.append(HRFlowable(width=W, thickness=1.5, color=C_BLUE_MED, spaceAfter=8))

ph_headers = [
    Paragraph("Drug / Class", table_header_style),
    Paragraph("Target", table_header_style),
    Paragraph("Mechanism", table_header_style),
    Paragraph("Clinical Use", table_header_style),
]
ph_rows = [
    ["Insulin (all types)", "Insulin receptor", "Directly replaces deficient insulin; activates tyrosine kinase → glucose uptake", "T1DM, T2DM, DKA, HHS, hyperkalaemia"],
    ["Sulphonylureas (glibenclamide, gliclazide)", "β-cell K-ATP channel", "Close K-ATP channels → depolarise → Ca²⁺ influx → insulin release", "T2DM (stimulate endogenous insulin)"],
    ["GLP-1 agonists (semaglutide, liraglutide)", "GLP-1 receptor", "Glucose-dependent insulin secretion ↑, glucagon ↓, gastric emptying ↓, weight ↓", "T2DM, obesity (Wegovy), CV risk reduction"],
    ["DPP-4 inhibitors (sitagliptin)", "DPP-4 enzyme", "Prevent GLP-1 degradation → prolong incretin effect", "T2DM; weight-neutral"],
    ["Metformin", "Mitochondrial complex I", "↓ Hepatic gluconeogenesis; improves insulin sensitivity; activates AMPK", "First-line T2DM; PCOS"],
    ["Diazoxide", "K-ATP channel opener on β-cell", "Opens K-ATP → hyperpolarises β-cell → inhibits insulin release", "Insulinoma (pre-op), congenital hyperinsulinism"],
    ["Octreotide / Lanreotide", "Somatostatin receptors (SSTR2/5)", "Mimics SST; suppresses GH, glucagon, insulin, GI hormones", "Acromegaly, carcinoid, glucagonoma, variceal bleed"],
    ["Pramlintide", "Amylin receptor", "Slows gastric emptying, suppresses glucagon, reduces appetite", "Adjunct to insulin in T1DM and T2DM"],
    ["Glucagon kit", "Glucagon receptor (Gs-GPCR)", "↑ Hepatic glycogenolysis; ↑ cAMP → glucose release", "Hypoglycaemia rescue; beta-blocker/CCB overdose"],
]

def make_ph(text):
    return Paragraph(text, ParagraphStyle("phc",
        fontSize=7.8, fontName="Helvetica", textColor=C_BLACK, leading=11))

ph_data = [ph_headers]
for row in ph_rows:
    ph_data.append([make_ph(c) for c in row])

ph_col_w = [W*0.22, W*0.15, W*0.35, W*0.28]
ph_tbl = Table(ph_data, colWidths=ph_col_w)
ph_tbl.setStyle(TableStyle([
    ("BACKGROUND", (0,0),(-1,0), colors.HexColor("#4A235A")),
    ("TEXTCOLOR", (0,0),(-1,0), C_WHITE),
    ("ROWBACKGROUNDS", (0,1),(-1,-1), [colors.HexColor("#F5EEF8"), C_WHITE]),
    ("GRID", (0,0),(-1,-1), 0.4, colors.HexColor("#CCCCCC")),
    ("TOPPADDING",(0,0),(-1,-1), 4),
    ("BOTTOMPADDING",(0,0),(-1,-1), 4),
    ("LEFTPADDING",(0,0),(-1,-1), 5),
    ("RIGHTPADDING",(0,0),(-1,-1), 5),
    ("VALIGN",(0,0),(-1,-1), "TOP"),
]))
story.append(ph_tbl)
story.append(Spacer(1, 0.4*cm))

# ════════════════════════════════════════════════════════════════
# FOOTER
# ════════════════════════════════════════════════════════════════
story.append(HRFlowable(width=W, thickness=0.5, color=colors.HexColor("#BBBBBB"), spaceAfter=4))
story.append(Paragraph(
    "Sources: Schwartz's Principles of Surgery 11e · Costanzo Physiology 7e · Junqueira's Basic Histology 17e · "
    "Lippincott Pharmacology · Katzung's Basic & Clinical Pharmacology 16e  |  Document generated for medical education purposes.",
    ParagraphStyle("foot", fontSize=7, fontName="Helvetica",
                   textColor=colors.HexColor("#999999"), alignment=TA_CENTER)))

# ════════════════════════════════════════════════════════════════
# BUILD
# ════════════════════════════════════════════════════════════════
doc.build(story)
print(f"PDF saved to: {OUTPUT}")
Running Command

cd /home/daytona/workspace/pancreatic-hormones && python generate_pdf.py 2>&1

Running Command

ls -lh /home/daytona/workspace/pancreatic-hormones/

Your PDF summary document is ready for download:

Pancreatic Hormones Summary

PDF Document · PDF


Here is what the document covers, organized for medical students:
1. Islet Cell Types at a Glance - Quick-reference table with all 5 cell types (α, β, δ, PP, ε), their % composition, location within the islet, hormone produced, and a mnemonic for each.
2. Individual Hormone Profiles (6 cards) - Each hormone gets a colour-coded card covering:
  • Cell source and molecular structure
  • What stimulates secretion
  • Key physiological actions
  • Clinical significance
  • Relevant drugs
  • Covered: Insulin, Glucagon, Somatostatin, Pancreatic Polypeptide, Ghrelin, Amylin (IAPP)
3. Insulin vs. Glucagon Comparison Table - Side-by-side comparison across 9 parameters (trigger, glucose effect, glycogenolysis, gluconeogenesis, lipolysis, protein synthesis, receptor pathway, metabolic state).
4. Key Clinical Conditions Table - DM Type 1/2, DKA, Insulinoma, Glucagonoma, Somatostatinoma, Acromegaly - with pathophysiology, features, and treatment principles.
5. High-Yield Exam Points - 14 starred facts (C-peptide, Whipple's triad, GLUT2 vs GLUT4, sulphonylurea mechanism, MEN-1, ghrelin as the only orexigenic gut peptide, etc.)
6. Pharmacology Table - 9 drug classes targeting pancreatic hormones with mechanisms and clinical uses.

PowerPoint file presentation for harmones secreted by pancreas

Reading File
Reading File
Reading File
Writing File

~/pancreatic-hormones/generate_pptx.js

const pptxgen = require("pptxgenjs");

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Hormones Secreted by the Pancreas";
pres.author = "Medical Education";

// ── Colour Palette ──────────────────────────────────────────────
const C = {
  navy:        "0D2B4E",   // dominant dark
  teal:        "0E7C7B",   // accent 1 (hormone colour)
  amber:       "E67E22",   // accent 2 (clinical)
  green:       "1E6B3C",   // accent 3 (exam facts)
  purple:      "5B2C8D",   // accent 4 (pharmacology)
  white:       "FFFFFF",
  offwhite:    "F0F6FF",
  lightTeal:   "D0EFEF",
  lightAmber:  "FEF0E2",
  lightGreen:  "D4EDDA",
  lightPurple: "EDE7F6",
  gray:        "F4F6F8",
  darkText:    "1C1C1C",
  mutedText:   "555555",
  lineColor:   "BBBBBB",
};

// ── Slide Dimensions ────────────────────────────────────────────
const W = 10, H = 5.625;

// ═══════════════════════════════════════════════════════════════
// HELPER FUNCTIONS
// ═══════════════════════════════════════════════════════════════
function addSlideHeader(slide, title, subtitle, bgColor, titleColor) {
  // Full-width top bar
  slide.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 0, w: W, h: 1.1,
    fill: { color: bgColor || C.navy },
    line: { color: bgColor || C.navy },
  });
  slide.addText(title, {
    x: 0.4, y: 0.08, w: 9.2, h: 0.6,
    fontSize: 22, bold: true, color: titleColor || C.white,
    fontFace: "Calibri", margin: 0,
  });
  if (subtitle) {
    slide.addText(subtitle, {
      x: 0.4, y: 0.7, w: 9.2, h: 0.35,
      fontSize: 11, color: "BDE0FF", fontFace: "Calibri", margin: 0,
    });
  }
}

function addFooter(slide, text) {
  slide.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: H - 0.28, w: W, h: 0.28,
    fill: { color: C.navy }, line: { color: C.navy },
  });
  slide.addText(text || "Hormones of the Pancreas", {
    x: 0, y: H - 0.28, w: W, h: 0.28,
    fontSize: 7.5, color: "88AABB", align: "center",
    fontFace: "Calibri", margin: 0,
  });
}

function card(slide, x, y, w, h, headerText, headerBg, bodyLines, bodyFontSize) {
  // Card header
  slide.addShape(pres.shapes.RECTANGLE, {
    x, y, w, h: 0.32,
    fill: { color: headerBg }, line: { color: headerBg },
  });
  slide.addText(headerText, {
    x: x + 0.06, y: y + 0.03, w: w - 0.1, h: 0.26,
    fontSize: 10, bold: true, color: C.white,
    fontFace: "Calibri", margin: 0,
  });
  // Card body
  slide.addShape(pres.shapes.RECTANGLE, {
    x, y: y + 0.32, w, h: h - 0.32,
    fill: { color: C.offwhite }, line: { color: headerBg, pt: 0.5 },
  });
  slide.addText(bodyLines, {
    x: x + 0.08, y: y + 0.36, w: w - 0.14, h: h - 0.42,
    fontSize: bodyFontSize || 8.5, color: C.darkText,
    fontFace: "Calibri", valign: "top", wrap: true, margin: 0,
  });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE SLIDE
// ═══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();

  // Background: full dark
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 0, w: W, h: H,
    fill: { color: C.navy }, line: { color: C.navy },
  });

  // Teal accent bar left
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: 0, w: 0.18, h: H,
    fill: { color: C.teal }, line: { color: C.teal },
  });

  // Decorative circles (representing islet cells)
  const circles = [
    { x: 7.8, y: 0.3, r: 1.4, c: "1A4A7A", t: 50 },
    { x: 8.6, y: 1.5, r: 0.9, c: "0E7C7B", t: 60 },
    { x: 7.2, y: 1.8, r: 0.6, c: "E67E22", t: 70 },
    { x: 8.9, y: 0.4, r: 0.55, c: "5B2C8D", t: 65 },
  ];
  circles.forEach(c => {
    s.addShape(pres.shapes.OVAL, {
      x: c.x, y: c.y, w: c.r, h: c.r,
      fill: { color: c.c, transparency: c.t },
      line: { color: c.c },
    });
  });

  // Title text
  s.addText("HORMONES OF THE PANCREAS", {
    x: 0.5, y: 1.2, w: 7.2, h: 0.8,
    fontSize: 30, bold: true, color: C.white,
    fontFace: "Calibri", charSpacing: 2,
  });

  // Teal underline
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.5, y: 2.05, w: 5.5, h: 0.05,
    fill: { color: C.teal }, line: { color: C.teal },
  });

  s.addText("Islets of Langerhans · Endocrine Pancreas", {
    x: 0.5, y: 2.2, w: 7.2, h: 0.4,
    fontSize: 14, color: "88CCDD", fontFace: "Calibri", italic: true,
  });

  s.addText("A Complete Medical Student Guide", {
    x: 0.5, y: 2.7, w: 7.2, h: 0.35,
    fontSize: 11, color: "AABBCC", fontFace: "Calibri",
  });

  // Bottom info band
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0, y: H - 0.8, w: W, h: 0.8,
    fill: { color: "091E36" }, line: { color: "091E36" },
  });
  s.addText([
    { text: "Topics Covered: ", options: { bold: true, color: C.teal } },
    { text: "Insulin · Glucagon · Somatostatin · Pancreatic Polypeptide · Ghrelin · Amylin · Clinical Significance · Pharmacology", options: { color: "AABBCC" } },
  ], {
    x: 0.3, y: H - 0.75, w: 9.4, h: 0.7,
    fontSize: 9, fontFace: "Calibri",
  });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 2 — PANCREAS OVERVIEW
// ═══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x:0,y:0,w:W,h:H, fill:{color:C.gray}, line:{color:C.gray} });
  addSlideHeader(s, "The Endocrine Pancreas — Overview", "Structure & Function of the Islets of Langerhans");
  addFooter(s);

  // Left: overview text box
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.3, y: 1.25, w: 4.4, h: 3.9,
    fill: { color: C.white }, line: { color: C.lineColor, pt: 0.8 },
    shadow: { type: "outer", color: "000000", blur: 5, offset: 2, angle: 135, opacity: 0.08 },
  });
  s.addText([
    { text: "What is the Endocrine Pancreas?\n", options: { bold: true, color: C.navy, fontSize: 11 } },
    { text: "The pancreas has two components:\n", options: { color: C.mutedText, fontSize: 9 } },
    { text: "• Exocrine: ", options: { bold: true, color: C.darkText, fontSize: 9 } },
    { text: "Acinar cells → digestive enzymes into gut\n", options: { color: C.darkText, fontSize: 9 } },
    { text: "• Endocrine: ", options: { bold: true, color: C.teal, fontSize: 9 } },
    { text: "Islets of Langerhans → hormones into bloodstream\n\n", options: { color: C.darkText, fontSize: 9 } },
    { text: "Islets of Langerhans:\n", options: { bold: true, color: C.navy, fontSize: 11 } },
    { text: "• ~1 million islets in adult pancreas\n• 1–2% of total pancreatic mass\n• 2,500–4,000 cells per islet\n• 5 distinct endocrine cell types\n\n", options: { color: C.darkText, fontSize: 9 } },
    { text: "Cellular Architecture:\n", options: { bold: true, color: C.navy, fontSize: 11 } },
    { text: "• β cells fill the central core\n• α cells form the outer rim\n• δ cells interpose between α and β\n• PP and ε cells scattered throughout\n\n", options: { color: C.darkText, fontSize: 9 } },
    { text: "Communication: ", options: { bold: true, color: C.navy, fontSize: 9 } },
    { text: "Gap junctions, paracrine signals, and autonomic innervation (sympathetic + parasympathetic) coordinate hormone secretion.", options: { color: C.darkText, fontSize: 9 } },
  ], { x: 0.45, y: 1.32, w: 4.1, h: 3.75, fontFace: "Calibri", valign: "top", wrap: true });

  // Right: cell type cards
  const cellTypes = [
    { cell: "β (Beta) Cell", pct: "60–65%", hormone: "Insulin + Amylin", bg: C.teal },
    { cell: "α (Alpha) Cell", pct: "20–30%", hormone: "Glucagon", bg: "2980B9" },
    { cell: "δ (Delta) Cell", pct: "5–10%", hormone: "Somatostatin", bg: "8E44AD" },
    { cell: "PP / F Cell", pct: "<5%", hormone: "Pancreatic Polypeptide", bg: C.amber },
    { cell: "ε (Epsilon) Cell", pct: "Rare", hormone: "Ghrelin", bg: C.green },
  ];
  cellTypes.forEach((ct, i) => {
    const y = 1.25 + i * 0.76;
    s.addShape(pres.shapes.RECTANGLE, {
      x: 5.0, y, w: 4.65, h: 0.68,
      fill: { color: C.white }, line: { color: ct.bg, pt: 1.5 },
    });
    s.addShape(pres.shapes.RECTANGLE, {
      x: 5.0, y, w: 0.12, h: 0.68,
      fill: { color: ct.bg }, line: { color: ct.bg },
    });
    s.addText(ct.cell, {
      x: 5.18, y: y + 0.06, w: 2.0, h: 0.25,
      fontSize: 10, bold: true, color: ct.bg, fontFace: "Calibri", margin: 0,
    });
    s.addText(ct.pct + " of islet", {
      x: 5.18, y: y + 0.34, w: 2.0, h: 0.22,
      fontSize: 8, color: C.mutedText, fontFace: "Calibri", margin: 0,
    });
    s.addText("→ " + ct.hormone, {
      x: 7.1, y: y + 0.18, w: 2.5, h: 0.3,
      fontSize: 9.5, bold: true, color: C.darkText, fontFace: "Calibri", margin: 0,
    });
  });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 3 — INSULIN
// ═══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x:0,y:0,w:W,h:H, fill:{color:C.gray}, line:{color:C.gray} });
  addSlideHeader(s, "1. Insulin", "β (Beta) Cells  ·  Peptide hormone (A + B chains, 51 AA)  ·  MW ~6,000 Da  ·  Hormone of 'Abundance'", C.teal);
  addFooter(s, "Insulin — β Cells");

  // Stimuli card
  card(s, 0.3, 1.2, 3.0, 2.0, "▲ Secretion Stimulated By", C.teal, [
    { text: "• High blood glucose (primary trigger)\n• Amino acids (arginine, leucine)\n• GLP-1 & GIP (incretins)\n• Parasympathetic (vagal) stimulation\n• Sulphonylureas (drug-induced)", options: { fontSize: 8.5, color: C.darkText, breakLine: false } },
  ]);

  // Actions card
  card(s, 3.5, 1.2, 3.8, 2.0, "⚡ Key Physiological Actions", C.navy, [
    { text: "• ↑ Glucose uptake (GLUT4 insertion) → ↓ blood glucose\n• ↑ Glycogen synthesis; ↓ glycogenolysis & gluconeogenesis\n• ↑ Lipogenesis; ↓ lipolysis & ketogenesis\n• ↑ Protein synthesis (anabolic)\n• Drives K⁺ into cells → lowers serum K⁺", options: { fontSize: 8.5, color: C.darkText } },
  ]);

  // Clinical card
  card(s, 7.5, 1.2, 2.2, 2.0, "🏥 Clinical", "8B1A1A", [
    { text: "• T1DM: absolute deficiency\n• T2DM: relative + resistance\n• DKA: uncontrolled\n• HHS: severe hyperglycaemia\n• Insulinoma: excess\n• Hyperkalaemia Rx", options: { fontSize: 8, color: C.darkText } },
  ]);

  // Mechanism card (bottom left)
  card(s, 0.3, 3.3, 4.5, 1.95, "⚙ Mechanism of Action", C.teal, [
    { text: "Receptor: Tyrosine Kinase Receptor (α₂β₂ tetramer)\n• Insulin binds α-subunits → β-subunit autophosphorylation\n• Activates PI3K/Akt pathway → GLUT4 translocation to membrane\n• Stimulates gene transcription (nucleus, Golgi, ER)\n• Down-regulates own receptor in obesity/T2DM", options: { fontSize: 8.5, color: C.darkText } },
  ]);

  // Drugs card (bottom right)
  card(s, 5.0, 3.3, 4.65, 1.95, "💊 Key Drugs", "4A235A", [
    { text: "• Insulin analogues: rapid (lispro, aspart), long-acting (glargine, detemir)\n• Sulphonylureas: close K-ATP → stimulate release\n• Metformin: ↓ gluconeogenesis, ↑ sensitivity\n• GLP-1 agonists: semaglutide, liraglutide\n• DPP-4 inhibitors: sitagliptin (prolong incretin)", options: { fontSize: 8.5, color: C.darkText } },
  ]);
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 4 — GLUCAGON
// ═══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x:0,y:0,w:W,h:H, fill:{color:C.gray}, line:{color:C.gray} });
  addSlideHeader(s, "2. Glucagon", "α (Alpha) Cells  ·  Polypeptide, 29 AA  ·  MW ~3,500 Da  ·  Counter-regulatory Hormone", "2980B9");
  addFooter(s, "Glucagon — α Cells");

  card(s, 0.3, 1.2, 3.0, 2.0, "▲ Secretion Stimulated By", "2980B9", [
    { text: "• ↓ Blood glucose (primary)\n• Amino acids (protein-rich meal)\n• Sympathetic stimulation / catecholamines\n• Fasting / prolonged exercise\n• Somatostatin INHIBITS release", options: { fontSize: 8.5, color: C.darkText } },
  ]);

  card(s, 3.5, 1.2, 3.8, 2.0, "⚡ Key Physiological Actions", C.navy, [
    { text: "• ↑ Hepatic glycogenolysis → ↑ blood glucose\n• ↑ Gluconeogenesis (liver)\n• ↑ Lipolysis & ketogenesis (adipose)\n• Receptor: GPCR (Gs) → ↑ cAMP → PKA\n• OPPOSITE effects to insulin", options: { fontSize: 8.5, color: C.darkText } },
  ]);

  card(s, 7.5, 1.2, 2.2, 2.0, "🏥 Clinical", "8B1A1A", [
    { text: "• Glucagonoma:\n  4D's: Dermatitis,\n  DM, DVT, Dep.\n• Hypoglycaemia\n  rescue (1mg IM)\n• β-blocker OD Rx\n• Worsens DKA", options: { fontSize: 8, color: C.darkText } },
  ]);

  // Glucagonoma box
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.3, y: 3.3, w: 4.5, h: 1.95,
    fill: { color: C.lightAmber }, line: { color: C.amber, pt: 1 },
  });
  s.addText("Glucagonoma — The 4 D's", {
    x: 0.4, y: 3.35, w: 4.3, h: 0.3,
    fontSize: 10, bold: true, color: C.amber, fontFace: "Calibri", margin: 0,
  });
  const fourDs = [
    { d: "Dermatitis", detail: "Necrolytic migratory erythema (NME) — pathognomonic" },
    { d: "Diabetes", detail: "Glucagon excess → hyperglycaemia" },
    { d: "DVT", detail: "Hypercoagulability (venous thromboembolism)" },
    { d: "Depression", detail: "Neuropsychiatric manifestation" },
  ];
  fourDs.forEach((item, i) => {
    s.addText([
      { text: item.d + ": ", options: { bold: true, color: C.amber } },
      { text: item.detail, options: { color: C.darkText } },
    ], { x: 0.5, y: 3.68 + i * 0.37, w: 4.1, h: 0.35, fontSize: 8.5, fontFace: "Calibri", margin: 0 });
  });

  card(s, 5.0, 3.3, 4.65, 1.95, "💊 Drugs & Treatment", "4A235A", [
    { text: "• Glucagon kit: IM/SC for hypoglycaemia rescue\n• Beta-blocker OD: glucagon bypasses β-receptor (↑ cAMP → inotropy)\n• GLP-1 agonists (semaglutide): exploit glucagon receptor family\n• Octreotide: suppresses glucagonoma\n• Streptozocin: chemotherapy for glucagonoma", options: { fontSize: 8.5, color: C.darkText } },
  ]);
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 5 — SOMATOSTATIN
// ═══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x:0,y:0,w:W,h:H, fill:{color:C.gray}, line:{color:C.gray} });
  addSlideHeader(s, "3. Somatostatin (SST)", "δ (Delta) Cells  ·  Polypeptide (SST-14 / SST-28)  ·  Universal Inhibitor", "8E44AD");
  addFooter(s, "Somatostatin — δ Cells");

  card(s, 0.3, 1.2, 3.0, 2.0, "▲ Secretion Stimulated By", "8E44AD", [
    { text: "• High glucose, amino acids, fatty acids\n• GIP, glucagon, CCK\n• Paracrine signals from islet cells\n• Mixed meal (coordinated response)", options: { fontSize: 9, color: C.darkText } },
  ]);

  card(s, 3.5, 1.2, 6.2, 2.0, "⚡ Actions — SST Inhibits EVERYTHING", "8E44AD", [
    { text: "• Inhibits insulin AND glucagon (paracrine — δ cells interposed between α and β)\n• Inhibits GH and TSH release (anterior pituitary)\n• Inhibits gastric HCl and pepsin secretion\n• Inhibits pancreatic exocrine secretion (enzymes + bicarbonate)\n• Inhibits intestinal motility and nutrient absorption\n• Inhibits virtually all GI hormones (secretin, CCK, GIP, motilin, VIP)", options: { fontSize: 8.5, color: C.darkText } },
  ]);

  // Somatostatinoma triad box
  s.addShape(pres.shapes.RECTANGLE, {
    x: 0.3, y: 3.3, w: 4.5, h: 1.95,
    fill: { color: C.lightPurple }, line: { color: "8E44AD", pt: 1 },
  });
  s.addText("Somatostatinoma Triad", {
    x: 0.4, y: 3.35, w: 4.3, h: 0.3,
    fontSize: 10, bold: true, color: "8E44AD", fontFace: "Calibri", margin: 0,
  });
  const triad = [
    { item: "Diabetes Mellitus", reason: "↓ Insulin secretion" },
    { item: "Cholelithiasis (gallstones)", reason: "↓ Bile secretion & gallbladder motility" },
    { item: "Steatorrhoea", reason: "↓ Pancreatic enzymes → fat malabsorption" },
  ];
  triad.forEach((t, i) => {
    s.addText([
      { text: "• " + t.item + ": ", options: { bold: true, color: "8E44AD" } },
      { text: t.reason, options: { color: C.darkText } },
    ], { x: 0.5, y: 3.72 + i * 0.42, w: 4.1, h: 0.38, fontSize: 8.5, fontFace: "Calibri", margin: 0 });
  });

  card(s, 5.0, 3.3, 4.65, 1.95, "💊 Clinical Uses of SST Analogues", "4A235A", [
    { text: "• Octreotide (short-acting):\n  - Acromegaly (↓ GH)\n  - Carcinoid syndrome (↓ flushing & diarrhoea)\n  - Glucagonoma / VIPoma\n  - Oesophageal variceal bleed (↓ portal pressure)\n  - Post-op pancreatic fistulae\n• Lanreotide / Pasireotide: long-acting depot forms", options: { fontSize: 8.5, color: C.darkText } },
  ]);
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 6 — PP, GHRELIN, AMYLIN (3 hormones on one slide)
// ═══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x:0,y:0,w:W,h:H, fill:{color:C.gray}, line:{color:C.gray} });
  addSlideHeader(s, "4–6. Pancreatic Polypeptide · Ghrelin · Amylin", "PP Cells · ε Cells · β Cells (co-secreted with Insulin)");
  addFooter(s, "PP · Ghrelin · Amylin");

  // PP Card
  const ppY = 1.18;
  s.addShape(pres.shapes.RECTANGLE, { x:0.2, y:ppY, w:3.15, h:0.32, fill:{color:C.amber}, line:{color:C.amber} });
  s.addText("Pancreatic Polypeptide (PP)  —  PP / F Cells", { x:0.28, y:ppY+0.04, w:3.0, h:0.24, fontSize:9, bold:true, color:C.white, fontFace:"Calibri", margin:0 });
  s.addShape(pres.shapes.RECTANGLE, { x:0.2, y:ppY+0.32, w:3.15, h:1.55, fill:{color:C.lightAmber}, line:{color:C.amber, pt:0.6} });
  s.addText([
    { text: "Stimulated by: ", options: { bold: true } },
    { text: "protein meal, fasting, vagal stimulation\n", options: {} },
    { text: "Actions:\n", options: { bold: true } },
    { text: "• ↓ Pancreatic exocrine secretion\n• ↓ Bile secretion & gut motility\n• Facilitates hepatic insulin action\n", options: {} },
    { text: "Clinical: ", options: { bold: true } },
    { text: "PPoma (rare); marker for MEN-1 pancreatic tumours; low PP response in autonomic neuropathy", options: {} },
  ], { x:0.28, y:ppY+0.36, w:2.95, h:1.44, fontSize:8.2, color:C.darkText, fontFace:"Calibri", valign:"top", wrap:true });

  // Ghrelin Card
  const ghY = 1.18;
  s.addShape(pres.shapes.RECTANGLE, { x:3.55, y:ghY, w:3.15, h:0.32, fill:{color:C.green}, line:{color:C.green} });
  s.addText("Ghrelin  —  ε (Epsilon) Cells  +  Stomach", { x:3.63, y:ghY+0.04, w:3.0, h:0.24, fontSize:9, bold:true, color:C.white, fontFace:"Calibri", margin:0 });
  s.addShape(pres.shapes.RECTANGLE, { x:3.55, y:ghY+0.32, w:3.15, h:1.55, fill:{color:C.lightGreen}, line:{color:C.green, pt:0.6} });
  s.addText([
    { text: "Stimulated by: ", options: { bold: true } },
    { text: "fasting, empty stomach, hypoglycaemia\n", options: {} },
    { text: "Actions:\n", options: { bold: true } },
    { text: "• Stimulates appetite (orexigenic)\n• Stimulates GH release (GH secretagogue)\n• ↓ Insulin secretion & action\n• ↑ Gastric motility\n", options: {} },
    { text: "Clinical: ", options: { bold: true } },
    { text: "Prader-Willi: very high ghrelin; Post-sleeve gastrectomy: ghrelin ↓ → satiety; Anamorelin (cancer cachexia)", options: {} },
  ], { x:3.63, y:ghY+0.36, w:2.95, h:1.44, fontSize:8.2, color:C.darkText, fontFace:"Calibri", valign:"top", wrap:true });

  // Amylin Card
  const amY = 1.18;
  s.addShape(pres.shapes.RECTANGLE, { x:6.9, y:amY, w:2.9, h:0.32, fill:{color:"8B1A1A"}, line:{color:"8B1A1A"} });
  s.addText("Amylin (IAPP)  —  β Cells", { x:6.98, y:amY+0.04, w:2.75, h:0.24, fontSize:9, bold:true, color:C.white, fontFace:"Calibri", margin:0 });
  s.addShape(pres.shapes.RECTANGLE, { x:6.9, y:amY+0.32, w:2.9, h:1.55, fill:{color:"FDE8E8"}, line:{color:"8B1A1A", pt:0.6} });
  s.addText([
    { text: "Co-secreted with insulin after meals\n", options: { bold: true } },
    { text: "Actions:\n", options: { bold: true } },
    { text: "• ↓ Gastric emptying → blunts glucose spike\n• Suppresses post-meal glucagon\n• ↓ Appetite (hypothalamus)\n", options: {} },
    { text: "Clinical: ", options: { bold: true } },
    { text: "IAPP aggregates = islet amyloid (T2DM hallmark). Deficient in T1DM. Structural similarity to Alzheimer Aβ plaque.", options: {} },
  ], { x:6.98, y:amY+0.36, w:2.72, h:1.44, fontSize:8.2, color:C.darkText, fontFace:"Calibri", valign:"top", wrap:true });

  // Bottom summary row — key mnemonic tags
  const tags = [
    { text: "PP: Pauses Pancreas (inhibits exocrine)", bg: C.amber },
    { text: "Ghrelin: Only GUT hormone that INCREASES appetite", bg: C.green },
    { text: "Amylin: T2DM amyloid marker; Pramlintide in clinic", bg: "8B1A1A" },
  ];
  tags.forEach((tag, i) => {
    s.addShape(pres.shapes.RECTANGLE, {
      x: 0.2 + i * 3.3, y: 4.78, w: 3.1, h: 0.47,
      fill: { color: tag.bg }, line: { color: tag.bg },
    });
    s.addText(tag.text, {
      x: 0.28 + i * 3.3, y: 4.8, w: 2.95, h: 0.43,
      fontSize: 8.5, bold: true, color: C.white, fontFace: "Calibri",
      align: "center", valign: "middle",
    });
  });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 7 — INSULIN vs GLUCAGON COMPARISON
// ═══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x:0,y:0,w:W,h:H, fill:{color:C.gray}, line:{color:C.gray} });
  addSlideHeader(s, "Insulin vs. Glucagon — Glucose Regulation", "The Two Master Metabolic Hormones");
  addFooter(s, "Insulin vs Glucagon");

  const rows = [
    ["Parameter", "INSULIN  (β-cell)", "GLUCAGON  (α-cell)"],
    ["Main trigger", "↑ Blood glucose, amino acids, incretins", "↓ Blood glucose, fasting, amino acids"],
    ["Blood glucose effect", "↓ LOWERS (hypoglycaemic)", "↑ RAISES (hyperglycaemic)"],
    ["Glycogenolysis", "↓ Inhibits", "↑ Stimulates"],
    ["Gluconeogenesis", "↓ Inhibits", "↑ Stimulates"],
    ["Glycogen synthesis", "↑ Stimulates", "↓ Inhibits"],
    ["Lipolysis / Ketogenesis", "↓ Inhibits", "↑ Stimulates"],
    ["Protein synthesis", "↑ Stimulates (anabolic)", "↓ Inhibits (catabolic)"],
    ["Receptor / Pathway", "Tyrosine kinase → PI3K/Akt → GLUT4", "GPCR (Gs) → ↑ cAMP → PKA"],
    ["Metabolic state", "'Fed' / Anabolic", "'Fasted' / Catabolic"],
  ];

  const colW = [2.4, 3.7, 3.7];
  const startX = 0.15;
  const startY = 1.18;
  const rowH = 0.39;

  rows.forEach((row, ri) => {
    const y = startY + ri * rowH;
    const isHeader = ri === 0;
    row.forEach((cell, ci) => {
      const x = startX + colW.slice(0, ci).reduce((a, b) => a + b, 0);
      const bg = isHeader
        ? [C.navy, C.teal, "2980B9"][ci]
        : ci === 0 ? "EAF0F8" : ri % 2 === 0 ? C.white : C.gray;
      s.addShape(pres.shapes.RECTANGLE, {
        x, y, w: colW[ci], h: rowH,
        fill: { color: bg }, line: { color: C.lineColor, pt: 0.3 },
      });
      s.addText(cell, {
        x: x + 0.08, y: y + 0.04, w: colW[ci] - 0.12, h: rowH - 0.06,
        fontSize: isHeader ? 10 : 8.5,
        bold: isHeader || ci === 0,
        color: isHeader ? C.white : C.darkText,
        fontFace: "Calibri", valign: "middle", margin: 0,
      });
    });
  });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 8 — CLINICAL CONDITIONS
// ═══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x:0,y:0,w:W,h:H, fill:{color:C.gray}, line:{color:C.gray} });
  addSlideHeader(s, "Clinical Conditions — Pancreatic Hormone Disorders", "Excess, Deficiency & Tumour Syndromes", "8B1A1A");
  addFooter(s, "Clinical Conditions");

  const conditions = [
    { name: "Type 1 DM", hormone: "↓↓ Insulin", path: "Autoimmune β-cell destruction (Anti-GAD, anti-IA2 Ab)", features: "Polyuria, polydipsia, weight loss; DKA prone; young onset", rx: "Insulin replacement (basal-bolus)" },
    { name: "Type 2 DM", hormone: "↓ Insulin + resistance", path: "Insulin resistance → β-cell exhaustion; amyloid deposits in islets", features: "Gradual onset; obesity; acanthosis nigricans; hyperglycaemia", rx: "Metformin → stepwise; insulin when needed" },
    { name: "DKA", hormone: "Severe ↓ Insulin, ↑ Glucagon", path: "Unrestrained lipolysis → ketoacids; anion-gap metabolic acidosis", features: "Kussmaul breathing, fruity breath, pH <7.3, hyperglycaemia", rx: "IV insulin + fluids + K⁺ replacement" },
    { name: "Insulinoma", hormone: "↑↑ Insulin (autonomous)", path: "Benign β-cell tumour (>90%); inappropriate fasting insulin", features: "Whipple's triad: hypoglycaemia + symptoms + relief with glucose", rx: "Surgical resection; diazoxide pre-op" },
    { name: "Glucagonoma", hormone: "↑↑ Glucagon", path: "Malignant α-cell tumour; MEN-1 association", features: "4 D's: NME dermatitis, DM, DVT, Depression", rx: "Octreotide; surgery; streptozocin" },
    { name: "Somatostatinoma", hormone: "↑↑ Somatostatin", path: "Rare δ-cell tumour; inhibits insulin, glucagon, exocrine", features: "Triad: DM + gallstones + steatorrhoea", rx: "Surgery; octreotide" },
  ];

  const colW2 = [1.5, 1.5, 2.4, 2.4, 2.0];
  const headers = ["Condition", "Hormone", "Pathophysiology", "Key Features", "Treatment"];
  const startX = 0.1, startY2 = 1.18, rowH2 = 0.56;

  // Header row
  headers.forEach((h, ci) => {
    const x = startX + colW2.slice(0, ci).reduce((a, b) => a + b, 0);
    s.addShape(pres.shapes.RECTANGLE, { x, y: startY2, w: colW2[ci], h: 0.34, fill: { color: "8B1A1A" }, line: { color: "8B1A1A" } });
    s.addText(h, { x: x+0.05, y: startY2+0.04, w: colW2[ci]-0.08, h: 0.26, fontSize: 9, bold: true, color: C.white, fontFace: "Calibri", margin: 0 });
  });

  // Data rows
  conditions.forEach((cond, ri) => {
    const y = startY2 + 0.34 + ri * rowH2;
    const bg = ri % 2 === 0 ? C.lightAmber : C.white;
    const cells = [cond.name, cond.hormone, cond.path, cond.features, cond.rx];
    cells.forEach((cell, ci) => {
      const x = startX + colW2.slice(0, ci).reduce((a, b) => a + b, 0);
      s.addShape(pres.shapes.RECTANGLE, { x, y, w: colW2[ci], h: rowH2, fill: { color: bg }, line: { color: C.lineColor, pt: 0.3 } });
      s.addText(cell, {
        x: x+0.05, y: y+0.04, w: colW2[ci]-0.08, h: rowH2-0.06,
        fontSize: ci === 0 ? 8.5 : 7.8,
        bold: ci === 0,
        color: ci === 0 ? "8B1A1A" : C.darkText,
        fontFace: "Calibri", valign: "top", wrap: true, margin: 0,
      });
    });
  });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 9 — PHARMACOLOGY
// ═══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x:0,y:0,w:W,h:H, fill:{color:C.gray}, line:{color:C.gray} });
  addSlideHeader(s, "Pharmacology — Drugs Targeting Pancreatic Hormones", "Mechanism-Based Drug Classes", "4A235A");
  addFooter(s, "Pharmacology");

  const drugs = [
    { drug: "Insulin analogues\n(lispro, aspart, glargine)", target: "Insulin receptor", mech: "Replaces deficient hormone → GLUT4 ↑, glucose uptake", use: "T1DM, T2DM, DKA, hyperkalaemia" },
    { drug: "Sulphonylureas\n(glibenclamide, gliclazide)", target: "K-ATP channels (β-cell)", mech: "Close K-ATP → depolarise β-cell → Ca²⁺ entry → insulin release", use: "T2DM — stimulate endogenous insulin" },
    { drug: "GLP-1 agonists\n(semaglutide, liraglutide)", target: "GLP-1 receptor", mech: "Glucose-dependent insulin ↑, glucagon ↓, gastric emptying ↓, weight ↓", use: "T2DM, obesity (Wegovy), CV risk" },
    { drug: "DPP-4 inhibitors\n(sitagliptin)", target: "DPP-4 enzyme", mech: "Inhibit GLP-1/GIP degradation → prolong incretin effect", use: "T2DM — weight neutral" },
    { drug: "Metformin", target: "Mitochondrial complex I / AMPK", mech: "↓ Hepatic gluconeogenesis; ↑ insulin sensitivity; activates AMPK", use: "First-line T2DM, PCOS" },
    { drug: "Diazoxide", target: "K-ATP channel opener", mech: "Opens K-ATP → hyperpolarise β-cell → inhibits insulin release", use: "Insulinoma pre-op; congenital hyperinsulinism" },
    { drug: "Octreotide / Lanreotide", target: "Somatostatin receptors (SSTR2/5)", mech: "Mimics SST → suppresses GH, glucagon, insulin, GI hormones", use: "Acromegaly, carcinoid, glucagonoma, varices" },
    { drug: "Pramlintide", target: "Amylin receptor", mech: "↓ Gastric emptying; suppresses glucagon; ↓ appetite", use: "Adjunct insulin in T1DM and T2DM" },
    { drug: "Glucagon kit", target: "Glucagon receptor (Gs-GPCR)", mech: "↑ Hepatic glycogenolysis → ↑ cAMP → glucose release", use: "Hypoglycaemia rescue; β-blocker / CCB OD" },
  ];

  const cw = [2.1, 2.0, 3.4, 2.4];
  const heads = ["Drug / Class", "Target", "Mechanism", "Clinical Use"];
  const sx = 0.1, sy = 1.18;

  heads.forEach((h, ci) => {
    const x = sx + cw.slice(0, ci).reduce((a, b) => a + b, 0);
    s.addShape(pres.shapes.RECTANGLE, { x, y: sy, w: cw[ci], h: 0.32, fill: { color: "4A235A" }, line: { color: "4A235A" } });
    s.addText(h, { x: x+0.05, y: sy+0.03, w: cw[ci]-0.08, h: 0.26, fontSize: 9, bold: true, color: C.white, fontFace: "Calibri", margin: 0 });
  });

  drugs.forEach((d, ri) => {
    const y = sy + 0.32 + ri * 0.43;
    const bg = ri % 2 === 0 ? C.lightPurple : C.white;
    const cells = [d.drug, d.target, d.mech, d.use];
    cells.forEach((cell, ci) => {
      const x = sx + cw.slice(0, ci).reduce((a, b) => a + b, 0);
      s.addShape(pres.shapes.RECTANGLE, { x, y, w: cw[ci], h: 0.43, fill: { color: bg }, line: { color: C.lineColor, pt: 0.25 } });
      s.addText(cell, {
        x: x+0.05, y: y+0.03, w: cw[ci]-0.08, h: 0.37,
        fontSize: 7.8, bold: ci === 0, color: ci === 0 ? "4A235A" : C.darkText,
        fontFace: "Calibri", valign: "top", wrap: true, margin: 0,
      });
    });
  });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 10 — HIGH-YIELD EXAM POINTS
// ═══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x:0,y:0,w:W,h:H, fill:{color:C.gray}, line:{color:C.gray} });
  addSlideHeader(s, "High-Yield Exam Points", "Key Facts for USMLE / MBBS / Clinical Exams", C.green);
  addFooter(s, "High-Yield Exam Points");

  const facts = [
    "Insulin is the ONLY hormone that LOWERS blood glucose. All others (glucagon, cortisol, adrenaline, GH) are counter-regulatory.",
    "C-peptide is co-secreted with insulin in equimolar amounts; longer half-life → used to detect endogenous insulin (insulinoma vs. exogenous injection).",
    "Proinsulin → Insulin + C-peptide (cleavage by prohormone convertase in secretory granules).",
    "GLUT2 (high-Km) = glucose sensor on β-cells. GLUT4 (insulin-dependent) = in muscle and adipose tissue.",
    "Sulphonylureas close K-ATP on β-cells → depolarisation → Ca²⁺ influx → insulin release. Diazoxide OPENS K-ATP (opposite effect).",
    "GLP-1 (incretin from L-cells) enhances glucose-dependent insulin release. GLP-1 agonists (semaglutide) exploit this pathway.",
    "Whipple's triad (insulinoma): (1) symptoms of hypoglycaemia, (2) documented low glucose, (3) relief with glucose.",
    "MEN-1 (3 P's): Parathyroid + Pituitary + Pancreatic tumours. Glucagonoma, insulinoma, and VIPoma are all MEN-1 associated.",
    "Ghrelin = ONLY GI peptide that INCREASES appetite. All others (GLP-1, PYY, CCK) decrease appetite.",
    "Amyloid (IAPP) deposits in pancreatic islets are the histological hallmark of Type 2 DM.",
    "Glucagonoma: Necrolytic Migratory Erythema (NME) is PATHOGNOMONIC — starts periorificially, migrates cyclically.",
    "Octreotide reduces portal pressure in variceal bleeding by splanchnic vasoconstriction (via SST receptors on vessels).",
    "Insulin drives K⁺ into cells — used therapeutically in hyperkalaemia (give with dextrose to prevent hypoglycaemia).",
  ];

  const mid = Math.ceil(facts.length / 2);
  const col1 = facts.slice(0, mid);
  const col2 = facts.slice(mid);

  [col1, col2].forEach((col, ci) => {
    const x = ci === 0 ? 0.2 : 5.1;
    const colWidth = 4.7;
    col.forEach((fact, fi) => {
      const y = 1.18 + fi * 0.49;
      s.addShape(pres.shapes.RECTANGLE, {
        x, y, w: colWidth, h: 0.44,
        fill: { color: fi % 2 === 0 ? C.lightGreen : C.white },
        line: { color: C.green, pt: 0.4 },
      });
      s.addShape(pres.shapes.RECTANGLE, { x, y, w: 0.08, h: 0.44, fill: { color: C.green }, line: { color: C.green } });
      s.addText("★ " + fact, {
        x: x + 0.12, y: y + 0.04, w: colWidth - 0.18, h: 0.36,
        fontSize: 7.8, color: C.darkText, fontFace: "Calibri", valign: "top", wrap: true, margin: 0,
      });
    });
  });
}

// ═══════════════════════════════════════════════════════════════
// SLIDE 11 — SUMMARY / CLOSING
// ═══════════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x:0,y:0,w:W,h:H, fill:{color:C.navy}, line:{color:C.navy} });

  // Teal left bar
  s.addShape(pres.shapes.RECTANGLE, { x:0,y:0,w:0.18,h:H, fill:{color:C.teal}, line:{color:C.teal} });

  s.addText("SUMMARY", { x:0.4, y:0.3, w:9.2, h:0.5, fontSize:26, bold:true, color:C.white, fontFace:"Calibri", charSpacing:3 });
  s.addShape(pres.shapes.RECTANGLE, { x:0.4, y:0.85, w:5.0, h:0.05, fill:{color:C.teal}, line:{color:C.teal} });
  s.addText("Hormones of the Pancreas — Key Takeaways", { x:0.4, y:0.95, w:9, h:0.35, fontSize:12, color:"88CCDD", fontFace:"Calibri", italic:true });

  const summaryItems = [
    { cell: "β", hormone: "Insulin", one: "Lowers glucose, anabolic, GLUT4, K⁺ shift", bg: C.teal },
    { cell: "α", hormone: "Glucagon", one: "Raises glucose, glycogenolysis, ketogenesis", bg: "2980B9" },
    { cell: "δ", hormone: "Somatostatin", one: "Universal inhibitor — insulin, glucagon, GH, GI", bg: "8E44AD" },
    { cell: "PP", hormone: "Pancreatic Polypeptide", one: "Inhibits exocrine pancreas and bile", bg: C.amber },
    { cell: "ε", hormone: "Ghrelin", one: "Hunger hormone — only orexigenic GI peptide", bg: C.green },
    { cell: "β", hormone: "Amylin (IAPP)", one: "Slows gastric emptying; islet amyloid in T2DM", bg: "8B1A1A" },
  ];

  summaryItems.forEach((item, i) => {
    const col = i < 3 ? 0 : 1;
    const row = i % 3;
    const x = col === 0 ? 0.35 : 5.2;
    const y = 1.42 + row * 1.1;
    s.addShape(pres.shapes.OVAL, { x: x, y: y+0.1, w: 0.55, h: 0.55, fill:{color:item.bg}, line:{color:item.bg} });
    s.addText(item.cell, { x: x, y: y+0.1, w: 0.55, h: 0.55, fontSize: 9, bold: true, color: C.white, align: "center", valign: "middle", fontFace: "Calibri" });
    s.addText(item.hormone, { x: x+0.62, y: y+0.12, w: 3.8, h: 0.28, fontSize: 11, bold: true, color: C.white, fontFace: "Calibri", margin: 0 });
    s.addText(item.one, { x: x+0.62, y: y+0.4, w: 3.8, h: 0.28, fontSize: 9, color: "AABBCC", fontFace: "Calibri", margin: 0 });
  });

  s.addText("Sources: Schwartz's Surgery 11e · Costanzo Physiology 7e · Junqueira's Histology 17e · Lippincott Pharmacology · Katzung 16e", {
    x: 0.3, y: H-0.35, w: 9.4, h: 0.3,
    fontSize: 7, color: "445566", align: "center", fontFace: "Calibri",
  });
}

// ═══════════════════════════════════════════════════════════════
// WRITE FILE
// ═══════════════════════════════════════════════════════════════
const outputPath = "/home/daytona/workspace/pancreatic-hormones/Pancreatic_Hormones.pptx";
pres.writeFile({ fileName: outputPath })
  .then(() => console.log("PPTX saved to: " + outputPath))
  .catch(e => { console.error(e); process.exit(1); });
Running Command

cd /home/daytona/workspace/pancreatic-hormones && node generate_pptx.js 2>&1

Running Command

ls -lh /home/daytona/workspace/pancreatic-hormones/

Your PowerPoint presentation is ready:

Pancreatic Hormones

Presentation · PPTX


The presentation contains 11 slides with a dark navy/teal medical theme:
SlideContent
1Title slide with decorative islet cell circles
2Endocrine Pancreas Overview — islet structure, 5 cell types with colour-coded cards
3Insulin — stimuli, actions, mechanism (tyrosine kinase/PI3K/GLUT4), clinical significance, drugs
4Glucagon — actions, Glucagonoma 4 D's breakdown, treatment
5Somatostatin — universal inhibitor actions, Somatostatinoma triad, octreotide uses
6PP · Ghrelin · Amylin — three hormones side by side with clinical pearls
7Insulin vs. Glucagon comparison table (10 parameters, colour-coded)
8Clinical Conditions table — T1DM, T2DM, DKA, Insulinoma, Glucagonoma, Somatostatinoma
9Pharmacology table — 9 drug classes with mechanisms and clinical uses
1013 High-Yield Exam Points (starred, two-column layout)
11Summary closing slide — all 6 hormones at a glance

Make the ppylt of harmones secreted by pancreas by Biochemical aspect

Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Reading File
Loading Image
Loading Image
Reading File
Writing File

~/pancreatic-hormones/generate_biochem_pptx.js

const pptxgen = require("pptxgenjs");

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title = "Pancreatic Hormones — Biochemical Aspects";
pres.author = "Medical Biochemistry";

// ── Colour Palette (Biochemistry theme: deep indigo + gold + green) ──
const C = {
  indigo:       "1A1A5E",
  indigoDark:   "0D0D3B",
  indigoMid:    "2D2D8E",
  gold:         "D4A017",
  goldLight:    "FFF3CD",
  teal:         "0E7C7B",
  tealLight:    "D0F0EF",
  green:        "1B5E20",
  greenLight:   "D4EDDA",
  red:          "8B1A1A",
  redLight:     "FDECEA",
  purple:       "4A148C",
  purpleLight:  "EDE7F6",
  amber:        "E65100",
  amberLight:   "FFF3E0",
  gray:         "F5F5F5",
  lineGray:     "CCCCCC",
  white:        "FFFFFF",
  dark:         "1C1C1C",
  muted:        "555555",
};

const W = 10, H = 5.625;

// ═══════════════════════════════════════════════════════════
// HELPERS
// ═══════════════════════════════════════════════════════════
function hdr(s, title, sub, bg) {
  s.addShape(pres.shapes.RECTANGLE, { x:0,y:0,w:W,h:1.0, fill:{color:bg||C.indigo}, line:{color:bg||C.indigo} });
  // Gold accent left stripe
  s.addShape(pres.shapes.RECTANGLE, { x:0,y:0,w:0.16,h:1.0, fill:{color:C.gold}, line:{color:C.gold} });
  s.addText(title, { x:0.28,y:0.07,w:9.5,h:0.52, fontSize:21, bold:true, color:C.white, fontFace:"Calibri", margin:0 });
  if (sub) s.addText(sub, { x:0.28,y:0.62,w:9.5,h:0.32, fontSize:10, color:"BBCCEE", fontFace:"Calibri", italic:true, margin:0 });
}

function footer(s, txt) {
  s.addShape(pres.shapes.RECTANGLE, { x:0,y:H-0.26,w:W,h:0.26, fill:{color:C.indigoDark}, line:{color:C.indigoDark} });
  s.addText(txt||"Pancreatic Hormones — Biochemical Aspects", { x:0,y:H-0.26,w:W,h:0.26, fontSize:7, color:"6677AA", align:"center", fontFace:"Calibri" });
}

function bg(s) {
  s.addShape(pres.shapes.RECTANGLE, { x:0,y:0,w:W,h:H, fill:{color:C.gray}, line:{color:C.gray} });
}

// Section box: coloured header + white body
function box(s, x, y, w, h, htxt, hbg, bodyLines, fz) {
  s.addShape(pres.shapes.RECTANGLE, { x,y,w,h:0.3, fill:{color:hbg}, line:{color:hbg} });
  s.addText(htxt, { x:x+0.07,y:y+0.03,w:w-0.1,h:0.24, fontSize:9.5, bold:true, color:C.white, fontFace:"Calibri", margin:0 });
  s.addShape(pres.shapes.RECTANGLE, { x,y:y+0.3,w,h:h-0.3, fill:{color:C.white}, line:{color:hbg,pt:0.7} });
  s.addText(bodyLines, { x:x+0.09,y:y+0.35,w:w-0.14,h:h-0.42, fontSize:fz||8.5, color:C.dark, fontFace:"Calibri", valign:"top", wrap:true, margin:0 });
}

// Step circle
function circle(s, x, y, r, num, label, bg2) {
  s.addShape(pres.shapes.OVAL, { x,y,w:r,h:r, fill:{color:bg2||C.indigo}, line:{color:bg2||C.indigo} });
  s.addText(String(num), { x,y,w:r,h:r, fontSize:11, bold:true, color:C.white, align:"center", valign:"middle", fontFace:"Calibri" });
  s.addText(label, { x:x+r+0.05,y:y,w:3.5,h:r, fontSize:8, color:C.dark, fontFace:"Calibri", valign:"middle", margin:0 });
}

// Arrow right
function arrow(s, x, y, w2) {
  s.addShape(pres.shapes.RECTANGLE, { x,y:y+0.11,w:w2,h:0.07, fill:{color:C.gold}, line:{color:C.gold} });
  s.addShape(pres.shapes.RIGHT_ARROW, { x:x+w2-0.01,y:y+0.04,w:0.2,h:0.22, fill:{color:C.gold}, line:{color:C.gold} });
}

// ═══════════════════════════════════════════════════════════
// SLIDE 1 — TITLE
// ═══════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE, { x:0,y:0,w:W,h:H, fill:{color:C.indigoDark}, line:{color:C.indigoDark} });
  // Gold diagonal accent band (simulated with two rectangles)
  s.addShape(pres.shapes.RECTANGLE, { x:0,y:0,w:0.22,h:H, fill:{color:C.gold}, line:{color:C.gold} });
  s.addShape(pres.shapes.RECTANGLE, { x:0,y:H-0.55,w:W,h:0.55, fill:{color:"111133"}, line:{color:"111133"} });

  // Decorative hexagons (molecules)
  [[8.1,0.4,0.7,"1E1E6A"],[9.0,1.2,0.5,"0D4A4A"],[8.5,2.2,0.9,"1A3A1A",60],[7.5,3.0,0.5,"4A148C",55]].forEach(([x,y,r,c,t])=>{
    s.addShape(pres.shapes.HEXAGON, { x,y,w:r,h:r, fill:{color:c,transparency:t||45}, line:{color:c} });
  });

  s.addText("PANCREATIC HORMONES", { x:0.4,y:0.9,w:7.5,h:0.7, fontSize:30, bold:true, color:C.white, fontFace:"Calibri", charSpacing:2 });
  s.addText("BIOCHEMICAL ASPECTS", { x:0.4,y:1.58,w:7.5,h:0.6, fontSize:22, bold:true, color:C.gold, fontFace:"Calibri", charSpacing:3 });
  s.addShape(pres.shapes.RECTANGLE, { x:0.4,y:2.22,w:6.0,h:0.05, fill:{color:C.gold}, line:{color:C.gold} });

  s.addText("Synthesis · Structure · Secretion Mechanism · Signal Transduction · Metabolic Pathways", {
    x:0.4,y:2.35,w:8,h:0.4, fontSize:11, color:"99AABB", fontFace:"Calibri", italic:true
  });

  const topics = [
    "Gene → Preproinsulin → Proinsulin → Insulin",
    "K-ATP Channel · Ca²⁺ · Exocytosis",
    "Tyrosine Kinase → IRS → PI3K/Akt",
    "cAMP → PKA → Glycogenolysis",
    "Glucose–Fatty Acid Cycle · Randle Cycle",
  ];
  topics.forEach((t,i)=>{
    s.addShape(pres.shapes.RECTANGLE, { x:0.4,y:2.92+i*0.34,w:7.8,h:0.3, fill:{color:i%2===0?"162244":"1A2A54"}, line:{color:"223366"} });
    s.addText("▸ "+t, { x:0.55,y:2.95+i*0.34,w:7.5,h:0.24, fontSize:9, color:"AABBDD", fontFace:"Calibri", margin:0 });
  });

  s.addText("Source: Lippincott Biochemistry 8e · Costanzo Physiology 7e · Guyton & Hall · Lippincott Pharmacology",
    { x:0.4,y:H-0.5,w:9,h:0.2, fontSize:7, color:"445577", fontFace:"Calibri" });
}

// ═══════════════════════════════════════════════════════════
// SLIDE 2 — OVERVIEW: HORMONE BIOCHEMISTRY SNAPSHOT
// ═══════════════════════════════════════════════════════════
{
  const s = pres.addSlide(); bg(s);
  hdr(s, "Biochemical Overview — Pancreatic Hormones at a Glance", "Chemical nature, gene, MW and receptor class for each hormone");
  footer(s);

  const cols = ["Hormone","Cell","Gene / Chromosome","Structure","MW (Da)","Receptor Type","2nd Messenger"];
  const rows = [
    ["Insulin","β (Beta)","Chromosome 11 (INS gene)","Polypeptide; A chain (21AA) + B chain (30AA); 3 S-S bonds","~6,000","Receptor Tyrosine Kinase (RTK)","PI3K/Akt, MAPK"],
    ["Glucagon","α (Alpha)","Chromosome 2 (GCG gene)","Polypeptide; 29 AA single chain; α-helix at N-term","~3,500","GPCR (Gs-coupled)","↑ cAMP → PKA"],
    ["Somatostatin","δ (Delta)","Chromosome 3 (SST gene)","SST-14 (cyclic 14AA) or SST-28; disulfide-bridged ring","1,640","GPCR (Gi-coupled)","↓ cAMP; ↑ K⁺ efflux"],
    ["Pancreatic Polypeptide","PP / F","Chromosome 17 (PPY gene)","36 AA; hairpin PP-fold (polyproline II helix + α-helix)","~4,200","GPCR (Y4 receptor)","↓ cAMP"],
    ["Ghrelin","ε (Epsilon)","Chromosome 3 (GHRL gene)","28 AA; acylated (n-octanoyl at Ser³) — essential for activity","~3,300","GPCR (GHS-R1a)","↑ cAMP; ↑ Ca²⁺"],
    ["Amylin (IAPP)","β (Beta, co-secreted)","Chromosome 12 (IAPP gene)","37 AA; C-terminal amidation; N-terminal disulfide loop","~3,900","Calcitonin receptor-like","↑ cAMP"],
  ];

  const cw = [1.3,0.8,1.6,2.15,0.75,1.65,1.65];
  const sx=0.05, sy=1.08, rh=0.56;

  // header
  cols.forEach((h,ci)=>{
    const x=sx+cw.slice(0,ci).reduce((a,b)=>a+b,0);
    s.addShape(pres.shapes.RECTANGLE,{x,y:sy,w:cw[ci],h:0.32,fill:{color:C.indigo},line:{color:C.indigo}});
    s.addText(h,{x:x+0.04,y:sy+0.03,w:cw[ci]-0.06,h:0.26,fontSize:8,bold:true,color:C.white,fontFace:"Calibri",margin:0,align:"center"});
  });

  rows.forEach((row,ri)=>{
    const y=sy+0.32+ri*rh;
    const bg2=ri%2===0?C.white:"F0F4FF";
    row.forEach((cell,ci)=>{
      const x=sx+cw.slice(0,ci).reduce((a,b)=>a+b,0);
      s.addShape(pres.shapes.RECTANGLE,{x,y,w:cw[ci],h:rh,fill:{color:bg2},line:{color:C.lineGray,pt:0.3}});
      s.addText(cell,{x:x+0.04,y:y+0.05,w:cw[ci]-0.06,h:rh-0.08,fontSize:ci===0?8:7.5,bold:ci===0,
        color:ci===0?C.indigo:C.dark,fontFace:"Calibri",valign:"top",wrap:true,margin:0});
    });
  });
}

// ═══════════════════════════════════════════════════════════
// SLIDE 3 — INSULIN SYNTHESIS (Gene → Active Hormone)
// ═══════════════════════════════════════════════════════════
{
  const s = pres.addSlide(); bg(s);
  hdr(s,"Insulin — Biosynthesis Pathway","Gene (Chr 11) → Preproinsulin → Proinsulin → Insulin + C-Peptide",C.teal);
  footer(s,"Insulin Biosynthesis");

  // Embed the textbook diagram
  const imgUrl = "https://cdn.orris.care/cdss_images/036a326a0489d35dfd5214a0402321c0597842002563cf994d766e0b0b3153f8.png";
  const imgs = JSON.parse(require("child_process").execSync(
    `node /home/daytona/skills/shared/scripts/fetch_images.js "${imgUrl}"`
  ).toString());
  if (imgs[0] && !imgs[0].error) {
    s.addImage({ data: imgs[0].base64, x:0.25,y:1.1,w:4.6,h:2.2 });
    s.addText("Fig: Preproinsulin → Proinsulin → Insulin + C-peptide\n(Lippincott Biochemistry 8e, Fig 23.3)", {
      x:0.25,y:3.35,w:4.6,h:0.3, fontSize:7, color:C.muted, fontFace:"Calibri", italic:true
    });
  }

  // Step-by-step details
  const steps = [
    { n:1, color:C.teal,   label:"Gene Transcription",   detail:"INS gene (Chr 11) transcribed → mRNA. Gene belongs to insulin/IGF superfamily." },
    { n:2, color:C.indigo, label:"Preproinsulin (110 AA)", detail:"Ribosomes synthesize preproinsulin (MW ~11,500). Contains signal peptide (24 AA) + B chain + C-peptide + A chain." },
    { n:3, color:C.green,  label:"Proinsulin (86 AA)",    detail:"Signal peptide cleaved in RER → proinsulin (MW ~9,000). Three disulfide bonds form (2 inter-chain, 1 intra-A-chain). Folding occurs here." },
    { n:4, color:C.gold,   label:"Golgi Packaging",       detail:"Proinsulin transferred to Golgi → packaged into secretory granules. Prohormone convertases (PC1/3, PC2) + carboxypeptidase E cleave C-peptide." },
    { n:5, color:C.red,    label:"Insulin + C-Peptide",   detail:"Active insulin (MW ~6,000; A+B chains) + C-peptide (31 AA) stored in granules. Released in equimolar amounts by exocytosis." },
  ];

  steps.forEach((st,i)=>{
    const y = 1.1 + i * 0.84;
    s.addShape(pres.shapes.OVAL,{ x:5.05,y:y+0.04,w:0.36,h:0.36, fill:{color:st.color}, line:{color:st.color} });
    s.addText(String(st.n),{ x:5.05,y:y+0.04,w:0.36,h:0.36, fontSize:10, bold:true, color:C.white, align:"center", valign:"middle", fontFace:"Calibri" });
    s.addText(st.label,{ x:5.46,y:y+0.04,w:4.3,h:0.28, fontSize:9.5, bold:true, color:st.color, fontFace:"Calibri", margin:0 });
    s.addText(st.detail,{ x:5.46,y:y+0.34,w:4.3,h:0.44, fontSize:8, color:C.dark, fontFace:"Calibri", margin:0, wrap:true });
  });
}

// ═══════════════════════════════════════════════════════════
// SLIDE 4 — INSULIN SECRETION MECHANISM (K-ATP / Ca²⁺)
// ═══════════════════════════════════════════════════════════
{
  const s = pres.addSlide(); bg(s);
  hdr(s,"Insulin — Secretion Mechanism (β-Cell)","Glucose-Sensing via GLUT2/Glucokinase → K-ATP Channel → Depolarisation → Ca²⁺ → Exocytosis",C.teal);
  footer(s,"Insulin Secretion Mechanism");

  // Left: flow diagram (simulated with boxes + arrows)
  const steps2 = [
    { txt:"Glucose enters β-cell via GLUT2\n(high-Km, non-saturable transporter)", color:C.teal },
    { txt:"Glucokinase (hexokinase IV) phosphorylates\nglucose → Glucose-6-phosphate\n(Key sensor: not inhibited by G-6-P)", color:C.indigo },
    { txt:"Glycolysis + TCA → ↑ ATP/ADP ratio\n(Critical intracellular signal)", color:C.green },
    { txt:"↑ ATP closes K-ATP channels\n(SUR1/Kir6.2 complex)\n→ Membrane depolarisation (ΔΨ)", color:C.amber },
    { txt:"Depolarisation opens voltage-gated\nCa²⁺ channels → ↑ intracellular Ca²⁺", color:C.red },
    { txt:"Ca²⁺ triggers SNARE-mediated exocytosis\nof insulin granules → Insulin + C-peptide released", color:C.purple },
  ];

  steps2.forEach((st,i)=>{
    const x=0.2, y=1.08+i*0.74, bh=0.65;
    s.addShape(pres.shapes.RECTANGLE,{ x,y,w:4.2,h:bh, fill:{color:C.white}, line:{color:st.color,pt:1.2} });
    s.addShape(pres.shapes.RECTANGLE,{ x,y,w:0.14,h:bh, fill:{color:st.color}, line:{color:st.color} });
    s.addShape(pres.shapes.OVAL,{ x:0.26,y:y+0.14,w:0.35,h:0.35, fill:{color:st.color}, line:{color:st.color} });
    s.addText(String(i+1),{ x:0.26,y:y+0.14,w:0.35,h:0.35, fontSize:10, bold:true, color:C.white, align:"center", valign:"middle", fontFace:"Calibri" });
    s.addText(st.txt,{ x:0.68,y:y+0.07,w:3.65,h:bh-0.1, fontSize:8.2, color:C.dark, fontFace:"Calibri", valign:"middle", wrap:true, margin:0 });
    // Downward connector
    if (i<5) s.addShape(pres.shapes.RECTANGLE,{ x:2.1,y:y+bh,w:0.06,h:0.09, fill:{color:C.gold}, line:{color:C.gold} });
  });

  // Right: additional regulation details
  box(s,4.65,1.08,5.1,1.3,"Key Biochemical Players",C.indigo,[
    {text:"• GLUT2: ",options:{bold:true}},{text:"High-Km glucose transporter — ensures β-cell glucose uptake ∝ blood glucose\n",options:{}},
    {text:"• Glucokinase: ",options:{bold:true}},{text:"Rate-limiting enzyme; sigmoidal kinetics (S₀.₅ ~8 mM); no product inhibition\n",options:{}},
    {text:"• K-ATP channel: ",options:{bold:true}},{text:"SUR1 (sulphonylurea receptor) + Kir6.2 subunits; target of sulphonylurea drugs\n",options:{}},
    {text:"• Ca²⁺: ",options:{bold:true}},{text:"Second messenger; activates PKC and calmodulin-dependent kinases → exocytosis",options:{}},
  ],8);

  box(s,4.65,2.5,5.1,1.3,"Pharmacological Modulation",C.purple,[
    {text:"Sulphonylureas (glibenclamide): ",options:{bold:true,color:C.purple}},{text:"Bind SUR1 → CLOSE K-ATP → stimulate insulin release\n",options:{}},
    {text:"Diazoxide: ",options:{bold:true,color:C.red}},{text:"Binds SUR1 → OPEN K-ATP → inhibit insulin release\n",options:{}},
    {text:"GLP-1 agonists: ",options:{bold:true,color:C.green}},{text:"↑ cAMP → PKA → potentiates Ca²⁺ signalling → amplifies exocytosis\n",options:{}},
    {text:"Incretins (GLP-1, GIP): ",options:{bold:true}},{text:"Released from gut; lower threshold for glucose-stimulated secretion",options:{}},
  ],8);

  box(s,4.65,3.92,5.1,1.4,"First Phase vs Second Phase Secretion",C.teal,[
    {text:"Phase 1 (0–10 min): ",options:{bold:true,color:C.teal}},{text:"Rapid release of pre-formed insulin from readily releasable granule pool. Blunts post-prandial glucose spike.\n",options:{}},
    {text:"Phase 2 (10–60 min): ",options:{bold:true,color:C.indigo}},{text:"Sustained release from reserve granule pool. Requires new synthesis. \n",options:{}},
    {text:"Note: ",options:{bold:true,color:C.red}},{text:"First-phase secretion is LOST early in T2DM — important diagnostic feature.",options:{color:C.red}},
  ],8);
}

// ═══════════════════════════════════════════════════════════
// SLIDE 5 — INSULIN SIGNAL TRANSDUCTION
// ═══════════════════════════════════════════════════════════
{
  const s = pres.addSlide(); bg(s);
  hdr(s,"Insulin — Signal Transduction Cascade","Receptor Tyrosine Kinase → IRS-1/2 → PI3K/Akt Pathway & MAPK Pathway",C.teal);
  footer(s,"Insulin Signal Transduction");

  // Left cascade diagram
  const cascade = [
    { label:"Insulin binds α-subunits of RTK",      detail:"α₂β₂ tetrameric receptor; α-subunits extracellular (binding site); β-subunits transmembrane + cytoplasmic kinase domain", color:C.teal },
    { label:"β-subunit autophosphorylation (Tyr)",  detail:"Conformational change → trans-autophosphorylation of tyrosine residues on β-subunits → activates intrinsic tyrosine kinase", color:C.indigo },
    { label:"IRS-1/2 phosphorylation",              detail:"Insulin receptor substrates (IRS-1, IRS-2) phosphorylated on multiple tyrosines → docking sites for SH2-domain proteins", color:C.green },
    { label:"PI3K activation",                      detail:"IRS binds PI3K p85 regulatory subunit → activates p110 catalytic subunit → PIP₂ → PIP₃ (phosphatidylinositol-3,4,5-triphosphate)", color:C.gold },
    { label:"PDK1 → Akt/PKB activation",            detail:"PIP₃ recruits PDK1 → phosphorylates Akt (Ser473/Thr308) → activated Akt (protein kinase B)", color:C.amber },
    { label:"Metabolic outcomes",                   detail:"GLUT4 vesicle translocation to membrane (↑ glucose uptake) · Glycogen synthase kinase-3 (GSK-3) inhibition → glycogen synthesis · mTOR activation → protein synthesis · FOXO inactivation → ↓ gluconeogenesis", color:C.red },
  ];

  cascade.forEach((c,i)=>{
    const y=1.08+i*0.74, x=0.2;
    s.addShape(pres.shapes.RECTANGLE,{x,y,w:4.4,h:0.66,fill:{color:C.white},line:{color:c.color,pt:1}});
    s.addShape(pres.shapes.RECTANGLE,{x,y,w:0.12,h:0.66,fill:{color:c.color},line:{color:c.color}});
    s.addText(c.label,{x:x+0.18,y:y+0.04,w:4.15,h:0.28,fontSize:9,bold:true,color:c.color,fontFace:"Calibri",margin:0});
    s.addText(c.detail,{x:x+0.18,y:y+0.33,w:4.15,h:0.3,fontSize:7.8,color:C.dark,fontFace:"Calibri",margin:0,wrap:true});
    if(i<5) s.addShape(pres.shapes.RECTANGLE,{x:2.2,y:y+0.66,w:0.06,h:0.08,fill:{color:C.gold},line:{color:C.gold}});
  });

  // Right panel: MAPK pathway + GLUT4 mechanism + key enzymes
  box(s,4.8,1.08,4.96,1.3,"MAPK / ERK Pathway (Growth/Gene Effects)",C.purple,[
    {text:"Parallel pathway from IRS:\n",options:{bold:true}},
    {text:"IRS → Grb2/SOS → Ras → Raf → MEK → ERK1/2\n",options:{color:C.purple}},
    {text:"Outcomes: ",options:{bold:true}},{text:"Gene transcription, cell growth, protein synthesis, β-cell proliferation. Less important for acute metabolic effects.",options:{}},
  ],8);

  box(s,4.8,2.5,4.96,1.3,"GLUT4 Translocation Mechanism",C.teal,[
    {text:"Akt phosphorylates AS160 (TBC1D4)\n",options:{bold:true}},
    {text:"→ Inactivates Rab-GAP → Rab proteins remain GTP-bound → GLUT4 storage vesicles (GSVs) traffic to plasma membrane\n",options:{}},
    {text:"Net result: ",options:{bold:true}},{text:"3–40× increase in surface GLUT4 → ↑ glucose uptake in muscle & adipose",options:{color:C.teal}},
  ],8);

  box(s,4.8,3.92,4.96,1.4,"Key Enzyme Targets of Insulin Signalling",C.green,[
    {text:"↑ Glycogen synthase",options:{bold:true,color:C.green}},{text:" (via GSK-3 inhibition → dephosphorylation)\n",options:{}},
    {text:"↑ Acetyl-CoA carboxylase (ACC)",options:{bold:true}},{text:" → ↑ malonyl-CoA → ↑ fatty acid synthesis\n",options:{}},
    {text:"↓ HSL (hormone-sensitive lipase)",options:{bold:true,color:C.red}},{text:" → ↓ lipolysis\n",options:{}},
    {text:"↓ PEPCK & G6Pase",options:{bold:true,color:C.red}},{text:" → ↓ gluconeogenesis (via FOXO1 nuclear exclusion)",options:{}},
  ],8);
}

// ═══════════════════════════════════════════════════════════
// SLIDE 6 — INSULIN METABOLIC EFFECTS (3-tissue table)
// ═══════════════════════════════════════════════════════════
{
  const s = pres.addSlide(); bg(s);
  hdr(s,"Insulin — Biochemical Metabolic Effects","Actions on Liver, Muscle, and Adipose Tissue | 'Hormone of the Fed State'",C.teal);
  footer(s,"Insulin Metabolic Effects");

  const tissues = [
    {
      name:"LIVER", icon:"🏭",
      carb: "↑ Glycogen synthesis (↑ glucokinase, glycogen synthase)\n↓ Glycogenolysis (↓ glycogen phosphorylase)\n↓ Gluconeogenesis (↓ PEPCK, FBPase-1, G6Pase via FOXO1)\n↓ Glycolysis inhibition (↓ PFK-1 via ↑ F-2,6-BP)",
      lipid:"↑ Fatty acid synthesis (↑ ACC → ↑ malonyl-CoA)\n↑ VLDL secretion (↑ TAG synthesis)\n↓ β-oxidation (malonyl-CoA inhibits CPT-1)\n↓ Ketogenesis",
      prot: "↑ Protein synthesis\n↑ Amino acid uptake\n↓ Protein catabolism (↓ proteasomal degradation)",
    },
    {
      name:"MUSCLE", icon:"💪",
      carb: "↑ Glucose uptake (GLUT4 translocation to sarcolemma)\n↑ Glycogen synthesis (↑ glycogen synthase via GSK-3 ↓)\n↑ Glycolysis (↑ PFK-1 activity)\n↓ Glycogenolysis",
      lipid:"↑ Lipoprotein lipase (LPL) activity → ↑ FA uptake\n↑ FA oxidation for energy\n↑ malonyl-CoA → ↓ CPT-1 activity at high glucose",
      prot: "↑ Protein synthesis (mTOR/S6K1 → ↑ translation)\n↑ Amino acid uptake\n↓ Muscle proteolysis (major anabolic effect)",
    },
    {
      name:"ADIPOSE", icon:"🫧",
      carb: "↑ Glucose uptake (GLUT4)\n↑ Glycolysis → ↑ glycerol-3-phosphate (backbone for TAG)\n↑ Conversion of glucose → acetyl-CoA → FA\n↓ Gluconeogenesis (minor)",
      lipid:"↑ LPL activity → cleaves chylomicron TAG → ↑ FA uptake\n↑ TAG synthesis (lipogenesis) → fat storage\n↓ Hormone-sensitive lipase (HSL) → ↓ lipolysis (↓ FFA & glycerol release)\n↓ Ketone production",
      prot: "↑ Protein synthesis (adipokine regulation)\n↑ Leptin synthesis\nMinor effects on proteolysis",
    },
  ];

  const subHeaders = ["Carbohydrate Metabolism","Lipid Metabolism","Protein Metabolism"];
  const cw2=[1.0,2.9,3.0,3.0];
  const sx=0.05,sy=1.08,rh=1.45;

  // Column headers
  ["Tissue",...subHeaders].forEach((h,ci)=>{
    const x=sx+cw2.slice(0,ci).reduce((a,b)=>a+b,0);
    const bg2=[C.indigoDark,C.teal,C.amber,C.green][ci];
    s.addShape(pres.shapes.RECTANGLE,{x,y:sy,w:cw2[ci],h:0.35,fill:{color:bg2},line:{color:bg2}});
    s.addText(h,{x:x+0.04,y:sy+0.04,w:cw2[ci]-0.06,h:0.28,fontSize:9,bold:true,color:C.white,fontFace:"Calibri",margin:0,align:"center"});
  });

  tissues.forEach((t,ri)=>{
    const y=sy+0.35+ri*rh;
    const rowBg=ri%2===0?C.white:"F0F4FF";
    // Tissue name cell
    s.addShape(pres.shapes.RECTANGLE,{x:sx,y,w:cw2[0],h:rh,fill:{color:C.indigo},line:{color:C.indigo}});
    s.addText(t.name,{x:sx+0.04,y:y+rh/2-0.2,w:0.9,h:0.4,fontSize:10,bold:true,color:C.white,fontFace:"Calibri",align:"center",valign:"middle"});
    // Data cells
    [t.carb,t.lipid,t.prot].forEach((cell,ci)=>{
      const x=sx+cw2.slice(0,ci+1).reduce((a,b)=>a+b,0);
      s.addShape(pres.shapes.RECTANGLE,{x,y,w:cw2[ci+1],h:rh,fill:{color:rowBg},line:{color:C.lineGray,pt:0.3}});
      s.addText(cell,{x:x+0.06,y:y+0.06,w:cw2[ci+1]-0.1,h:rh-0.1,fontSize:7.8,color:C.dark,fontFace:"Calibri",valign:"top",wrap:true,margin:0});
    });
  });
}

// ═══════════════════════════════════════════════════════════
// SLIDE 7 — GLUCAGON BIOCHEMISTRY
// ═══════════════════════════════════════════════════════════
{
  const s = pres.addSlide(); bg(s);
  hdr(s,"Glucagon — Biochemistry","Synthesis · cAMP/PKA Pathway · Metabolic Effects on Liver","2980B9");
  footer(s,"Glucagon Biochemistry");

  // Left: structure & synthesis
  box(s,0.2,1.08,4.55,2.0,"Structure & Synthesis","2980B9",[
    {text:"Gene: ",options:{bold:true}},{text:"GCG gene (Chr 2) encodes proglucagon — a single precursor processed differently in different tissues:\n",options:{}},
    {text:"• Pancreatic α-cells: ",options:{bold:true,color:"2980B9"}},{text:"Proglucagon → Glucagon (29 AA) + glicentin-related pancreatic peptide\n",options:{}},
    {text:"• Intestinal L-cells: ",options:{bold:true,color:C.green}},{text:"Proglucagon → GLP-1 + GLP-2 + oxyntomodulin (tissue-specific PC1/3 cleavage)\n",options:{}},
    {text:"Structure: ",options:{bold:true}},{text:"29 AA single-chain polypeptide; α-helical near N-terminus; MW ~3,500 Da; no disulfide bonds.\n",options:{}},
    {text:"Half-life: ",options:{bold:true}},{text:"~5 min. Degraded by DPP-4, NEP 24.11 (neprilysin), and hepatic enzymes.",options:{}},
  ],8);

  // Right: cAMP pathway
  box(s,4.95,1.08,4.8,2.0,"Signal Transduction: Gs-GPCR → cAMP → PKA","2980B9",[
    {text:"1. Glucagon binds GPCR (Gs-coupled) on hepatocyte\n",options:{bold:true}},
    {text:"2. Gs activates adenylyl cyclase → ATP → cAMP (↑↑)\n",options:{}},
    {text:"3. cAMP activates PKA (protein kinase A)\n",options:{}},
    {text:"   PKA phosphorylates:\n",options:{}},
    {text:"   • Glycogen phosphorylase kinase → phosphorylates glycogen phosphorylase b → a (active)\n   • Glycogen synthase → inactivated (phosphorylated)\n   • PFK-2 / F-2,6-BPase bifunctional enzyme → lowers F-2,6-BP → ↓ PFK-1 → ↓ glycolysis\n   • Hormone-sensitive lipase (HSL) → ↑ lipolysis\n",options:{}},
    {text:"4. PKA also enters nucleus → phosphorylates CREB → ↑ PEPCK and G6Pase gene transcription",options:{color:C.red}},
  ],7.8);

  // Bottom left: metabolic effects table
  const effects = [
    ["Glycogenolysis","↑↑ Activates","Glycogen phosphorylase a via PKA","↑ Blood glucose","Liver"],
    ["Gluconeogenesis","↑↑ Promotes","↑ PEPCK, G6Pase via CREB; amino acids & lactate as substrates","↑ Blood glucose","Liver"],
    ["Glycolysis","↓↓ Inhibits","↓ F-2,6-BP (via PFK-2 phosphorylation) → ↓ PFK-1 activity","↓ Glucose oxidation","Liver"],
    ["Lipolysis","↑ Promotes","PKA phosphorylates & activates HSL in adipocytes","↑ FFA & glycerol → ↑ ketones","Adipose"],
    ["Ketogenesis","↑ Promotes","↓ malonyl-CoA (↓ ACC activity) → ↑ CPT-1 → ↑ β-oxidation","↑ Ketone bodies","Liver"],
    ["FA synthesis","↓ Inhibits","PKA phosphorylates & inactivates ACC → ↓ malonyl-CoA","↓ De novo lipogenesis","Liver"],
  ];

  const cw3=[1.6,1.0,3.1,1.7,1.45];
  const hdrs=["Process","Effect","Biochemical Mechanism","Outcome","Tissue"];
  const sx2=0.2,sy2=3.18,rh2=0.35;

  hdrs.forEach((h,ci)=>{
    const x=sx2+cw3.slice(0,ci).reduce((a,b)=>a+b,0);
    s.addShape(pres.shapes.RECTANGLE,{x,y:sy2,w:cw3[ci],h:0.3,fill:{color:"2980B9"},line:{color:"2980B9"}});
    s.addText(h,{x:x+0.04,y:sy2+0.03,w:cw3[ci]-0.06,h:0.24,fontSize:8.5,bold:true,color:C.white,fontFace:"Calibri",margin:0});
  });
  effects.forEach((row,ri)=>{
    const y=sy2+0.3+ri*rh2;
    const bg2=ri%2===0?C.white:"EFF4FF";
    row.forEach((cell,ci)=>{
      const x=sx2+cw3.slice(0,ci).reduce((a,b)=>a+b,0);
      s.addShape(pres.shapes.RECTANGLE,{x,y,w:cw3[ci],h:rh2,fill:{color:bg2},line:{color:C.lineGray,pt:0.3}});
      s.addText(cell,{x:x+0.04,y:y+0.04,w:cw3[ci]-0.06,h:rh2-0.06,fontSize:7.8,
        bold:ci===0,color:ci===1?(row[1].startsWith("↑")?"1B5E20":"8B1A1A"):C.dark,
        fontFace:"Calibri",valign:"middle",wrap:true,margin:0});
    });
  });
}

// ═══════════════════════════════════════════════════════════
// SLIDE 8 — SOMATOSTATIN, PP, GHRELIN, AMYLIN BIOCHEMISTRY
// ═══════════════════════════════════════════════════════════
{
  const s = pres.addSlide(); bg(s);
  hdr(s,"Somatostatin · Pancreatic Polypeptide · Ghrelin · Amylin — Biochemistry","Structure, Receptor, Signal Transduction & Biochemical Mechanism",C.purple);
  footer(s,"SST · PP · Ghrelin · Amylin Biochemistry");

  const hormones = [
    {
      name:"SOMATOSTATIN (SST)", color:C.purple, cell:"δ cells",
      struct:"SST-14: 14 AA cyclic peptide (disulfide bridge between Cys³-Cys¹⁴)\nSST-28: 28 AA N-terminal extended form\nGene: SST (Chr 3) → preprosomatostatin → SST-14/28",
      receptor:"5 GPCR subtypes (SSTR1–5); Gi-coupled:\n→ ↓ cAMP (inhibits adenylyl cyclase)\n→ Opens K⁺ channels → hyperpolarisation\n→ Blocks Ca²⁺ channels → ↓ exocytosis",
      mech:"Paracrine: δ-cells directly contact α and β cells via processes.\nInhibits insulin & glucagon secretion.\nInhibits pituitary GH & TSH via SSTR2.\nInhibits all GI secretions via Gi pathway."
    },
    {
      name:"PANCREATIC POLYPEPTIDE (PP)", color:C.amber, cell:"PP/F cells",
      struct:"36 AA; adopts PP-fold: N-terminal polyproline II helix + C-terminal amphipathic α-helix (hairpin)\nGene: PPY (Chr 17) → preproPP → PP\nAmidated C-terminus essential for activity",
      receptor:"Y4 receptor (neuropeptide Y receptor family); Gi-coupled:\n→ ↓ cAMP\n→ Inhibits secretory cells of pancreatic acini\n→ Inhibits smooth muscle of gallbladder & gut",
      mech:"Inhibits pancreatic exocrine secretion (enzymes + HCO₃⁻) post-prandially.\nReduces gallbladder contraction.\nSuppresses appetite via hypothalamic Y4R.\nReleased proportionally to meal calorie content."
    },
    {
      name:"GHRELIN", color:C.green, cell:"ε cells + gastric fundus",
      struct:"28 AA; UNIQUE acylation: n-octanoyl group on Ser³ (essential for biological activity)\nAcylation catalysed by GOAT enzyme (ghrelin O-acyltransferase)\nGene: GHRL (Chr 3) → preproghrelin; processed to ghrelin + obestatin",
      receptor:"GHS-R1a (growth hormone secretagogue receptor 1a); Gq/Gs-coupled:\n→ ↑ cAMP + ↑ IP₃/DAG → ↑ intracellular Ca²⁺\n→ Activates NPY/AgRP neurons in hypothalamus → hunger",
      mech:"Only known orexigenic (appetite-stimulating) GI peptide.\nAcylated form stimulates GH release from pituitary.\nDecreases β-cell insulin secretion.\nRises before meals; suppressed after eating."
    },
    {
      name:"AMYLIN (IAPP)", color:C.red, cell:"β cells (co-secreted with insulin)",
      struct:"37 AA; C-terminal amidation; N-terminal disulfide loop (Cys²-Cys⁷)\nMW ~3,900 Da; gene: IAPP (Chr 12)\nHighly amyloidogenic: hydrophobic core (AA 20–29) → β-sheet → fibrils",
      receptor:"Calcitonin receptor-like receptor (CALCR) + RAMPs (1,2,3):\n→ Gs → ↑ cAMP → PKA\n→ Acts in area postrema + hypothalamus",
      mech:"Slows gastric emptying → blunts glucose spike post-meal.\nSuppresses post-prandial glucagon from α-cells.\nInduces satiety via CNS (area postrema).\nAmyloid plaques (IAPP fibrils) in T2DM islets → β-cell toxicity → loss of β-cell mass."
    },
  ];

  const cols2 = 2;
  hormones.forEach((h,i)=>{
    const col = i%2, row2 = Math.floor(i/2);
    const x = col===0?0.18:5.1, y = 1.08+row2*2.26;
    const w = 4.72, totalH = 2.1;

    // Header
    s.addShape(pres.shapes.RECTANGLE,{x,y,w,h:0.28,fill:{color:h.color},line:{color:h.color}});
    s.addText(h.name+" — "+h.cell,{x:x+0.08,y:y+0.03,w:w-0.1,h:0.22,fontSize:9,bold:true,color:C.white,fontFace:"Calibri",margin:0});

    // 3 sub-columns
    const subW = (w)/3;
    const subHdrs=["Structure / Gene","Receptor & Pathway","Biochemical Mechanism"];
    const contents=[h.struct,h.receptor,h.mech];
    subHdrs.forEach((sh,si)=>{
      const sx3=x+si*subW;
      s.addShape(pres.shapes.RECTANGLE,{x:sx3,y:y+0.28,w:subW,h:0.24,fill:{color:h.color+"33"},line:{color:h.color,pt:0.4}});
      s.addText(sh,{x:sx3+0.04,y:y+0.3,w:subW-0.06,h:0.2,fontSize:7.5,bold:true,color:h.color,fontFace:"Calibri",margin:0});
      s.addShape(pres.shapes.RECTANGLE,{x:sx3,y:y+0.52,w:subW,h:totalH-0.52,fill:{color:C.white},line:{color:h.color,pt:0.4}});
      s.addText(contents[si],{x:sx3+0.05,y:y+0.56,w:subW-0.08,h:totalH-0.62,fontSize:7.5,color:C.dark,fontFace:"Calibri",valign:"top",wrap:true,margin:0});
    });
  });
}

// ═══════════════════════════════════════════════════════════
// SLIDE 9 — GLUCOSE-FATTY ACID (RANDLE) CYCLE
// ═══════════════════════════════════════════════════════════
{
  const s = pres.addSlide(); bg(s);
  hdr(s,"Glucose–Fatty Acid Cycle (Randle Cycle) & Metabolic Integration","How insulin and glucagon coordinate fuel metabolism across tissues",C.green);
  footer(s,"Randle Cycle & Metabolic Integration");

  // Left: Randle cycle explanation
  box(s,0.2,1.08,4.55,2.2,"Randle Cycle — Biochemical Basis",C.green,[
    {text:"Core concept: ",options:{bold:true,color:C.green}},{text:"Glucose and fatty acids compete as fuels in muscle and heart. Proposed by Philip Randle, 1963.\n\n",options:{}},
    {text:"When FA oxidation is high (fasting / glucagon dominant):\n",options:{bold:true}},
    {text:"β-oxidation → ↑ Acetyl-CoA → ↑ citrate → inhibits PFK-1\n↑ NADH → inhibits pyruvate dehydrogenase (PDH)\n↑ Acetyl-CoA → inhibits PDH kinase → PDH inactivated\n→ ↓ Glucose oxidation even when glucose is available\n\n",options:{}},
    {text:"When insulin dominates (fed state):\n",options:{bold:true}},{text:"↑ Malonyl-CoA → inhibits CPT-1 → ↓ FA entry into mitochondria → forces glucose use as primary fuel",options:{}},
  ],8.5);

  // Right: Insulin-Glucagon ratio
  box(s,4.95,1.08,4.8,2.2,"Insulin:Glucagon Molar Ratio (I:G Ratio)",C.indigo,[
    {text:"Clinical significance of I:G ratio:\n",options:{bold:true,color:C.indigo}},
    {text:"• Fed state: ",options:{bold:true}},{text:"I:G ratio HIGH → anabolic metabolism\n",options:{}},
    {text:"• Fasted state: ",options:{bold:true}},{text:"I:G ratio LOW → catabolic metabolism\n",options:{}},
    {text:"• DKA: ",options:{bold:true,color:C.red}},{text:"I:G ratio near 0 → unopposed glucagon → glycogenolysis, gluconeogenesis, ketogenesis\n\n",options:{}},
    {text:"Key enzymes regulated by I:G ratio:\n",options:{bold:true}},
    {text:"PFK-1, PDH, glycogen synthase, ACC, HSL, PEPCK, G6Pase\n— all shift activity with the ratio",options:{}},
  ],8.5);

  // Bottom: coordinated fuel switch table
  const fueltable = [
    ["State","Insulin","Glucagon","I:G Ratio","Fuel Used","Key Biochemistry"],
    ["Fed (Post-meal)","↑↑","↓","High (>1)","Glucose","Glycogen synthesis, lipogenesis, protein synthesis; GLUT4 up; glycolysis ↑"],
    ["Fasting (Overnight)","↓","↑","Low (<1)","Fatty acids","Glycogenolysis → gluconeogenesis → lipolysis; malonyl-CoA ↓; CPT-1 ↑"],
    ["Prolonged fasting","↓↓","↑↑","Very low","Ketones + FA","Ketogenesis (β-oxidation → acetyl-CoA → ketones); glucose spared for brain"],
    ["DKA","~0","↑↑↑","Near 0","FFA + Ketones","Uncontrolled ketogenesis; H⁺ from ketoacid dissociation → metabolic acidosis"],
    ["Exercise","↓ slightly","↑","Decreasing","Glucose + FA","Hepatic glycogenolysis + muscle glycogen; FA for sustained effort"],
  ];
  const cw4=[1.3,1.0,1.0,0.9,1.15,4.5];
  const sx3=0.2,sy3=3.42,rh3=0.33;

  fueltable.forEach((row,ri)=>{
    const y=sy3+ri*rh3;
    const isH=ri===0;
    const bg2=isH?C.indigoDark:ri%2===0?C.white:"F0F6F0";
    row.forEach((cell,ci)=>{
      const x=sx3+cw4.slice(0,ci).reduce((a,b)=>a+b,0);
      s.addShape(pres.shapes.RECTANGLE,{x,y,w:cw4[ci],h:rh3,fill:{color:bg2},line:{color:C.lineGray,pt:0.3}});
      s.addText(cell,{x:x+0.04,y:y+0.04,w:cw4[ci]-0.06,h:rh3-0.06,
        fontSize:isH?8:7.8, bold:isH||ci===0,
        color:isH?C.white:ci===0?C.green:C.dark,
        fontFace:"Calibri",valign:"middle",wrap:true,margin:0});
    });
  });
}

// ═══════════════════════════════════════════════════════════
// SLIDE 10 — KEY BIOCHEMICAL ENZYMES REGULATED BY PANCREATIC HORMONES
// ═══════════════════════════════════════════════════════════
{
  const s = pres.addSlide(); bg(s);
  hdr(s,"Key Enzymes Regulated by Pancreatic Hormones","Phosphorylation / Dephosphorylation as the Master Switch",C.amber);
  footer(s,"Key Enzyme Regulation");

  const enzymes = [
    { enzyme:"Glycogen Phosphorylase", pathway:"Glycogen → Glucose-1-P", insulin:"Inactive (dephosphorylated)", glucagon:"Active (phosphorylated by PKA)", net:"Glucagon promotes, insulin inhibits glycogenolysis" },
    { enzyme:"Glycogen Synthase", pathway:"UDP-Glucose → Glycogen", insulin:"Active (dephosphorylated; GSK-3 inhibited)", glucagon:"Inactive (phosphorylated by PKA)", net:"Insulin promotes, glucagon inhibits glycogen storage" },
    { enzyme:"Pyruvate Kinase (L-type)", pathway:"PEP → Pyruvate", insulin:"Active (dephosphorylated)", glucagon:"Inactive (phosphorylated by PKA → ↓ glycolysis)", net:"Glucagon diverts PEP to gluconeogenesis" },
    { enzyme:"Pyruvate Dehydrogenase (PDH)", pathway:"Pyruvate → Acetyl-CoA", insulin:"Active (↑ PDH phosphatase)", glucagon:"Less active (↑ PDH kinase via ↑ acetyl-CoA)", net:"Insulin favours full glucose oxidation" },
    { enzyme:"Acetyl-CoA Carboxylase (ACC)", pathway:"Acetyl-CoA → Malonyl-CoA", insulin:"Active (dephosphorylated → ↑ FA synthesis)", glucagon:"Inactive (phosphorylated by AMPK/PKA → ↓ malonyl-CoA)", net:"Glucagon promotes β-oxidation by removing malonyl-CoA" },
    { enzyme:"Hormone-Sensitive Lipase (HSL)", pathway:"TAG → FFA + Glycerol", insulin:"Inactive (dephosphorylated by PP2A)", glucagon:"Active (phosphorylated by PKA)", net:"Glucagon promotes lipolysis; insulin opposes" },
    { enzyme:"PEPCK (Phosphoenolpyruvate Carboxykinase)", pathway:"OAA → PEP (gluconeogenesis)", insulin:"↓ Gene expression (FOXO1 excluded from nucleus)", glucagon:"↑ Gene expression (CREB activated by PKA)", net:"Master enzyme of gluconeogenesis; glucagon drives it" },
    { enzyme:"PFK-2 / Fructose-2,6-BPase", pathway:"F-6-P ↔ F-2,6-BP", insulin:"Kinase active → ↑ F-2,6-BP → activates PFK-1 → ↑ glycolysis", glucagon:"Phosphatase active → ↓ F-2,6-BP → ↓ PFK-1 → ↓ glycolysis", net:"F-2,6-BP is the key allosteric regulator of glycolysis" },
  ];

  const cw5=[2.0,1.6,2.2,2.2,1.9];
  const hdrs2=["Enzyme","Metabolic Pathway","↑ Insulin Effect","↑ Glucagon Effect","Net Significance"];
  const sx4=0.1,sy4=1.08,rh4=0.48;

  hdrs2.forEach((h,ci)=>{
    const x=sx4+cw5.slice(0,ci).reduce((a,b)=>a+b,0);
    const bg3=[C.indigoDark,C.teal,"1B5E20",C.amber,"555555"][ci]||C.indigo;
    s.addShape(pres.shapes.RECTANGLE,{x,y:sy4,w:cw5[ci],h:0.32,fill:{color:bg3},line:{color:bg3}});
    s.addText(h,{x:x+0.04,y:sy4+0.03,w:cw5[ci]-0.06,h:0.26,fontSize:8.5,bold:true,color:C.white,fontFace:"Calibri",margin:0});
  });

  enzymes.forEach((row,ri)=>{
    const y=sy4+0.32+ri*rh4;
    const bg3=ri%2===0?C.white:"FFF8E1";
    const cells=[row.enzyme,row.pathway,row.insulin,row.glucagon,row.net];
    cells.forEach((cell,ci)=>{
      const x=sx4+cw5.slice(0,ci).reduce((a,b)=>a+b,0);
      s.addShape(pres.shapes.RECTANGLE,{x,y,w:cw5[ci],h:rh4,fill:{color:bg3},line:{color:C.lineGray,pt:0.3}});
      s.addText(cell,{x:x+0.04,y:y+0.04,w:cw5[ci]-0.06,h:rh4-0.06,
        fontSize:ci===0?8.2:7.5,bold:ci===0,
        color:ci===0?C.indigo:ci===2?"1B5E20":ci===3?C.amber:C.dark,
        fontFace:"Calibri",valign:"top",wrap:true,margin:0});
    });
  });
}

// ═══════════════════════════════════════════════════════════
// SLIDE 11 — BIOCHEMICAL BASIS OF DIABETES (Insulin Resistance)
// ═══════════════════════════════════════════════════════════
{
  const s = pres.addSlide(); bg(s);
  hdr(s,"Biochemical Basis of Diabetes Mellitus","T1DM: Absolute Insulin Deficiency | T2DM: Insulin Resistance & Relative Deficiency",C.red);
  footer(s,"Biochemical Basis of DM");

  box(s,0.2,1.08,4.6,2.1,"Type 1 DM — Absolute Insulin Deficiency",C.red,[
    {text:"Aetiology: ",options:{bold:true}},{text:"Autoimmune destruction of β-cells. Auto-antibodies: anti-GAD65 (glutamate decarboxylase), anti-IA-2 (tyrosine phosphatase), anti-insulin, anti-ZnT8 (zinc transporter)\n",options:{}},
    {text:"Biochemical Consequences:\n",options:{bold:true,color:C.red}},
    {text:"• No insulin → no GLUT4 insertion → hyperglycaemia\n• Unopposed glucagon → glycogenolysis + gluconeogenesis\n• ↑ HSL → lipolysis → ↑ FFA → ↑ acetyl-CoA → ↑ HMG-CoA → ↑ ketones (acetoacetate, β-hydroxybutyrate)\n• Ketonuria + osmotic diuresis → dehydration\n• H⁺ from ketoacid dissociation → anion-gap metabolic acidosis (DKA)",options:{}},
  ],8);

  box(s,5.0,1.08,4.75,2.1,"Type 2 DM — Insulin Resistance",C.amber,[
    {text:"Aetiology: ",options:{bold:true}},{text:"Peripheral insulin resistance → compensatory hyperinsulinaemia → β-cell exhaustion\n",options:{}},
    {text:"Molecular mechanisms of resistance:\n",options:{bold:true,color:C.amber}},
    {text:"• Serine phosphorylation of IRS-1/2 (by IKK-β, PKC-θ) → impairs tyrosine phosphorylation → ↓ PI3K/Akt\n• DAG accumulates (from lipid overload) → activates PKC → blocks insulin signalling\n• Inflammatory cytokines (TNF-α, IL-6) activate IKK-β → serine phosphorylates IRS-1\n• ER stress → UPR (unfolded protein response) → disrupts insulin signalling\n• IAPP amyloid deposits → β-cell lipotoxicity → apoptosis",options:{}},
  ],8);

  box(s,0.2,3.28,4.6,1.98,"DKA Biochemistry — Metabolic Cascade",C.red,[
    {text:"No insulin → ↑ glucagon → ↑ cAMP → ↑ PKA:\n",options:{bold:true}},
    {text:"→ Glycogenolysis (↑ glucose)\n→ Gluconeogenesis (↑ glucose)\n→ Lipolysis (↑ FFA to liver)\n→ ↓ malonyl-CoA → CPT-1 active → β-oxidation → ↑↑ acetyl-CoA\n→ Acetyl-CoA exceeds TCA capacity → HMG-CoA pathway → ketone bodies\n→ Acetoacetate + β-hydroxybutyrate → dissociate → H⁺ → pH ↓ → Anion gap ↑\n→ Osmotic diuresis → loss of K⁺ (total body K⁺ low despite normal serum K⁺!)",options:{}},
  ],8);

  box(s,5.0,3.28,4.75,1.98,"HbA1c — Biochemical Basis",C.green,[
    {text:"Glycated haemoglobin:\n",options:{bold:true,color:C.green}},
    {text:"Non-enzymatic glycation (Maillard reaction):\nGlucose + Hb-β chain N-terminus (Val¹) → Schiff base → Amadori product → HbA1c\n\n",options:{}},
    {text:"Reflects mean glucose over 8–12 weeks (RBC lifespan ~120 days).\n",options:{}},
    {text:"• Normal: ",options:{bold:true}},{text:"<5.7%\n",options:{}},
    {text:"• Pre-diabetes: ",options:{bold:true,color:C.amber}},{text:"5.7–6.4%\n",options:{}},
    {text:"• Diabetes: ",options:{bold:true,color:C.red}},{text:"≥6.5%\n",options:{}},
    {text:"Fructosamine: ",options:{bold:true}},{text:"Reflects 2–3 weeks of glucose control (albumin glycation)",options:{}},
  ],8);
}

// ═══════════════════════════════════════════════════════════
// SLIDE 12 — CLOSING SUMMARY
// ═══════════════════════════════════════════════════════════
{
  const s = pres.addSlide();
  s.addShape(pres.shapes.RECTANGLE,{x:0,y:0,w:W,h:H,fill:{color:C.indigoDark},line:{color:C.indigoDark}});
  s.addShape(pres.shapes.RECTANGLE,{x:0,y:0,w:0.18,h:H,fill:{color:C.gold},line:{color:C.gold}});
  s.addShape(pres.shapes.RECTANGLE,{x:0,y:H-0.5,w:W,h:0.5,fill:{color:"0A0A2A"},line:{color:"0A0A2A"}});

  s.addText("BIOCHEMICAL SUMMARY",{x:0.35,y:0.2,w:9.3,h:0.55,fontSize:24,bold:true,color:C.white,fontFace:"Calibri",charSpacing:2});
  s.addShape(pres.shapes.RECTANGLE,{x:0.35,y:0.8,w:5.5,h:0.05,fill:{color:C.gold},line:{color:C.gold}});
  s.addText("Pancreatic Hormones — Key Biochemical Concepts",{x:0.35,y:0.9,w:9,h:0.35,fontSize:11,color:"99AACC",fontFace:"Calibri",italic:true});

  const items = [
    { label:"Insulin", detail:"Gene→Preproinsulin→Proinsulin→Insulin+C-peptide | RTK→IRS→PI3K/Akt→GLUT4 | Promotes glycogen, FA, protein synthesis | GSK-3↓, HSL↓, PEPCK↓", color:C.teal },
    { label:"Glucagon", detail:"Gs-GPCR→↑cAMP→PKA | Activates glycogen phosphorylase, inactivates glycogen synthase, ACC | ↓F-2,6-BP→↓PFK-1 | ↑PEPCK/G6Pase via CREB", color:"2980B9" },
    { label:"Somatostatin", detail:"Gi-GPCR→↓cAMP+opens K⁺ channels | Inhibits Ca²⁺-mediated exocytosis in α and β cells | SST-14 cyclic peptide (Cys³-Cys¹⁴ disulfide)", color:C.purple },
    { label:"PP / Ghrelin / Amylin", detail:"PP: Gi/Y4R→↓cAMP, inhibits exocrine | Ghrelin: acylated (Ser³ n-octanoyl), GHS-R1a, orexigenic | Amylin: CALCR+RAMP, ↑cAMP, slows gastric emptying; amyloid in T2DM", color:C.amber },
    { label:"Master Switch", detail:"Phosphorylation (PKA) = Glucagon state | Dephosphorylation (PP2A/insulin) = Insulin state | Randle cycle: Glucose ↔ FA competition | I:G ratio determines fed vs fasted metabolism", color:C.gold },
    { label:"Diabetes", detail:"T1DM: autoimmune (anti-GAD, anti-IA-2) → DKA via uncontrolled β-oxidation→ketogenesis | T2DM: IRS serine phosphorylation by PKC/IKK-β → insulin resistance → IAPP amyloid→β-cell loss", color:C.red },
  ];

  items.forEach((item,i)=>{
    const col=i%2, row2=Math.floor(i/2);
    const x=col===0?0.3:5.15, y=1.35+row2*1.1;
    s.addShape(pres.shapes.RECTANGLE,{x,y,w:4.65,h:0.96,fill:{color:"0F1F3D"},line:{color:item.color,pt:1}});
    s.addShape(pres.shapes.RECTANGLE,{x,y,w:0.1,h:0.96,fill:{color:item.color},line:{color:item.color}});
    s.addText(item.label,{x:x+0.16,y:y+0.08,w:4.42,h:0.28,fontSize:10.5,bold:true,color:item.color,fontFace:"Calibri",margin:0});
    s.addText(item.detail,{x:x+0.16,y:y+0.38,w:4.42,h:0.52,fontSize:8,color:"AABBCC",fontFace:"Calibri",wrap:true,margin:0});
  });

  s.addText("Sources: Lippincott Biochemistry 8e · Costanzo Physiology 7e · Guyton & Hall Medical Physiology · Lippincott Pharmacology · Schwartz's Surgery 11e",
    {x:0.3,y:H-0.46,w:9.4,h:0.3,fontSize:7,color:"445577",align:"center",fontFace:"Calibri"});
}

// ═══════════════════════════════════════════════════════════
// WRITE FILE
// ═══════════════════════════════════════════════════════════
const out = "/home/daytona/workspace/pancreatic-hormones/Pancreatic_Hormones_Biochemistry.pptx";
pres.writeFile({fileName:out})
  .then(()=>console.log("Saved: "+out))
  .catch(e=>{console.error(e);process.exit(1);});
!

Failed to create session: bad request: failed to resolve container IP after 3 attempts: no IP address found. Is the Sandbox started?

We encountered an error while processing your request. Please try again or reach out to us for help.

This is a shared conversation. Sign in to Orris to start your own chat.