Endi
Endocrine system 1st year mbbs
| Class | Examples | Receptor location |
|---|---|---|
| Steroids | Cortisol, Aldosterone, Sex hormones | Intracellular |
| Peptides | GH, ACTH, TSH, ADH, Oxytocin, PTH, Insulin | Cell surface |
| Amines | Thyroid hormones (T3/T4), Epinephrine | Intracellular (T3/T4); Cell surface (Epi) |
Exam Trick: Thyroid hormone is an amine (derived from tyrosine) but behaves like a steroid - it uses an intracellular receptor. This is a classic MCQ trap!
| Hormone | Type | Action |
|---|---|---|
| TRH (Thyrotropin-releasing hormone) | Peptide | Stimulates TSH + Prolactin |
| CRH (Corticotropin-releasing hormone) | Peptide | Stimulates ACTH |
| GnRH (Gonadotropin-releasing hormone) | Peptide | Stimulates LH + FSH |
| GHRH (Growth hormone-releasing hormone) | Peptide | Stimulates GH |
| Somatostatin (SRIF) | Peptide | Inhibits GH |
| Dopamine (PIF) | Amine | Inhibits Prolactin |
| Hormone | Type | Action |
|---|---|---|
| TSH | Peptide | Stimulates synthesis & secretion of thyroid hormones |
| FSH | Peptide | Sperm maturation (Sertoli cells); Follicular development |
| LH | Peptide | Testosterone synthesis (Leydig cells); Ovulation |
| GH (Growth Hormone) | Peptide | Protein synthesis, overall growth |
| Prolactin | Peptide | Milk production & secretion |
| ACTH | Peptide | Stimulates adrenal cortex hormones |
| MSH | Peptide | Melanin synthesis |
| Hormone | Action |
|---|---|
| ADH (Vasopressin) | Water reabsorption in collecting ducts; arteriolar constriction |
| Oxytocin | Milk ejection; uterine contractions |
| Hormone | Type | Action |
|---|---|---|
| T3 (Triiodothyronine) | Amine | ↑ BMR, growth, development, heart rate |
| T4 (Thyroxine) | Amine | Same as T3 (T4 converted to active T3 peripherally) |
| Calcitonin | Peptide | ↓ Serum Ca2+ (inhibits osteoclasts) |
| Hormone | Action |
|---|---|
| PTH (Parathyroid hormone) | ↑ Serum Ca2+, ↓ Phosphate; activates Vit D |
| Zone | Hormone | Action |
|---|---|---|
| Zona Glomerulosa | Aldosterone (Mineralocorticoid) | ↑ Na+ reabsorption, ↑ K+ excretion (kidney) |
| Zona Fasciculata | Cortisol (Glucocorticoid) | ↑ Blood glucose, anti-inflammatory, stress response |
| Zona Reticularis | Androgens (DHEA) | Male secondary sex characteristics |
| Hormone | Type | Action |
|---|---|---|
| Epinephrine (80%) | Amine | Fight-or-flight: ↑HR, ↑BP, ↑glucose |
| Norepinephrine (20%) | Amine | Vasoconstriction |
| Cell | Hormone | Action |
|---|---|---|
| Beta (β) | Insulin | ↓ Blood glucose (uptake, storage) |
| Alpha (α) | Glucagon | ↑ Blood glucose (glycogenolysis, gluconeogenesis) |
| Delta (δ) | Somatostatin | Inhibits both insulin & glucagon locally |
Hypothalamus → TRH → Anterior Pituitary → TSH → Thyroid → T3/T4
T3/T4 provides NEGATIVE FEEDBACK to Hypothalamus & Pituitary
Hypothalamus → CRH → Anterior Pituitary → ACTH → Adrenal Cortex → Cortisol
Cortisol provides NEGATIVE FEEDBACK
Low BP / Low Na+ → Kidney (Renin) → Angiotensin I → ACE (lungs) → Angiotensin II → Aldosterone (Zona Glomerulosa)
| Disorder | Gland | Too Much / Too Little | Key Features |
|---|---|---|---|
| Hypothyroidism | Thyroid | ↓ T3/T4 | Fatigue, cold intolerance, weight gain, bradycardia |
| Hyperthyroidism (Graves') | Thyroid | ↑ T3/T4 | Weight loss, heat intolerance, tachycardia, exophthalmos |
| Cushing's Syndrome | Adrenal cortex | ↑ Cortisol | Buffalo hump, moon face, striae, hyperglycemia |
| Addison's Disease | Adrenal cortex | ↓ Cortisol & Aldosterone | Hypotension, hyperpigmentation, hypoglycemia |
| Gigantism / Acromegaly | Anterior pituitary | ↑ GH | Gigantism (before epiphyseal closure); Acromegaly (adult) |
| Diabetes Insipidus | Posterior pituitary | ↓ ADH | Excessive dilute urine, extreme thirst |
| Hyperparathyroidism | Parathyroid | ↑ PTH | "Bones, Stones, Groans, Moans" (↑Ca2+) |
| Type 1 DM | Pancreas | ↓ Insulin | Autoimmune β-cell destruction |
| Type 2 DM | Pancreas | Insulin resistance | Obesity, hyperglycemia |
| Pheochromocytoma | Adrenal medulla | ↑ Epi/NE | Episodic hypertension, headache, sweating |
Create a summary PDF with diagrams of hormone axes
ls -la /home/daytona/workspace/ 2>/dev/null || echo "workspace empty or missing"
mkdir -p /home/daytona/workspace/endocrine-pdf && echo "done"
~/endocrine-pdf/generate_pdf.py
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import cm, mm
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.platypus import (SimpleDocTemplate, Paragraph, Spacer, Table,
TableStyle, PageBreak, HRFlowable)
from reportlab.platypus.flowables import Flowable
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_RIGHT
from reportlab.graphics.shapes import (Drawing, Rect, String, Line, Arrow,
Circle, Polygon, Path, Group)
from reportlab.graphics import renderPDF
from reportlab.graphics.shapes import Drawing, Rect, String, Line, Circle, Polygon
from reportlab.platypus import Image
import os
# ─── Color Palette ───────────────────────────────────────────────────────────
NAVY = colors.HexColor('#1A3A5C')
TEAL = colors.HexColor('#0D7377')
GOLD = colors.HexColor('#F4A300')
ORANGE = colors.HexColor('#E07B39')
GREEN = colors.HexColor('#2E7D32')
RED = colors.HexColor('#C0392B')
PURPLE = colors.HexColor('#6A0DAD')
BLUE_LT = colors.HexColor('#D6EAF8')
TEAL_LT = colors.HexColor('#D0F0F0')
GOLD_LT = colors.HexColor('#FFF3CC')
GREY_LT = colors.HexColor('#F4F6F7')
GREY_MED = colors.HexColor('#BDC3C7')
WHITE = colors.white
BLACK = colors.black
OUTPUT = '/home/daytona/workspace/endocrine-pdf/Endocrine_System_MBBS.pdf'
# ─── Styles ───────────────────────────────────────────────────────────────────
styles = getSampleStyleSheet()
def make_style(name, parent='Normal', **kw):
s = ParagraphStyle(name, parent=styles[parent], **kw)
return s
TITLE_STYLE = make_style('Title2', fontName='Helvetica-Bold', fontSize=26,
textColor=WHITE, alignment=TA_CENTER, spaceAfter=6)
SUBTITLE_STYLE = make_style('Subtitle', fontName='Helvetica', fontSize=13,
textColor=GOLD_LT, alignment=TA_CENTER)
H1 = make_style('H1', fontName='Helvetica-Bold', fontSize=15,
textColor=WHITE, spaceBefore=4, spaceAfter=4)
H2 = make_style('H2', fontName='Helvetica-Bold', fontSize=12,
textColor=NAVY, spaceBefore=8, spaceAfter=4)
H3 = make_style('H3', fontName='Helvetica-Bold', fontSize=10,
textColor=TEAL, spaceBefore=4, spaceAfter=2)
BODY = make_style('Body2', fontName='Helvetica', fontSize=9,
textColor=colors.HexColor('#2C3E50'), leading=14, spaceAfter=3)
BULLET = make_style('Bullet', fontName='Helvetica', fontSize=9,
textColor=colors.HexColor('#2C3E50'), leading=13,
leftIndent=14, spaceAfter=2, bulletIndent=4)
CAPTION = make_style('Caption', fontName='Helvetica-Oblique', fontSize=8,
textColor=GREY_MED, alignment=TA_CENTER, spaceAfter=4)
SMALL_BOLD = make_style('SmallBold', fontName='Helvetica-Bold', fontSize=8,
textColor=NAVY)
MCQ_Q = make_style('MCQQ', fontName='Helvetica-Bold', fontSize=9,
textColor=NAVY, spaceBefore=6, spaceAfter=2)
MCQ_A = make_style('MCQA', fontName='Helvetica', fontSize=9,
textColor=colors.HexColor('#2C3E50'), leading=13,
leftIndent=12, spaceAfter=1)
MCQ_CORRECT = make_style('MCQCorrect', fontName='Helvetica-Bold', fontSize=9,
textColor=GREEN, leftIndent=12)
TRICK = make_style('Trick', fontName='Helvetica-Oblique', fontSize=8.5,
textColor=RED, leftIndent=10, spaceAfter=4)
# ─── Helper: Colored Section Header ──────────────────────────────────────────
class ColorHeader(Flowable):
def __init__(self, text, bg=NAVY, fg=WHITE, width=None, height=26, fontsize=13):
super().__init__()
self.text = text
self.bg = bg
self.fg = fg
self._w = width
self.height = height
self.fontsize = fontsize
def wrap(self, aw, ah):
self._w = aw
return aw, self.height
def draw(self):
c = self.canv
c.setFillColor(self.bg)
c.roundRect(0, 0, self._w, self.height, 6, fill=1, stroke=0)
c.setFillColor(self.fg)
c.setFont('Helvetica-Bold', self.fontsize)
c.drawString(10, self.height / 2 - self.fontsize / 2 + 1, self.text)
# ─── Helper: Arrow-box axis diagram ─────────────────────────────────────────
class AxisDiagram(Flowable):
"""Draws a vertical hormone axis with boxes and arrows."""
def __init__(self, title, steps, feedback=None, width=160, box_h=28,
gap=18, color_scheme=None):
super().__init__()
self.title = title
self.steps = steps # list of (label, sublabel, color)
self.feedback = feedback # optional feedback label string
self.bw = width
self.box_h = box_h
self.gap = gap
self.color_scheme = color_scheme or NAVY
n = len(steps)
self._total_h = 30 + n * box_h + (n - 1) * gap + 20
def wrap(self, aw, ah):
return self.bw, self._total_h
def draw(self):
c = self.canv
steps = self.steps
bh = self.box_h
gap = self.gap
bw = self.bw
y_start = self._total_h - 28
# Title
c.setFont('Helvetica-Bold', 9)
c.setFillColor(self.color_scheme)
c.drawCentredString(bw / 2, y_start + 4, self.title)
positions = []
for i, (label, sublabel, col) in enumerate(steps):
y = y_start - (i * (bh + gap)) - bh - 4
positions.append(y)
# Box
c.setFillColor(col)
c.setStrokeColor(WHITE)
c.roundRect(5, y, bw - 10, bh, 5, fill=1, stroke=1)
# Label
c.setFillColor(WHITE)
c.setFont('Helvetica-Bold', 8)
c.drawCentredString(bw / 2, y + bh / 2 + 2, label)
if sublabel:
c.setFont('Helvetica', 6.5)
c.drawCentredString(bw / 2, y + bh / 2 - 7, sublabel)
# Arrow down
if i < len(steps) - 1:
ax = bw / 2
ay_top = y
ay_bot = y - gap
c.setStrokeColor(colors.HexColor('#555555'))
c.setFillColor(colors.HexColor('#555555'))
c.setLineWidth(1.5)
c.line(ax, ay_top, ax, ay_bot + 5)
# arrowhead
c.setFillColor(colors.HexColor('#555555'))
c.beginPath()
c.moveTo(ax, ay_bot)
c.lineTo(ax - 4, ay_bot + 7)
c.lineTo(ax + 4, ay_bot + 7)
c.closePath()
c.fill()
# Feedback arrow on right side
if self.feedback and len(positions) >= 2:
x_fb = bw - 5
y_top_box = positions[0] + bh / 2
y_bot_box = positions[-1] + bh / 2
c.setStrokeColor(RED)
c.setFillColor(RED)
c.setLineWidth(1.2)
# vertical line
c.line(x_fb, y_top_box, x_fb, y_bot_box)
# horizontal ticks
c.line(x_fb - 20, y_top_box, x_fb, y_top_box)
c.line(x_fb - 20, y_bot_box, x_fb, y_bot_box)
# arrowhead pointing up (toward top)
c.beginPath()
c.moveTo(x_fb - 20, y_top_box)
c.lineTo(x_fb - 15, y_top_box - 5)
c.lineTo(x_fb - 25, y_top_box - 5)
c.closePath()
c.fill()
# label
c.setFont('Helvetica-Bold', 6.5)
c.setFillColor(RED)
c.drawString(x_fb - 18, (y_top_box + y_bot_box) / 2 + 2, '(-)')
c.setFont('Helvetica', 6)
c.drawString(x_fb - 28, (y_top_box + y_bot_box) / 2 - 8, self.feedback)
# ─── Helper: Gland diagram (circle with label) ───────────────────────────────
class GlandSummaryBox(Flowable):
"""A colored rounded box summarising gland info."""
def __init__(self, gland, hormones, actions, color, width=170, height=90):
super().__init__()
self.gland = gland
self.hormones = hormones
self.actions = actions
self.color = color
self._w = width
self._h = height
def wrap(self, aw, ah):
return self._w, self._h
def draw(self):
c = self.canv
# outer box
c.setFillColor(self.color)
c.roundRect(0, 0, self._w, self._h, 8, fill=1, stroke=0)
# header bar
c.setFillColor(colors.HexColor('#00000033'))
c.roundRect(0, self._h - 22, self._w, 22, 8, fill=1, stroke=0)
c.rect(0, self._h - 22, self._w, 10, fill=1, stroke=0) # square bottom
# title
c.setFillColor(WHITE)
c.setFont('Helvetica-Bold', 9)
c.drawCentredString(self._w / 2, self._h - 15, self.gland)
# hormones
c.setFont('Helvetica-Bold', 7.5)
c.setFillColor(WHITE)
c.drawString(6, self._h - 32, 'Hormones:')
c.setFont('Helvetica', 7.5)
y = self._h - 43
for h in self.hormones:
c.drawString(8, y, u'\u2022 ' + h)
y -= 11
# actions
c.setFont('Helvetica-Bold', 7.5)
c.drawString(6, y - 2, 'Key Actions:')
y -= 13
for a in self.actions:
c.setFont('Helvetica', 7)
c.drawString(8, y, u'\u2192 ' + a)
y -= 10
# ─── Page background / header ─────────────────────────────────────────────────
def cover_page_bg(canvas, doc):
canvas.saveState()
W, H = A4
# gradient-like background
canvas.setFillColor(NAVY)
canvas.rect(0, 0, W, H, fill=1, stroke=0)
# decorative circles
canvas.setFillColor(colors.HexColor('#1E4D78'))
canvas.circle(W * 0.85, H * 0.85, 120, fill=1, stroke=0)
canvas.circle(W * 0.1, H * 0.15, 80, fill=1, stroke=0)
canvas.setFillColor(colors.HexColor('#153352'))
canvas.circle(W * 0.5, H * 0.5, 200, fill=1, stroke=0)
canvas.restoreState()
def content_page_bg(canvas, doc):
canvas.saveState()
W, H = A4
canvas.setFillColor(colors.HexColor('#F8FAFB'))
canvas.rect(0, 0, W, H, fill=1, stroke=0)
# top bar
canvas.setFillColor(NAVY)
canvas.rect(0, H - 22, W, 22, fill=1, stroke=0)
canvas.setFillColor(WHITE)
canvas.setFont('Helvetica-Bold', 8)
canvas.drawString(15, H - 14, 'Endocrine System - 1st Year MBBS Summary')
canvas.setFont('Helvetica', 8)
canvas.drawRightString(W - 15, H - 14, f'Page {doc.page}')
# bottom bar
canvas.setFillColor(TEAL)
canvas.rect(0, 0, W, 14, fill=1, stroke=0)
canvas.setFillColor(WHITE)
canvas.setFont('Helvetica', 7)
canvas.drawCentredString(W / 2, 4, 'Sources: Costanzo Physiology 7e | Ganong\'s Review of Medical Physiology 26e')
canvas.restoreState()
# ─── Build document ───────────────────────────────────────────────────────────
def build_pdf():
doc = SimpleDocTemplate(
OUTPUT, pagesize=A4,
leftMargin=1.5*cm, rightMargin=1.5*cm,
topMargin=1.5*cm, bottomMargin=1.2*cm
)
story = []
W = A4[0] - 3*cm # usable width
# ══════════════════════════════════════════════════════════════
# COVER PAGE
# ══════════════════════════════════════════════════════════════
story.append(Spacer(1, 3*cm))
story.append(Paragraph('ENDOCRINE SYSTEM', TITLE_STYLE))
story.append(Spacer(1, 0.3*cm))
story.append(Paragraph('1st Year MBBS - Complete Summary Notes', SUBTITLE_STYLE))
story.append(Spacer(1, 0.2*cm))
story.append(Paragraph('Hormone Axes | Gland Summaries | MCQs | Key Mnemonics', SUBTITLE_STYLE))
story.append(Spacer(1, 2*cm))
# Cover info box
cover_data = [
['Topics Covered'],
['\u2022 Hormone Classification (Steroids, Peptides, Amines)'],
['\u2022 HPT Axis (Hypothalamus-Pituitary-Thyroid)'],
['\u2022 HPA Axis (Hypothalamus-Pituitary-Adrenal)'],
['\u2022 HPG Axis (Hypothalamus-Pituitary-Gonadal)'],
['\u2022 RAAS (Renin-Angiotensin-Aldosterone)'],
['\u2022 Pancreatic Hormones (Insulin & Glucagon)'],
['\u2022 All Gland Summaries with Hormones & Actions'],
['\u2022 Adrenal Cortex Zones (GFR Mnemonic)'],
['\u2022 Clinical Disorders Table'],
['\u2022 10 Exam MCQs with Answers'],
['\u2022 High-Yield Viva Facts'],
]
cover_ts = TableStyle([
('BACKGROUND', (0, 0), (-1, 0), TEAL),
('BACKGROUND', (0, 1), (-1, -1), colors.HexColor('#0D2137')),
('TEXTCOLOR', (0, 0), (-1, 0), WHITE),
('TEXTCOLOR', (0, 1), (-1, -1), colors.HexColor('#A8D8EA')),
('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'),
('FONTNAME', (0, 1), (-1, -1), 'Helvetica'),
('FONTSIZE', (0, 0), (-1, 0), 12),
('FONTSIZE', (0, 1), (-1, -1), 9.5),
('ROWBACKGROUNDS', (0, 1), (-1, -1), [colors.HexColor('#0D2137'), colors.HexColor('#102840')]),
('ALIGN', (0, 0), (-1, -1), 'LEFT'),
('LEFTPADDING', (0, 0), (-1, -1), 16),
('TOPPADDING', (0, 0), (-1, 0), 10),
('BOTTOMPADDING', (0, 0), (-1, 0), 10),
('TOPPADDING', (0, 1), (-1, -1), 6),
('BOTTOMPADDING', (0, 1), (-1, -1), 6),
('ROUNDEDCORNERS', [8], ),
])
t = Table(cover_data, colWidths=[W])
t.setStyle(cover_ts)
story.append(t)
story.append(PageBreak())
# ══════════════════════════════════════════════════════════════
# PAGE 2: Hormone Classification + Master Abbreviation Table
# ══════════════════════════════════════════════════════════════
story.append(ColorHeader('1. Hormone Classification & Key Abbreviations', bg=NAVY))
story.append(Spacer(1, 0.3*cm))
story.append(Paragraph('Three Classes of Hormones', H2))
class_data = [
['Class', 'Examples', 'Receptor Location', 'Mechanism'],
['Steroids', 'Cortisol, Aldosterone,\nEstrogen, Testosterone', 'Intracellular\n(cytoplasm/nucleus)', 'Direct gene\ntranscription'],
['Peptides', 'GH, ACTH, TSH, ADH,\nOxytocin, PTH, Insulin', 'Cell surface\n(membrane)', 'cAMP, IP3/DAG\n2nd messengers'],
['Amines', 'T3, T4 (intracellular)\nEpinephrine (surface)', 'T3/T4: Intracellular\nEpi: Cell surface', 'T3/T4: like steroids\nEpi: like peptides'],
]
class_ts = TableStyle([
('BACKGROUND', (0, 0), (-1, 0), TEAL),
('TEXTCOLOR', (0, 0), (-1, 0), WHITE),
('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'),
('FONTSIZE', (0, 0), (-1, -1), 8.5),
('ROWBACKGROUNDS', (0, 1), (-1, -1), [WHITE, TEAL_LT]),
('GRID', (0, 0), (-1, -1), 0.5, GREY_MED),
('ALIGN', (0, 0), (-1, -1), 'CENTER'),
('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
('TOPPADDING', (0, 0), (-1, -1), 6),
('BOTTOMPADDING', (0, 0), (-1, -1), 6),
('FONTNAME', (0, 1), (0, -1), 'Helvetica-Bold'),
('TEXTCOLOR', (0, 1), (0, -1), TEAL),
])
t = Table(class_data, colWidths=[W*0.14, W*0.28, W*0.28, W*0.3])
t.setStyle(class_ts)
story.append(t)
story.append(Paragraph(
'<font color="#C0392B"><b>Exam Trap:</b></font> Thyroid hormones (T3/T4) are amines '
'(derived from tyrosine) but act like steroids - they use intracellular receptors! '
'Epinephrine is also an amine but uses a cell-surface receptor.',
make_style('Tip', fontName='Helvetica', fontSize=8.5, textColor=RED,
backColor=colors.HexColor('#FDECEA'), leftIndent=8, rightIndent=8,
spaceBefore=6, spaceAfter=8,
borderPad=6, borderColor=RED, borderWidth=0.5)
))
story.append(Paragraph('Key Abbreviations (Must-Know for Exams)', H2))
abbr_data = [
['Abbr.', 'Hormone', 'Abbr.', 'Hormone'],
['TRH', 'Thyrotropin-releasing hormone', 'ACTH', 'Adrenocorticotropic hormone'],
['TSH', 'Thyroid-stimulating hormone', 'ADH', 'Antidiuretic hormone (Vasopressin)'],
['T3 / T4', 'Triiodothyronine / Thyroxine', 'CRH', 'Corticotropin-releasing hormone'],
['GH', 'Growth hormone', 'GHRH', 'Growth hormone-releasing hormone'],
['IGF-1', 'Insulin-like growth factor-1', 'SRIF', 'Somatostatin (inhibits GH)'],
['FSH', 'Follicle-stimulating hormone', 'LH', 'Luteinizing hormone'],
['GnRH', 'Gonadotropin-releasing hormone', 'PIF', 'Prolactin-inhibiting factor (Dopamine)'],
['PTH', 'Parathyroid hormone', 'POMC', 'Pro-opiomelanocortin'],
['DHEA', 'Dehydroepiandrosterone', 'HCG', 'Human chorionic gonadotropin'],
]
abbr_ts = TableStyle([
('BACKGROUND', (0, 0), (-1, 0), NAVY),
('TEXTCOLOR', (0, 0), (-1, 0), WHITE),
('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'),
('FONTSIZE', (0, 0), (-1, -1), 8),
('ROWBACKGROUNDS', (0, 1), (-1, -1), [WHITE, BLUE_LT]),
('GRID', (0, 0), (-1, -1), 0.4, GREY_MED),
('FONTNAME', (0, 1), (0, -1), 'Helvetica-Bold'),
('TEXTCOLOR', (0, 1), (0, -1), TEAL),
('FONTNAME', (2, 1), (2, -1), 'Helvetica-Bold'),
('TEXTCOLOR', (2, 1), (2, -1), TEAL),
('TOPPADDING', (0, 0), (-1, -1), 4),
('BOTTOMPADDING', (0, 0), (-1, -1), 4),
('LEFTPADDING', (0, 0), (-1, -1), 6),
])
t = Table(abbr_data, colWidths=[W*0.1, W*0.4, W*0.1, W*0.4])
t.setStyle(abbr_ts)
story.append(t)
story.append(PageBreak())
# ══════════════════════════════════════════════════════════════
# PAGE 3: HPT, HPA, HPG AXES DIAGRAMS
# ══════════════════════════════════════════════════════════════
story.append(ColorHeader('2. Major Hormone Axes - Visual Diagrams', bg=TEAL))
story.append(Spacer(1, 0.3*cm))
story.append(Paragraph(
'These axes show how the hypothalamus controls the pituitary, which then controls '
'peripheral glands. Negative feedback (-) keeps hormone levels in balance.',
BODY))
story.append(Spacer(1, 0.2*cm))
# Three axes side by side
hpt_steps = [
('HYPOTHALAMUS', 'Paraventricular nucleus', NAVY),
('TRH', 'Thyrotropin-releasing\nhormone (peptide)', TEAL),
('ANTERIOR PITUITARY', 'Thyrotroph cells', colors.HexColor('#1565C0')),
('TSH', 'Thyroid-stimulating\nhormone (peptide)', colors.HexColor('#1976D2')),
('THYROID GLAND', 'Follicular cells', colors.HexColor('#0288D1')),
('T3 / T4', 'Active thyroid\nhormones (amines)', GOLD),
]
hpa_steps = [
('HYPOTHALAMUS', 'Paraventricular nucleus', NAVY),
('CRH', 'Corticotropin-releasing\nhormone (peptide)', colors.HexColor('#880E4F')),
('ANTERIOR PITUITARY', 'Corticotroph cells', colors.HexColor('#6A1B9A')),
('ACTH', 'Adrenocorticotropic\nhormone (peptide)', colors.HexColor('#7B1FA2')),
('ADRENAL CORTEX', 'Zona fasciculata', colors.HexColor('#AD1457')),
('CORTISOL', 'Glucocorticoid\n(steroid)', ORANGE),
]
hpg_steps = [
('HYPOTHALAMUS', 'Arcuate nucleus', NAVY),
('GnRH', 'Gonadotropin-releasing\nhormone (peptide)', GREEN),
('ANTERIOR PITUITARY', 'Gonadotroph cells', colors.HexColor('#2E7D32')),
('LH / FSH', 'Gonadotropins\n(peptides)', colors.HexColor('#388E3C')),
('GONADS', 'Testes / Ovaries', colors.HexColor('#1B5E20')),
('SEX STEROIDS', 'Testosterone/Estrogen\n(steroids)', GOLD),
]
ax_w = 155
hpt_diag = AxisDiagram('HPT Axis', hpt_steps, 'Neg. Feedback', width=ax_w)
hpa_diag = AxisDiagram('HPA Axis', hpa_steps, 'Neg. Feedback', width=ax_w)
hpg_diag = AxisDiagram('HPG Axis', hpg_steps, 'Neg. Feedback', width=ax_w)
axes_table = Table([[hpt_diag, hpa_diag, hpg_diag]],
colWidths=[ax_w + 10, ax_w + 10, ax_w + 10])
axes_table.setStyle(TableStyle([
('ALIGN', (0, 0), (-1, -1), 'CENTER'),
('VALIGN', (0, 0), (-1, -1), 'TOP'),
('BACKGROUND', (0, 0), (-1, -1), WHITE),
('BOX', (0, 0), (-1, -1), 1, GREY_MED),
('INNERGRID', (0, 0), (-1, -1), 0.5, GREY_MED),
('TOPPADDING', (0, 0), (-1, -1), 8),
('BOTTOMPADDING', (0, 0), (-1, -1), 8),
('LEFTPADDING', (0, 0), (-1, -1), 4),
('RIGHTPADDING', (0, 0), (-1, -1), 4),
('ROUNDEDCORNERS', [6]),
]))
story.append(axes_table)
story.append(Spacer(1, 0.4*cm))
# RAAS + GH axis
story.append(Paragraph('RAAS & GH Axis', H2))
raas_steps = [
('LOW BP / LOW Na+', 'Trigger (kidney sensors)', colors.HexColor('#B71C1C')),
('RENIN', 'From juxtaglomerular\ncells (kidney)', RED),
('ANGIOTENSIN I', 'Inactive precursor\n(liver - angiotensinogen)', colors.HexColor('#E53935')),
('ACE', 'Angiotensin-converting\nenzyme (LUNGS)', ORANGE),
('ANGIOTENSIN II', 'Active vasoconstrictor', colors.HexColor('#E65100')),
('ALDOSTERONE', 'Zona glomerulosa\n(adrenal cortex)', GOLD),
]
gh_steps = [
('HYPOTHALAMUS', '', NAVY),
('GHRH (+) /\nSomatostatin (-)', 'Stimulate/Inhibit\nGH release', TEAL),
('ANTERIOR PITUITARY', 'Somatotroph cells', colors.HexColor('#1565C0')),
('GROWTH HORMONE', 'GH (peptide)', colors.HexColor('#1976D2')),
('LIVER', 'Primary target', colors.HexColor('#2E7D32')),
('IGF-1', 'Insulin-like\nGrowth Factor-1', GREEN),
]
raas_diag = AxisDiagram('RAAS Axis', raas_steps, 'High BP feedback', width=ax_w)
gh_diag = AxisDiagram('GH / IGF-1 Axis', gh_steps, 'IGF-1 feedback', width=ax_w)
axes_table2 = Table([[raas_diag, Spacer(10, 10), gh_diag]],
colWidths=[ax_w + 10, 50, ax_w + 10])
axes_table2.setStyle(TableStyle([
('ALIGN', (0, 0), (-1, -1), 'CENTER'),
('VALIGN', (0, 0), (-1, -1), 'TOP'),
]))
story.append(axes_table2)
story.append(PageBreak())
# ══════════════════════════════════════════════════════════════
# PAGE 4: GLAND SUMMARIES + ADRENAL ZONES
# ══════════════════════════════════════════════════════════════
story.append(ColorHeader('3. Complete Gland-by-Gland Summary', bg=PURPLE))
story.append(Spacer(1, 0.3*cm))
# Full hormone table
story.append(Paragraph('Master Hormone Table', H2))
ht_data = [
['Gland / Origin', 'Hormone', 'Class', 'Major Action'],
# Hypothalamus
['Hypothalamus', 'TRH', 'Peptide', 'Stimulates TSH + Prolactin'],
['', 'CRH', 'Peptide', 'Stimulates ACTH'],
['', 'GnRH', 'Peptide', 'Stimulates LH + FSH'],
['', 'GHRH', 'Peptide', 'Stimulates GH'],
['', 'Somatostatin (SRIF)', 'Peptide', 'INHIBITS GH'],
['', 'Dopamine (PIF)', 'Amine', 'INHIBITS Prolactin'],
# Anterior Pituitary
['Anterior Pituitary', 'TSH', 'Peptide', 'Stimulates T3/T4 synthesis'],
['', 'ACTH', 'Peptide', 'Stimulates adrenal cortex (cortisol, androgens, aldosterone)'],
['', 'GH', 'Peptide', 'Protein synthesis, growth (via IGF-1)'],
['', 'Prolactin', 'Peptide', 'Milk production and secretion'],
['', 'FSH', 'Peptide', 'Sperm maturation (Sertoli); follicular development'],
['', 'LH', 'Peptide', 'Testosterone (Leydig cells); ovulation, corpus luteum'],
['', 'MSH', 'Peptide', 'Melanin synthesis'],
# Posterior Pituitary
['Posterior Pituitary\n(made in hypothalamus)', 'ADH (Vasopressin)', 'Peptide', 'Water reabsorption (collecting duct); vasoconstriction'],
['', 'Oxytocin', 'Peptide', 'Milk ejection; uterine contractions'],
# Thyroid
['Thyroid', 'T3 (active)', 'Amine', 'Increase BMR, HR, growth, development'],
['', 'T4 (prohormone)', 'Amine', 'Converted to T3 in periphery'],
['', 'Calcitonin', 'Peptide', 'Decrease serum Ca2+ (inhibits osteoclasts)'],
# Parathyroid
['Parathyroid', 'PTH', 'Peptide', 'Increase serum Ca2+, decrease phosphate; activates Vit D'],
# Adrenal Cortex
['Adrenal Cortex\n(Zona Glomerulosa)', 'Aldosterone', 'Steroid', 'Na+ reabsorption, K+ excretion (kidneys)'],
['(Zona Fasciculata)', 'Cortisol', 'Steroid', 'Raise blood glucose; anti-inflammatory; stress'],
['(Zona Reticularis)', 'Androgens (DHEA)', 'Steroid', 'Male secondary sex characteristics'],
# Adrenal Medulla
['Adrenal Medulla', 'Epinephrine (80%)', 'Amine', 'Fight-or-flight: HR, BP, blood glucose'],
['', 'Norepinephrine (20%)', 'Amine', 'Peripheral vasoconstriction'],
# Pancreas
['Pancreas (beta cells)', 'Insulin', 'Peptide', 'Decrease blood glucose (uptake & storage)'],
['Pancreas (alpha cells)', 'Glucagon', 'Peptide', 'Increase blood glucose (glycogenolysis, gluconeogenesis)'],
['Pancreas (delta cells)', 'Somatostatin', 'Peptide', 'Locally inhibits insulin AND glucagon'],
]
ht_col_widths = [W*0.18, W*0.18, W*0.1, W*0.54]
ht_ts = TableStyle([
('BACKGROUND', (0, 0), (-1, 0), NAVY),
('TEXTCOLOR', (0, 0), (-1, 0), WHITE),
('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'),
('FONTSIZE', (0, 0), (-1, -1), 7.5),
('ROWBACKGROUNDS', (0, 1), (-1, -1), [WHITE, GREY_LT]),
('GRID', (0, 0), (-1, -1), 0.3, GREY_MED),
('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
('TOPPADDING', (0, 0), (-1, -1), 3),
('BOTTOMPADDING', (0, 0), (-1, -1), 3),
('LEFTPADDING', (0, 0), (-1, -1), 4),
# Color code gland origins
('BACKGROUND', (0, 1), (0, 6), colors.HexColor('#E8F5E9')), # Hypothalamus - green
('BACKGROUND', (0, 7), (0, 13), BLUE_LT), # Ant. pituitary - blue
('BACKGROUND', (0, 14), (0, 15), colors.HexColor('#FFF9C4')), # Post. pituitary - yellow
('BACKGROUND', (0, 16), (0, 18), colors.HexColor('#E3F2FD')), # Thyroid - light blue
('BACKGROUND', (0, 19), (0, 19), colors.HexColor('#FCE4EC')), # Parathyroid - pink
('BACKGROUND', (0, 20), (0, 24), colors.HexColor('#FFF3E0')), # Adrenal - orange
('BACKGROUND', (0, 25), (0, 27), colors.HexColor('#F3E5F5')), # Pancreas - purple
('FONTNAME', (1, 1), (1, -1), 'Helvetica-Bold'),
('TEXTCOLOR', (1, 5), (1, 5), RED), # Somatostatin inhibits
('TEXTCOLOR', (1, 6), (1, 6), RED), # Dopamine inhibits
('TEXTCOLOR', (3, 5), (3, 6), RED),
('SPAN', (0, 1), (0, 6)), # Hypothalamus span
('SPAN', (0, 7), (0, 13)), # Ant pit span
('SPAN', (0, 14), (0, 15)), # Post pit span
('SPAN', (0, 16), (0, 18)), # Thyroid span
('SPAN', (0, 20), (0, 22)), # Adrenal cortex span
('SPAN', (0, 23), (0, 24)), # Adrenal medulla span
])
t = Table(ht_data, colWidths=ht_col_widths, repeatRows=1)
t.setStyle(ht_ts)
story.append(t)
story.append(PageBreak())
# ══════════════════════════════════════════════════════════════
# PAGE 5: ADRENAL CORTEX ZONES + PANCREAS DIAGRAM
# ══════════════════════════════════════════════════════════════
story.append(ColorHeader('4. Adrenal Cortex Zones & Pancreatic Islets', bg=ORANGE))
story.append(Spacer(1, 0.3*cm))
# Adrenal zones diagram - custom flowable
class AdrenalZonesDiagram(Flowable):
def __init__(self, width=280, height=200):
super().__init__()
self._w = width
self._h = height
def wrap(self, aw, ah):
return self._w, self._h
def draw(self):
c = self.canv
cx = self._w / 2
# Title
c.setFont('Helvetica-Bold', 10)
c.setFillColor(NAVY)
c.drawCentredString(cx, self._h - 12, 'Adrenal Gland Cross-Section')
# Draw concentric zones
zones = [
(80, colors.HexColor('#FFECB3'), 'ZONA GLOMERULOSA', 'Aldosterone\n(Mineralocorticoid)', 'Outermost zone - "Salt"'),
(58, colors.HexColor('#FFCC80'), 'ZONA FASCICULATA', 'Cortisol\n(Glucocorticoid)', 'Largest zone - "Sugar"'),
(38, colors.HexColor('#EF9A9A'), 'ZONA RETICULARIS', 'DHEA / Androgens', 'Inner cortex - "Sex"'),
(20, colors.HexColor('#CE93D8'), 'MEDULLA', 'Epi (80%) / NE (20%)', 'Neural crest origin'),
]
cy = self._h / 2 - 10
for r, col, name, hormone, note in zones:
c.setFillColor(col)
c.setStrokeColor(WHITE)
c.setLineWidth(2)
c.circle(cx, cy, r, fill=1, stroke=1)
# Labels with arrows pointing to each zone
label_x = cx + 90
label_data = [
(cy + 65, colors.HexColor('#F57F17'), 'Zona Glomerulosa', 'Aldosterone - Na+/K+ balance'),
(cy + 30, colors.HexColor('#E65100'), 'Zona Fasciculata', 'Cortisol - stress, glucose'),
(cy - 5, colors.HexColor('#C62828'), 'Zona Reticularis', 'DHEA / Androgens'),
(cy - 40, PURPLE, 'Medulla', 'Epinephrine, Norepinephrine'),
]
edge_xs = [cx + 80, cx + 58, cx + 38, cx + 20]
for (ly, lc, ltitle, lsub), ex in zip(label_data, edge_xs):
# Connecting line
c.setStrokeColor(lc)
c.setLineWidth(0.8)
c.line(ex, ly, label_x - 2, ly)
c.setFillColor(lc)
c.setFont('Helvetica-Bold', 7.5)
c.drawString(label_x, ly + 3, ltitle)
c.setFillColor(colors.HexColor('#555555'))
c.setFont('Helvetica', 6.5)
c.drawString(label_x, ly - 6, lsub)
# Mnemonic box
c.setFillColor(colors.HexColor('#E8F5E9'))
c.setStrokeColor(GREEN)
c.setLineWidth(1)
c.roundRect(cx - 40, 5, 80, 30, 4, fill=1, stroke=1)
c.setFillColor(GREEN)
c.setFont('Helvetica-Bold', 8)
c.drawCentredString(cx, 27, 'Mnemonic: "GFR"')
c.setFont('Helvetica', 7)
c.drawCentredString(cx, 15, 'Salt | Sugar | Sex (outer to inner)')
class PancreasIsletsDiagram(Flowable):
def __init__(self, width=220, height=200):
super().__init__()
self._w = width
self._h = height
def wrap(self, aw, ah):
return self._w, self._h
def draw(self):
c = self.canv
cx = self._w / 2
cy = self._h / 2
c.setFont('Helvetica-Bold', 10)
c.setFillColor(NAVY)
c.drawCentredString(cx, self._h - 12, 'Islets of Langerhans')
# Outer islet circle
c.setFillColor(colors.HexColor('#FFF9C4'))
c.setStrokeColor(GOLD)
c.setLineWidth(1.5)
c.circle(cx, cy, 70, fill=1, stroke=1)
# Alpha cells (outer ring) - red
import math
for angle_deg in [0, 60, 120, 180, 240, 300]:
angle = math.radians(angle_deg)
bx = cx + 50 * math.cos(angle)
by = cy + 50 * math.sin(angle)
c.setFillColor(colors.HexColor('#FFCDD2'))
c.setStrokeColor(RED)
c.setLineWidth(1)
c.circle(bx, by, 13, fill=1, stroke=1)
c.setFillColor(RED)
c.setFont('Helvetica-Bold', 6)
c.drawCentredString(bx, by + 2, 'alpha')
c.setFont('Helvetica', 5.5)
c.drawCentredString(bx, by - 6, 'Glucagon')
# Beta cells (center)
c.setFillColor(colors.HexColor('#BBDEFB'))
c.setStrokeColor(colors.HexColor('#1565C0'))
c.setLineWidth(1.5)
c.circle(cx, cy, 22, fill=1, stroke=1)
c.setFillColor(colors.HexColor('#1565C0'))
c.setFont('Helvetica-Bold', 7.5)
c.drawCentredString(cx, cy + 4, 'BETA')
c.setFont('Helvetica', 6.5)
c.drawCentredString(cx, cy - 6, 'Insulin')
# Delta cell label
c.setFillColor(colors.HexColor('#555555'))
c.setFont('Helvetica', 7)
c.drawCentredString(cx, 18, 'Delta cells (scattered) - Somatostatin')
# Legend
legend_items = [
(colors.HexColor('#BBDEFB'), colors.HexColor('#1565C0'), 'Beta (beta) - Insulin - lowers glucose (60-70%)'),
(colors.HexColor('#FFCDD2'), RED, 'Alpha (alpha) - Glucagon - raises glucose (20-25%)'),
(GREY_LT, GREY_MED, 'Delta (delta) - Somatostatin - inhibits both (~5%)'),
]
ly = 10
for bg, stroke, label in reversed(legend_items):
ly_pos = ly
c.setFillColor(bg)
c.setStrokeColor(stroke)
c.roundRect(4, ly_pos, 9, 7, 1, fill=1, stroke=1)
c.setFillColor(colors.HexColor('#333333'))
c.setFont('Helvetica', 6)
c.drawString(16, ly_pos + 1, label)
ly += 11
adrenal_diag = AdrenalZonesDiagram(width=280, height=200)
pancreas_diag = PancreasIsletsDiagram(width=220, height=200)
combined = Table([[adrenal_diag, pancreas_diag]],
colWidths=[290, 230])
combined.setStyle(TableStyle([
('VALIGN', (0, 0), (-1, -1), 'TOP'),
('BACKGROUND', (0, 0), (-1, -1), WHITE),
('BOX', (0, 0), (-1, -1), 0.5, GREY_MED),
('INNERGRID', (0, 0), (-1, -1), 0.5, GREY_MED),
('TOPPADDING', (0, 0), (-1, -1), 6),
('BOTTOMPADDING', (0, 0), (-1, -1), 6),
('LEFTPADDING', (0, 0), (-1, -1), 6),
]))
story.append(combined)
story.append(Spacer(1, 0.4*cm))
# Adrenal mnemonic box
story.append(Paragraph('Adrenal Cortex Mnemonic - "GFR = Salt, Sugar, Sex"', H2))
mnem_data = [
['Zone', 'Mnemonic', 'Hormone', 'Regulator', 'Key Action'],
['Zona Glomerulosa\n(outermost)', 'SALT', 'Aldosterone\n(Mineralocorticoid)', 'Angiotensin II\nHigh K+', 'Na+ in, K+ out\n(collecting duct)'],
['Zona Fasciculata\n(middle, largest)', 'SUGAR', 'Cortisol\n(Glucocorticoid)', 'ACTH', 'Raise blood glucose\nAnti-inflammatory'],
['Zona Reticularis\n(innermost)', 'SEX', 'DHEA / Androgens\n(Sex steroids)', 'ACTH', 'Male sex\ncharacteristics'],
]
mnem_ts = TableStyle([
('BACKGROUND', (0, 0), (-1, 0), ORANGE),
('TEXTCOLOR', (0, 0), (-1, 0), WHITE),
('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'),
('FONTSIZE', (0, 0), (-1, -1), 8),
('ROWBACKGROUNDS', (0, 1), (-1, -1), [colors.HexColor('#FFF8E1'), colors.HexColor('#FFF3CD'), colors.HexColor('#FCEBD5')]),
('GRID', (0, 0), (-1, -1), 0.5, GREY_MED),
('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
('FONTNAME', (0, 1), (0, -1), 'Helvetica-Bold'),
('FONTNAME', (1, 1), (1, -1), 'Helvetica-Bold'),
('TEXTCOLOR', (1, 1), (1, -1), ORANGE),
('ALIGN', (1, 0), (1, -1), 'CENTER'),
('TOPPADDING', (0, 0), (-1, -1), 5),
('BOTTOMPADDING', (0, 0), (-1, -1), 5),
('LEFTPADDING', (0, 0), (-1, -1), 6),
])
t = Table(mnem_data, colWidths=[W*0.2, W*0.1, W*0.2, W*0.2, W*0.3])
t.setStyle(mnem_ts)
story.append(t)
story.append(PageBreak())
# ══════════════════════════════════════════════════════════════
# PAGE 6: DISORDERS TABLE + MCQs
# ══════════════════════════════════════════════════════════════
story.append(ColorHeader('5. Common Endocrine Disorders', bg=RED))
story.append(Spacer(1, 0.3*cm))
dis_data = [
['Disorder', 'Gland', 'Imbalance', 'Key Features'],
['Hypothyroidism', 'Thyroid', 'Low T3/T4, High TSH', 'Fatigue, cold intolerance, weight GAIN, bradycardia, constipation, dry skin'],
['Hyperthyroidism\n(Graves\')', 'Thyroid', 'High T3/T4, Low TSH', 'Weight LOSS, heat intolerance, tachycardia, exophthalmos, tremor, sweating'],
['Cushing\'s Syndrome', 'Adrenal cortex', 'High Cortisol', 'Moon face, buffalo hump, central obesity, striae, hyperglycemia, hypertension'],
['Addison\'s Disease', 'Adrenal cortex', 'Low Cortisol + Aldosterone', 'Hypotension, hyperpigmentation (high ACTH/MSH), hypoglycemia, weakness'],
['Gigantism', 'Ant. Pituitary', 'High GH (before puberty)', 'Excess height, before epiphyseal plate closure'],
['Acromegaly', 'Ant. Pituitary', 'High GH (adult)', 'Coarse facial features, large hands/feet, prognathism'],
['Diabetes Insipidus\n(Central)', 'Post. Pituitary', 'Low ADH', 'Polyuria (dilute), polydipsia; treated with desmopressin'],
['Hyperparathyroidism', 'Parathyroid', 'High PTH', '"Bones, Stones, Groans, Moans" - high Ca2+, kidney stones, abdominal pain'],
['Hypoparathyroidism', 'Parathyroid', 'Low PTH', 'Low Ca2+: tetany, Chvostek\'s & Trousseau\'s signs, seizures'],
['Type 1 DM', 'Pancreas', 'No Insulin', 'Autoimmune beta-cell destruction, DKA, young patients'],
['Type 2 DM', 'Pancreas', 'Insulin resistance', 'Obesity, hyperglycemia, gradual onset, adults'],
['Pheochromocytoma', 'Adrenal medulla', 'High Epi + NE', 'Episodic hypertension, headache, palpitations, diaphoresis - "Rule of 10s"'],
['SIADH', 'Post. Pituitary', 'High ADH', 'Hyponatremia, euvolemic, concentrated urine'],
['Conn\'s Syndrome', 'Adrenal cortex', 'High Aldosterone', 'Hypertension, hypokalemia, alkalosis; LOW renin'],
]
dis_ts = TableStyle([
('BACKGROUND', (0, 0), (-1, 0), RED),
('TEXTCOLOR', (0, 0), (-1, 0), WHITE),
('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'),
('FONTSIZE', (0, 0), (-1, -1), 7.5),
('ROWBACKGROUNDS', (0, 1), (-1, -1), [WHITE, colors.HexColor('#FFF5F5')]),
('GRID', (0, 0), (-1, -1), 0.3, GREY_MED),
('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
('TOPPADDING', (0, 0), (-1, -1), 4),
('BOTTOMPADDING', (0, 0), (-1, -1), 4),
('LEFTPADDING', (0, 0), (-1, -1), 5),
('FONTNAME', (0, 1), (0, -1), 'Helvetica-Bold'),
('FONTNAME', (2, 1), (2, -1), 'Helvetica-Bold'),
('TEXTCOLOR', (2, 1), (2, -1), RED),
])
t = Table(dis_data, colWidths=[W*0.19, W*0.14, W*0.2, W*0.47], repeatRows=1)
t.setStyle(dis_ts)
story.append(t)
story.append(PageBreak())
# ══════════════════════════════════════════════════════════════
# PAGE 7: MCQs
# ══════════════════════════════════════════════════════════════
story.append(ColorHeader('6. Practice MCQs (Exam-Style)', bg=colors.HexColor('#1A237E')))
story.append(Spacer(1, 0.3*cm))
story.append(Paragraph(
'These 10 MCQs cover the most-tested concepts in 1st year MBBS endocrine exams.',
BODY))
story.append(Spacer(1, 0.2*cm))
mcqs = [
{
'q': 'Q1. Which hormone is derived from tyrosine but acts via an INTRACELLULAR receptor (like a steroid)?',
'opts': ['A) Epinephrine', 'B) Dopamine', 'C) Thyroid hormone (T3)', 'D) Norepinephrine'],
'ans': 'C) Thyroid hormone (T3)',
'exp': 'T3/T4 are amines (tyrosine derivatives) but act like steroids - they cross the cell membrane and bind intracellular receptors. Epinephrine and dopamine use cell-surface receptors.',
},
{
'q': 'Q2. The ONLY hormone that inhibits prolactin secretion from the anterior pituitary is:',
'opts': ['A) TRH', 'B) Somatostatin', 'C) Dopamine (PIF)', 'D) Oxytocin'],
'ans': 'C) Dopamine (PIF)',
'exp': 'Dopamine (= Prolactin-Inhibiting Factor) is the unique tonic inhibitor of prolactin. TRH stimulates prolactin. Dopamine agonists (bromocriptine) treat prolactinomas.',
},
{
'q': 'Q3. Posterior pituitary hormones (ADH and Oxytocin) are actually synthesized in:',
'opts': ['A) Posterior pituitary itself', 'B) Anterior pituitary', 'C) Hypothalamic nuclei', 'D) Pineal gland'],
'ans': 'C) Hypothalamic nuclei',
'exp': 'ADH is made in the supraoptic nucleus; Oxytocin in the paraventricular nucleus. They are transported down axons to the posterior pituitary, where they are stored and released.',
},
{
'q': 'Q4. A patient undergoes thyroid surgery and develops tetany post-operatively. Which structure was inadvertently removed?',
'opts': ['A) Thyroid C-cells', 'B) Parathyroid glands', 'C) Adrenal cortex', 'D) Thyroid follicular cells'],
'ans': 'B) Parathyroid glands',
'exp': 'Loss of PTH leads to hypocalcemia → tetany. Parathyroid glands are embedded in or near the thyroid and can be accidentally removed during thyroidectomy. Chvostek and Trousseau signs confirm hypocalcemia.',
},
{
'q': 'Q5. The adrenal cortex zone that secretes mineralocorticoids is:',
'opts': ['A) Zona Reticularis', 'B) Zona Fasciculata', 'C) Zona Glomerulosa', 'D) Adrenal Medulla'],
'ans': 'C) Zona Glomerulosa',
'exp': 'GFR mnemonic: Glomerulosa = Salt (Aldosterone), Fasciculata = Sugar (Cortisol), Reticularis = Sex (Androgens). The medulla is neural crest origin and makes catecholamines.',
},
{
'q': 'Q6. In the RAAS, Angiotensin-Converting Enzyme (ACE) is primarily located in the:',
'opts': ['A) Kidneys', 'B) Liver', 'C) Lungs', 'D) Adrenal gland'],
'ans': 'C) Lungs',
'exp': 'ACE converts Angiotensin I (inactive) to Angiotensin II (active) in the pulmonary endothelium. This is why ACE inhibitors can cause dry cough - they prevent bradykinin breakdown in the lungs.',
},
{
'q': 'Q7. Growth hormone promotes growth INDIRECTLY by stimulating production of:',
'opts': ['A) ACTH', 'B) IGF-1 (from liver)', 'C) TSH', 'D) Cortisol'],
'ans': 'B) IGF-1 (from liver)',
'exp': 'GH stimulates the liver to produce IGF-1 (Insulin-like Growth Factor-1), which mediates most of the growth-promoting effects. IGF-1 also provides negative feedback to inhibit GH release.',
},
{
'q': 'Q8. A patient presents with: hypertension, hypokalemia, and alkalosis. Renin level is LOW. Most likely diagnosis:',
'opts': ['A) Cushing syndrome', 'B) Pheochromocytoma', 'C) Primary hyperaldosteronism (Conn syndrome)', 'D) Renal artery stenosis'],
'ans': 'C) Primary hyperaldosteronism (Conn syndrome)',
'exp': 'High aldosterone from the zona glomerulosa causes Na+ retention (HTN) and K+ loss (hypokalemia) with alkalosis. Renin is LOW because high aldosterone provides negative feedback. Secondary hyperaldosteronism has HIGH renin.',
},
{
'q': 'Q9. Calcitonin, which lowers serum calcium, is secreted by which thyroid cell type?',
'opts': ['A) Follicular cells', 'B) Chief cells', 'C) Oxyphil cells', 'D) Parafollicular (C) cells'],
'ans': 'D) Parafollicular (C) cells',
'exp': 'Parafollicular C-cells (derived from neural crest) secrete calcitonin in response to high serum Ca2+. Follicular cells make T3/T4. Chief cells are in the parathyroid, secreting PTH.',
},
{
'q': 'Q10. POMC (Pro-opiomelanocortin) is a precursor molecule in the anterior pituitary. It gives rise to:',
'opts': ['A) TSH and GH', 'B) ACTH and MSH', 'C) FSH and LH', 'D) Prolactin and Oxytocin'],
'ans': 'B) ACTH and MSH',
'exp': 'POMC is cleaved to produce ACTH (by corticotrophs) and MSH. This explains why in Addison\'s disease (low cortisol → high ACTH → high POMC), MSH is also elevated, causing characteristic hyperpigmentation.',
},
]
for i, mcq in enumerate(mcqs):
story.append(Paragraph(mcq['q'], MCQ_Q))
for opt in mcq['opts']:
if opt == mcq['ans']:
story.append(Paragraph(u'\u2713 ' + opt + ' (CORRECT)', MCQ_CORRECT))
else:
story.append(Paragraph(opt, MCQ_A))
story.append(Paragraph(
'<font color="#1A3A5C"><b>Explanation:</b></font> ' + mcq['exp'],
make_style(f'Exp{i}', fontName='Helvetica', fontSize=8,
textColor=colors.HexColor('#2C3E50'),
backColor=BLUE_LT, leftIndent=10, rightIndent=10,
spaceBefore=2, spaceAfter=8, leading=12)
))
story.append(PageBreak())
# ══════════════════════════════════════════════════════════════
# PAGE 8: HIGH-YIELD FACTS + ANTERIOR PITUITARY MNEMONIC
# ══════════════════════════════════════════════════════════════
story.append(ColorHeader('7. High-Yield Viva Facts & Mnemonics', bg=GREEN))
story.append(Spacer(1, 0.3*cm))
# Anterior pituitary visual mnemonic
story.append(Paragraph('Anterior Pituitary Hormones - "FLAT PiG"', H2))
class FlatPigDiagram(Flowable):
def __init__(self, width=500, height=80):
super().__init__()
self._w = width
self._h = height
def wrap(self, aw, ah):
return self._w, self._h
def draw(self):
c = self.canv
letters = [
('F', 'FSH', 'Follicle-Stimulating\nHormone', TEAL),
('L', 'LH', 'Luteinizing\nHormone', colors.HexColor('#2E7D32')),
('A', 'ACTH', 'Adreno-\nCorticotropic', ORANGE),
('T', 'TSH', 'Thyroid-\nStimulating', colors.HexColor('#1565C0')),
('P', 'Prolactin', 'Milk\nProduction', colors.HexColor('#6A0DAD')),
('i', 'MSH', 'Melanocyte-\nStimulating', colors.HexColor('#795548')),
('G', 'GH', 'Growth\nHormone', RED),
]
bw = self._w / len(letters) - 4
for idx, (letter, abbr, full, col) in enumerate(letters):
x = idx * (bw + 4)
# Box
c.setFillColor(col)
c.setStrokeColor(WHITE)
c.roundRect(x, 30, bw, 45, 5, fill=1, stroke=1)
c.setFillColor(WHITE)
c.setFont('Helvetica-Bold', 18)
c.drawCentredString(x + bw / 2, 52, letter)
# Abbr below
c.setFillColor(col)
c.setFont('Helvetica-Bold', 7)
c.drawCentredString(x + bw / 2, 20, abbr)
c.setFont('Helvetica', 5.5)
lines = full.split('\n')
y_txt = 12
for line in reversed(lines):
c.drawCentredString(x + bw / 2, y_txt, line)
y_txt -= 8
flat_pig = FlatPigDiagram(width=W, height=80)
story.append(flat_pig)
story.append(Spacer(1, 0.4*cm))
# High-yield facts in 2 columns
story.append(Paragraph('Must-Know Facts', H2))
facts = [
('1', 'Master gland = Pituitary; "Master of the master" = Hypothalamus'),
('2', 'Posterior pituitary DOES NOT synthesize hormones - it only stores and releases ADH and Oxytocin (made in hypothalamus)'),
('3', 'Insulin is the ONLY hormone that lowers blood glucose'),
('4', 'T3 is the biologically active thyroid hormone; T4 is a prohormone converted to T3 peripherally (by deiodinases)'),
('5', 'Cortisol peaks in early morning (circadian rhythm) and is the primary stress hormone'),
('6', 'Aldosterone acts on principal cells of renal collecting duct: Na+ in, K+ out, H+ out'),
('7', 'GH acts mainly via IGF-1 produced by the liver'),
('8', 'Glucagon acts on the liver: glycogenolysis + gluconeogenesis = raises blood glucose'),
('9', 'POMC is precursor to ACTH and MSH - explains hyperpigmentation in Addison\'s disease (high ACTH + MSH)'),
('10', 'Diabetes Insipidus (central): low ADH → treated with desmopressin (ADH analog)'),
('11', 'Somatostatin is secreted from BOTH the hypothalamus (inhibits GH) AND pancreatic delta cells (inhibits insulin + glucagon)'),
('12', 'Calcitonin from parafollicular C-cells opposes PTH (PTH raises Ca2+; calcitonin lowers Ca2+)'),
('13', 'Conn syndrome = primary hyperaldosteronism with LOW renin (negative feedback on renin from high aldosterone)'),
('14', 'Chromaffin cells of adrenal medulla are derived from neural crest - they are modified postganglionic sympathetic neurons'),
('15', 'Pheochromocytoma - "Rule of 10s": 10% bilateral, 10% malignant, 10% extra-adrenal, 10% familial, 10% in children'),
]
fact_rows = []
for num, fact in facts:
fact_rows.append([
Paragraph(f'<b>{num}</b>', make_style(f'fn{num}', fontName='Helvetica-Bold', fontSize=9,
textColor=WHITE, alignment=TA_CENTER)),
Paragraph(fact, make_style(f'ft{num}', fontName='Helvetica', fontSize=8.5,
textColor=colors.HexColor('#1A3A5C'), leading=12))
])
facts_ts = TableStyle([
('BACKGROUND', (0, 0), (0, -1), GREEN),
('BACKGROUND', (1, 0), (1, -1), WHITE),
('ROWBACKGROUNDS', (1, 0), (1, -1), [WHITE, colors.HexColor('#F0FFF0')]),
('GRID', (0, 0), (-1, -1), 0.3, GREY_MED),
('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
('TOPPADDING', (0, 0), (-1, -1), 5),
('BOTTOMPADDING', (0, 0), (-1, -1), 5),
('LEFTPADDING', (0, 0), (-1, -1), 6),
('ALIGN', (0, 0), (0, -1), 'CENTER'),
])
t = Table(fact_rows, colWidths=[W*0.06, W*0.94])
t.setStyle(facts_ts)
story.append(t)
story.append(Spacer(1, 0.5*cm))
# Ca2+ regulation summary
story.append(ColorHeader('Ca2+ Regulation - PTH vs Calcitonin', bg=colors.HexColor('#00838F'), height=22, fontsize=11))
story.append(Spacer(1, 0.2*cm))
ca_data = [
['', 'PTH (Parathyroid hormone)', 'Calcitonin (Thyroid C-cells)', 'Vitamin D (Activated by PTH)'],
['Effect on Ca2+', 'INCREASES (raises blood Ca2+)', 'DECREASES (lowers blood Ca2+)', 'INCREASES absorption'],
['Trigger', 'Low serum Ca2+', 'High serum Ca2+', 'PTH stimulus, low Ca2+'],
['Bone', 'Stimulates osteoclasts (resorption)', 'Inhibits osteoclasts', 'Promotes mineralization'],
['Kidney', 'Ca2+ reabsorption up\nPhosphate reabsorption DOWN\nActivates Vit D', 'Increases Ca2+ excretion', 'Increases Ca2+/phosphate absorption in gut'],
['Gut', 'Indirect (via Vit D)', 'Minimal direct effect', 'Direct: increases Ca2+ + phosphate absorption'],
]
ca_ts = TableStyle([
('BACKGROUND', (0, 0), (-1, 0), colors.HexColor('#00838F')),
('TEXTCOLOR', (0, 0), (-1, 0), WHITE),
('FONTNAME', (0, 0), (-1, 0), 'Helvetica-Bold'),
('BACKGROUND', (1, 1), (1, -1), colors.HexColor('#FFF8E1')),
('BACKGROUND', (2, 1), (2, -1), colors.HexColor('#E8F5E9')),
('BACKGROUND', (3, 1), (3, -1), colors.HexColor('#E3F2FD')),
('BACKGROUND', (0, 1), (0, -1), GREY_LT),
('FONTNAME', (0, 1), (0, -1), 'Helvetica-Bold'),
('TEXTCOLOR', (0, 1), (0, -1), NAVY),
('FONTSIZE', (0, 0), (-1, -1), 7.5),
('GRID', (0, 0), (-1, -1), 0.4, GREY_MED),
('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
('TOPPADDING', (0, 0), (-1, -1), 4),
('BOTTOMPADDING', (0, 0), (-1, -1), 4),
('LEFTPADDING', (0, 0), (-1, -1), 5),
('TEXTCOLOR', (1, 1), (1, 1), RED),
('TEXTCOLOR', (2, 1), (2, 1), GREEN),
('FONTNAME', (1, 1), (1, 1), 'Helvetica-Bold'),
('FONTNAME', (2, 1), (2, 1), 'Helvetica-Bold'),
])
t = Table(ca_data, colWidths=[W*0.12, W*0.29, W*0.29, W*0.3], repeatRows=1)
t.setStyle(ca_ts)
story.append(t)
# Build with page templates
from reportlab.platypus import NextPageTemplate, Frame
from reportlab.platypus.doctemplate import PageTemplate
# Re-build with background
doc2 = SimpleDocTemplate(
OUTPUT, pagesize=A4,
leftMargin=1.5*cm, rightMargin=1.5*cm,
topMargin=1.8*cm, bottomMargin=1.5*cm
)
def first_page(canvas, doc):
cover_page_bg(canvas, doc)
def later_pages(canvas, doc):
content_page_bg(canvas, doc)
doc2.build(story, onFirstPage=first_page, onLaterPages=later_pages)
print(f"PDF created: {OUTPUT}")
build_pdf()
cd /home/daytona/workspace/endocrine-pdf && python generate_pdf.py 2>&1
~/endocrine-pdf/generate_pdf.py
Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/endocrine-pdf/generate_pdf.py'
cd /home/daytona/workspace/endocrine-pdf && python generate_pdf.py 2>&1
~/endocrine-pdf/generate_pdf.py
Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/endocrine-pdf/generate_pdf.py'
~/endocrine-pdf/generate_pdf.py
Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/endocrine-pdf/generate_pdf.py'
cd /home/daytona/workspace/endocrine-pdf && python generate_pdf.py 2>&1
ls -lh /home/daytona/workspace/endocrine-pdf/Endocrine_System_MBBS.pdf
Endocrine System MBBS
PDF Document · PDF
| Page | Content |
|---|---|
| 1 | Cover page with topic index |
| 2 | Hormone classification table + key abbreviations (ACTH, ADH, TRH, etc.) |
| 3 | Visual axis diagrams - HPT, HPA, HPG axes side-by-side with negative feedback arrows; RAAS and GH/IGF-1 axes |
| 4 | Master hormone table - all glands color-coded (hypothalamus through pancreas) |
| 5 | Adrenal cortex cross-section diagram + Islets of Langerhans diagram + GFR mnemonic table |
| 6 | Clinical disorders table (15 conditions with key features) |
| 7 | 10 exam-style MCQs with answers + explanations |
| 8 | FLAT PiG mnemonic diagram + 15 high-yield viva facts + Ca2+ regulation comparison table (PTH vs Calcitonin vs Vit D) |