Generate a notes of 4-5 pages for pituitary hypothalamic axis for menarche menopause
ls /home/daytona/workspace/ 2>/dev/null || echo "workspace empty or missing"
mkdir -p /home/daytona/workspace/hpa-notes
~/hpa-notes/generate_notes.js
const {
Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
HeadingLevel, AlignmentType, BorderStyle, WidthType, ShadingType,
PageNumber, PageBreak, VerticalAlign, Header, Footer, TabStopType
} = require('docx');
const fs = require('fs');
// ── Helpers ──────────────────────────────────────────────────────────────────
function heading1(text) {
return new Paragraph({
text,
heading: HeadingLevel.HEADING_1,
spacing: { before: 360, after: 120 },
border: {
bottom: { color: '2E74B5', size: 8, space: 4, style: BorderStyle.SINGLE }
}
});
}
function heading2(text) {
return new Paragraph({
text,
heading: HeadingLevel.HEADING_2,
spacing: { before: 260, after: 80 }
});
}
function heading3(text) {
return new Paragraph({
text,
heading: HeadingLevel.HEADING_3,
spacing: { before: 180, after: 60 }
});
}
function body(text) {
return new Paragraph({
children: [new TextRun({ text, size: 22 })],
spacing: { before: 60, after: 80 },
alignment: AlignmentType.JUSTIFIED
});
}
function bullet(text, bold_prefix) {
const children = [];
if (bold_prefix) {
children.push(new TextRun({ text: bold_prefix, bold: true, size: 22 }));
children.push(new TextRun({ text: ' ' + text, size: 22 }));
} else {
children.push(new TextRun({ text, size: 22 }));
}
return new Paragraph({
children,
bullet: { level: 0 },
spacing: { before: 40, after: 40 }
});
}
function subbullet(text, bold_prefix) {
const children = [];
if (bold_prefix) {
children.push(new TextRun({ text: bold_prefix, bold: true, size: 22 }));
children.push(new TextRun({ text: ' ' + text, size: 22 }));
} else {
children.push(new TextRun({ text, size: 22 }));
}
return new Paragraph({
children,
bullet: { level: 1 },
spacing: { before: 30, after: 30 }
});
}
function keybox(label, value) {
return new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({
children: [
new TableCell({
width: { size: 32, type: WidthType.PERCENTAGE },
shading: { type: ShadingType.SOLID, color: '2E74B5', fill: '2E74B5' },
verticalAlign: VerticalAlign.CENTER,
children: [new Paragraph({
children: [new TextRun({ text: label, bold: true, color: 'FFFFFF', size: 20 })],
alignment: AlignmentType.CENTER
})]
}),
new TableCell({
width: { size: 68, type: WidthType.PERCENTAGE },
shading: { type: ShadingType.SOLID, color: 'DEEAF1', fill: 'DEEAF1' },
children: [new Paragraph({
children: [new TextRun({ text: value, size: 20 })],
spacing: { before: 40, after: 40 }
})]
})
]
})
],
margins: { top: 40, bottom: 40 }
});
}
function spacer() {
return new Paragraph({ text: '', spacing: { before: 60, after: 60 } });
}
function pageBreak() {
return new Paragraph({
children: [new PageBreak()]
});
}
// ── Table builder ─────────────────────────────────────────────────────────────
function makeTable(headers, rows, colWidths) {
const headerRow = new TableRow({
tableHeader: true,
children: headers.map((h, i) => new TableCell({
width: { size: colWidths[i], type: WidthType.PERCENTAGE },
shading: { type: ShadingType.SOLID, color: '2E74B5', fill: '2E74B5' },
children: [new Paragraph({
children: [new TextRun({ text: h, bold: true, color: 'FFFFFF', size: 20 })],
alignment: AlignmentType.CENTER
})]
}))
});
const dataRows = rows.map(row => new TableRow({
children: row.map((cell, i) => new TableCell({
width: { size: colWidths[i], type: WidthType.PERCENTAGE },
children: [new Paragraph({
children: [new TextRun({ text: cell, size: 20 })],
spacing: { before: 40, after: 40 }
})]
}))
}));
return new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [headerRow, ...dataRows]
});
}
// ── Document ──────────────────────────────────────────────────────────────────
const doc = new Document({
styles: {
default: {
document: {
run: { font: 'Calibri', size: 22 },
paragraph: { spacing: { line: 276 } }
}
},
paragraphStyles: [
{
id: 'Heading1',
name: 'Heading 1',
run: { font: 'Calibri', size: 28, bold: true, color: '1F3864' },
paragraph: { spacing: { before: 360, after: 120 } }
},
{
id: 'Heading2',
name: 'Heading 2',
run: { font: 'Calibri', size: 24, bold: true, color: '2E74B5' },
paragraph: { spacing: { before: 240, after: 80 } }
},
{
id: 'Heading3',
name: 'Heading 3',
run: { font: 'Calibri', size: 22, bold: true, color: '2E74B5', italics: true },
paragraph: { spacing: { before: 160, after: 60 } }
}
]
},
sections: [
{
properties: {
page: {
margin: { top: 900, bottom: 900, left: 1080, right: 1080 }
}
},
headers: {
default: new Header({
children: [
new Paragraph({
children: [
new TextRun({ text: 'Hypothalamic-Pituitary-Gonadal Axis | Menarche to Menopause', size: 18, color: '595959', italics: true })
],
alignment: AlignmentType.RIGHT,
border: { bottom: { color: 'BFBFBF', size: 6, space: 4, style: BorderStyle.SINGLE } }
})
]
})
},
footers: {
default: new Footer({
children: [
new Paragraph({
children: [
new TextRun({ text: 'Sources: Guyton & Hall | Medical Physiology (Boron & Boulpaep) | Ganong\'s Review | Costanzo Physiology Page ', size: 18, color: '595959' }),
new TextRun({ children: [PageNumber.CURRENT], size: 18, color: '595959' })
],
alignment: AlignmentType.CENTER,
border: { top: { color: 'BFBFBF', size: 6, space: 4, style: BorderStyle.SINGLE } }
})
]
})
},
children: [
// ═══════════════════════════════════════════════════════════════════
// TITLE PAGE BLOCK
// ═══════════════════════════════════════════════════════════════════
new Paragraph({
children: [new TextRun({ text: '', size: 22 })],
spacing: { before: 0, after: 240 }
}),
new Paragraph({
children: [new TextRun({ text: 'HYPOTHALAMIC-PITUITARY-GONADAL AXIS', bold: true, size: 40, color: '1F3864' })],
alignment: AlignmentType.CENTER,
spacing: { before: 0, after: 120 }
}),
new Paragraph({
children: [new TextRun({ text: 'From Menarche to Menopause', bold: true, size: 30, color: '2E74B5' })],
alignment: AlignmentType.CENTER,
spacing: { before: 0, after: 60 }
}),
new Paragraph({
children: [new TextRun({ text: 'A Comprehensive Study Notes | Reproductive Endocrinology', size: 22, color: '595959', italics: true })],
alignment: AlignmentType.CENTER,
spacing: { before: 0, after: 480 }
}),
// ═══════════════════════════════════════════════════════════════════
// PAGE 1: OVERVIEW & ANATOMY OF THE AXIS
// ═══════════════════════════════════════════════════════════════════
heading1('1. Overview of the Hypothalamic-Pituitary-Gonadal (HPG) Axis'),
body('The HPG axis is a tightly integrated neuroendocrine feedback system that governs female reproductive function throughout life - from the onset of puberty (menarche) through the cessation of cycles (menopause). It operates via a hierarchy of three structures: the hypothalamus, the anterior pituitary gland, and the ovaries.'),
heading2('1.1 Components of the Axis'),
bullet('Hypothalamus - secretes Gonadotropin-Releasing Hormone (GnRH) in a pulsatile fashion from the arcuate nucleus and preoptic area.'),
bullet('Anterior Pituitary - gonadotrophs respond to GnRH by releasing Follicle-Stimulating Hormone (FSH) and Luteinizing Hormone (LH).'),
bullet('Ovaries - produce estrogens (mainly 17β-estradiol), progesterone, inhibins, and activins; they also mature and release the oocyte.'),
spacer(),
keybox('KEY CONCEPT', 'The uniqueness of the HPG axis lies in its capacity for BOTH negative AND positive feedback - a dual-mode regulation that is essential for generating the LH surge at midcycle, triggering ovulation.'),
spacer(),
heading2('1.2 GnRH - The Master Regulator'),
body('GnRH is a decapeptide synthesized in neurons of the arcuate nucleus and preoptic area of the hypothalamus. It is transported axonally to nerve terminals in the median eminence, where it is released into the hypothalamo-hypophyseal portal blood to reach the anterior pituitary.'),
bullet('Pulsatile secretion is essential:', 'Pulse frequency:'),
subbullet('Pulses every 60-90 minutes upregulate GnRH receptors on gonadotrophs → stimulate FSH/LH release.'),
subbullet('Continuous (non-pulsatile) GnRH causes receptor downregulation → suppresses gonadotropins (basis for GnRH agonist therapy in endometriosis, precocious puberty).'),
bullet('Half-life of GnRH in blood: only 2-4 minutes.'),
bullet('Monthly rhythm: a massive GnRH surge from preoptic neurons at midcycle drives the preovulatory LH surge.'),
heading2('1.3 KNDy-Kisspeptin Neurons - The Pulse Generator'),
body('KNDy neurons (containing Kisspeptin, Neurokinin B, and Dynorphin) in the arcuate nucleus act as the GnRH pulse generator. They are critical gatekeepers for pubertal activation and ongoing reproductive cycling.'),
bullet('Kisspeptin strongly stimulates GnRH release via Kiss1 receptors on GnRH neurons.'),
bullet('Neurokinin B amplifies kisspeptin-driven GnRH pulses.'),
bullet('Dynorphin provides inhibitory restraint, setting the pulse interval.'),
bullet('Mutations of the kisspeptin receptor gene are associated with pubertal disorders: activating mutations cause central precocious puberty; inactivating mutations delay or halt puberty.'),
heading2('1.4 Gonadotropins: FSH and LH'),
makeTable(
['Property', 'FSH', 'LH'],
[
['Cell of origin', 'Gonadotrophs (anterior pituitary)', 'Gonadotrophs (anterior pituitary)'],
['Primary target (ovary)', 'Granulosa cells', 'Theca cells & granulosa cells (at LH surge)'],
['Main action', 'Follicle growth; aromatase induction; inhibin production', 'Androgen synthesis; LH surge triggers ovulation; corpus luteum maintenance'],
['Feedback regulated by', 'Estradiol (-), Inhibin B (-), Activin (+)', 'Estradiol (- and + depending on level), Progesterone (-)'],
['Surge at menopause', 'Marked increase (FSH rises first)', 'Moderate increase']
],
[30, 35, 35]
),
pageBreak(),
// ═══════════════════════════════════════════════════════════════════
// PAGE 2: MENSTRUAL CYCLE & FEEDBACK MECHANISMS
// ═══════════════════════════════════════════════════════════════════
heading1('2. The Menstrual Cycle - HPG Axis in Action'),
body('The menstrual cycle averages 28 days and is divided into the follicular phase, ovulation, and the luteal phase. The HPG axis orchestrates precise hormonal changes during each phase through feedback loops.'),
heading2('2.1 Follicular Phase (Days 1-14)'),
bullet('FSH rises at the start of each cycle (due to fall of inhibin and estradiol from the preceding corpus luteum).'),
bullet('FSH stimulates growth of a cohort of primordial follicles → one dominant follicle is selected.'),
bullet('Granulosa cells of the growing follicle produce increasing amounts of estradiol.'),
bullet('Rising estradiol initially exerts NEGATIVE feedback → suppresses FSH (preventing further follicle recruitment).'),
bullet('Estradiol also stimulates proliferation of the endometrium (proliferative phase).'),
bullet('Late follicular phase: estradiol levels exceed 200 pg/mL for >48 hours → switches to POSITIVE feedback on the anterior pituitary → triggers the LH surge.'),
bullet('GnRH sensitivity of the pituitary increases late in the follicular phase, amplifying each GnRH pulse\'s effect.'),
heading2('2.2 Ovulation (around Day 14)'),
bullet('The LH surge (with a smaller FSH surge) occurs approximately 36 hours before follicle rupture.'),
bullet('LH surge triggers resumption of meiosis I in the oocyte, prostaglandin synthesis, and proteolytic enzyme activation → follicle wall rupture.'),
bullet('The oocyte is released into the peritoneal cavity and swept into the fallopian tube.'),
heading2('2.3 Luteal Phase (Days 15-28)'),
bullet('The ruptured follicle transforms into the corpus luteum under continued LH stimulation.'),
bullet('Corpus luteum secretes progesterone (dominant) and estradiol.'),
bullet('Progesterone prepares the endometrium for implantation (secretory phase): increases glandular secretions, decidualization.'),
bullet('Progesterone + estradiol provide NEGATIVE feedback on the hypothalamus and pituitary, suppressing GnRH, LH, and FSH.'),
bullet('If no implantation occurs: corpus luteum degenerates at ~day 24-26 → fall in progesterone and estradiol → withdrawal leads to endometrial sloughing (menstruation).'),
bullet('Fall in ovarian hormones removes negative feedback → FSH begins to rise again, initiating a new cycle.'),
heading2('2.4 Feedback Mechanisms Summary'),
spacer(),
makeTable(
['Hormone', 'Source', 'Feedback on GnRH/LH/FSH', 'Phase'],
[
['Estradiol (low)', 'Granulosa cells', 'Negative - suppresses GnRH pulse amplitude, reduces LH/FSH', 'Early-mid follicular'],
['Estradiol (high, sustained)', 'Dominant follicle', 'Positive - triggers LH surge', 'Late follicular'],
['Progesterone', 'Corpus luteum', 'Negative - reduces GnRH pulse frequency, suppresses LH/FSH', 'Luteal'],
['Inhibin B', 'Granulosa cells', 'Negative - selectively suppresses FSH at pituitary', 'Follicular'],
['Inhibin A', 'Corpus luteum', 'Negative - suppresses FSH', 'Luteal'],
['Activin', 'Granulosa, pituitary', 'Positive - increases FSH release', 'Follicular']
],
[20, 20, 35, 25]
),
spacer(),
heading2('2.5 Role of Inhibins and Activins'),
body('Inhibins and activins are glycoprotein dimers composed of alpha (α) and beta (β) subunits. They exert crucial fine-tuning control over FSH secretion:'),
bullet('Inhibin B: produced by granulosa cells of developing follicles in response to FSH; selectively suppresses FSH mRNA (βFSH subunit) at the pituitary without affecting LH.'),
bullet('Inhibin A: produced by the corpus luteum; dominant inhibin in the luteal phase.'),
bullet('Activins: composed of two β subunits (βA-βA, βB-βB, or βA-βB); stimulate FSH release and augment GnRH production by hypothalamic neurons; modulate folliculogenesis within the ovary.'),
bullet('Follistatin: binds activin with high affinity, neutralizing its effects.'),
pageBreak(),
// ═══════════════════════════════════════════════════════════════════
// PAGE 3: MENARCHE (PUBERTY)
// ═══════════════════════════════════════════════════════════════════
heading1('3. Menarche - Activation of the HPG Axis at Puberty'),
heading2('3.1 Definition and Timing'),
body('Menarche is defined as the first menstrual period, marking the clinical hallmark of female puberty. It represents the culmination of progressive activation of the HPG axis.'),
spacer(),
keybox('NORMAL RANGE', 'Age 10-14 years in girls (average: ~12 years). Puberty changes begin ~2-3 years before menarche (thelarche around age 8-10 years).'),
spacer(),
heading2('3.2 Mechanism of Pubertal Activation'),
body('The HPG axis is fully functional in infancy but is held quiescent during childhood by high CNS inhibitory tone on the hypothalamus. The onset of puberty requires the release of this inhibition.'),
bullet('Before puberty: GnRH neurons are quiescent; hypothalamus is hypersensitive to negative feedback from even low circulating estrogen levels (gonadostat theory).'),
bullet('Onset of puberty: maturation of KNDy-kisspeptin neurons in the arcuate nucleus removes CNS inhibition → pulsatile GnRH secretion resumes.'),
bullet('Initially: GnRH/LH/FSH pulses occur predominantly during sleep (nocturnal pulsatility is a hallmark of early puberty).'),
bullet('Progressively: pulses extend throughout the day, FSH and LH levels rise steadily.'),
bullet('Gonadotropins stimulate ovarian estradiol production → secondary sexual characteristics develop (breast budding = thelarche, pubic hair = pubarche/adrenarche).'),
bullet('Eventually: estradiol levels are sufficient to trigger a positive feedback LH surge → first ovulation → first menstrual period (menarche).'),
heading2('3.3 Role of KNDy Neurons and Kisspeptin in Puberty'),
body('KNDy neurons in the arcuate nucleus are the central clock of the GnRH pulse generator. Their maturation at puberty is considered the critical initiating event:'),
bullet('Kisspeptin neurons increase in number and activity at puberty.'),
bullet('Kisspeptin acts on GnRH neurons via Kiss1 receptors to stimulate GnRH release.'),
bullet('Genetic evidence: activating mutation of Kiss1R (kisspeptin receptor) = first identified genetic cause of central precocious puberty; loss-of-function mutations = delayed puberty or hypogonadotropic hypogonadism (Kallmann syndrome if combined with anosmia).'),
heading2('3.4 Sequence of Pubertal Events (Girls)'),
makeTable(
['Stage / Event', 'Age (approx.)', 'HPG Axis Event'],
[
['Adrenarche', '6-8 years', 'Adrenal androgen surge (DHEA) - independent of HPG axis'],
['Thelarche (breast budding)', '8-10 years', 'Early follicular FSH rise; low-level estradiol secretion begins'],
['Pubarche (pubic hair)', '9-11 years', 'Rising FSH/LH; increasing ovarian estradiol'],
['Peak height velocity', '10-12 years', 'Estradiol stimulates IGF-1; bone elongation'],
['Menarche', '10-14 years (avg 12)', 'First LH surge → first ovulation → first menses'],
['Regular ovulatory cycles', '2-5 years after menarche', 'Full adult pattern of pulsatile GnRH → cyclical FSH/LH/estradiol']
],
[30, 25, 45]
),
spacer(),
heading2('3.5 Factors Influencing Timing of Menarche'),
bullet('Nutrition and body weight: a critical body fat percentage (~17%) appears necessary for menarche (Frisch hypothesis). Leptin from adipose tissue has a permissive role in activating kisspeptin neurons.'),
bullet('Genetics: heritability of menarche age is ~50-80%; family history is the strongest predictor.'),
bullet('Chronic illness, malnutrition, extreme exercise: delay menarche by suppressing kisspeptin/GnRH.'),
bullet('Light exposure and stress: can modify hypothalamic GnRH pulsatility.'),
bullet('Secular trend: average age of menarche has decreased by ~3 months per decade over the past century, likely due to improved nutrition.'),
heading2('3.6 Abnormalities of Menarche'),
bullet('Precocious puberty: menarche before age 8 years. Central precocious puberty = premature activation of GnRH pulse generator (may be caused by kisspeptin receptor activating mutation, hypothalamic tumors, or idiopathic). Treatment: long-acting GnRH agonists (cause receptor downregulation → gonadotropin suppression).'),
bullet('Delayed puberty / primary amenorrhea: no menarche by age 16. Causes include: hypothalamic/pituitary disorders (hypogonadotropic hypogonadism), gonadal failure (hypergonadotropic hypogonadism), anatomical defects.'),
bullet('Isolated premature menarche: rare form of incomplete precocious puberty where only menses occur without full pubertal development; FSH and LH remain at prepubertal levels.'),
pageBreak(),
// ═══════════════════════════════════════════════════════════════════
// PAGE 4: MENOPAUSE
// ═══════════════════════════════════════════════════════════════════
heading1('4. Menopause - Decline and Cessation of HPG Axis Activity'),
heading2('4.1 Definition and Staging'),
body('Menopause is defined as the permanent cessation of menstruation resulting from the loss of ovarian follicular activity. It is diagnosed retrospectively after 12 consecutive months of amenorrhea without any other pathological cause.'),
spacer(),
keybox('AVERAGE AGE', 'Natural menopause occurs at an average age of 51 years (range: 45-55 years). "Premature ovarian insufficiency" = menopause before age 40.'),
spacer(),
makeTable(
['Stage', 'Definition', 'Hormonal Pattern'],
[
['Perimenopause / Menopausal transition', 'Irregular cycles for at least 1 year; up to 10 years before final menstrual period', 'FSH rises first (due to decreased inhibin B), cycles become anovulatory; estrogen and progesterone fluctuate'],
['Menopause', 'Final menstrual period (diagnosed retrospectively at 12 months amenorrhea)', 'Estrogen and progesterone fall sharply; FSH markedly elevated; LH moderately elevated'],
['Postmenopause', 'All years after the final menstrual period', 'Persistently low estrogen; high FSH/LH; residual estrogen from peripheral aromatization of adrenal androgens']
],
[25, 38, 37]
),
spacer(),
heading2('4.2 Pathophysiology of Menopause'),
body('The primary driver of menopause is depletion of the ovarian follicle pool, not dysfunction of the hypothalamus or pituitary. Throughout reproductive life, follicles are progressively depleted:'),
bullet('At birth: approximately 1-2 million primordial follicles.'),
bullet('At puberty: approximately 300,000-400,000 primordial follicles remain.'),
bullet('During reproductive life: ~400 follicles ovulate; hundreds of thousands more undergo atresia.'),
bullet('By age 45: only a few primordial follicles remain; follicular reserve is critically low.'),
bullet('Consequence: declining granulosa cell mass → decreased inhibin B production → FSH rises (loss of inhibin B negative feedback is the earliest hormonal change).'),
bullet('Progressive follicle depletion → estradiol production falls below critical threshold → no longer sufficient for LH surge → anovulatory cycles → amenorrhea.'),
bullet('Pituitary and hypothalamus are intact: FSH rises markedly (10-fold), LH rises moderately; this confirms the primary ovarian origin of menopause.'),
heading2('4.3 Hormonal Changes in Detail'),
body('The hormonal changes of menopause follow a characteristic sequence:'),
bullet('Inhibin B falls first (earliest marker - detectable in the late 30s).'),
bullet('FSH rises (especially in perimenopause) - a serum FSH >40 IU/L on two occasions confirms menopause.'),
bullet('Estradiol falls progressively (though it fluctuates in perimenopause).'),
bullet('LH rises, but less dramatically than FSH.'),
bullet('Progesterone falls to near zero (due to lack of corpus luteum formation in anovulatory cycles).'),
bullet('Postmenopause: estrogen is produced only from peripheral aromatization of adrenal androstenedione in adipose tissue, liver, skin → mostly estrone (weaker estrogen), not estradiol.'),
heading2('4.4 Clinical Features of Menopause'),
heading3('Vasomotor Symptoms'),
bullet('Hot flushes (flashes) - occur in ~75% of menopausal women; may persist intermittently for up to 40 years.'),
bullet('Mechanism: estrogen-sensitive event in the hypothalamus simultaneously triggers an LH burst and a vasomotor episode. LH itself is not the cause (symptoms persist after pituitary removal). Each hot flush coincides with a large episodic LH burst (circhoral secretion every 30-60 min).'),
bullet('Night sweats: nocturnal equivalent of hot flushes; frequently disrupt sleep.'),
heading3('Urogenital Atrophy'),
bullet('Uterus becomes smaller (near-infantile size after prolonged estrogen loss).'),
bullet('Vaginal epithelium becomes thin, dry, and easily damaged (atrophic vaginitis → dyspareunia).'),
bullet('Vaginal pH rises (loss of lactobacilli) → increased susceptibility to infections.'),
bullet('Urinary symptoms: urgency, frequency, recurrent UTIs.'),
heading3('Skeletal Effects'),
bullet('Accelerated bone loss begins in perimenopause: estrogen normally inhibits osteoclast activity; loss of estrogen → increased bone resorption → osteoporosis.'),
bullet('Risk of vertebral and hip fractures increases significantly.'),
heading3('Cardiovascular Effects'),
bullet('Estrogen has cardioprotective effects (improves lipid profile, vasodilatory effects on endothelium).'),
bullet('After menopause: increased LDL, decreased HDL → increased risk of ischemic heart disease.'),
heading3('Neuropsychological Effects'),
bullet('Irritability, anxiety, fatigue, difficulty concentrating (partly vasomotor-related, partly direct estrogen withdrawal effect).'),
bullet('Increased risk of depressive symptoms in perimenopause.'),
pageBreak(),
// ═══════════════════════════════════════════════════════════════════
// PAGE 5: MANAGEMENT & CLINICAL CORRELATES
// ═══════════════════════════════════════════════════════════════════
heading1('5. Management, Hormone Therapy, and Clinical Correlates'),
heading2('5.1 Hormone Replacement Therapy (HRT) / Menopausal Hormone Therapy (MHT)'),
body('HRT aims to replace the estrogen (and in women with an intact uterus, progesterone) lost at menopause to relieve symptoms and prevent bone loss.'),
bullet('Indications: vasomotor symptoms significantly affecting quality of life; genitourinary syndrome of menopause; prevention of osteoporosis; women with premature ovarian insufficiency.'),
bullet('Regimens:', 'Types:'),
subbullet('Estrogen only: for women after hysterectomy.'),
subbullet('Combined estrogen + progestogen: required for women with intact uterus (to prevent endometrial hyperplasia from unopposed estrogen).'),
bullet('Routes: oral, transdermal patch, gel, spray, intrauterine system, vaginal preparations.'),
spacer(),
keybox('TIMING HYPOTHESIS', 'HRT initiated before age 60 or within 10 years of menopause onset appears to have a favorable benefit:risk ratio (lower cardiovascular risk, better overall outcomes) compared to late initiation. This is the "window of opportunity" or "timing hypothesis."'),
spacer(),
bullet('Risks of HRT (from large trials like WHI):'),
subbullet('Breast cancer: slightly increased risk with combined estrogen-progestogen HRT (not with estrogen alone).'),
subbullet('Venous thromboembolism: increased with oral estrogen (less with transdermal route).'),
subbullet('Stroke: slightly increased with oral estrogen.'),
subbullet('Endometrial cancer: risk increased if estrogen given without progestogen in women with intact uterus.'),
bullet('Benefits of HRT:'),
subbullet('Relief of vasomotor symptoms (most effective treatment).'),
subbullet('Prevention and treatment of osteoporosis.'),
subbullet('Urogenital symptom improvement.'),
subbullet('Possible cardiovascular benefit if initiated in the window period.'),
subbullet('Reduction in risk of type 2 diabetes, colorectal cancer.'),
heading2('5.2 Diagnosis of Menopause'),
body('Menopause is a clinical diagnosis in most women (>45 years with typical symptoms and 12 months amenorrhea). Hormonal testing is used in:'),
bullet('Women <45 years (to diagnose premature ovarian insufficiency).'),
bullet('Women on contraception where bleeding pattern is obscured.'),
bullet('Serum FSH >40 IU/L (measured twice, 4-6 weeks apart, in the absence of hormonal contraception) confirms ovarian failure.'),
bullet('AMH (anti-Müllerian hormone): produced by granulosa cells of small follicles; best marker of ovarian reserve; falls progressively to undetectable levels at menopause.'),
bullet('Estradiol <20 pg/mL in the context of elevated FSH supports diagnosis.'),
heading2('5.3 Key Comparisons: Menarche vs. Menopause'),
spacer(),
makeTable(
['Feature', 'Menarche (Puberty)', 'Menopause'],
[
['HPG Axis Status', 'Activation - progressive rise in GnRH pulsatility', 'Deactivation - ovarian follicle depletion causes axis to lose target'],
['GnRH', 'Pulsatility initiated by KNDy maturation', 'GnRH remains active; no ovarian response'],
['FSH', 'Gradually increases during puberty', 'Markedly elevated (first to rise in perimenopause)'],
['LH', 'Gradually increases; first LH surge triggers ovulation', 'Moderately elevated; large episodic bursts cause hot flushes'],
['Estradiol', 'Progressively rises from near-zero to adult levels', 'Falls progressively to near-zero (only peripheral estrone remains)'],
['Progesterone', 'Begins cycling after first ovulation', 'Falls to near-zero (no corpus luteum)'],
['Inhibin B', 'Rises with developing follicles', 'Falls to near-zero (earliest hormonal change)'],
['Kisspeptin', 'Drives puberty onset by activating GnRH neurons', 'Less directly involved; hypothalamus intact but no ovarian response'],
['Clinical feature', 'First menstrual period; secondary sexual characteristics', 'Last menstrual period; vasomotor/genitourinary symptoms'],
['Transition duration', 'Irregular cycles for 1-2 years post-menarche are normal', 'Perimenopause: variable cycles for up to 10 years']
],
[22, 39, 39]
),
spacer(),
heading2('5.4 Diagnostic Flowchart: Amenorrhea at the Extremes'),
body('When a woman presents with absent or irregular menses, the HPG axis level affected guides diagnosis:'),
bullet('High FSH + Low Estradiol = Primary ovarian insufficiency (ovarian failure). Causes: premature ovarian insufficiency, Turner syndrome, ovarian damage.'),
bullet('Low/Normal FSH + Low Estradiol = Hypogonadotropic hypogonadism. Causes: hypothalamic amenorrhea (stress, weight loss, exercise), Kallmann syndrome, pituitary adenoma, hyperprolactinemia.'),
bullet('Normal FSH + Normal/High Estradiol + no menses = Outflow tract obstruction (Asherman syndrome, imperforate hymen) or PCOS (oligo-ovulation).'),
heading2('5.5 Summary: Lifetime Hormonal Profile'),
body('The HPG axis undergoes predictable changes across a woman\'s life span. Understanding this arc is essential for interpreting symptoms and laboratory findings:'),
makeTable(
['Life Phase', 'FSH', 'LH', 'Estradiol', 'Progesterone'],
[
['Childhood', 'Very low', 'Very low', 'Very low', 'Very low'],
['Early puberty', 'Low-rising (nocturnal pulses)', 'Low-rising', 'Beginning to rise', 'Very low'],
['Menarche', 'Rising cyclically', 'Surge at mid-cycle', 'Cyclical (low to ~300 pg/mL peak)', 'Cyclical (rises in luteal phase)'],
['Reproductive years', 'Cyclical (low in follicular, suppressed in luteal)', 'Cyclical (mid-cycle surge)', 'Cyclical (high in late follicular)', 'Cyclical (high in luteal)'],
['Perimenopause', 'Progressively rising (FSH >10 IU/L early sign)', 'Rising', 'Fluctuating then falling', 'Progressively falling (anovulatory cycles)'],
['Postmenopause', '>40 IU/L (very high)', 'Moderately elevated', '<20 pg/mL (mostly estrone)', 'Near zero']
],
[22, 19, 19, 22, 18]
),
spacer(),
spacer(),
new Paragraph({
children: [new TextRun({ text: 'Key References', bold: true, size: 22, color: '1F3864' })],
spacing: { before: 200, after: 60 }
}),
new Paragraph({
children: [new TextRun({ text: '1. Guyton AC, Hall JE. Textbook of Medical Physiology, 14th ed. (pp. 1027-1028)', size: 18, italics: true, color: '595959' })],
spacing: { before: 20, after: 20 }
}),
new Paragraph({
children: [new TextRun({ text: '2. Boron WF, Boulpaep EL. Medical Physiology, 3rd ed. (Ch. 55 - Reproductive System)', size: 18, italics: true, color: '595959' })],
spacing: { before: 20, after: 20 }
}),
new Paragraph({
children: [new TextRun({ text: '3. Barrett KE et al. Ganong\'s Review of Medical Physiology, 26th ed. (Ch. 22)', size: 18, italics: true, color: '595959' })],
spacing: { before: 20, after: 20 }
}),
new Paragraph({
children: [new TextRun({ text: '4. Costanzo LS. Physiology, 7th ed. (Ch. 10 - Reproductive Physiology)', size: 18, italics: true, color: '595959' })],
spacing: { before: 20, after: 20 }
}),
new Paragraph({
children: [new TextRun({ text: '5. Berek & Novak\'s Gynecology, 16th ed. (Isolated Premature Menarche)', size: 18, italics: true, color: '595959' })],
spacing: { before: 20, after: 20 }
})
] // end children
}
]
});
Packer.toBuffer(doc).then(buffer => {
fs.writeFileSync('/home/daytona/workspace/hpa-notes/HPG_Axis_Menarche_Menopause_Notes.docx', buffer);
console.log('SUCCESS: Document written.');
}).catch(err => {
console.error('ERROR:', err);
process.exit(1);
});
cd /home/daytona/workspace/hpa-notes && node generate_notes.js 2>&1
python3 /home/daytona/skills/docx/scripts/office/validate.py /home/daytona/workspace/hpa-notes/HPG_Axis_Menarche_Menopause_Notes.docx 2>&1
ls -lh /home/daytona/workspace/hpa-notes/ && python3 -c "import zipfile; z=zipfile.ZipFile('/home/daytona/workspace/hpa-notes/HPG_Axis_Menarche_Menopause_Notes.docx'); print('Valid ZIP. Files:', z.namelist()[:5])"
HPG Axis Menarche Menopause Notes
Word Document · DOCX