Reproductive physiology notes for professional exam mbbs 1st yr

Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Loading Image
Finding Sources
I now have comprehensive, authoritative content from Costanzo, Ganong's, and Guyton. Let me compile the complete MBBS 1st year reproductive physiology notes.

Reproductive Physiology - MBBS 1st Year Notes

Sources: Costanzo Physiology 7th Ed., Ganong's Review of Medical Physiology 26th Ed., Guyton & Hall Medical Physiology, Berek & Novak's Gynecology

1. OVERVIEW OF REPRODUCTIVE PHYSIOLOGY

Reproduction involves two separate but integrated systems - male (continuous sperm production + testosterone secretion) and female (cyclic oogenesis + steroid hormone secretion). Both systems are controlled by the hypothalamo-pituitary-gonadal (HPG) axis.
Key hormones:
  • GnRH (from hypothalamus) - pulsatile release
  • FSH and LH (from anterior pituitary)
  • Testosterone (testes), Estrogen + Progesterone (ovaries)

2. MALE REPRODUCTIVE PHYSIOLOGY

A. Structure of the Testes

ComponentProportionFunction
Seminiferous tubules80% of testisSpermatogenesis
Leydig cellsIn connective tissueTestosterone synthesis
Sertoli cellsLine seminiferous tubulesSupport spermatogenesis
Testicular temperature: 35-36°C (1-2°C below body temperature) - essential for spermatogenesis, maintained by countercurrent heat exchange between testicular arteries and veins. This is why testes descend into the scrotum.

B. Sertoli Cell Functions (4 key functions)

  1. Nutritive - provide nutrients to developing sperm (isolated from bloodstream)
  2. Blood-testis barrier - tight junctions between Sertoli cells; protects developing sperm from noxious substances while allowing testosterone to cross
  3. Fluid secretion - aqueous fluid into lumen of seminiferous tubules; transports sperm toward epididymis
  4. Androgen-binding protein (ABP) - secreted into lumen; keeps local testosterone levels high near developing sperm
Exam tip: Sertoli cells are regulated by FSH. Leydig cells are regulated by LH.

C. Spermatogenesis

Location: Seminiferous tubules
Duration: ~64 days for one full cycle
Output: ~128 million sperm/day (each spermatogonium produces 64 spermatozoa)
Three phases:
  1. Mitotic phase - Spermatogonia (stem cells) divide mitotically to produce spermatocytes
  2. Meiotic phase - Primary spermatocytes (2n) undergo meiosis I → secondary spermatocytes (n) → meiosis II → spermatids (haploid)
  3. Spermiogenesis - Spermatids transform into mature spermatozoa (loss of cytoplasm, development of flagella, acrosome formation)
Spermatogenic wave = temporal organization ensuring continuous sperm production.

D. Sperm Transport and Accessory Glands

