~/physiology-study-guide/build_guide.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, PageBreak, KeepTogether
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus.flowables import HRFlowable
OUTPUT = "/home/daytona/workspace/physiology-study-guide/Physiology_Study_Guide.pdf"
# ── Colour palette ──────────────────────────────────────────────────────────
DARK_BLUE = colors.HexColor("#1A3A5C")
MID_BLUE = colors.HexColor("#2E6DA4")
LIGHT_BLUE = colors.HexColor("#D6E8F7")
ACCENT = colors.HexColor("#E8A020")
GREEN = colors.HexColor("#2A7A3B")
LIGHT_GREEN = colors.HexColor("#D5EDD9")
RED = colors.HexColor("#C0392B")
LIGHT_RED = colors.HexColor("#FDECEA")
PURPLE = colors.HexColor("#6C3483")
LIGHT_PURPLE= colors.HexColor("#EDE5F5")
ORANGE = colors.HexColor("#D35400")
LIGHT_ORANGE= colors.HexColor("#FDEBD0")
LIGHT_GREY = colors.HexColor("#F4F6F8")
MID_GREY = colors.HexColor("#BDC3C7")
DARK_GREY = colors.HexColor("#2C3E50")
WHITE = colors.white
# ── Styles ───────────────────────────────────────────────────────────────────
styles = getSampleStyleSheet()
def make_style(name, parent="Normal", **kw):
return ParagraphStyle(name, parent=styles[parent], **kw)
# Title / cover
S_COVER_TITLE = make_style("CoverTitle",
fontSize=30, textColor=WHITE, fontName="Helvetica-Bold",
alignment=TA_CENTER, spaceAfter=8)
S_COVER_SUB = make_style("CoverSub",
fontSize=14, textColor=colors.HexColor("#D0E8FF"),
alignment=TA_CENTER, spaceAfter=4)
S_COVER_NOTE = make_style("CoverNote",
fontSize=10, textColor=colors.HexColor("#A0C8F0"),
alignment=TA_CENTER)
# Chapter heading
S_CH = make_style("ChHead",
fontSize=17, textColor=WHITE, fontName="Helvetica-Bold",
alignment=TA_LEFT, spaceAfter=4, spaceBefore=2)
# Section heading
S_SEC = make_style("SecHead",
fontSize=12, textColor=DARK_BLUE, fontName="Helvetica-Bold",
spaceAfter=4, spaceBefore=10, leftIndent=0)
# Sub-section
S_SUB = make_style("SubHead",
fontSize=10.5, textColor=MID_BLUE, fontName="Helvetica-Bold",
spaceAfter=3, spaceBefore=6, leftIndent=6)
# Body
S_BODY = make_style("Body",
fontSize=9.5, leading=14, textColor=DARK_GREY,
spaceAfter=4, leftIndent=6, alignment=TA_JUSTIFY)
# Bullet
S_BULLET = make_style("Bullet",
fontSize=9, leading=13, textColor=DARK_GREY,
spaceAfter=2, leftIndent=14, bulletIndent=6)
# Key fact box text
S_KEY = make_style("Key",
fontSize=9, leading=13, textColor=DARK_GREY,
spaceAfter=2, leftIndent=8)
# Table header
S_TH = make_style("TH",
fontSize=9, fontName="Helvetica-Bold", textColor=WHITE,
alignment=TA_CENTER, leading=12)
# Table cell
S_TC = make_style("TC",
fontSize=8.5, textColor=DARK_GREY, leading=12, alignment=TA_LEFT)
S_TC_C = make_style("TCC",
fontSize=8.5, textColor=DARK_GREY, leading=12, alignment=TA_CENTER)
# Answer key
S_ANS = make_style("Ans",
fontSize=9, leading=12, textColor=DARK_GREY, leftIndent=4)
S_CORRECT = make_style("Correct",
fontSize=9, fontName="Helvetica-Bold", textColor=GREEN, leading=12)
# ── Helper flowables ─────────────────────────────────────────────────────────
def chapter_header(title, color=DARK_BLUE):
tbl = Table([[Paragraph(title, S_CH)]], colWidths=[17*cm])
tbl.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), color),
("TOPPADDING", (0,0), (-1,-1), 10),
("BOTTOMPADDING",(0,0), (-1,-1), 10),
("LEFTPADDING", (0,0), (-1,-1), 14),
("RIGHTPADDING", (0,0), (-1,-1), 8),
("ROUNDEDCORNERS", [6]),
]))
return tbl
def section(title):
return Paragraph(title, S_SEC)
def sub(title):
return Paragraph(title, S_SUB)
def body(text):
return Paragraph(text, S_BODY)
def bullet(text):
return Paragraph(f"• {text}", S_BULLET)
def spacer(h=0.3):
return Spacer(1, h*cm)
def hr(color=MID_GREY):
return HRFlowable(width="100%", thickness=0.5, color=color, spaceAfter=4, spaceBefore=4)
def key_box(title, items, bg=LIGHT_BLUE, border=MID_BLUE):
"""A coloured info box with a title and bullet items."""
content = f"<b>{title}</b><br/>" + "<br/>".join(f"• {i}" for i in items)
tbl = Table([[Paragraph(content, S_KEY)]], colWidths=[16.5*cm])
tbl.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), bg),
("BOX", (0,0), (-1,-1), 1, border),
("TOPPADDING", (0,0), (-1,-1), 7),
("BOTTOMPADDING",(0,0), (-1,-1), 7),
("LEFTPADDING", (0,0), (-1,-1), 10),
("RIGHTPADDING", (0,0), (-1,-1), 8),
]))
return tbl
def two_col_table(headers, rows, col_widths=None, hdr_color=DARK_BLUE):
if col_widths is None:
col_widths = [6*cm, 10.5*cm]
data = [[Paragraph(h, S_TH) for h in headers]]
for r in rows:
data.append([Paragraph(str(c), S_TC) for c in r])
tbl = Table(data, colWidths=col_widths, repeatRows=1)
n = len(data)
style = [
("BACKGROUND", (0,0), (-1,0), hdr_color),
("ROWBACKGROUNDS",(0,1),(-1,-1),[WHITE, LIGHT_GREY]),
("BOX", (0,0), (-1,-1), 0.5, MID_GREY),
("INNERGRID", (0,0), (-1,-1), 0.3, MID_GREY),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING",(0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 6),
("RIGHTPADDING", (0,0), (-1,-1), 6),
("VALIGN", (0,0), (-1,-1), "TOP"),
]
tbl.setStyle(TableStyle(style))
return tbl
def mcq_answer_table(questions):
"""questions = list of (num, question_text, answer, explanation)"""
data = [[
Paragraph("Q", S_TH),
Paragraph("Question", S_TH),
Paragraph("Answer", S_TH),
]]
for num, q, ans, exp in questions:
data.append([
Paragraph(str(num), S_TC_C),
Paragraph(q, S_TC),
Paragraph(f"<b><font color='#2A7A3B'>{ans}</font></b><br/><font size='8' color='#555555'>{exp}</font>", S_TC),
])
tbl = Table(data, colWidths=[1*cm, 7.5*cm, 8*cm], repeatRows=1)
tbl.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), DARK_BLUE),
("ROWBACKGROUNDS",(0,1),(-1,-1),[WHITE, LIGHT_GREY]),
("BOX", (0,0), (-1,-1), 0.5, MID_GREY),
("INNERGRID", (0,0), (-1,-1), 0.3, MID_GREY),
("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"),
]))
return tbl
# ── Cover page ───────────────────────────────────────────────────────────────
def cover_page(story):
# Big coloured block
cover_data = [[
Paragraph("PHYSIOLOGY", S_COVER_TITLE),
],[
Paragraph("Comprehensive Study Guide", S_COVER_SUB),
],[
Paragraph("KMTC · Physiology I & II", S_COVER_NOTE),
],[
Paragraph("Endocrine · Respiratory · Digestive · Reproductive · Special Senses", S_COVER_NOTE),
]]
cover_tbl = Table(cover_data, colWidths=[17*cm])
cover_tbl.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), DARK_BLUE),
("TOPPADDING", (0,0), (-1,-1), 22),
("BOTTOMPADDING",(0,0), (-1,-1), 22),
("LEFTPADDING", (0,0), (-1,-1), 20),
("RIGHTPADDING", (0,0), (-1,-1), 20),
("ROUNDEDCORNERS",[8]),
]))
story += [
spacer(2),
cover_tbl,
spacer(1),
Paragraph("Based on KMTC/QP-08/EPS examination questions", make_style("coverfooter",
fontSize=9, textColor=MID_GREY, alignment=TA_CENTER)),
spacer(0.3),
Paragraph("Topics: Hormones · Respiration · Digestion · Reproduction · Senses · Acid-Base",
make_style("coverfooter2", fontSize=9, textColor=MID_GREY, alignment=TA_CENTER)),
PageBreak(),
]
# ── TABLE OF CONTENTS ────────────────────────────────────────────────────────
def toc_page(story):
story.append(chapter_header("TABLE OF CONTENTS", DARK_BLUE))
story.append(spacer(0.4))
toc_items = [
("1", "Endocrine System", "Hormones, Glands, Regulation"),
("2", "Respiratory System", "Ventilation, Gas Exchange, Control"),
("3", "Digestive System", "GI Tract, Enzymes, Secretions"),
("4", "Renal & Fluid Balance", "Kidneys, ADH, RAAS, Electrolytes"),
("5", "Reproductive System", "Male & Female Physiology"),
("6", "Special Sense Organs", "Eye, Ear, Nose"),
("7", "Autonomic Nervous System", "Sympathetic vs Parasympathetic"),
("8", "Acid-Base Balance", "Disorders & Compensation"),
("9", "MCQ Answer Keys", "KMTC & Physiology II"),
("10","Short & Long Answer Summaries","Clinical Scenarios"),
]
data = [[Paragraph("Ch", S_TH), Paragraph("Chapter", S_TH), Paragraph("Key Topics", S_TH)]]
for ch, title, topics in toc_items:
data.append([Paragraph(ch, S_TC_C), Paragraph(f"<b>{title}</b>", S_TC), Paragraph(topics, S_TC)])
tbl = Table(data, colWidths=[1.5*cm, 7*cm, 8.5*cm], repeatRows=1)
tbl.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), MID_BLUE),
("ROWBACKGROUNDS",(0,1),(-1,-1),[WHITE, LIGHT_BLUE]),
("BOX", (0,0), (-1,-1), 0.5, MID_GREY),
("INNERGRID", (0,0), (-1,-1), 0.3, MID_GREY),
("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), "TOP"),
]))
story.append(tbl)
story.append(PageBreak())
# ══════════════════════════════════════════════════════════════════════════════
# CHAPTER 1 — ENDOCRINE SYSTEM
# ══════════════════════════════════════════════════════════════════════════════
def ch_endocrine(story):
story.append(chapter_header("Chapter 1: Endocrine System", MID_BLUE))
story.append(spacer(0.3))
story.append(section("1.1 Overview of Hormones"))
story.append(body(
"Hormones are chemical messengers secreted by endocrine glands directly into the bloodstream "
"to act on distant target organs. They are classified by chemical structure and mechanism of action."
))
story.append(two_col_table(
["Hormone Class", "Characteristics / Examples"],
[
["Peptide / Protein", "Water-soluble; synthesised in rough ER; act on surface receptors; use second messengers (cAMP). E.g. Insulin, GH, FSH, LH, ADH, PTH"],
["Steroid", "Lipid-soluble; derived from cholesterol; diffuse into cell; act on nuclear receptors. E.g. Cortisol, Aldosterone, Estrogen, Testosterone"],
["Amine", "Derived from tyrosine or tryptophan. E.g. Thyroxine (T4), Adrenaline, Melatonin"],
]
))
story.append(spacer(0.3))
story.append(section("1.2 Key Glands and Their Hormones"))
gland_data = [
["Hypothalamus", "GHRH, TRH, CRH, GnRH, Dopamine, Somatostatin", "Releasing/inhibiting hormones for anterior pituitary"],
["Anterior Pituitary", "GH, TSH, ACTH, FSH, LH, Prolactin", "Master gland of the endocrine system"],
["Posterior Pituitary", "ADH (Vasopressin), Oxytocin", "Stored and released (made in hypothalamus)"],
["Pineal Gland", "Melatonin", "Circadian rhythm regulation; secreted in darkness"],
["Thyroid Gland", "T3, T4 (follicular cells); Calcitonin (C cells)", "Metabolism; calcium regulation"],
["Parathyroid", "PTH", "Raises blood calcium; activates osteoclasts; stimulates renal calcitriol production"],
["Adrenal Cortex", "Cortisol (zona fasciculata); Aldosterone (zona glomerulosa); Androgens (zona reticularis)", "Stress response; fluid/electrolyte balance"],
["Adrenal Medulla", "Adrenaline (80%), Noradrenaline (20%)", "Acute fight-or-flight response"],
["Pancreas", "Insulin (beta cells); Glucagon (alpha cells); Somatostatin (delta cells)", "Blood glucose regulation"],
["Testes", "Testosterone (Leydig cells)", "Stimulated by LH"],
["Ovaries", "Estrogen (follicles), Progesterone (corpus luteum)", "Stimulated by FSH/LH"],
["Kidneys", "Erythropoietin (EPO), Renin, Calcitriol (active Vit D)", "RBC production; BP regulation"],
["Thymus", "Thymosin, Thymulin, Thymopoietin", "T-lymphocyte maturation"],
["Heart (Atria)", "ANP (Atrial Natriuretic Peptide)", "Promotes natriuresis; lowers BP"],
]
data = [[Paragraph(h, S_TH) for h in ["Gland", "Hormone(s)", "Key Function"]]]
for r in gland_data:
data.append([Paragraph(c, S_TC) for c in r])
tbl = Table(data, colWidths=[4*cm, 6*cm, 6.5*cm], repeatRows=1)
tbl.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), DARK_BLUE),
("ROWBACKGROUNDS",(0,1),(-1,-1),[WHITE, LIGHT_GREY]),
("BOX", (0,0), (-1,-1), 0.5, MID_GREY),
("INNERGRID", (0,0), (-1,-1), 0.3, MID_GREY),
("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(tbl)
story.append(spacer(0.4))
story.append(section("1.3 Hormonal Interaction Types"))
story.append(two_col_table(
["Type", "Definition & Example"],
[
["Permissive", "One hormone enables full effect of another. Cortisol permits adrenaline to cause vasoconstriction."],
["Synergistic", "Two hormones together produce greater effect than either alone. FSH + LH promote spermatogenesis."],
["Antagonistic", "One hormone opposes another. Insulin lowers glucose; glucagon raises it."],
["Agonistic", "A substance mimics a hormone's normal effect."],
]
))
story.append(spacer(0.3))
story.append(section("1.4 Key Endocrine Disorders"))
disorders = [
["Diabetes Mellitus (Type 1)", "Autoimmune destruction of beta cells → absent insulin → hyperglycemia → polyuria, polydipsia, polyphagia, ketonuria"],
["Diabetes Mellitus (Type 2)", "Insulin resistance + relative deficiency; not insulin-dependent initially; managed by lifestyle + oral agents"],
["Diabetes Insipidus", "ADH deficiency → massive dilute polyuria + polydipsia; NO polyphagia"],
["Cushing's Syndrome", "Cortisol excess (exogenous steroids, pituitary adenoma) → central obesity, moon face, striae, hypertension, hyperglycemia, osteoporosis"],
["Addison's Disease", "Primary adrenal insufficiency; cortisol + aldosterone deficiency → hypotension, hyponatremia, hyperkalemia, hypoglycemia. Tx: Hydrocortisone"],
["Hashimoto's Thyroiditis", "Autoimmune destruction of thyroid → hypothyroidism (cold intolerance, fatigue, weight gain, bradycardia)"],
["Hyperthyroidism (Graves')", "Autoantibodies stimulate TSH receptor → heat intolerance, weight loss, tachycardia, exophthalmos"],
["Hyperparathyroidism", "Excess PTH → hypercalcemia → 'bones, stones, abdominal groans, psychic moans'; pathological fractures"],
["Gigantism", "GH hypersecretion BEFORE epiphyseal closure (children) → excessive height"],
["Acromegaly", "GH hypersecretion AFTER epiphyseal closure (adults) → enlarged hands, feet, jaw"],
]
data = [[Paragraph(h, S_TH) for h in ["Disorder", "Key Features & Notes"]]]
for r in disorders:
data.append([Paragraph(r[0], S_TC), Paragraph(r[1], S_TC)])
tbl = Table(data, colWidths=[5.5*cm, 11*cm], repeatRows=1)
tbl.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), RED),
("ROWBACKGROUNDS",(0,1),(-1,-1),[WHITE, LIGHT_RED]),
("BOX", (0,0), (-1,-1), 0.5, MID_GREY),
("INNERGRID", (0,0), (-1,-1), 0.3, MID_GREY),
("TOPPADDING", (0,0), (-1,-1), 4),("BOTTOMPADDING",(0,0),(-1,-1),4),
("LEFTPADDING", (0,0), (-1,-1), 6),("RIGHTPADDING", (0,0),(-1,-1),6),
("VALIGN", (0,0), (-1,-1), "TOP"),
]))
story.append(tbl)
story.append(spacer(0.3))
story.append(key_box("EXAM MEMORABLES - Endocrine", [
"Pineal = Melatonin (sleep/circadian rhythm)",
"Calcitonin = C cells of thyroid (lowers Ca2+); PTH = parathyroid (raises Ca2+)",
"Cortisol = zona fasciculata; Aldosterone = zona glomerulosa; Medulla = Adrenaline",
"LH → testosterone from Leydig cells; FSH → spermatogenesis (Sertoli cells)",
"EPO from kidneys; Thymosin from thymus (T-cell maturation)",
"ANP from atria → promotes Na+ excretion (lowers BP)",
"Permissive = one hormone needed for another to work fully",
"Polydipsia + Polyuria + Polyphagia = Diabetes MELLITUS (not insipidus)",
], LIGHT_BLUE, MID_BLUE))
story.append(PageBreak())
# ══════════════════════════════════════════════════════════════════════════════
# CHAPTER 2 — RESPIRATORY SYSTEM
# ══════════════════════════════════════════════════════════════════════════════
def ch_respiratory(story):
story.append(chapter_header("Chapter 2: Respiratory System", GREEN))
story.append(spacer(0.3))
story.append(section("2.1 Structural Overview"))
story.append(body(
"The respiratory tract is divided into the conducting zone (nose → terminal bronchioles; warms, "
"filters, humidifies air) and the respiratory zone (respiratory bronchioles → alveoli; actual gas exchange)."
))
story.append(two_col_table(
["Structure", "Key Feature"],
[
["Nose/Mouth", "Entry of air; filtering by hairs; warming by turbinates"],
["Pharynx", "Common passage; nasopharynx, oropharynx, laryngopharynx"],
["Larynx", "Houses vocal cords; epiglottis prevents aspiration during swallowing"],
["Trachea", "~12 cm long; 16-20 C-shaped cartilage rings; lined by pseudostratified ciliated columnar epithelium; bifurcates at carina (T4/T5) into primary bronchi"],
["Bronchi (Primary)", "Two main bronchi enter lungs; right is wider and more vertical"],
["Bronchioles", "No cartilage; smooth muscle; bronchoconstriction increases airway resistance"],
["Alveoli", "~300 million per lung; site of gas exchange; Type I = gas exchange; Type II = surfactant secretion"],
["Pleural cavity", "Visceral + parietal pleura; ~5-15 ml pleural fluid reduces friction; negative intrapleural pressure keeps lungs expanded"],
],
col_widths=[4*cm, 12.5*cm]
))
story.append(spacer(0.3))
story.append(section("2.2 Mechanism of Ventilation"))
story.append(sub("Inspiration (Active Process)"))
for b in [
"Diaphragm contracts → flattens and moves downward",
"External intercostal muscles contract → ribs move up and out",
"Thoracic volume increases → intrapulmonary pressure falls below atmospheric (-1 to -3 mmHg)",
"Air flows into lungs along pressure gradient",
]:
story.append(bullet(b))
story.append(sub("Expiration (Passive at rest)"))
for b in [
"Diaphragm and external intercostals relax",
"Elastic recoil of lungs reduces thoracic volume",
"Intrapulmonary pressure rises above atmospheric",
"Air flows out of lungs",
]:
story.append(bullet(b))
story.append(key_box("Pressure Rule", [
"Inspiration ends when alveolar pressure = atmospheric pressure (0 mmHg gauge)",
"Intrapleural pressure is always negative (about -5 mmHg at rest) — this prevents lung collapse",
], LIGHT_GREEN, GREEN))
story.append(spacer(0.3))
story.append(section("2.3 Gas Exchange"))
story.append(body("Gas exchange occurs by simple diffusion across the respiratory membrane (alveolar epithelium + basement membrane + capillary endothelium; ~0.5 µm thick). Governed by Fick's Law."))
story.append(two_col_table(
["Gas", "Partial Pressures & Direction"],
[
["Oxygen (O2)", "Alveolar PO2 ≈ 100 mmHg → Venous blood PO2 ≈ 40 mmHg → O2 diffuses INTO blood"],
["Carbon Dioxide (CO2)", "Venous blood PCO2 ≈ 45 mmHg → Alveolar PCO2 ≈ 40 mmHg → CO2 diffuses OUT of blood"],
]
))
story.append(spacer(0.2))
story.append(section("2.4 Gas Transport in Blood"))
story.append(two_col_table(
["Gas", "Transport Mechanism"],
[
["Oxygen", "97% as oxyhaemoglobin (bound to Hb); 3% dissolved in plasma"],
["Carbon Dioxide", "70% as bicarbonate (HCO3-) via carbonic anhydrase; 23% as carbaminohaemoglobin; 7% dissolved"],
]
))
story.append(spacer(0.3))
story.append(section("2.5 Surfactant & Lung Compliance"))
for b in [
"Produced by Type II pneumocytes (alveolar cells)",
"Main component: dipalmitoylphosphatidylcholine (DPPC)",
"REDUCES surface tension inside alveoli → prevents alveolar collapse",
"INCREASES lung compliance (ease of inflation)",
"Absent in premature infants → Neonatal Respiratory Distress Syndrome (RDS)",
"Type I cells: thin, flat, cover 95% of alveolar surface; gas exchange; contribute to compliance by elasticity",
]:
story.append(bullet(b))
story.append(spacer(0.3))
story.append(section("2.6 Mucociliary Clearance"))
story.append(body(
"The trachea is lined by pseudostratified ciliated columnar epithelium. "
"Goblet cells secrete mucus that traps inhaled particles and pathogens. "
"Cilia beat in coordinated waves, moving the mucus escalator upward "
"toward the pharynx (mucociliary escalator). Smoking, cold air, and cystic fibrosis impair this mechanism."
))
story.append(spacer(0.3))
story.append(section("2.7 Control of Respiration"))
story.append(two_col_table(
["Centre / Receptor", "Role"],
[
["Dorsal Respiratory Group (medulla)", "Sets basic inspiratory rhythm; fires cyclically"],
["Ventral Respiratory Group (medulla)", "Active during forced expiration; recruits accessory muscles"],
["Pneumotaxic Centre (pons)", "Limits duration of inspiration; regulates respiratory rate"],
["Peripheral chemoreceptors (carotid + aortic bodies)", "Detect: decreased PO2, increased PCO2, decreased pH → increase ventilation"],
["Central chemoreceptors (medulla)", "Detect: increased PCO2 / decreased CSF pH → primary drive to breathe in normal conditions"],
]
))
story.append(spacer(0.3))
story.append(key_box("EXAM MEMORABLES - Respiratory", [
"Diaphragm CONTRACTS and moves DOWN during inspiration",
"Trachea = ~12 cm; bifurcates into PRIMARY BRONCHI (not bronchioles)",
"Epiglottis prevents food entering respiratory tract during swallowing",
"Surfactant = Type II cells → reduces surface tension → increases compliance",
"Type I cells = gas exchange; thin and flat (95% of alveolar surface)",
"Blood flowing TO lungs (pulmonary artery) = LOW O2, HIGH CO2",
"External respiration = lungs ↔ blood; Internal respiration = blood ↔ tissues",
"Pleural fluid HOLDS lungs against thoracic wall (surface tension coupling)",
"Pseudostratified ciliated columnar epithelium lines trachea → mucociliary escalator",
"Bronchoconstriction (smooth muscle contraction) DECREASES airway diameter",
], LIGHT_GREEN, GREEN))
story.append(PageBreak())
# ══════════════════════════════════════════════════════════════════════════════
# CHAPTER 3 — DIGESTIVE SYSTEM
# ══════════════════════════════════════════════════════════════════════════════
def ch_digestive(story):
story.append(chapter_header("Chapter 3: Digestive System", PURPLE))
story.append(spacer(0.3))
story.append(section("3.1 GI Tract Layers"))
story.append(two_col_table(
["Layer", "Role"],
[
["Mucosa", "Innermost layer; absorption and secretion; contains glands and immune cells"],
["Submucosa", "Connective tissue; contains Meissner's (submucosal) plexus; blood and lymph vessels"],
["Muscularis (Muscularis externa)", "Inner circular + outer longitudinal smooth muscle; produces PERISTALSIS; contains Auerbach's (myenteric) plexus"],
["Serosa / Adventitia", "Outermost protective layer; visceral peritoneum"],
]
))
story.append(spacer(0.3))
story.append(section("3.2 Digestive Enzymes"))
story.append(two_col_table(
["Enzyme", "Source / Location / Substrate"],
[
["Salivary Amylase", "Parotid glands; begins carbohydrate (starch) digestion in MOUTH"],
["Pepsin", "Stomach (chief cells secrete pepsinogen → activated by HCl); digests PROTEINS → peptides"],
["Gastric Lipase", "Stomach; minor fat digestion"],
["Pancreatic Amylase", "Pancreas → duodenum; continues starch → maltose digestion"],
["Pancreatic Lipase", "Pancreas → duodenum; digests triglycerides → fatty acids + glycerol"],
["Trypsin / Chymotrypsin", "Pancreas (as inactive zymogens); activated in duodenum; digests PROTEINS"],
["Maltase / Sucrase / Lactase", "Brush border of small intestine; break disaccharides → monosaccharides"],
["Bile (not an enzyme)", "Liver (stored in gallbladder); emulsifies fats; no enzymatic action"],
]
))
story.append(spacer(0.3))
story.append(section("3.3 Where Digestion Begins"))
story.append(two_col_table(
["Macronutrient", "Where Digestion Begins"],
[
["Carbohydrates", "MOUTH (salivary amylase)"],
["Proteins", "STOMACH (pepsin)"],
["Fats", "DUODENUM / small intestine (pancreatic lipase + bile)"],
]
))
story.append(spacer(0.3))
story.append(section("3.4 Gastrointestinal Hormones"))
story.append(two_col_table(
["Hormone", "Source / Stimulus / Action"],
[
["Gastrin", "G cells of gastric antrum; released by protein/distension/vagal stimulation; STIMULATES HCl and pepsinogen secretion"],
["Secretin", "S cells of duodenum; released by acidic chyme; INHIBITS gastric acid; stimulates bicarbonate secretion from pancreas"],
["CCK (Cholecystokinin)", "I cells of duodenum; released by fats/protein; stimulates pancreatic enzyme release + gallbladder contraction"],
["GIP (Gastric Inhibitory Peptide)", "K cells of duodenum; inhibits gastric motility and acid secretion when fat/glucose enter duodenum"],
["Ghrelin", "Stomach fundus; 'hunger hormone'; stimulates appetite"],
]
))
story.append(spacer(0.3))
story.append(section("3.5 Accessory Digestive Organs"))
for b in [
"LIVER: produces bile (emulsifies fats), metabolises nutrients, detoxification, produces clotting factors",
"GALLBLADDER: stores and concentrates bile; releases bile into duodenum when CCK is secreted",
"PANCREAS (exocrine): secretes bicarbonate (neutralises acid chyme) + all digestive enzymes",
"SALIVARY GLANDS: secrete amylase and mucus; parotid, submandibular, sublingual",
"Note: Teeth, tongue, pancreas = accessory organs; duodenum/esophagus are PART of the GI tract",
]:
story.append(bullet(b))
story.append(spacer(0.3))
story.append(section("3.6 Intestinal Secretions & Motility"))
story.append(two_col_table(
["Parameter", "Value / Description"],
[
["Total GI secretions/day", "~7-8 litres (mostly reabsorbed in small intestine)"],
["Intestinal secretions", "~1500 ml/day"],
["Peristalsis", "Produced by muscularis layer (circular + longitudinal smooth muscle)"],
["Sympathetic effect on GI", "REDUCES motility, secretion, blood flow (fight-or-flight)"],
["Parasympathetic effect on GI", "INCREASES motility, secretion (rest-and-digest)"],
["Opioid effect on GI", "REDUCES peristalsis via mu-receptors → constipation"],
]
))
story.append(spacer(0.3))
story.append(key_box("EXAM MEMORABLES - Digestive", [
"Pepsin digests proteins in the STOMACH",
"Gastrin STIMULATES gastric acid; Secretin INHIBITS gastric acid",
"Which hormone stimulates gastric juice? GASTRIN",
"Muscularis layer = peristalsis (NOT mucosa or submucosa)",
"Protein digestion begins in the STOMACH",
"Accessory organs = liver, gallbladder, pancreas, salivary glands",
"Total intestinal secretions ≈ 1500 ml/day",
"Opioids cause constipation by reducing parasympathetic/enteric nervous system activity",
"Bloating on oral feeds after prolonged fasting = atonic gut + reduced enzyme secretion",
], LIGHT_PURPLE, PURPLE))
story.append(PageBreak())
# ══════════════════════════════════════════════════════════════════════════════
# CHAPTER 4 — RENAL & FLUID BALANCE
# ══════════════════════════════════════════════════════════════════════════════
def ch_renal(story):
story.append(chapter_header("Chapter 4: Renal System & Fluid Balance", ORANGE))
story.append(spacer(0.3))
story.append(section("4.1 Kidney Functions"))
for b in [
"Filtration of blood → urine production",
"Regulation of water and electrolyte balance (Na+, K+, Ca2+, H+)",
"Acid-base regulation (H+ excretion / HCO3- reabsorption)",
"Hormone secretion: Renin, EPO, Calcitriol (active Vit D)",
"Blood pressure regulation via RAAS",
]:
story.append(bullet(b))
story.append(spacer(0.3))
story.append(section("4.2 RAAS (Renin-Angiotensin-Aldosterone System)"))
story.append(body("Activated by: low renal perfusion, low Na+, sympathetic stimulation."))
raas_steps = [
"Juxtaglomerular cells release RENIN",
"Renin cleaves angiotensinogen → Angiotensin I",
"ACE (in lungs) converts Angiotensin I → Angiotensin II",
"Angiotensin II: (a) vasoconstriction (raises BP), (b) stimulates aldosterone release, (c) stimulates ADH, (d) stimulates thirst",
"ALDOSTERONE (zona glomerulosa) → Na+ reabsorption + K+ excretion in collecting duct",
"Net effect: increased blood volume, increased BP, reduced urine output",
]
for i, s in enumerate(raas_steps, 1):
story.append(Paragraph(f"{i}. {s}", S_BULLET))
story.append(spacer(0.3))
story.append(section("4.3 ADH (Antidiuretic Hormone / Vasopressin)"))
story.append(two_col_table(
["Feature", "Detail"],
[
["Made by", "Hypothalamus (supraoptic nucleus)"],
["Stored/Released by", "Posterior pituitary"],
["Stimulus", "Increased plasma osmolarity; decreased blood volume"],
["Action", "Inserts aquaporin-2 channels in collecting duct → water reabsorption → concentrated urine"],
["Deficiency", "Diabetes Insipidus → massive dilute polyuria"],
]
))
story.append(spacer(0.3))
story.append(section("4.4 Electrolyte Regulation"))
story.append(two_col_table(
["Electrolyte", "Regulation"],
[
["Sodium (Na+)", "Aldosterone increases reabsorption in collecting duct. ANP promotes excretion. Normal: 135-145 mEq/L"],
["Potassium (K+)", "Aldosterone causes K+ SECRETION in exchange for Na+ reabsorption. Hyperkalemia directly stimulates aldosterone. Normal: 3.5-5.0 mEq/L"],
["Calcium (Ca2+)", "PTH raises Ca2+ (bone resorption + renal reabsorption). Calcitonin lowers Ca2+. Vitamin D increases intestinal absorption."],
]
))
story.append(spacer(0.3))
story.append(section("4.5 Response to Haemorrhage / Blood Loss"))
for b in [
"IMMEDIATE: baroreceptors detect low BP → sympathetic activation → tachycardia, vasoconstriction",
"Adrenal medulla: adrenaline + noradrenaline → cardiac output and vasoconstriction",
"Posterior pituitary: ADH release → water reabsorption → reduced urine output (oliguria)",
"RAAS: renin → angiotensin II → aldosterone → Na+/water retention",
"Adrenal cortex: cortisol → gluconeogenesis → maintained glucose supply",
"Net: expanded blood volume, restored blood pressure, reduced urine output",
"Prerenal AKI: if blood loss is severe, GFR falls critically → oliguria/anuria",
]:
story.append(bullet(b))
story.append(spacer(0.3))
story.append(section("4.6 Acid-Base Disorders"))
story.append(two_col_table(
["Disorder", "Cause / Example"],
[
["Metabolic Acidosis", "Acid accumulation or HCO3- loss. E.g. DKA, renal failure, diarrhoea. Compensation: hyperventilation (↓ CO2)"],
["Metabolic Alkalosis", "H+ loss or HCO3- gain. E.g. VOMITING (loss of HCl) → hypochloraemic alkalosis. Compensation: hypoventilation (↑ CO2)"],
["Respiratory Acidosis", "CO2 retention (hypoventilation). E.g. COPD, sedation. pH <7.35. Compensation: renal HCO3- retention"],
["Respiratory Alkalosis", "CO2 loss (hyperventilation). E.g. anxiety, high altitude. pH >7.45. Compensation: renal HCO3- excretion"],
]
))
story.append(spacer(0.3))
story.append(key_box("EXAM MEMORABLES - Renal & Fluid", [
"EPO from KIDNEYS (not thymus, not lungs)",
"ADH: made in hypothalamus, stored/released from POSTERIOR pituitary",
"Aldosterone = zona glomerulosa; promotes Na+ IN, K+ OUT",
"ANP = from atria, promotes SODIUM EXCRETION (opposite of aldosterone)",
"Vomiting → loss of HCl → METABOLIC ALKALOSIS",
"RAAS: low BP → Renin → Ang I → Ang II → Aldosterone → Na+/water retention",
"Reduced urine output after trauma = reduced GFR + increased ADH",
"Hypokalemia (K+ <3.5) = muscle weakness (hyperpolarisation of cell membranes)",
], LIGHT_ORANGE, ORANGE))
story.append(PageBreak())
# ══════════════════════════════════════════════════════════════════════════════
# CHAPTER 5 — REPRODUCTIVE SYSTEM
# ══════════════════════════════════════════════════════════════════════════════
def ch_reproductive(story):
story.append(chapter_header("Chapter 5: Reproductive System", colors.HexColor("#1A6B3C")))
story.append(spacer(0.3))
story.append(section("5.1 Female Reproductive Physiology"))
story.append(two_col_table(
["Topic", "Key Points"],
[
["Fertilisation", "Occurs in the AMPULLA of the fallopian tube (oviduct); sperm meets ovum after ovulation"],
["Implantation", "Fertilised ovum implants in the ENDOMETRIUM (uterus)"],
["Menstrual Cycle", "Follicular (proliferative) phase: FSH → follicle development → ESTROGEN → endometrial thickening. Ovulation: LH surge. Luteal (secretory) phase: corpus luteum → PROGESTERONE → maintains endometrium for implantation."],
["Estrogen", "Thickens uterine lining (proliferative phase); secondary sex characteristics; feedback on pituitary"],
["Progesterone", "Maintains endometrium in secretory phase; prevents uterine contractions in pregnancy; rises after ovulation"],
],
col_widths=[4*cm, 12.5*cm]
))
story.append(spacer(0.3))
story.append(section("5.2 Male Reproductive Physiology"))
story.append(two_col_table(
["Topic", "Key Points"],
[
["Testes", "Produce SPERM (seminiferous tubules) AND TESTOSTERONE (Leydig cells) — the ONLY organ that does both"],
["LH", "Stimulates Leydig cells → testosterone secretion"],
["FSH", "Stimulates Sertoli cells → spermatogenesis; also produces inhibin"],
["Testosterone", "Male secondary sex characteristics; spermatogenesis; muscle mass; libido"],
["Prostate Gland", "Secretes alkaline fluid to NEUTRALISE acidic vaginal medium; enhances sperm motility"],
["Epididymis", "Site of sperm MATURATION and storage"],
["Vas Deferens", "Conveys sperm from epididymis to urethra"],
["Scrotum", "Maintains testes ~2°C below body temperature for spermatogenesis"],
],
col_widths=[4*cm, 12.5*cm]
))
story.append(spacer(0.3))
story.append(key_box("EXAM MEMORABLES - Reproductive", [
"Fertilisation = OVIDUCT (not uterus, not ovary)",
"Testis = produces BOTH sperm and testosterone",
"LH → Leydig cells → Testosterone",
"FSH → Sertoli cells → Spermatogenesis",
"Estrogen = thickening of uterine lining (proliferative phase)",
"Prostate = neutralises acidic vaginal medium",
"Parafollicular (C) cells of thyroid = Calcitonin (LOWERS Ca2+)",
], LIGHT_GREEN, GREEN))
story.append(PageBreak())
# ══════════════════════════════════════════════════════════════════════════════
# CHAPTER 6 — SPECIAL SENSE ORGANS
# ══════════════════════════════════════════════════════════════════════════════
def ch_senses(story):
story.append(chapter_header("Chapter 6: Special Sense Organs", colors.HexColor("#6C3483")))
story.append(spacer(0.3))
story.append(section("6.1 The Eye"))
story.append(two_col_table(
["Structure", "Function"],
[
["Cornea", "Transparent; refracts ~70% of light; avascular; most powerful refractive surface"],
["Iris / Pupil", "Circular (sphincter) muscle: constriction in bright light (CN III). Radial (dilator) muscle: dilation in dim light (sympathetic)"],
["Lens", "Accommodation - changes shape via ciliary muscles; more convex for near vision"],
["Ciliary muscles", "Contract for near vision (relaxes zonule ligaments → lens becomes rounder)"],
["Retina", "Inner photosensitive layer containing rods and cones"],
["Rods", "~120 million; peripheral vision; dim light (scotopic); contain rhodopsin"],
["Cones", "~6 million; concentrated in fovea; colour vision (photopic); red/green/blue types"],
["Fovea centralis", "Highest visual acuity; densely packed cones; no rods"],
["Optic disc", "Blind spot; where optic nerve exits; no photoreceptors"],
["Choroid", "Vascular layer; nourishes retina; contains melanin (absorbs stray light)"],
],
col_widths=[4.5*cm, 12*cm]
))
story.append(spacer(0.2))
story.append(body("Accommodation: ciliary muscles contract → zonule fibres relax → lens becomes more convex → increases refractive power for near objects. CN III (oculomotor) controls ciliary muscle AND pupil constriction."))
story.append(spacer(0.3))
story.append(section("6.2 The Ear"))
story.append(two_col_table(
["Division", "Structures & Functions"],
[
["Outer Ear", "Pinna (collects sound); External auditory meatus (conducts sound); Tympanic membrane (vibrates with sound)"],
["Middle Ear", "Ossicles: Malleus → Incus → Stapes (amplify sound ~20x); Oval window (transmits to inner ear); Eustachian tube (equalises pressure with nasopharynx)"],
["Inner Ear - Cochlea", "Fluid-filled (perilymph + endolymph); Organ of Corti on basilar membrane; Hair cells convert sound waves → electrical signals → CN VIII (cochlear division) → auditory cortex (temporal lobe)"],
["Inner Ear - Vestibular", "3 Semicircular canals: detect ROTATIONAL/angular acceleration; Utricle + Saccule (otolith organs): detect LINEAR acceleration and gravity; Signals via CN VIII (vestibular division) → cerebellum, spinal cord, eye muscles"],
],
col_widths=[4*cm, 12.5*cm]
))
story.append(spacer(0.3))
story.append(section("6.3 The Nose (Olfaction)"))
story.append(two_col_table(
["Feature", "Detail"],
[
["Olfactory epithelium", "Located in SUPERIOR nasal cavity (roof); bipolar olfactory receptor neurons with cilia"],
["Mechanism", "Odorants dissolve in mucus → bind receptors → G-protein/cAMP → depolarisation → action potentials"],
["Pathway", "CN I (olfactory nerve) → cribriform plate → olfactory bulb → piriform cortex, amygdala, hippocampus"],
["Functions of nose", "Olfaction; air conditioning (warm, humidify, filter); mucociliary clearance; voice resonance"],
]
))
story.append(spacer(0.3))
story.append(section("6.4 Taste (Gustation)"))
story.append(two_col_table(
["Feature", "Detail"],
[
["Receptors", "Taste buds on tongue papillae (fungiform, circumvallate, foliate)"],
["Cranial nerves", "CN VII (anterior 2/3 tongue); CN IX (posterior 1/3); CN X (epiglottis/pharynx)"],
["Basic tastes", "Sweet, sour, salty, bitter, umami"],
]
))
story.append(spacer(0.3))
story.append(key_box("EXAM MEMORABLES - Special Senses", [
"Balance = SEMICIRCULAR CANALS (rotational) + Utricle/Saccule (linear)",
"Bright light → pupil CONSTRICTION via circular iris muscle (CN III)",
"Accommodation: ciliary muscles CONTRACT → lens more CONVEX (near vision)",
"Photoreceptors unique to the eye: RODS (dim light) + CONES (colour)",
"Ossicles: Malleus → Incus → Stapes (MIS) — sound amplification",
"Olfaction (smell) originates from NASAL CAVITY (superior olfactory epithelium)",
"Taste (gustation): CN VII + IX + X",
"Rods and cones generate the initial phototransduction signal",
"Optic disc = blind spot (no photoreceptors)",
], LIGHT_PURPLE, PURPLE))
story.append(PageBreak())
# ══════════════════════════════════════════════════════════════════════════════
# CHAPTER 7 — AUTONOMIC NERVOUS SYSTEM
# ══════════════════════════════════════════════════════════════════════════════
def ch_ans(story):
story.append(chapter_header("Chapter 7: Autonomic Nervous System", colors.HexColor("#17607A")))
story.append(spacer(0.3))
story.append(two_col_table(
["Feature", "Sympathetic ('Fight or Flight')", ],
[
["Trigger", "Stress, fear, exercise, blood loss"],
["Neurotransmitter", "Noradrenaline (at effectors); Adrenaline (from adrenal medulla)"],
["Heart", "Increases rate and force (tachycardia)"],
["Blood vessels", "Vasoconstriction → increased BP"],
["Lungs", "Bronchodilation (β2 receptors)"],
["GI tract", "Reduced motility, secretion, blood flow"],
["Eyes", "Pupil dilation (radial muscle - mydriasis)"],
["Sweat glands", "Increases sweating"],
["Bladder", "Relaxes detrusor; contracts sphincter (urine retention)"],
],
col_widths=[5*cm, 11.5*cm],
hdr_color=colors.HexColor("#C0392B")
))
story.append(spacer(0.3))
story.append(two_col_table(
["Feature", "Parasympathetic ('Rest and Digest')"],
[
["Trigger", "Rest, feeding, sexual arousal"],
["Neurotransmitter", "Acetylcholine (muscarinic receptors)"],
["Heart", "Decreases rate (bradycardia) - vagus nerve (CN X)"],
["Blood vessels", "Vasodilation (selected vascular beds)"],
["Lungs", "Bronchoconstriction"],
["GI tract", "Increases motility and secretion (digestion)"],
["Eyes", "Pupil constriction (circular muscle - miosis); accommodation"],
["Bladder", "Contracts detrusor; relaxes sphincter (urination)"],
["Salivary glands", "Increases salivation"],
],
col_widths=[5*cm, 11.5*cm],
hdr_color=GREEN
))
story.append(spacer(0.3))
story.append(section("7.1 Medullary Control Centres"))
story.append(body("The medulla oblongata controls vital involuntary functions:"))
for b in [
"Cardiovascular centre: regulates heart rate and blood vessel tone",
"Respiratory rhythmicity centre: sets basic breathing rhythm (dorsal + ventral respiratory groups)",
"Vomiting centre (chemoreceptor trigger zone)",
"Swallowing centre",
]:
story.append(bullet(b))
story.append(spacer(0.3))
story.append(key_box("EXAM MEMORABLES - ANS", [
"Fight-or-flight = SYMPATHETIC; Rest-and-digest = PARASYMPATHETIC",
"Adrenaline from adrenal MEDULLA (not cortex)",
"Opioids suppress parasympathetic GI activity → constipation",
"Stress REDUCES digestion (sympathetic dominance)",
"Medulla oblongata controls BREATHING, heart rate, swallowing (involuntary)",
"Pre-operative stress → sympathetic activation → nausea, reduced GI motility",
], LIGHT_BLUE, MID_BLUE))
story.append(PageBreak())
# ══════════════════════════════════════════════════════════════════════════════
# CHAPTER 8 — CORTICOSTEROIDS & WOUND HEALING
# ══════════════════════════════════════════════════════════════════════════════
def ch_steroids(story):
story.append(chapter_header("Chapter 8: Corticosteroids & Tissue Repair", colors.HexColor("#8E2D0A")))
story.append(spacer(0.3))
story.append(section("8.1 Physiological Effects of Glucocorticoids (Cortisol)"))
story.append(two_col_table(
["System", "Effect"],
[
["Carbohydrate", "Stimulates gluconeogenesis (liver); reduces peripheral glucose uptake → raises blood glucose"],
["Protein", "CATABOLIC: breaks down muscle protein → amino acids (substrate for gluconeogenesis) → muscle wasting"],
["Fat", "Stimulates lipolysis (fat breakdown); redistributes fat centrally (central obesity in Cushing's)"],
["Anti-inflammatory", "Inhibits phospholipase A2 → reduces prostaglandins/leukotrienes; stabilises lysosomal membranes"],
["Immune", "Suppresses lymphocytes, macrophages, eosinophils → immunosuppression"],
["Bone", "Decreases calcium absorption, increases bone resorption → osteoporosis"],
["Water/Electrolyte", "Some mineralocorticoid effect: Na+ retention, K+ excretion"],
]
))
story.append(spacer(0.3))
story.append(section("8.2 Corticosteroids and Wound Healing"))
story.append(body("Long-term steroids impair every phase of wound healing:"))
story.append(two_col_table(
["Phase", "Steroid Effect"],
[
["Inflammatory phase", "SUPPRESSED: fewer neutrophils and macrophages → impaired debridement and infection control"],
["Proliferative phase", "SUPPRESSED: fewer fibroblasts → reduced collagen synthesis → poor scar tissue formation"],
["Angiogenesis", "IMPAIRED: reduced new blood vessel formation → poor granulation tissue"],
["Remodelling", "IMPAIRED: reduced collagen cross-linking → weak scar"],
]
))
story.append(spacer(0.3))
story.append(key_box("EXAM MEMORABLES - Steroids", [
"Cortisol = zona FASCICULATA; glucocorticoid",
"Protein CATABOLISM → muscle wasting (steroid myopathy)",
"Steroids RAISE blood glucose (gluconeogenesis) — worsen diabetes",
"Slow wound healing = suppressed inflammation + reduced collagen synthesis",
"Cushing's: central obesity, moon face, buffalo hump, striae, hypertension",
"Addison's disease: adrenal insufficiency → treat with HYDROCORTISONE",
], LIGHT_ORANGE, ORANGE))
story.append(PageBreak())
# ══════════════════════════════════════════════════════════════════════════════
# CHAPTER 9 — MCQ ANSWER KEYS
# ══════════════════════════════════════════════════════════════════════════════
def ch_mcq(story):
story.append(chapter_header("Chapter 9: MCQ Answer Keys with Explanations", DARK_BLUE))
story.append(spacer(0.3))
story.append(section("KMTC/QP-08/EPS - Section 1 MCQ Answers"))
kmtc_mcqs = [
(1, "Boxer - loss of balance after punch near ear", "A - Semicircular canals", "Detect rotational movement; fluid displacement deflects hair cells in ampullae"),
(2, "Which gland secretes melatonin?", "B - Pineal gland", "Secretes melatonin in darkness; regulates circadian rhythm"),
(3, "Fight-or-flight hormone in trauma patient", "B - Adrenaline", "Adrenal medulla; causes tachycardia, pallor, sweating, bronchodilation"),
(4, "Hormone responsible for uterine lining thickening", "A - Estrogen", "Drives endometrial proliferation in follicular phase"),
(5, "Diaphragm during inhalation", "B - Contracts and moves down", "Increases thoracic volume; decreases intrapulmonary pressure"),
(6, "Bright light discomfort - adjustment", "A - Pupillary constriction (iris circular muscle)", "Pupillary light reflex via CN III; limits retinal light exposure"),
(7, "Digestive enzyme acting on proteins in stomach", "C - Pepsin", "Activated from pepsinogen by HCl; cleaves peptide bonds"),
(8, "Lungs help regulate", "A - Oxygen exchange (and CO2)", "Primary function: O2/CO2 exchange + acid-base via CO2"),
(14, "Brain centre for involuntary breathing", "A - Medulla oblongata", "Contains dorsal and ventral respiratory groups"),
(15, "Post-surgery vomiting 2 days - acid-base disorder", "A - Metabolic alkalosis (H+ loss)", "HCl loss from vomiting → raised pH → metabolic alkalosis"),
(16, "Gland located above each kidney", "B - Adrenal gland", "Suprarenal glands; cortex + medulla"),
(17, "Organ producing sperm AND testosterone", "C - Testis", "Seminiferous tubules (sperm) + Leydig cells (testosterone)"),
(18, "Pelvic trauma - reduced urine output mechanism", "A - Reduced GFR + increased ADH release", "Low perfusion → reduced filtration + ADH-driven water reabsorption"),
(19, "Trachea divides into two?", "C - Bronchi (primary/main bronchi)", "Bifurcation at carina (T4/T5)"),
(20, "Hormone stimulating gastric juice secretion", "B - Gastrin", "G cells of gastric antrum; stimulates HCl + pepsinogen"),
]
story.append(mcq_answer_table(kmtc_mcqs))
story.append(spacer(0.5))
story.append(PageBreak())
story.append(section("Physiology II - MCQ Answers (Q1-Q20)"))
phys1_mcqs = [
(1, "Fertilisation of ovum occurs at?", "a) Oviduct (fallopian tube)", "Specifically the ampulla; sperm meets egg here after ovulation"),
(2, "Function of prostate gland", "d) Secretes fluid to neutralise acidic vaginal medium", "Alkaline prostatic secretion protects sperm from vaginal acidity"),
(3, "Accessory organs of digestion", "Liver, gallbladder, pancreas (salivary glands)", "These lie outside GI tract but contribute secretions for digestion"),
(4, "Peristaltic movements produced by?", "c) Muscularis layer", "Inner circular + outer longitudinal smooth muscle produce peristalsis"),
(5, "Total volume of intestinal secretions", "d) 1500 ml/day", "Total GI secretions ~7-8L/day; intestinal secretions ~1500 ml"),
(6, "Parafollicular cells of thyroid secrete?", "d) Calcitonin", "C cells → calcitonin → lowers blood Ca2+ by inhibiting osteoclasts"),
(7, "Erythropoietin secreted from?", "c) Kidney", "Peritubular fibroblasts of renal cortex; response to hypoxia"),
(8, "One hormone needed for another to work = ?", "a) Permissive action", "E.g. cortisol permits adrenaline's vasoconstrictive effect"),
(9, "Protein/peptide hormones are?", "b) Synthesised in rough ER", "Water-soluble; stored in vesicles; act on surface receptors via 2nd messengers"),
(10, "FSH action", "c) Stimulates sperm production in males", "Acts on Sertoli cells of seminiferous tubules"),
(11, "Testosterone release stimulated by?", "d) Luteinizing hormone (LH)", "LH → Leydig cells → testosterone production"),
(12, "Hormone for T-lymphocyte maturation", "c) Thymosin", "Thymus gland secretes thymosins → T-cell differentiation and immunocompetence"),
(13, "Cortisol is?", "a) Glucocorticoid from adrenal cortex (zona fasciculata)", "ACTH-stimulated; raises glucose; anti-inflammatory; catabolic"),
(14, "Hydrocortisone function", "b) Stimulates protein and fat breakdown", "Catabolism → amino acids and fatty acids for gluconeogenesis"),
(15, "Cushing's syndrome associated with?", "a) Hypersecretion of cortisol", "Causes central obesity, moon face, striae, hyperglycaemia"),
(16, "Parathyroid hormone", "a) Increases calcium absorption from small intestine (via Vit D)", "Also activates osteoclasts; increases renal Ca2+ reabsorption"),
(17, "Atrial natriuretic peptide", "b) Increased renal sodium excretion", "Released from atria when overstretched; promotes natriuresis + diuresis"),
(18, "Hashimoto's thyroiditis", "a) Immune cells attack and destroy the thyroid", "Autoimmune; anti-TPO antibodies; leads to hypothyroidism"),
(19, "Hypothalamic hormones include?", "c) GHRH and prolactin-releasing hormone", "Hypothalamus makes releasing/inhibiting hormones for anterior pituitary"),
(20, "Gigantism is a disorder of?", "d) GH hypersecretion in children", "Before growth plate closure → excessive height; in adults = acromegaly"),
]
story.append(mcq_answer_table(phys1_mcqs))
story.append(PageBreak())
story.append(section("Physiology II - MCQ Answers (Q21-Q40)"))
phys2_mcqs = [
(21, "Polydipsia, polyuria, polyphagia = cardinal signs of?", "a) Diabetes mellitus", "Hyperglycaemia → osmotic diuresis + cellular starvation"),
(22, "Endocrine disorder with pathological fracture?", "b) Hyperparathyroidism", "Excess PTH → osteoclast activation → bone resorption → fractures"),
(23, "Medication for Addison's disease?", "a) Intramuscular hydrocortisone injection", "Addison's = adrenal insufficiency; replace cortisol with hydrocortisone"),
(24, "Type 2 diabetes mellitus is?", "c) Not insulin dependent", "Insulin resistance; managed initially by lifestyle/oral agents; no islet destruction"),
(25, "Average length of adult trachea?", "c) ~12 cm", "Extends from C6 to T4/T5 carina; ~2.5 cm diameter; C-shaped cartilage rings"),
(26, "Gas exchange at alveolar level = ?", "d) External respiration", "External = lungs ↔ blood; Internal = blood ↔ tissues"),
(27, "Role of pleural fluid?", "c) Holds lungs against thoracic wall", "Surface tension coupling keeps lungs expanded; lubricates pleural surfaces"),
(28, "Mucus/debris moved up by?", "b) Ciliated columnar epithelium of trachea", "Mucociliary escalator; cilia beat upward to pharynx"),
(29, "Bronchiole smooth muscle contraction?", "a) Decreases airway diameter", "Bronchoconstriction → increased resistance; occurs in asthma"),
(30, "Surfactant secreted into alveoli?", "c) Increases compliance", "Reduces surface tension → easier to inflate → increased compliance"),
(31, "Inspiration ends when?", "d) Alveolar pressure = atmospheric pressure", "No pressure gradient → no airflow → end of inspiration"),
(32, "Pleural fluid volume?", "a) ~2.5 ml (up to ~15 ml)", "Small amount for lubrication; excess = pleural effusion"),
(33, "Epithelium lining trachea?", "a) Pseudostratified ciliated columnar epithelium", "Respiratory epithelium; all cells on basement membrane; cilia + goblet cells"),
(34, "Type I alveolar cells?", "c) Contribute to lung compliance by elasticity", "Thin, flat; 95% of alveolar surface; gas exchange surface"),
(35, "Blood flowing towards lungs?", "d) Low O2, high CO2", "Pulmonary artery carries deoxygenated blood to lungs for oxygenation"),
(36, "Protein digestion begins in?", "c) Stomach", "Pepsin (activated by HCl) begins protein hydrolysis"),
(37, "Receptors found only in the eye?", "Photoreceptors (rods and cones)", "Respond to light via phototransduction; not found in other organs"),
(38, "Cranial nerves for taste (gustation)?", "a) CN VII, IX, and X", "VII: anterior 2/3 tongue; IX: posterior 1/3; X: epiglottis/pharynx"),
(39, "Olfaction originates from?", "c) The nasal cavity", "Olfactory epithelium in superior nasal cavity; CN I → olfactory bulb"),
(40, "Retinal layer generating action potentials?", "d) Layer of rods and cones", "Photoreceptors transduce light → electrical signal via phototransduction"),
]
story.append(mcq_answer_table(phys2_mcqs))
story.append(PageBreak())
# ══════════════════════════════════════════════════════════════════════════════
# CHAPTER 10 — SHORT & LONG ANSWER SUMMARIES
# ══════════════════════════════════════════════════════════════════════════════
def ch_saq(story):
story.append(chapter_header("Chapter 10: Short & Long Answer Key Points", colors.HexColor("#1A3A5C")))
story.append(spacer(0.3))
saqs = [
("Q21 - Stress and Digestion (Mutua)",
["Sympathetic dominance during stress REDUCES digestion",
"↓ Peristalsis, ↓ enzyme secretion, ↓ blood flow to gut, ↑ sphincter tone",
"Parasympathetic (vagus) suppressed → nausea, indigestion",
"Stress hormones (adrenaline, cortisol) prepare body for fight-or-flight, not digestion"]),
("Q22 - Accommodation after head injury (Harrison)",
["Accommodation = ciliary muscle contraction → zonule relaxation → lens more convex",
"CN III (oculomotor nerve) controls ciliary muscle",
"Head injury can damage CN III → accommodative paresis",
"Result: cannot focus on near objects (difficulty reading)"]),
("Q23 - Adrenal response to blood loss (Cathrine)",
["IMMEDIATE: adrenal medulla → adrenaline/noradrenaline → ↑ HR, vasoconstriction, glycogenolysis",
"DELAYED: RAAS → aldosterone → Na+/water retention",
"Cortisol: gluconeogenesis → maintains blood glucose",
"ADH: water reabsorption → maintains circulating volume"]),
("Q24 - Kidney regulation of K+ and Na+ (Korir - burn patient)",
["Aldosterone: Na+ IN, K+ OUT in collecting duct",
"Burn patients: cell destruction releases K+ → hyperkalemia OR diuresis/IV fluids → hypokalemia",
"Hypokalemia → muscle weakness (hyperpolarization of cell membranes)",
"ANP opposes aldosterone; promotes natriuresis"]),
("Q25 - Stomach and Pancreas in digestion (Melody - after IV fluids)",
["Stomach: HCl (activates pepsin), pepsinogen (protein digestion), intrinsic factor (Vit B12)",
"Stomach: gastrin, ghrelin, mechanical churning",
"Pancreas: bicarbonate (neutralises acid) + amylase, lipase, trypsin, chymotrypsin",
"After prolonged fasting: gut atony + reduced enzyme secretion → bloating when feeds restart"]),
("Q26 - Fluid balance after massive blood loss (Matata)",
["Step 1: baroreceptors detect ↓BP → sympathetic activation",
"Step 2: RAAS → renin → Ang II → vasoconstriction + aldosterone",
"Step 3: ADH → collecting duct aquaporins → water reabsorption",
"Step 4: Aldosterone → Na+/water retention → expanded blood volume",
"Net: oliguria, raised BP; severe loss → prerenal AKI"]),
("Q27 - Vestibular system and balance",
["Semicircular canals (3): detect ROTATIONAL acceleration; endolymph deflects cupula",
"Utricle + Saccule: detect LINEAR acceleration and gravity (otolith membranes)",
"Signals via CN VIII (vestibular) → vestibular nuclei → cerebellum + spinal cord",
"Trauma → labyrinthine concussion → vertigo, nystagmus, imbalance"]),
("Q28 - Corticosteroids: protein metabolism and wound healing",
["Protein catabolism in muscle → amino acids → gluconeogenesis → muscle wasting",
"Inhibit fibroblast activity → reduced collagen synthesis",
"Suppress macrophages/neutrophils → impaired inflammatory phase",
"Reduce angiogenesis → poor granulation tissue formation",
"Net: slow wound healing, susceptibility to infection, thin fragile skin"]),
]
for title, points in saqs:
story.append(sub(title))
for p in points:
story.append(bullet(p))
story.append(spacer(0.2))
story.append(PageBreak())
story.append(section("Long Answer Key Points: Respiration (Q29)"))
story.append(body("See Chapter 2 for full respiratory mechanics. Key summary points:"))
resp_points = [
"Conducting zone: nose → trachea → terminal bronchioles (warms, filters, humidifies)",
"Respiratory zone: respiratory bronchioles → alveoli (gas exchange)",
"Inspiration: diaphragm contracts and descends + external intercostals contract → volume ↑, pressure ↓",
"Expiration: passive recoil at rest; active with abdominal/internal intercostals during exercise",
"External respiration: O2 moves alveoli → blood (PAO2 100 → PO2 40 mmHg); CO2 opposite",
"O2 transport: 97% as oxyhaemoglobin; CO2: 70% as bicarbonate (carbonic anhydrase reaction)",
"Control: medulla (DRG/VRG), pons (pneumotaxic), chemoreceptors (peripheral: O2/CO2/pH; central: CO2/pH)",
]
for p in resp_points:
story.append(bullet(p))
story.append(spacer(0.3))
story.append(section("Long Answer Key Points: Special Sense Organs (Q30)"))
sense_points = [
"EYE: cornea (refraction) → pupil (light regulation) → lens (accommodation) → retina (rods + cones) → optic nerve (CN II) → occipital cortex",
"EAR HEARING: pinna → tympanic membrane → ossicles (malleus-incus-stapes) → oval window → cochlea (Organ of Corti) → CN VIII → temporal cortex",
"EAR BALANCE: semicircular canals (rotation) + utricle/saccule (linear/gravity) → CN VIII → cerebellum + spinal cord",
"NOSE: olfactory epithelium (superior nasal cavity) → CN I → olfactory bulb → limbic system (amygdala, hippocampus)",
"Accommodation: ciliary muscles CONTRACT → zonule fibres RELAX → lens becomes MORE CONVEX (near vision)",
"Pupil reflex: bright light → CN II afferent → CN III efferent → circular iris muscle contracts → miosis",
]
for p in sense_points:
story.append(bullet(p))
story.append(spacer(0.4))
story.append(key_box("FINAL EXAM TIPS", [
"Always link symptoms to a specific hormone or organ (e.g. cold intolerance = hypothyroidism = low thyroxine)",
"For blood loss questions: think RAAS + ADH + adrenal medulla in sequence",
"Peristalsis = MUSCULARIS layer; NOT mucosa or serosa",
"Trachea divides into PRIMARY BRONCHI (not bronchioles, not alveoli)",
"Surfactant = Type II cells → reduces surface tension → INCREASES compliance",
"Vomiting → metabolic ALKALOSIS; Diarrhoea → metabolic ACIDOSIS",
"LH → testosterone (Leydig cells); FSH → spermatogenesis (Sertoli cells)",
"Fertilisation = OVIDUCT; Implantation = ENDOMETRIUM (uterus)",
"Semicircular canals = ROTATION; Utricle/Saccule = LINEAR / GRAVITY",
"Photoreceptors: Rods = dim light; Cones = colour (fovea)",
], LIGHT_BLUE, DARK_BLUE))
# ══════════════════════════════════════════════════════════════════════════════
# PAGE TEMPLATE (header / footer)
# ══════════════════════════════════════════════════════════════════════════════
def on_page(canvas, doc):
canvas.saveState()
W, H = A4
# Header bar
canvas.setFillColor(DARK_BLUE)
canvas.rect(0, H - 22*mm, W, 22*mm, fill=1, stroke=0)
canvas.setFont("Helvetica-Bold", 9)
canvas.setFillColor(WHITE)
canvas.drawString(1.5*cm, H - 13*mm, "PHYSIOLOGY STUDY GUIDE")
canvas.setFont("Helvetica", 8)
canvas.drawRightString(W - 1.5*cm, H - 13*mm, "KMTC · Physiology I & II")
# Footer
canvas.setFillColor(LIGHT_GREY)
canvas.rect(0, 0, W, 12*mm, fill=1, stroke=0)
canvas.setFillColor(MID_GREY)
canvas.setFont("Helvetica", 8)
canvas.drawString(1.5*cm, 4*mm, "For educational use only")
canvas.drawCentredString(W/2, 4*mm, f"Page {doc.page}")
canvas.drawRightString(W - 1.5*cm, 4*mm, "Physiology Study Guide")
canvas.restoreState()
# ══════════════════════════════════════════════════════════════════════════════
# BUILD THE PDF
# ══════════════════════════════════════════════════════════════════════════════
def build():
doc = SimpleDocTemplate(
OUTPUT,
pagesize=A4,
topMargin=28*mm,
bottomMargin=18*mm,
leftMargin=1.8*cm,
rightMargin=1.8*cm,
title="Physiology Study Guide",
author="KMTC Study Aid",
subject="Physiology I & II",
)
story = []
cover_page(story)
toc_page(story)
ch_endocrine(story)
ch_respiratory(story)
ch_digestive(story)
ch_renal(story)
ch_reproductive(story)
ch_senses(story)
ch_ans(story)
ch_steroids(story)
ch_mcq(story)
ch_saq(story)
doc.build(story, onFirstPage=on_page, onLaterPages=on_page)
print(f"PDF created: {OUTPUT}")
build()