Path of sperm: Seminiferous tubules → Epididymis → Vas deferens → Ejaculatory duct → Urethra
  • Epididymis: Primary site for sperm maturation and storage; sperm remain viable here for several months
  • Seminal vesicles: Contribute ~60% of ejaculate volume (fructose - energy source for sperm, prostaglandins)
  • Prostate gland: Alkaline secretions (neutralize vaginal acidity, zinc, citric acid)
  • Bulbourethral (Cowper's) glands: Pre-ejaculatory fluid (lubrication, neutralizes urethral acidity)

E. Testosterone

Secreted by: Leydig cells of testes
Stimulus: LH from anterior pituitary
Actions - mediated by testosterone vs. DHT:
Mediated by TestosteroneMediated by DHT (5α-reduced)
Differentiation of epididymis, vas deferens, seminal vesiclesDifferentiation of penis, scrotum, prostate
Increased muscle massMale hair pattern
Pubertal growth spurtMale pattern baldness
Epiphyseal closureSebaceous gland activity
Deepening of voiceGrowth of prostate
Spermatogenesis
Negative feedback on anterior pituitary
Libido
Feedback regulation:
  • Testosterone → negative feedback on both hypothalamus (↓GnRH) and anterior pituitary (↓LH)
  • Inhibin (from Sertoli cells) → negative feedback on anterior pituitary (↓FSH)

3. FEMALE REPRODUCTIVE PHYSIOLOGY

A. Anatomy of the Ovary

The ovary has three zones:
  1. Cortex (outer/largest) - lined by germinal epithelium; contains all oocytes in follicles
  2. Medulla (middle) - mixture of cell types
  3. Hilum (inner) - blood vessels and lymphatics
Functional unit = Ovarian follicle - one germ cell surrounded by endocrine cells

B. Oogenesis

StageEvent
Gestational weeks 8-9Oogonia enter meiosis → become primary oocytes
Weeks 20-24 gestationPeak ~7 million oogonia
Birth~2 million oocytes remain
Puberty~400,000 oocytes remain
MenopauseFew/none remain
Key difference from spermatogenesis:
  • Primary oocytes are arrested in prophase of Meiosis I from fetal life until ovulation
  • First meiotic division completed just before ovulation
  • Second meiotic division completed only upon fertilization
  • Females do NOT produce new oocytes after birth (unlike males who continuously produce sperm)

4. THE MENSTRUAL CYCLE

Average length: 28 days (range: 21-35 days)
Day 1 = First day of menstrual bleeding

A. Phases of the Menstrual Cycle

The cycle has two overlapping cycles:
Ovarian Cycle: Follicular phase → Ovulation → Luteal phase
Uterine (Endometrial) Cycle: Menstrual phase → Proliferative phase → Secretory phase
Female reproductive tract anatomy and ovarian follicle stages (Ganong's)
Diagram: Female reproductive anatomy (top) and ovarian cross-section showing stages from primordial follicle to corpus albicans (bottom) - Ganong's Review

B. Follicular (Proliferative) Phase - Days 1-14

Hormonal events:
  • FSH (slightly elevated) stimulates 6-12 primary follicles to grow
  • One dominant (Graafian) follicle selected by day ~6 (related to ability to secrete estrogen); others undergo atresia (apoptosis)
  • Dominant follicle produces increasing estradiol (E2)
Follicle development stages:
  1. Primordial follicle (oocyte + single granulosa cell layer)
  2. Primary follicle (multiple granulosa cell layers)
  3. Secondary follicle (theca interna + theca externa form)
  4. Antral (Graafian) follicle (antrum fills with estrogen-rich follicular fluid)
Two-cell, two-gonadotropin theory:
  • Theca interna cells (stimulated by LH) → produce androgens (androstenedione)
  • Granulosa cells (stimulated by FSH) → aromatize androgens → estrogens
Endometrial changes (proliferative):
  • Estradiol → endometrial growth, gland elongation, spiral artery growth
  • Cervical mucus: copious, watery, elastic, shows "ferning" pattern on glass slide
  • Ferning creates channels in the cervix for sperm penetration

C. Ovulation - Day 14 (of 28-day cycle)

Trigger: Rising estradiol causes positive feedback on pituitary → LH surge (preovulatory LH surge)
Ovulation occurs ~36 hours after onset of the LH surge
Mechanism:
  1. High estrogen (sustained >200 pg/mL for >50 hours) → switches from negative to positive feedback on anterior pituitary
  2. Massive LH surge → proteolytic enzyme activation, prostaglandin secretion
  3. Follicle ruptures → oocyte extruded into peritoneal cavity
  4. Fimbriated ends of fallopian tube pick up the oocyte
Mittelschmerz = fleeting lower abdominal pain at time of ovulation due to minor bleeding from ruptured follicle into peritoneal cavity.
Corpus hemorrhagicum = blood-filled follicle immediately after ovulation.

D. Luteal (Secretory) Phase - Days 14-28

  • Ruptured follicle → granulosa + theca cells proliferate → filled with lipid-rich luteal cells → Corpus luteum
  • Corpus luteum secretes estrogen + progesterone (VEGF needed for its blood supply)
  • If no pregnancy: Corpus luteum degenerates → corpus albicans → ↓ estrogen + progesterone → menstruation (Day 28)
  • If pregnancy: hCG from trophoblast (has same α-subunit as LH) maintains corpus luteum until placenta takes over (~10 weeks)
Endometrial changes (secretory):
  • Progesterone: glands become tortuous, accumulate glycogen, ↑mucus secretions; stroma edematous; spiral arteries elongate + coil
  • Cervical mucus: thick, non-elastic, does not fern (blocks sperm - fertilization window closed)
  • Progesterone has mild thermogenic effect → basal body temperature rises ~0.5°C in luteal phase (basis of rhythm contraception method)

E. Hormone Levels Summary During the Cycle

PhaseDominant HormoneFSHLHEstrogenProgesterone
Menstruation (D1-5)Low all↑ startsLowLowLow
Follicular (D5-14)Estrogen↑ then ↓Low then surgeRising → peakLow
Ovulation (D14)LH surgeMid-cycle surgeSurgePeak just beforeLow
Luteal (D14-28)ProgesteroneLowLowModerateHigh

5. HORMONAL CONTROL - HPG AXIS

Hypothalamus
     |
  GnRH (pulsatile)
     |
Anterior Pituitary
   /        \
 FSH         LH
  |            |
Granulosa    Theca/Leydig
cells        cells
  |            |
Inhibin      Estrogen/
             Testosterone
     |
  Negative feedback (usually)
  Positive feedback at mid-cycle surge (estrogen only)
Key regulatory points:
  • GnRH must be pulsatile to stimulate FSH/LH (continuous GnRH → downregulates receptors → no effect → basis of GnRH agonist therapy for endometriosis, prostate cancer)
  • Inhibin (from granulosa/Sertoli cells) selectively suppresses FSH
  • Activin (also from granulosa cells) stimulates FSH release

6. PUBERTY

Female puberty sequence (THARB):
  1. Thelarche (breast development) - first sign
  2. Hair (pubic and axillary)
  3. Adrenarchy (adrenal androgens)
  4. Rapid growth spurt
  5. Birth (menarche) - average age ~12-13 years
Male puberty:
  1. Testicular enlargement - first sign
  2. Pubic hair
  3. Growth spurt
  4. Voice change
  5. Spermarche
GnRH pulse generator is suppressed throughout childhood; reactivation at puberty initiates the HPG axis.

7. FERTILIZATION AND IMPLANTATION

Site of fertilization: Ampulla of the fallopian tube (most common)
Steps of fertilization:
  1. Chemoattraction of sperm to ovum
  2. Sperm bind to zona pellucida (ZP3 receptor)
  3. Acrosomal reaction - breakdown of acrosome, release of acrosin (trypsin-like protease) → facilitates zona penetration
  4. Sperm head fuses with oocyte membrane via fertilin protein → sperm nucleus released into oocyte cytoplasm
  5. Cortical reaction → zona pellucida hardens → blocks polyspermy
Prevention of polyspermy:
  • Fast block: Immediate change in oocyte membrane potential
  • Slow block: Structural change in zona pellucida (cortical reaction, zona hardening)
Journey to uterus:
  • Fertilized ovum (zygote) → travels down fallopian tube over ~3 days → reaches 8-16 cell stage → becomes blastocyst
  • Implantation occurs in uterine endometrium ~6-7 days after fertilization (decidualized endometrium in secretory phase)
  • Trophoblast cells of blastocyst secrete hCG → maintains corpus luteum → continued progesterone → protects pregnancy

8. ESTROGEN AND PROGESTERONE - ACTIONS SUMMARY

Estrogen actions:

  • Uterus: endometrial proliferation, growth of glands and spiral arteries
  • Cervix: watery, elastic mucus with ferning (sperm-friendly)
  • Breast: ductal growth, areolar pigmentation, fat deposition
  • Bone: promotes pubertal growth spurt; closes epiphyses at end of puberty
  • Feedback: negative (usually), positive at mid-cycle surge
  • Stimulates prolactin secretion from pituitary
  • Enlarges external genitalia
  • Female fat distribution (subcutaneous)

Progesterone actions:

  • Uterus: converts proliferative → secretory endometrium; maintains pregnancy; raises threshold to myometrial contractions
  • Cervix: thick, non-elastic mucus (no ferning - sperm-hostile)
  • Breast: stimulates secretory activity in mammary ducts (with estrogen)
  • Temperature: mild thermogenic effect (↑BBT in luteal phase by ~0.5°C)
  • Feedback: negative on pituitary; responsible for FSH mid-cycle surge

9. QUICK REVISION TABLES

Cells and Hormones at a Glance

CellHormone ProducedRegulated by
Leydig cellsTestosteroneLH
Sertoli cellsInhibin, ABPFSH
Theca internaAndrogensLH
Granulosa cellsEstrogen, InhibinFSH
Corpus luteumProgesterone + EstrogenLH (then hCG)
TrophoblasthCG-

Key Numbers to Remember

FactNumber
Duration of spermatogenesis64 days
Sperm produced per day128 million
Oogonia at peak (gestation weeks 20-24)7 million
Oocytes at birth2 million
Oocytes at puberty400,000
Average menstrual cycle length28 days
Ovulation occurs after LH surge~36 hours
Fertilization to implantation~6-7 days
Time for blastocyst to reach uterus~3 days
Temperature rise at ovulation (BBT)~0.5°C
Testicular temperature35-36°C (1-2°C below core)

10. HIGH-YIELD EXAM POINTS

  1. Blood-testis barrier is formed by tight junctions between Sertoli cells (not Leydig cells)
  2. FSH regulates Sertoli cells (spermatogenesis); LH regulates Leydig cells (testosterone)
  3. Female meiosis is arrested in prophase of Meiosis I until ovulation; completed at fertilization
  4. Ferning of cervical mucus = follicular/estrogenic phase; no ferning = luteal/progestogenic phase
  5. Mittelschmerz = mid-cycle pain at ovulation
  6. Positive feedback of estrogen → LH surge → ovulation
  7. hCG = "pregnancy hormone"; same α-subunit as LH/FSH/TSH; rescues corpus luteum
  8. Inhibin suppresses FSH specifically (not LH)
  9. Testosterone → muscle, voice, libido; DHT → prostate, hair, genitalia
  10. GnRH must be pulsatile - continuous = down-regulation (used therapeutically)
  11. Corpus luteum → progesterone dominance → if no pregnancy → luteolysis → withdrawal bleeding
  12. Spermatogonia (2n) → Primary spermatocytes (2n) → Secondary spermatocytes (n) → Spermatids (n) → Spermatozoa

Compiled from: Costanzo Physiology 7th Ed. (pp. 460-479), Ganong's Review of Medical Physiology 26th Ed. (Ch. 22), Guyton & Hall Medical Physiology (Ch. 82), Berek & Novak's Gynecology (Ch. 2)

1

Asking for Preferences

Create notes as flowchart and diagram create it into doc format

Reading File
Running Command

mkdir -p /home/daytona/workspace/repro-physiology && ls /home/daytona/workspace/…

Writing File

~/repro-physiology/build.js

const {
  Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
  HeadingLevel, AlignmentType, BorderStyle, WidthType, ShadingType,
  VerticalAlign, PageNumber, Header, Footer, PageBreak,
  convertInchesToTwip, UnderlineType
} = require('docx');
const fs = require('fs');

// ─── colour palette ──────────────────────────────────────────────────
const BLUE      = "1F4E79";
const LBLUE     = "2E75B6";
const TEAL      = "17375E";
const LTBLUE    = "BDD7EE";
const LLBLUE    = "DEEAF1";
const PINK      = "C00000";
const GREEN     = "375623";
const LGREEN    = "E2EFDA";
const LYELLOW   = "FFF2CC";
const LORANGE   = "FCE4D6";
const LGREY     = "F2F2F2";
const WHITE     = "FFFFFF";
const DARKGREY  = "404040";
const BLACK     = "000000";

// ─── helper builders ─────────────────────────────────────────────────

function heading1(text) {
  return new Paragraph({
    text,
    heading: HeadingLevel.HEADING_1,
    spacing: { before: 360, after: 120 },
    shading: { type: ShadingType.SOLID, color: BLUE },
    run: { color: WHITE, bold: true },
  });
}

function heading2(text) {
  return new Paragraph({
    text,
    heading: HeadingLevel.HEADING_2,
    spacing: { before: 240, after: 80 },
  });
}

function heading3(text) {
  return new Paragraph({
    text,
    heading: HeadingLevel.HEADING_3,
    spacing: { before: 160, after: 60 },
  });
}

function para(text, opts = {}) {
  return new Paragraph({
    children: [new TextRun({ text, color: opts.color || BLACK, bold: opts.bold, italics: opts.italic, size: opts.size || 22 })],
    spacing: { before: 60, after: 60 },
    alignment: opts.align || AlignmentType.LEFT,
    indent: opts.indent ? { left: convertInchesToTwip(0.3) } : undefined,
  });
}

function bullet(text, level = 0, color = BLACK) {
  return new Paragraph({
    children: [new TextRun({ text, color, size: 22 })],
    bullet: { level },
    spacing: { before: 40, after: 40 },
  });
}

function keyPoint(label, value) {
  return new Paragraph({
    children: [
      new TextRun({ text: label + ": ", bold: true, color: LBLUE, size: 22 }),
      new TextRun({ text: value, color: BLACK, size: 22 }),
    ],
    spacing: { before: 50, after: 50 },
    indent: { left: convertInchesToTwip(0.2) },
  });
}

function divider() {
  return new Paragraph({
    text: "",
    border: { bottom: { color: LBLUE, size: 6, style: BorderStyle.SINGLE } },
    spacing: { before: 120, after: 120 },
  });
}

function pageBreak() {
  return new Paragraph({ children: [new PageBreak()] });
}

function centeredBold(text, size = 28, color = WHITE, shade = LBLUE) {
  return new Paragraph({
    children: [new TextRun({ text, bold: true, color, size })],
    alignment: AlignmentType.CENTER,
    spacing: { before: 80, after: 80 },
    shading: { type: ShadingType.SOLID, color: shade },
  });
}

// ─── TABLE helpers ────────────────────────────────────────────────────

function makeCell(text, opts = {}) {
  return new TableCell({
    children: [new Paragraph({
      children: [new TextRun({
        text,
        bold: opts.bold || false,
        color: opts.textColor || BLACK,
        size: opts.size || 20,
      })],
      alignment: opts.align || AlignmentType.LEFT,
      spacing: { before: 40, after: 40 },
    })],
    shading: opts.shade ? { type: ShadingType.SOLID, color: opts.shade } : undefined,
    verticalAlign: VerticalAlign.CENTER,
    width: opts.width ? { size: opts.width, type: WidthType.PERCENTAGE } : undefined,
    columnSpan: opts.span || 1,
  });
}

function headerRow(cells, shade = LBLUE) {
  return new TableRow({
    children: cells.map(c =>
      typeof c === 'string'
        ? makeCell(c, { bold: true, textColor: WHITE, shade, align: AlignmentType.CENTER })
        : makeCell(c.text, { bold: true, textColor: WHITE, shade, align: AlignmentType.CENTER, width: c.w })
    ),
    tableHeader: true,
  });
}

function dataRow(cells, altShade) {
  return new TableRow({
    children: cells.map(c =>
      typeof c === 'string'
        ? makeCell(c, { shade: altShade })
        : makeCell(c.text, { shade: altShade || c.shade, bold: c.bold, textColor: c.color, align: c.align, width: c.w })
    ),
  });
}

function simpleTable(headers, rows, colWidths) {
  const tRows = [headerRow(headers.map((h, i) => ({ text: h, w: colWidths ? colWidths[i] : undefined })))];
  rows.forEach((r, idx) => {
    tRows.push(dataRow(r.map((c, i) => ({
      text: c,
      w: colWidths ? colWidths[i] : undefined,
      shade: idx % 2 === 0 ? LGREY : WHITE,
    })));
  });
  return new Table({
    rows: tRows,
    width: { size: 100, type: WidthType.PERCENTAGE },
    margins: { top: 80, bottom: 80, left: 100, right: 100 },
  });
}

// ─── FLOWCHART via ASCII-art table ───────────────────────────────────

function flowBox(text, shade = LTBLUE, textColor = TEAL, bold = true) {
  return new Table({
    rows: [new TableRow({ children: [makeCell(text, { shade, textColor: textColor, bold, align: AlignmentType.CENTER, size: 22 })] })],
    width: { size: 60, type: WidthType.PERCENTAGE },
    float: { horizontalAnchor: "margin", absoluteHorizontalPosition: convertInchesToTwip(1.5) },
  });
}

function arrow() {
  return new Paragraph({
    children: [new TextRun({ text: "↓", color: LBLUE, bold: true, size: 32 })],
    alignment: AlignmentType.CENTER,
    spacing: { before: 60, after: 60 },
  });
}

function flowStep(label, detail, shade = LLBLUE) {
  return [
    new Table({
      rows: [new TableRow({
        children: [
          makeCell(label, { shade, bold: true, textColor: TEAL, align: AlignmentType.CENTER, size: 20, w: 30 }),
          makeCell(detail, { shade: WHITE, textColor: BLACK, align: AlignmentType.LEFT, size: 20, w: 70 }),
        ],
      })],
      width: { size: 100, type: WidthType.PERCENTAGE },
    }),
    arrow(),
  ];
}

// ─── CONTENT BUILDER ─────────────────────────────────────────────────
const children = [];

// ══════════════════════════════════════════════════════════════════════
// TITLE PAGE
// ══════════════════════════════════════════════════════════════════════
children.push(
  new Paragraph({ spacing: { before: 600 } }),
  new Paragraph({
    children: [new TextRun({ text: "REPRODUCTIVE PHYSIOLOGY", bold: true, color: WHITE, size: 52 })],
    alignment: AlignmentType.CENTER,
    shading: { type: ShadingType.SOLID, color: BLUE },
    spacing: { before: 200, after: 60 },
  }),
  new Paragraph({
    children: [new TextRun({ text: "MBBS 1st Year — Professional Exam Notes", bold: false, color: WHITE, size: 28 })],
    alignment: AlignmentType.CENTER,
    shading: { type: ShadingType.SOLID, color: LBLUE },
    spacing: { before: 0, after: 200 },
  }),
  new Paragraph({
    children: [new TextRun({ text: "Flowcharts • Diagrams • Tables • High-Yield Points", italics: true, color: LBLUE, size: 24 })],
    alignment: AlignmentType.CENTER,
    spacing: { before: 200, after: 60 },
  }),
  new Paragraph({
    children: [new TextRun({ text: "Sources: Costanzo Physiology 7e | Ganong's 26e | Guyton & Hall | Berek & Novak", italics: true, color: DARKGREY, size: 20 })],
    alignment: AlignmentType.CENTER,
    spacing: { before: 60, after: 400 },
  }),
  pageBreak()
);

// ══════════════════════════════════════════════════════════════════════
// SECTION 1 — HPG AXIS FLOWCHART
// ══════════════════════════════════════════════════════════════════════
children.push(
  heading1("1. HYPOTHALAMO-PITUITARY-GONADAL (HPG) AXIS"),
  para("The entire reproductive system is governed by a 3-tier hormonal hierarchy."),
  divider(),
);

// Flowchart built as a vertical table
const hpgRows = [
  ["HYPOTHALAMUS", "Arcuate nucleus\nPulse generator → GnRH (pulsatile, q 60-90 min)\nContinuous GnRH → downregulation (used therapeutically)", BLUE, WHITE],
  ["↓  GnRH  ↓", "Gonadotropin-Releasing Hormone (decapeptide)", LBLUE, WHITE],
  ["ANTERIOR PITUITARY", "Gonadotroph cells\nFSH + LH secreted in response to GnRH", TEAL, WHITE],
  ["↓  FSH + LH  ↓", "Gonadotropins travel via bloodstream", LTBLUE, TEAL],
  ["GONADS (Testes / Ovaries)", "Testes: Sertoli cells (FSH) + Leydig cells (LH)\nOvaries: Granulosa cells (FSH) + Theca cells (LH)", LGREEN, GREEN],
  ["↑  Negative Feedback  ↑", "Testosterone / Estrogen / Inhibin → suppress hypothalamus & pituitary", LORANGE, PINK],
  ["⚡ EXCEPTION: Positive Feedback", "High sustained estrogen (>200 pg/mL, >50 hrs) → triggers LH SURGE → Ovulation", LYELLOW, PINK],
];

const hpgTable = new Table({
  rows: hpgRows.map(([label, detail, shade, tc]) =>
    new TableRow({
      children: [
        makeCell(label, { shade, bold: true, textColor: tc, align: AlignmentType.CENTER, size: 22, w: 30 }),
        makeCell(detail, { shade: label.includes("↓") || label.includes("↑") ? shade : WHITE, textColor: BLACK, align: AlignmentType.LEFT, size: 20, w: 70 }),
      ],
    })
  ),
  width: { size: 100, type: WidthType.PERCENTAGE },
});
children.push(hpgTable, para(""), divider());

// Key regulators table
children.push(heading2("Key Regulatory Hormones"));
children.push(simpleTable(
  ["Hormone", "Source", "Target", "Key Action"],
  [
    ["GnRH", "Hypothalamus", "Ant. Pituitary", "Stimulates FSH + LH (must be pulsatile)"],
    ["FSH", "Ant. Pituitary", "Sertoli / Granulosa cells", "Spermatogenesis / Follicle development"],
    ["LH", "Ant. Pituitary", "Leydig / Theca cells", "Testosterone / Androgen synthesis"],
    ["Inhibin", "Sertoli / Granulosa", "Ant. Pituitary", "Selectively suppresses FSH"],
    ["Testosterone", "Leydig cells", "Multiple", "Secondary sex characteristics, spermatogenesis"],
    ["Estradiol (E2)", "Granulosa cells", "Multiple", "Follicular phase, positive feedback → LH surge"],
    ["Progesterone", "Corpus luteum", "Uterus / Pituitary", "Secretory phase, maintain pregnancy"],
    ["hCG", "Trophoblast", "Corpus luteum", "Maintains CL in early pregnancy"],
  ],
));
children.push(para(""), pageBreak());

// ══════════════════════════════════════════════════════════════════════
// SECTION 2 — MALE REPRODUCTIVE PHYSIOLOGY
// ══════════════════════════════════════════════════════════════════════
children.push(
  heading1("2. MALE REPRODUCTIVE PHYSIOLOGY"),
  heading2("A. Testicular Structure"),
);

children.push(simpleTable(
  ["Component", "% of Testis", "Cell Type", "Function"],
  [
    ["Seminiferous tubules", "80%", "Sertoli cells + Spermatogonia", "Spermatogenesis"],
    ["Connective tissue + Leydig", "20%", "Leydig cells", "Testosterone synthesis"],
    ["Epididymis", "—", "Stereocilia epithelium", "Sperm maturation & storage"],
  ],
));

children.push(
  heading2("B. Sertoli Cell Functions"),
  para("Regulated by FSH. Located in seminiferous tubule epithelium."),
);
const sertoliFn = [
  ["1. NUTRITIVE", "Provide nutrients to developing sperm (isolated from blood)", LLBLUE],
  ["2. BLOOD-TESTIS BARRIER", "Tight junctions between Sertoli cells; selective permeability; protects developing sperm", LLBLUE],
  ["3. FLUID SECRETION", "Aqueous fluid → transports sperm toward epididymis", LGREEN],
  ["4. ANDROGEN-BINDING PROTEIN (ABP)", "Secreted into tubule lumen; maintains high local testosterone near sperm", LYELLOW],
];
children.push(new Table({
  rows: sertoliFn.map(([fn, detail, shade]) =>
    new TableRow({ children: [
      makeCell(fn, { shade: LBLUE, bold: true, textColor: WHITE, align: AlignmentType.CENTER, w: 35 }),
      makeCell(detail, { shade, textColor: BLACK, w: 65 }),
    ]})
  ),
  width: { size: 100, type: WidthType.PERCENTAGE },
}));

// Spermatogenesis Flowchart
children.push(
  heading2("C. Spermatogenesis Flowchart"),
  para("Duration: ~64 days | Output: 128 million sperm/day", { bold: true }),
  para(""),
);

const spermFlow = new Table({
  rows: [
    new TableRow({ children: [
      makeCell("SPERMATOGONIUM (2n)", { shade: BLUE, bold: true, textColor: WHITE, align: AlignmentType.CENTER }),
      makeCell("Stem cell | Mitotic divisions in basal compartment of seminiferous tubule", { shade: LLBLUE }),
    ]}),
    new TableRow({ children: [
      makeCell("↓ Mitosis ↓", { shade: LTBLUE, bold: true, textColor: TEAL, align: AlignmentType.CENTER }),
      makeCell("", { shade: WHITE }),
    ]}),
    new TableRow({ children: [
      makeCell("PRIMARY SPERMATOCYTE (2n)", { shade: LBLUE, bold: true, textColor: WHITE, align: AlignmentType.CENTER }),
      makeCell("Largest cell; enters Meiosis I; arrested in prophase I for days", { shade: LLBLUE }),
    ]}),
    new TableRow({ children: [
      makeCell("↓ Meiosis I ↓", { shade: LTBLUE, bold: true, textColor: TEAL, align: AlignmentType.CENTER }),
      makeCell("Reductional division: chromosome number halved", { shade: WHITE }),
    ]}),
    new TableRow({ children: [
      makeCell("SECONDARY SPERMATOCYTE (n)", { shade: TEAL, bold: true, textColor: WHITE, align: AlignmentType.CENTER }),
      makeCell("Haploid; short-lived; quickly enters Meiosis II", { shade: LLBLUE }),
    ]}),
    new TableRow({ children: [
      makeCell("↓ Meiosis II ↓", { shade: LTBLUE, bold: true, textColor: TEAL, align: AlignmentType.CENTER }),
      makeCell("Equational division: sister chromatids separated", { shade: WHITE }),
    ]}),
    new TableRow({ children: [
      makeCell("SPERMATID (n)", { shade: GREEN, bold: true, textColor: WHITE, align: AlignmentType.CENTER }),
      makeCell("Round cell; haploid; no further division", { shade: LGREEN }),
    ]}),
    new TableRow({ children: [
      makeCell("↓ Spermiogenesis ↓", { shade: LGREEN, bold: true, textColor: GREEN, align: AlignmentType.CENTER }),
      makeCell("Morphological transformation: acrosome, flagellum, loss of cytoplasm", { shade: WHITE }),
    ]}),
    new TableRow({ children: [
      makeCell("MATURE SPERMATOZOON (n)", { shade: PINK, bold: true, textColor: WHITE, align: AlignmentType.CENTER }),
      makeCell("Head + midpiece + tail; 64 sperm from each spermatogonium", { shade: LORANGE }),
    ]}),
  ],
  width: { size: 100, type: WidthType.PERCENTAGE },
});
children.push(spermFlow);

// Testosterone table
children.push(heading2("D. Testosterone — Actions"), para(""));
children.push(simpleTable(
  ["Action mediated by TESTOSTERONE", "Action mediated by DHT (5α-reductase)"],
  [
    ["Differentiation: epididymis, vas deferens, seminal vesicles", "Differentiation: penis, scrotum, prostate"],
    ["Increased muscle mass", "Male hair pattern (beard, chest)"],
    ["Pubertal growth spurt", "Male pattern baldness"],
    ["Epiphyseal closure", "Sebaceous gland activity"],
    ["Deepening of voice", "Growth of prostate"],
    ["Spermatogenesis", ""],
    ["Negative feedback on pituitary", ""],
    ["Libido", ""],
  ],
  [50, 50]
));

// Sperm pathway diagram
children.push(heading2("E. Sperm Pathway (ASCII Flowchart)"), para(""));
const spermPath = new Table({
  rows: [
    ["TESTES (Seminiferous tubules)"],
    ["↓"],
    ["RETE TESTIS"],
    ["↓"],
    ["EFFERENT DUCTULES"],
    ["↓"],
    ["EPIDIDYMIS → Maturation + Storage (viable months)"],
    ["↓"],
    ["VAS DEFERENS → smooth muscle contractions at ejaculation"],
    ["↓"],
    ["EJACULATORY DUCT (joins seminal vesicle duct)"],
    ["↓"],
    ["URETHRA (+ prostate secretions added)"],
    ["↓"],
    ["EJACULATE: Seminal vesicles 60% + Prostate 30% + Sperm 10%"],
  ].map(([t], i) => new TableRow({ children: [
    makeCell(t, {
      shade: i % 2 === 0 ? LLBLUE : WHITE,
      bold: !t.includes("↓"),
      textColor: t.includes("↓") ? LBLUE : TEAL,
      align: AlignmentType.CENTER,
    }),
  ]})),
  width: { size: 80, type: WidthType.PERCENTAGE },
});
children.push(spermPath, para(""), pageBreak());

// ══════════════════════════════════════════════════════════════════════
// SECTION 3 — FEMALE REPRODUCTIVE PHYSIOLOGY
// ══════════════════════════════════════════════════════════════════════
children.push(heading1("3. FEMALE REPRODUCTIVE PHYSIOLOGY"));

// Oogenesis flowchart
children.push(heading2("A. Oogenesis Flowchart"), para(""));
const oogenesisFlow = new Table({
  rows: [
    ["Gestational weeks 4-6:\nPrimordial germ cells migrate to gonadal ridge → OOGONIA (2n) — multiply by MITOSIS"],
    ["Gestational weeks 8-9:\nOogonia → PRIMARY OOCYTES — enter Meiosis I — ARRESTED in Prophase I ← key exam point"],
    ["Gestational weeks 20-24:\nPeak 7 MILLION oogonia/oocytes"],
    ["AT BIRTH:\n~2 million oocytes remain (atresia begins)"],
    ["AT PUBERTY:\n~400,000 oocytes remain"],
    ["EACH CYCLE (after puberty):\nFSH recruits 6-12 follicles → dominant follicle selected → meiosis I RESUMES"],
    ["JUST BEFORE OVULATION:\nMeiosis I COMPLETED → Secondary oocyte (n) + First polar body\nSecondary oocyte ARRESTED at Metaphase II"],
    ["AT FERTILIZATION (only if sperm penetrates):\nMeiosis II COMPLETED → Mature ovum (n) + Second polar body"],
    ["AT MENOPAUSE:\nFew/no oocytes remain"],
  ].map(([t], i) => new TableRow({ children: [
    makeCell(t, {
      shade: [BLUE, LBLUE, LTBLUE, LLBLUE, LGREEN, LYELLOW, LORANGE, LGREEN, LGREY][i] || WHITE,
      bold: false,
      textColor: i < 2 ? WHITE : BLACK,
      align: AlignmentType.LEFT,
    }),
  ]})),
  width: { size: 100, type: WidthType.PERCENTAGE },
});
children.push(oogenesisFlow);

// Key numbers
children.push(heading3("Key Numbers — Oogenesis"), simpleTable(
  ["Timepoint", "Number of Oocytes"],
  [
    ["Peak (Gestational weeks 20-24)", "~7 million"],
    ["Birth", "~2 million"],
    ["Puberty", "~400,000"],
    ["Each month ovulated", "1 (usually)"],
    ["Menopause", "~0"],
  ],
  [60, 40]
));

// Follicle Development
children.push(heading2("B. Follicular Development Stages"), para(""));
children.push(new Table({
  rows: [
    new TableRow({ children: [
      makeCell("Stage", { shade: BLUE, bold: true, textColor: WHITE, align: AlignmentType.CENTER, w: 25 }),
      makeCell("Structure", { shade: BLUE, bold: true, textColor: WHITE, align: AlignmentType.CENTER, w: 40 }),
      makeCell("Stimulus", { shade: BLUE, bold: true, textColor: WHITE, align: AlignmentType.CENTER, w: 35 }),
    ]}),
    new TableRow({ children: [
      makeCell("Primordial follicle", { shade: LLBLUE, bold: true, w: 25 }),
      makeCell("Oocyte + single flat granulosa cell layer", { w: 40 }),
      makeCell("None (quiescent)", { w: 35 }),
    ]}),
    new TableRow({ children: [
      makeCell("Primary follicle", { shade: LGREEN, bold: true, w: 25 }),
      makeCell("Oocyte + cuboidal granulosa (multi-layer)", { w: 40 }),
      makeCell("FSH (early)", { w: 35 }),
    ]}),
    new TableRow({ children: [
      makeCell("Secondary follicle", { shade: LYELLOW, bold: true, w: 25 }),
      makeCell("+ Theca interna + Theca externa form", { w: 40 }),
      makeCell("FSH + local estrogen", { w: 35 }),
    ]}),
    new TableRow({ children: [
      makeCell("Antral (Graafian) follicle", { shade: LORANGE, bold: true, w: 25 }),
      makeCell("Antrum filled with estrogen-rich fluid\nZona pellucida visible", { w: 40 }),
      makeCell("FSH + LH (both needed)", { w: 35 }),
    ]}),
    new TableRow({ children: [
      makeCell("Dominant follicle", { shade: PINK, bold: true, textColor: WHITE, w: 25 }),
      makeCell("One selected ~Day 6; others → atresia", { w: 40 }),
      makeCell("Estrogen positive feedback on self (more FSH receptors)", { w: 35 }),
    ]}),
  ],
  width: { size: 100, type: WidthType.PERCENTAGE },
}));

// Two-cell two-gonadotropin
children.push(
  heading2("C. Two-Cell, Two-Gonadotropin Theory"),
  para(""),
  new Table({
    rows: [
      new TableRow({ children: [
        makeCell("THECA INTERNA CELL\n(stimulated by LH)", { shade: LBLUE, bold: true, textColor: WHITE, align: AlignmentType.CENTER }),
        makeCell("", { shade: WHITE, align: AlignmentType.CENTER }),
        makeCell("GRANULOSA CELL\n(stimulated by FSH)", { shade: GREEN, bold: true, textColor: WHITE, align: AlignmentType.CENTER }),
      ]}),
      new TableRow({ children: [
        makeCell("Produces ANDROGENS\n(androstenedione, testosterone)", { shade: LLBLUE, align: AlignmentType.CENTER }),
        makeCell("→ Diffuse across basement membrane →", { shade: LGREY, align: AlignmentType.CENTER, bold: true, textColor: LBLUE }),
        makeCell("AROMATASE converts\nAndrogens → ESTROGENS", { shade: LGREEN, align: AlignmentType.CENTER }),
      ]}),
      new TableRow({ children: [
        makeCell("", { shade: WHITE }),
        makeCell("→ ESTRADIOL (E2) released into circulation", { shade: LYELLOW, align: AlignmentType.CENTER, bold: true, textColor: PINK }),
        makeCell("", { shade: WHITE }),
      ]}),
    ],
    width: { size: 100, type: WidthType.PERCENTAGE },
  }),
  para(""),
  pageBreak()
);

// ══════════════════════════════════════════════════════════════════════
// SECTION 4 — MENSTRUAL CYCLE
// ══════════════════════════════════════════════════════════════════════
children.push(heading1("4. THE MENSTRUAL CYCLE — FLOWCHART"));
children.push(para("Average: 28 days | Day 1 = First day of menstrual bleeding", { bold: true }));
children.push(para(""));

// Menstrual cycle as a large flowchart-table
const mcRows = [
  // Headers
  null,
  // Menstrual phase
  ["DAYS 1–5\nMENSTRUAL PHASE", "Uterine endometrium sheds\n→ Menstrual bleeding\nSpiral arteries vasospasm → ischemia → necrosis", "FSH ↑ slightly (rising)\nEstrogen LOW\nProgesterone LOW", PINK, WHITE],
  ["↓", "", "", LGREY, DARKGREY],
  ["DAYS 1–14\nFOLLICULAR PHASE\n(PROLIFERATIVE)", "Dominant follicle grows\nGranulosa cells produce estradiol\nEndometrium proliferates\nCervical mucus: watery, elastic, FERNING (+)", "FSH → ↓ as E2 rises\nLH low\nE2 → rising peak", LBLUE, WHITE],
  ["↓", "", "", LGREY, DARKGREY],
  ["DAY ~12-13\nPRE-OVULATORY", "E2 > 200 pg/mL sustained >50 hrs\n→ POSITIVE FEEDBACK\n→ Anterior pituitary: massive LH SURGE", "LH SURGE ← critical\nFSH mid-cycle surge (progesterone effect)\nE2 peaks just before ovulation", TEAL, WHITE],
  ["↓", "", "", LGREY, DARKGREY],
  ["DAY 14\nOVULATION", "Dominant follicle ruptures\nOocyte released into peritoneal cavity\nPicked up by fimbriae of fallopian tube\nMittelschmerz (fleeting pelvic pain)", "LH surge → ~36 hrs → OVULATION\nFollicle wall enzymes (collagenase)\n+ Prostaglandins → rupture", BLUE, WHITE],
  ["↓", "", "", LGREY, DARKGREY],
  ["DAYS 14–28\nLUTEAL PHASE\n(SECRETORY)", "Corpus luteum forms from ruptured follicle\nSecrets progesterone + estrogen\nEndometrium: tortuous glands, glycogen, edema\nCervical mucus: thick, non-elastic, NO FERNING\nBBT rises ~0.5°C", "Progesterone HIGH\nEstrogen moderate\nFSH + LH LOW (neg. feedback)", LGREEN, BLACK],
  ["↓", "", "", LGREY, DARKGREY],
  ["DAY 28 — NO PREGNANCY", "Corpus luteum degenerates → Corpus albicans\n↓ Estrogen + Progesterone → Withdrawal bleeding\n→ NEW CYCLE BEGINS", "All hormones fall\nFSH starts rising → next cycle", LORANGE, BLACK],
  ["↓ PREGNANCY", "hCG from trophoblast (LH-like)\n→ Rescues corpus luteum\n→ Continues progesterone until placenta takes over (~10 wks)", "hCG detectable from day ~8-10 post-fertilization\nBasis of pregnancy tests", LYELLOW, BLACK],
];

const mcTable = new Table({
  rows: mcRows.slice(1).map(([phase, endo, hormones, shade, tc]) => {
    if (phase === "↓") {
      return new TableRow({ children: [
        makeCell("↓", { shade: LGREY, bold: true, textColor: LBLUE, align: AlignmentType.CENTER }),
        makeCell("", { shade: WHITE }),
        makeCell("", { shade: WHITE }),
      ]});
    }
    return new TableRow({ children: [
      makeCell(phase, { shade, bold: true, textColor: tc, align: AlignmentType.CENTER, w: 20 }),
      makeCell(endo, { shade: WHITE, textColor: BLACK, w: 50 }),
      makeCell(hormones, { shade: LGREY, textColor: DARKGREY, w: 30 }),
    ]});
  }),
  width: { size: 100, type: WidthType.PERCENTAGE },
});
children.push(mcTable);

// Hormone level summary
children.push(heading2("Hormone Levels at a Glance"), para(""), simpleTable(
  ["Phase", "FSH", "LH", "Estrogen", "Progesterone"],
  [
    ["Menstrual (D1-5)", "↑ Rising", "Low", "Low", "Low"],
    ["Follicular (D5-14)", "↑ then ↓", "Low", "Rising", "Low"],
    ["Ovulation (D14)", "Mid-surge", "⚡ SURGE", "Peak (just before)", "Low"],
    ["Luteal (D14-28)", "Low", "Low", "Moderate", "HIGH ↑"],
    ["If pregnant", "Suppressed", "Suppressed", "Rising", "HIGH (CL + placenta)"],
  ],
  [22, 15, 15, 25, 23]
));
children.push(para(""), pageBreak());

// ══════════════════════════════════════════════════════════════════════
// SECTION 5 — CERVICAL MUCUS & ENDOMETRIUM
// ══════════════════════════════════════════════════════════════════════
children.push(heading1("5. CERVICAL MUCUS & ENDOMETRIAL CHANGES"));
children.push(simpleTable(
  ["Feature", "FOLLICULAR (Estrogen dominant)", "LUTEAL (Progesterone dominant)"],
  [
    ["Cervical mucus", "Copious, watery, elastic", "Scant, thick, non-elastic"],
    ["Ferning pattern", "PRESENT (spinn-barkheit, sperm-friendly)", "ABSENT (sperm-hostile)"],
    ["Endometrium", "Proliferates (glands + stroma grow)", "Secretory (glands tortuous, glycogen, edema)"],
    ["Spiral arteries", "Elongate", "Coil + elongate further"],
    ["BBT", "Lower (pre-ovulatory baseline)", "Rises ~0.5°C (thermogenic effect of P4)"],
    ["Sperm penetration", "Easy (channels in mucus)", "Blocked"],
  ],
  [25, 37, 38]
));

children.push(heading2("Endometrial Phases in Detail"), para(""));
children.push(new Table({
  rows: [
    new TableRow({ children: [
      makeCell("Phase", { shade: BLUE, bold: true, textColor: WHITE, align: AlignmentType.CENTER, w: 20 }),
      makeCell("Days", { shade: BLUE, bold: true, textColor: WHITE, align: AlignmentType.CENTER, w: 10 }),
      makeCell("Hormone", { shade: BLUE, bold: true, textColor: WHITE, align: AlignmentType.CENTER, w: 15 }),
      makeCell("Histological Changes", { shade: BLUE, bold: true, textColor: WHITE, align: AlignmentType.CENTER, w: 55 }),
    ]}),
    new TableRow({ children: [
      makeCell("Menstrual", { shade: LORANGE, w: 20 }), makeCell("1–5", { shade: LORANGE, w: 10 }), makeCell("Low E + P", { shade: LORANGE, w: 15 }),
      makeCell("Functional layer shed; spiral arteries vasospasm; prostaglandin-induced ischemia", { w: 55 }),
    ]}),
    new TableRow({ children: [
      makeCell("Proliferative", { shade: LGREEN, w: 20 }), makeCell("5–14", { shade: LGREEN, w: 10 }), makeCell("Estrogen ↑", { shade: LGREEN, w: 15 }),
      makeCell("Straight tubular glands; mitoses in stroma; compact; stromal edema absent", { w: 55 }),
    ]}),
    new TableRow({ children: [
      makeCell("Early Secretory", { shade: LYELLOW, w: 20 }), makeCell("14–21", { shade: LYELLOW, w: 10 }), makeCell("Progesterone ↑", { shade: LYELLOW, w: 15 }),
      makeCell("Subnuclear vacuoles in glands (glycogen below nucleus) ← EARLIEST secretory change", { w: 55 }),
    ]}),
    new TableRow({ children: [
      makeCell("Late Secretory", { shade: LLBLUE, w: 20 }), makeCell("21–28", { shade: LLBLUE, w: 10 }), makeCell("P4 + E2", { shade: LLBLUE, w: 15 }),
      makeCell("Glands tortuous + serrated ('saw-tooth'); stromal edema; decidualization; coiled arteries", { w: 55 }),
    ]}),
  ],
  width: { size: 100, type: WidthType.PERCENTAGE },
}));
children.push(para(""), pageBreak());

// ══════════════════════════════════════════════════════════════════════
// SECTION 6 — FERTILIZATION & IMPLANTATION
// ══════════════════════════════════════════════════════════════════════
children.push(heading1("6. FERTILIZATION & IMPLANTATION FLOWCHART"), para(""));

const fertFlow = new Table({
  rows: [
    ["OVULATION → Oocyte released into peritoneal cavity\n(Still in Metaphase II — meiosis not yet complete)", BLUE, WHITE],
    ["↓ Fimbriae pick up oocyte → Transport in fallopian tube", LGREY, DARKGREY],
    ["CAPACITATION OF SPERM in female tract\n(Removal of cholesterol from sperm membrane → hypermotility, hyperactivation)", LBLUE, WHITE],
    ["↓ 50-100 sperm reach the ampulla", LGREY, DARKGREY],
    ["SPERM CONTACT: Zona Pellucida binding via ZP3 receptor", LTBLUE, TEAL],
    ["↓", LGREY, DARKGREY],
    ["ACROSOMAL REACTION: Acrosome releases enzymes (acrosin - trypsin-like)\n→ Zona penetration", LYELLOW, BLACK],
    ["↓", LGREY, DARKGREY],
    ["SPERM-EGG FUSION via FERTILIN protein on sperm head\n→ Sperm nucleus enters oocyte cytoplasm", LGREEN, BLACK],
    ["↓", LGREY, DARKGREY],
    ["PREVENTION OF POLYSPERMY:\n1. Fast block: Rapid change in oocyte membrane potential\n2. Slow block: Cortical reaction → Zona hardening", LORANGE, BLACK],
    ["↓", LGREY, DARKGREY],
    ["MEIOSIS II COMPLETED: Secondary oocyte → Mature ovum + 2nd polar body\nZygote (2n) formed", LGREEN, BLACK],
    ["↓ Cleavage divisions begin", LGREY, DARKGREY],
    ["Day 1-3: Zygote → 2-cell → 4-cell → 8-cell → Morula", LLBLUE, TEAL],
    ["↓ Travels down fallopian tube (~3 days)", LGREY, DARKGREY],
    ["Day 4-5: BLASTOCYST forms (inner cell mass + trophoblast)", LTBLUE, TEAL],
    ["↓ Enters uterine cavity", LGREY, DARKGREY],
    ["Day 6-7: IMPLANTATION in posterior wall of uterine body\n(Trophoblast cells invade decidualized endometrium)", BLUE, WHITE],
    ["↓", LGREY, DARKGREY],
    ["TROPHOBLAST secretes hCG → Rescues corpus luteum → Continued progesterone\n→ PREGNANCY MAINTAINED", PINK, WHITE],
  ].map(([t, shade, tc]) => new TableRow({ children: [
    makeCell(t, { shade, textColor: tc, align: t === "↓" ? AlignmentType.CENTER : AlignmentType.LEFT, bold: !t.startsWith("↓") && !t.startsWith("Day") }),
  ]})),
  width: { size: 100, type: WidthType.PERCENTAGE },
});
children.push(fertFlow);
children.push(para(""), pageBreak());

// ══════════════════════════════════════════════════════════════════════
// SECTION 7 — ESTROGEN & PROGESTERONE ACTIONS
// ══════════════════════════════════════════════════════════════════════
children.push(heading1("7. ESTROGEN & PROGESTERONE — ACTIONS DIAGRAM"));
children.push(new Table({
  rows: [
    new TableRow({ children: [
      makeCell("TARGET ORGAN", { shade: BLUE, bold: true, textColor: WHITE, align: AlignmentType.CENTER, w: 20 }),
      makeCell("ESTROGEN (E2) ACTION", { shade: LBLUE, bold: true, textColor: WHITE, align: AlignmentType.CENTER, w: 40 }),
      makeCell("PROGESTERONE (P4) ACTION", { shade: GREEN, bold: true, textColor: WHITE, align: AlignmentType.CENTER, w: 40 }),
    ]}),
    ...([
      ["Uterus", "Endometrial proliferation\nGrowth of glands + stroma\nSpiral artery elongation", "Secretory transformation\nGlycogens in glands\nRaised threshold for contractions (maintain pregnancy)"],
      ["Cervix", "Watery, elastic, copious mucus\nFerning (+) — sperm-friendly", "Thick, scant, non-elastic mucus\nFerning (−) — sperm-hostile"],
      ["Breast", "Ductal growth\nAreolar pigmentation\nFat deposition (female shape)", "Alveolar development\nSecretory activity in ducts"],
      ["Bone", "Pubertal growth spurt\nEpiphyseal closure at end of puberty", "Minimal direct effect"],
      ["Pituitary", "Negative feedback (usually)\nPositive feedback at mid-cycle surge\nStimulates prolactin secretion", "Negative feedback\nResponsible for FSH mid-cycle surge"],
      ["Fat distribution", "Subcutaneous fat (hips, thighs)", "Mild thermogenic effect (↑BBT 0.5°C)"],
      ["External genitalia", "Enlargement", "—"],
      ["Vagina", "Cornification of epithelium", "Decreased cornification"],
    ].map(([org, e, p], i) => new TableRow({ children: [
      makeCell(org, { shade: i % 2 === 0 ? LLBLUE : WHITE, bold: true, w: 20 }),
      makeCell(e, { shade: i % 2 === 0 ? LGREY : WHITE, w: 40 }),
      makeCell(p, { shade: i % 2 === 0 ? LGREEN : WHITE, w: 40 }),
    ]}))),
  ],
  width: { size: 100, type: WidthType.PERCENTAGE },
}));
children.push(para(""), pageBreak());

// ══════════════════════════════════════════════════════════════════════
// SECTION 8 — PUBERTY
// ══════════════════════════════════════════════════════════════════════
children.push(heading1("8. PUBERTY — SEQUENCE FLOWCHART"));

children.push(heading2("Female Puberty (mnemonic: THELARCHE first)"), para(""));
const femalePuberty = new Table({
  rows: [
    ["1. THELARCHE (Breast bud)", "First sign of puberty in girls\nAverage age: 8-13 years\nEstrogen-driven", LLBLUE],
    ["2. PUBARCHE", "Pubic and axillary hair growth\nAdrenal androgens (adrenarche)", LGREEN],
    ["3. PEAK GROWTH SPURT", "Estrogen + GH → rapid height gain", LYELLOW],
    ["4. MENARCHE", "First menstrual period\nAverage age: 12-13 years (range 10-16)\nInitially anovulatory cycles common", LORANGE],
    ["5. ADULT BODY COMPOSITION", "Final fat distribution, bone density\nEpiphyseal closure", LGREY],
  ].map(([step, detail, shade]) => new TableRow({ children: [
    makeCell(step, { shade: LBLUE, bold: true, textColor: WHITE, align: AlignmentType.CENTER, w: 30 }),
    makeCell(detail, { shade, w: 70 }),
  ]})),
  width: { size: 100, type: WidthType.PERCENTAGE },
});
children.push(femalePuberty);

children.push(heading2("Male Puberty"), para(""));
const malePuberty = new Table({
  rows: [
    ["1. TESTICULAR ENLARGEMENT", "First sign in boys\nAverage age: 9-14 years\nLH → Leydig cells → testosterone", LLBLUE],
    ["2. PUBARCHE + SCROTAL PIGMENTATION", "Androgens → pubic, axillary, facial hair", LGREEN],
    ["3. PENILE GROWTH + VOICE CHANGE", "Testosterone → laryngeal enlargement → deepening", LYELLOW],
    ["4. PEAK GROWTH SPURT", "Later than females; taller final height", LORANGE],
    ["5. SPERMARCHE", "First ejaculation with sperm\nMay have nocturnal emissions", LGREY],
  ].map(([step, detail, shade]) => new TableRow({ children: [
    makeCell(step, { shade: TEAL, bold: true, textColor: WHITE, align: AlignmentType.CENTER, w: 30 }),
    makeCell(detail, { shade, w: 70 }),
  ]})),
  width: { size: 100, type: WidthType.PERCENTAGE },
});
children.push(malePuberty, para(""), pageBreak());

// ══════════════════════════════════════════════════════════════════════
// SECTION 9 — HIGH-YIELD QUICK REVISION
// ══════════════════════════════════════════════════════════════════════
children.push(heading1("9. HIGH-YIELD EXAM SUMMARY"));

children.push(heading2("Key Numbers Table"), simpleTable(
  ["Fact", "Value"],
  [
    ["Duration of spermatogenesis", "64 days"],
    ["Sperm produced daily", "~128 million"],
    ["Peak oogonia (gestational wks 20-24)", "~7 million"],
    ["Oocytes at birth", "~2 million"],
    ["Oocytes at puberty", "~400,000"],
    ["Average menstrual cycle", "28 days"],
    ["Ovulation after LH surge", "~36 hours"],
    ["Fertilization → implantation", "~6-7 days"],
    ["Fallopian tube transit time", "~3 days"],
    ["BBT rise at ovulation", "~0.5°C"],
    ["Testicular temperature", "35-36°C (1-2°C below body)"],
    ["hCG detectable (post-fertilization)", "~Day 8-10"],
    ["Placenta takes over from CL", "~10 weeks gestation"],
  ],
  [70, 30]
));

children.push(heading2("Cells and Hormones — Quick Reference"), simpleTable(
  ["Cell", "Hormone Produced", "Regulated By"],
  [
    ["Leydig cells (testis)", "Testosterone", "LH"],
    ["Sertoli cells (testis)", "Inhibin, ABP, fluid", "FSH"],
    ["Theca interna (ovary)", "Androgens → aromatized to estrogen", "LH"],
    ["Granulosa cells (ovary)", "Estrogen (via aromatase), Inhibin", "FSH"],
    ["Corpus luteum", "Progesterone + Estrogen", "LH (then hCG)"],
    ["Trophoblast (early pregnancy)", "hCG", "—"],
    ["Placenta (mid-late pregnancy)", "Progesterone + Estrogen", "—"],
  ],
));

children.push(heading2("Top 12 Exam Points"), para(""));
const examPoints = [
  "Blood-testis barrier = tight junctions between SERTOLI cells (not Leydig cells)",
  "FSH → Sertoli cells (spermatogenesis) | LH → Leydig cells (testosterone) — memorize this",
  "Female meiosis arrested in PROPHASE I from fetal life until ovulation — completed at fertilization",
  "FERNING of cervical mucus = follicular/estrogenic phase; NO ferning = luteal/progestogenic phase",
  "MITTELSCHMERZ = mid-cycle pain at ovulation (minor blood irritating peritoneum)",
  "POSITIVE feedback: High sustained estrogen → LH surge → Ovulation (unique exception to negative feedback)",
  "hCG = 'pregnancy hormone'; same α-subunit as LH/FSH/TSH; rescues corpus luteum in early pregnancy",
  "INHIBIN selectively suppresses FSH (not LH) — from Sertoli cells and granulosa cells",
  "Testosterone → muscle/voice/libido; DHT (5α-reduced) → prostate/hair/genitalia",
  "GnRH must be PULSATILE — continuous GnRH = receptor downregulation = no gonadotropins (used for endometriosis, prostate CA)",
  "Corpus luteum → progesterone dominance; if no pregnancy → luteolysis → withdrawal bleeding",
  "Subnuclear vacuoles in endometrial glands = EARLIEST histological sign of secretory (post-ovulatory) phase",
];
examPoints.forEach((pt, i) =>
  children.push(new Paragraph({
    children: [
      new TextRun({ text: `${i+1}. `, bold: true, color: PINK, size: 22 }),
      new TextRun({ text: pt, size: 22, color: BLACK }),
    ],
    spacing: { before: 80, after: 60 },
    shading: { type: ShadingType.SOLID, color: i % 2 === 0 ? LGREY : WHITE },
  }))
);

// Footer note
children.push(para(""), divider(), new Paragraph({
  children: [new TextRun({ text: "Notes compiled from: Costanzo Physiology 7e | Ganong's Review of Medical Physiology 26e | Guyton & Hall Textbook of Medical Physiology | Berek & Novak's Gynecology", italics: true, size: 18, color: DARKGREY })],
  alignment: AlignmentType.CENTER,
  spacing: { before: 100, after: 40 },
}));

// ─── BUILD DOC ────────────────────────────────────────────────────────

const doc = new Document({
  styles: {
    default: {
      document: {
        run: { font: "Calibri", size: 22 },
      },
    },
    paragraphStyles: [
      {
        id: "Heading1",
        name: "Heading 1",
        basedOn: "Normal",
        run: { bold: true, size: 32, color: WHITE, font: "Calibri" },
        paragraph: { spacing: { before: 360, after: 120 }, shading: { type: ShadingType.SOLID, color: BLUE } },
      },
      {
        id: "Heading2",
        name: "Heading 2",
        basedOn: "Normal",
        run: { bold: true, size: 26, color: TEAL, font: "Calibri" },
        paragraph: { spacing: { before: 240, after: 80 }, border: { bottom: { style: BorderStyle.SINGLE, color: LTBLUE, size: 4 } } },
      },
      {
        id: "Heading3",
        name: "Heading 3",
        basedOn: "Normal",
        run: { bold: true, size: 22, color: LBLUE, font: "Calibri" },
        paragraph: { spacing: { before: 160, after: 60 } },
      },
    ],
  },
  sections: [{
    properties: {
      page: {
        margin: {
          top: convertInchesToTwip(0.8),
          right: convertInchesToTwip(0.8),
          bottom: convertInchesToTwip(0.8),
          left: convertInchesToTwip(0.8),
        },
      },
    },
    headers: {
      default: new Header({
        children: [new Paragraph({
          children: [
            new TextRun({ text: "REPRODUCTIVE PHYSIOLOGY — MBBS 1st Year Notes", bold: true, color: WHITE, size: 18 }),
            new TextRun({ text: "        Page ", size: 18, color: WHITE }),
            new PageNumber({ type: "current", color: WHITE }),
          ],
          shading: { type: ShadingType.SOLID, color: BLUE },
          spacing: { before: 80, after: 80 },
        })],
      }),
    },
    children,
  }],
});

Packer.toBuffer(doc).then(buf => {
  fs.writeFileSync("/home/daytona/workspace/repro-physiology/Reproductive_Physiology_Notes.docx", buf);
  console.log("Done: Reproductive_Physiology_Notes.docx");
}).catch(e => { console.error(e); process.exit(1); });
Running Command

cd /home/daytona/workspace/repro-physiology && node build.js 2>&1

Reading File
Editing File

~/repro-physiology/build.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/repro-physiology/build.js'
Running Command

cd /home/daytona/workspace/repro-physiology && node build.js 2>&1

Editing File

~/repro-physiology/build.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/repro-physiology/build.js'
Editing File

~/repro-physiology/build.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/repro-physiology/build.js'
Running Command

cd /home/daytona/workspace/repro-physiology && node build.js 2>&1

Running Command

python /home/daytona/skills/docx/scripts/office/validate.py /home/daytona/worksp…

Running Command

cd /home/daytona/workspace/repro-physiology && python -c "import zipfile; z=zipf…

Your Word document is ready for download:

Reproductive Physiology Notes

Word Document · DOCX


What's inside the document (9 sections, ~21 KB):
SectionContent
Title PageStyled cover with source references
1. HPG AxisFull flowchart table (Hypothalamus → Pituitary → Gonads → Feedback), key hormones table, positive vs. negative feedback
2. Male PhysiologyTesticular structure, Sertoli cell functions (4-row diagram), Spermatogenesis flowchart (Spermatogonium → Spermatozoon step-by-step), Testosterone actions table (T vs. DHT), Sperm pathway diagram
3. Female PhysiologyOogenesis flowchart (fetal to menopause), follicle development stages diagram, Two-cell Two-gonadotropin theory diagram
4. Menstrual CycleFull 28-day cycle flowchart (all 5 phases with hormones + endometrial changes), hormone levels table
5. Cervical Mucus & EndometriumFerning vs. no ferning comparison, endometrial phases histology table
6. Fertilization & ImplantationStep-by-step flowchart (capacitation → acrosomal reaction → polyspermy block → implantation → hCG)
7. Estrogen & ProgesteroneSide-by-side actions table (8 organ systems)
8. PubertySeparate flowcharts for female and male puberty sequences
9. High-Yield SummaryKey numbers table, cells & hormones quick-ref, Top 12 exam points highlighted
All tables are color-coded (blue = male/HPG, green = female/progesterone, orange = key events) for easy visual scanning during exam revision.
This is a shared conversation. Sign in to Orris to start your own chat.