Breast pathology complete
ls /home/daytona/workspace/ && mkdir -p /home/daytona/workspace/breast-pathology
~/breast-pathology/generate.js
const {
Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
HeadingLevel, AlignmentType, BorderStyle, WidthType, ShadingType,
PageBreak, VerticalAlign, TableOfContents
} = require('docx');
const fs = require('fs');
// Helper: heading paragraph
function h1(text) {
return new Paragraph({
text,
heading: HeadingLevel.HEADING_1,
spacing: { before: 400, after: 120 }
});
}
function h2(text) {
return new Paragraph({
text,
heading: HeadingLevel.HEADING_2,
spacing: { before: 300, after: 100 }
});
}
function h3(text) {
return new Paragraph({
text,
heading: HeadingLevel.HEADING_3,
spacing: { before: 200, after: 80 }
});
}
function para(text) {
return new Paragraph({
children: [new TextRun({ text, size: 22 })],
spacing: { before: 80, after: 80 },
alignment: AlignmentType.JUSTIFIED
});
}
function bullet(text, level = 0) {
return new Paragraph({
children: [new TextRun({ text, size: 22 })],
bullet: { level },
spacing: { before: 40, after: 40 }
});
}
function boldBullet(label, text, level = 0) {
return new Paragraph({
children: [
new TextRun({ text: label + ': ', bold: true, size: 22 }),
new TextRun({ text, size: 22 })
],
bullet: { level },
spacing: { before: 40, after: 40 }
});
}
function noteBox(text) {
return new Paragraph({
children: [new TextRun({ text: '★ HIGH-YIELD: ' + text, bold: true, color: '7B0000', size: 22 })],
spacing: { before: 100, after: 100 },
shading: { type: ShadingType.CLEAR, fill: 'FFF3CD' },
indent: { left: 400, right: 400 }
});
}
function makeTable(headers, rows) {
const headerCells = headers.map(h =>
new TableCell({
children: [new Paragraph({ children: [new TextRun({ text: h, bold: true, size: 20 })], alignment: AlignmentType.CENTER })],
shading: { type: ShadingType.CLEAR, fill: '1F4E79' },
verticalAlign: VerticalAlign.CENTER,
margins: { top: 80, bottom: 80, left: 120, right: 120 }
})
);
const dataRows = rows.map(row =>
new TableRow({
children: row.map(cell =>
new TableCell({
children: [new Paragraph({ children: [new TextRun({ text: cell, size: 20 })], alignment: AlignmentType.LEFT })],
margins: { top: 60, bottom: 60, left: 120, right: 120 }
})
)
})
);
return new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({ children: headerCells, tableHeader: true }),
...dataRows
],
margins: { top: 100, bottom: 100 }
});
}
const doc = new Document({
styles: {
default: {
heading1: {
run: { color: '1F4E79', bold: true, size: 32 }
},
heading2: {
run: { color: '2E75B6', bold: true, size: 26 }
},
heading3: {
run: { color: '2F5496', bold: true, size: 24 }
}
}
},
sections: [{
children: [
// TITLE PAGE
new Paragraph({
children: [new TextRun({ text: 'BREAST PATHOLOGY', bold: true, size: 56, color: '1F4E79' })],
alignment: AlignmentType.CENTER,
spacing: { before: 1200, after: 200 }
}),
new Paragraph({
children: [new TextRun({ text: 'Comprehensive USMLE Study Notes', size: 32, color: '2E75B6' })],
alignment: AlignmentType.CENTER,
spacing: { before: 200, after: 200 }
}),
new Paragraph({
children: [new TextRun({ text: 'Based on Robbins & Kumar Basic Pathology and Robbins, Cotran & Kumar Pathologic Basis of Disease', size: 20, color: '666666', italics: true })],
alignment: AlignmentType.CENTER,
spacing: { before: 200, after: 200 }
}),
new Paragraph({
children: [new PageBreak()]
}),
// ─────────────────────────────────────────────
// SECTION 1: NORMAL BREAST ANATOMY
// ─────────────────────────────────────────────
h1('1. NORMAL BREAST ANATOMY & HISTOLOGY'),
para('Understanding breast pathology begins with the normal structure of the breast. The functional unit is the terminal duct lobular unit (TDLU), which consists of a lobule (cluster of acini) and its terminal duct. Most breast cancers and benign lesions arise from the TDLU.'),
h2('Cell Types'),
bullet('Luminal epithelial cells - inner layer; produce milk during lactation'),
bullet('Myoepithelial cells - outer/basal layer; contractile (aids milk ejection); supports basement membrane'),
bullet('Intralobular stromal cells - specialized; source of fibroadenomas and phyllodes tumors'),
bullet('Interlobular stromal cells - source of mesenchymal tumors (lipomas, angiosarcomas)'),
h2('Structural Components'),
bullet('5-15 lobes/segments per breast, each drained by a major duct to the nipple'),
bullet('Ductal system: major ducts > smaller ducts > lobules (TDLU)'),
bullet('Basement membrane separates epithelium from stroma (key in distinguishing in situ vs. invasive)'),
bullet('Nipple: keratinizing squamous epithelium transitions abruptly to bilayered ductal epithelium'),
h2('Hormonal Changes'),
bullet('Estrogen + progesterone drive cyclical changes - proliferation in second half of cycle, regression after menstruation'),
bullet('Pregnancy: massive lobular expansion; colostrum (high protein) → milk (high fat) at ~10 days postpartum'),
bullet('Menopause: involution of lobules and stroma; cystic changes may develop'),
noteBox('Most benign lesions arise in women 30-50 years old (reproductive/perimenopausal years); cancer risk increases with age.'),
new Paragraph({ children: [new PageBreak()] }),
// ─────────────────────────────────────────────
// SECTION 2: CLINICAL PRESENTATIONS
// ─────────────────────────────────────────────
h1('2. CLINICAL PRESENTATIONS OF BREAST DISEASE'),
para('The predominant presenting symptoms are pain, inflammation, nipple discharge, diffuse nodularity, or a palpable mass. >90% of breast lesions are benign, but all require investigation to exclude malignancy.'),
h2('Key Presenting Symptoms'),
boldBullet('Pain (Mastalgia/Mastodynia)', 'Often cyclic (related to menses); due to edema and swelling. Localized pain may indicate ruptured cyst or fat necrosis. ~5% of painful masses are malignant.'),
boldBullet('Inflammation', 'Erythema + edema. Most often lactational infection. ALWAYS consider inflammatory carcinoma (peau d\'orange) as mimicking infection.'),
boldBullet('Nipple Discharge', 'Bilateral = usually physiologic. Unilateral = pathologic. Spontaneous, unilateral, bloody = most worrisome for malignancy. Most common benign cause = intraductal papilloma.'),
boldBullet('Diffuse Nodularity', 'Usually physiologic ("lumpiness"). Imaging helps determine if discrete mass is present.'),
boldBullet('Palpable Mass', '~95% are benign - round/oval with circumscribed borders. Malignant tumors: irregular, spiculated borders, cross tissue planes. All palpable masses require evaluation.'),
boldBullet('Gynecomastia (male)', 'Increase in stroma and epithelial cells. Caused by imbalance between estrogens (stimulate) and androgens (counteract). Causes: Klinefelter, liver disease, drugs (spironolactone, cimetidine, anabolic steroids), testicular tumors.'),
h2('Mammographic Screening'),
bullet('Introduced in the 1980s; detects tumors before clinical signs'),
bullet('45% of breast cancers have symptoms; 55% detected by screening'),
bullet('Detects microcalcifications (hallmark of DCIS and some invasive cancers)'),
new Paragraph({ children: [new PageBreak()] }),
// ─────────────────────────────────────────────
// SECTION 3: INFLAMMATORY CONDITIONS
// ─────────────────────────────────────────────
h1('3. INFLAMMATORY CONDITIONS OF THE BREAST'),
para('Inflammatory breast diseases are rare. Always consider inflammatory carcinoma as a mimic.'),
h2('Bacterial Mastitis / Lactational Abscess'),
bullet('Most common in first month of breastfeeding'),
bullet('Organisms: Staphylococcus aureus (most common), Streptococci'),
bullet('Treatment: antibiotics + continued milk expression; rarely surgical drainage'),
bullet('Non-lactational abscesses: often mixed anaerobic infections; rarer'),
h2('Fat Necrosis'),
bullet('Usually follows trauma or surgery (including reduction mammoplasty)'),
bullet('Grossly: yellow-chalky area; may become fibrotic and calcify'),
bullet('Microscopy: foamy (lipid-laden) macrophages, giant cells, fibrosis'),
bullet('May simulate carcinoma clinically and mammographically'),
noteBox('Fat necrosis can mimic carcinoma on imaging - always biopsy if uncertain.'),
new Paragraph({ children: [new PageBreak()] }),
// ─────────────────────────────────────────────
// SECTION 4: BENIGN EPITHELIAL LESIONS (FIBROCYSTIC CHANGES)
// ─────────────────────────────────────────────
h1('4. BENIGN EPITHELIAL LESIONS & FIBROCYSTIC CHANGES'),
para('Benign epithelial lesions are classified into three groups with differing cancer risk. This classification is essential for USMLE.'),
makeTable(
['Category', 'Examples', 'Relative Cancer Risk'],
[
['Non-proliferative changes', 'Cysts, apocrine metaplasia, mild epithelial hyperplasia, adenosis', 'No increased risk (1x)'],
['Proliferative WITHOUT atypia', 'Moderate/florid hyperplasia, sclerosing adenosis, papilloma', 'Slight increase (1.5-2x)'],
['Proliferative WITH atypia (ADH/ALH)', 'Atypical ductal hyperplasia (ADH), Atypical lobular hyperplasia (ALH)', 'Moderately increased (4-5x); 10x if family history']
]
),
new Paragraph({ spacing: { before: 200 } }),
h2('4.1 Non-Proliferative (Fibrocystic) Changes'),
para('Most common breast lesion in premenopausal women (age 30-50). Due to cyclic hormonal changes.'),
h3('Morphology - Three Principal Features:'),
boldBullet('Cysts', 'Dilation of lobular acini → small cysts coalesce → large cysts. "Blue-dome cysts" = turbid blue-brown fluid. Lined by flattened atrophic or apocrine metaplastic epithelium. Apocrine cells: abundant granular eosinophilic cytoplasm. Calcifications common.'),
boldBullet('Fibrosis', 'Ruptured cysts → chronic inflammation → fibrosis → palpable nodularity'),
boldBullet('Adenosis', 'Increased number of acini per lobule. Lined by columnar epithelium. Calcifications may be present.'),
h2('4.2 Proliferative Disease WITHOUT Atypia'),
para('Associated with 1.5-2x increased cancer risk. These are risk predictors, not direct precursors.'),
boldBullet('Usual Ductal Hyperplasia (UDH)', 'Increased luminal + myoepithelial cells filling ducts/lobules. Irregular lumens. Mixed cell population.'),
boldBullet('Sclerosing Adenosis', 'Compressed/distorted acini within fibrous stroma. Maintains two-cell layer (luminal + myoepithelial). Key: myoepithelial cells PRESENT (distinguishes from carcinoma). May produce calcifications and mimic carcinoma on imaging.'),
boldBullet('Intraductal Papilloma', 'Benign papillary growth within a large duct. Most common cause of bloody/serous nipple discharge. Microscopy: fibrovascular core with two-cell layer. Usually solitary (near nipple = lower cancer risk) vs. multiple peripheral papillomas (higher risk).'),
boldBullet('Columnar Cell Changes', 'Luminal cells become elongated (columnar); calcifications often present; detected as mammographic calcifications.'),
h2('4.3 Proliferative Disease WITH Atypia'),
noteBox('ADH and ALH have 4-5x increased cancer risk; with a first-degree family history of breast cancer, this rises to ~10x.'),
h3('Atypical Ductal Hyperplasia (ADH)'),
bullet('Has some but NOT all features of low-grade DCIS'),
bullet('Two-cell population; incomplete involvement of spaces; lacks uniform monotonous cell population of DCIS'),
bullet('Management: surgical excision to exclude adjacent DCIS'),
h3('Atypical Lobular Hyperplasia (ALH)'),
bullet('Similar cells to LCIS but does NOT fill and expand >50% of acini'),
bullet('E-cadherin NEGATIVE (same as LCIS) - distinguishes from UDH'),
bullet('Confers bilateral increased risk'),
new Paragraph({ children: [new PageBreak()] }),
// ─────────────────────────────────────────────
// SECTION 5: STROMAL NEOPLASMS
// ─────────────────────────────────────────────
h1('5. STROMAL NEOPLASMS'),
h2('5.1 Fibroadenoma'),
para('Most common benign tumor of the female breast. Peak age: 20-35 years. Driven by MED12 mutations (~2/3 of cases; same gene mutated in uterine leiomyomas).'),
h3('Pathology'),
bullet('Biphasic tumor: neoplastic stromal cells + reactive epithelial proliferation'),
bullet('Gross: circumscribed, rubbery, freely mobile ("breast mouse"), well-defined borders'),
bullet('Micro: elongated slitlike epithelial spaces compressed by proliferating stroma (intracanalicular pattern); or glands with open round lumens (pericanalicular). LOW cellularity stroma.'),
bullet('Influenced by estrogen: grows during pregnancy, involutes after menopause'),
h3('Clinical Features'),
bullet('Solitary, firm, mobile, nontender mass'),
bullet('Mammography: well-defined oval/lobular mass, often with "popcorn" calcifications in older lesions'),
bullet('Management: can observe small lesions; excision if large/growing or patient anxiety'),
noteBox('Fibroadenoma = most common BENIGN breast tumor in young women. Do NOT confuse with phyllodes (which can recur/metastasize).'),
h2('5.2 Phyllodes Tumor'),
para('Rare biphasic tumor on the spectrum with fibroadenoma. Wide age range but usually older (median age 45).'),
h3('Pathology'),
bullet('Biphasic: neoplastic stroma outgrows epithelial component'),
bullet('Characteristic "leaf-like" (phyllodes) growth pattern: bulbous stromal nodules covered by epithelium protrude into cystic spaces'),
bullet('Classified as benign, borderline, or malignant based on: mitotic rate, stromal cellularity, atypia, margins, stromal overgrowth'),
bullet('High-grade: sarcomatous appearance (epithelium may be absent)'),
h3('Clinical Features'),
bullet('Usually large (5-10 cm), rapidly growing mass'),
bullet('Even "benign" phyllodes tumors can recur locally after excision'),
bullet('Malignant phyllodes: 15-25% develop distant metastases (lung most common)'),
bullet('Management: wide local excision with clear margins; mastectomy for large/malignant'),
new Paragraph({ children: [new PageBreak()] }),
// ─────────────────────────────────────────────
// SECTION 6: CARCINOMA IN SITU
// ─────────────────────────────────────────────
h1('6. CARCINOMA IN SITU'),
para('Carcinoma in situ (CIS) = malignant cells confined within ducts/lobules, with intact basement membrane. Two types: DCIS and LCIS, distinguished by histology and E-cadherin expression.'),
makeTable(
['Feature', 'DCIS', 'LCIS'],
[
['E-cadherin', 'POSITIVE (intact)', 'NEGATIVE (lost)'],
['Cell appearance', 'Cohesive, variable; large pleomorphic', 'Small, uniform, loosely cohesive; signet ring cells'],
['Necrosis', 'Common in high grade (comedo type)', 'Absent (classic type)'],
['Calcifications', 'Common (on necrosis or secretions)', 'Usually absent (classic type)'],
['Detection', 'Mammographic microcalcifications', 'Incidental finding on biopsy'],
['Bilateral risk', 'Same breast (ipsilateral)', 'Both breasts (bilateral marker)'],
['Cancer risk', '~30-50% progress to invasive in same location', '1% per year; 8-10x general population'],
['Subsequent cancer type', 'Invasive ductal carcinoma at same site', '~50% ductal, ~50% lobular; bilateral'],
['Receptor status', 'Varies by grade', 'ER+, PR+; HER2 usually negative'],
['Management', 'Surgery ± radiation ± endocrine therapy', 'Surveillance; endocrine therapy; rarely excision']
]
),
new Paragraph({ spacing: { before: 200 } }),
h2('6.1 Ductal Carcinoma In Situ (DCIS)'),
para('DCIS is a proliferation of malignant epithelial cells confined to ducts/lobules, without invasion through the basement membrane. It is the most common in situ carcinoma.'),
h3('Grading (by nuclear features, NOT architectural pattern)'),
bullet('Low-grade DCIS: small uniform nuclei, low N:C ratio, rare mitoses'),
bullet('Intermediate-grade DCIS: features between low and high'),
bullet('High-grade DCIS: large pleomorphic nuclei, prominent nucleoli, frequent mitoses'),
h3('Architectural Patterns (descriptive, not used for grading)'),
bullet('Comedo: central necrosis with dystrophic calcification in high-grade DCIS - hallmark on mammography'),
bullet('Cribriform: cells form "cookie cutter" rounded spaces'),
bullet('Solid: sheets filling duct without spaces'),
bullet('Micropapillary: finger-like projections without fibrovascular core'),
bullet('Papillary: papillary fronds with fibrovascular cores'),
h3('Clinical Features'),
bullet('Most detected by screening mammography as linear/branching microcalcifications'),
bullet('BRCA1/2 carriers have higher incidence of DCIS'),
bullet('~30-50% of untreated high-grade DCIS will develop invasive carcinoma at same site within 10 years'),
bullet('Low-grade DCIS: slower progression (~30% over 30 years)'),
noteBox('DCIS grading = nuclear grade (NOT architectural pattern). Comedo necrosis = hallmark of high-grade DCIS.'),
h2('6.2 Lobular Carcinoma In Situ (LCIS)'),
para('LCIS is a non-obligate precursor and risk marker for invasive carcinoma. It arises from the terminal duct lobular unit.'),
h3('Morphology'),
bullet('Uniform, small, loosely cohesive cells with oval/round nuclei and small nucleoli'),
bullet('Fill and EXPAND >50% of acini in a TDLU (distinguishes from ALH, which has <50% involvement)'),
bullet('Mucin-positive signet ring cells are common'),
bullet('E-cadherin NEGATIVE (loss of E-cadherin → loss of cell cohesion)'),
bullet('Pagetoid spread (cells between basement membrane and luminal cells) in ducts - common'),
bullet('NO necrosis; NO calcifications in classic LCIS'),
bullet('Pleomorphic LCIS: large cells, necrosis, calcifications - managed like DCIS (surgical excision)'),
h3('Receptor Status'),
bullet('Almost always ER+ and PR+'),
bullet('HER2 negative (classic type)'),
new Paragraph({ children: [new PageBreak()] }),
// ─────────────────────────────────────────────
// SECTION 7: INVASIVE BREAST CARCINOMA - EPIDEMIOLOGY & RISK FACTORS
// ─────────────────────────────────────────────
h1('7. INVASIVE BREAST CARCINOMA'),
h2('7.1 Epidemiology'),
bullet('Most common malignancy globally; leading cause of cancer death in females worldwide'),
bullet('In 2020: ~2.3 million new cases worldwide (surpassed lung cancer as most common cancer overall)'),
bullet('Lifetime risk for American women: 1 in 8 (~12%)'),
bullet('~75% diagnosed after age 50; rare before age 30'),
bullet('~1% of all breast cancers occur in males'),
h2('7.2 Risk Factors'),
h3('Hormonal Factors (most important modifiable group)'),
bullet('Early menarche (<12 years) or late menopause (>55 years) - prolonged estrogen exposure'),
bullet('Nulliparity or late first pregnancy (>30 years)'),
bullet('Hormone replacement therapy (combined estrogen + progestin)'),
bullet('Obesity (postmenopausal) - adipose tissue converts androgens to estrogens (peripheral aromatization)'),
bullet('Oral contraceptive pills: very slightly increased risk (controversial)'),
h3('Genetic Factors'),
bullet('~12% of all breast cancers have a germline mutation'),
bullet('BRCA1 and BRCA2 account for ~50% of hereditary breast cancers'),
h3('Other Risk Factors'),
bullet('Previous breast cancer or high-risk lesions (ADH, ALH, LCIS)'),
bullet('Dense breast tissue on mammography'),
bullet('Previous chest radiation (e.g., Hodgkin lymphoma treatment)'),
bullet('Alcohol consumption'),
bullet('Protective: breastfeeding, early first full-term pregnancy, exercise, oophorectomy'),
makeTable(
['Gene', 'Lifetime Risk', 'Key Associations', 'Pathology Features'],
[
['BRCA1 (17q21)', '55-72%', 'Ovarian cancer, male breast cancer', 'Triple-negative; medullary pattern; high grade; TP53 mutations common'],
['BRCA2 (13q12)', '45-69%', 'Male breast cancer, pancreatic, ovarian', 'Luminal (ER+); lower grade than BRCA1'],
['TP53 (Li-Fraumeni)', '~30%', 'Multiple tumor types; early onset', 'Any subtype'],
['PTEN (Cowden syndrome)', 'Increased', 'Thyroid tumors, macrocephaly', 'Various'],
['CDH1', 'Increased', 'Hereditary diffuse gastric cancer', 'Invasive lobular carcinoma (ILC)'],
['PALB2, CHEK2, ATM', 'Moderate', 'Moderate-penetrance genes', 'Various']
]
),
new Paragraph({ spacing: { before: 200 } }),
h2('7.3 Pathogenesis'),
h3('General Pathways'),
bullet('TDLU is the site of origin for most breast cancers'),
bullet('Two main pathways: low-grade pathway (luminal A, ER+, slow progression) and high-grade pathway (triple negative, HER2+, rapid progression)'),
h3('Key Molecular Events'),
bullet('Loss of E-cadherin: key in lobular carcinoma (CDH1 mutations/silencing)'),
bullet('HER2 amplification: 15-20% of breast cancers; chromosome 17q12; drives proliferation via RAS/MAPK and PI3K/AKT'),
bullet('ER pathway: estrogen binding → proliferation, anti-apoptosis; target of tamoxifen and aromatase inhibitors'),
bullet('BRCA1/2: involved in DNA double-strand break repair (homologous recombination); loss → genomic instability'),
bullet('PIK3CA mutations: most common somatic mutation in luminal breast cancers'),
bullet('TP53 mutations: most common in triple-negative breast cancer'),
new Paragraph({ children: [new PageBreak()] }),
// ─────────────────────────────────────────────
// SECTION 8: HISTOLOGIC TYPES OF INVASIVE CARCINOMA
// ─────────────────────────────────────────────
h1('8. HISTOLOGIC TYPES OF INVASIVE BREAST CARCINOMA'),
para('~70-80% of invasive breast carcinomas are "no special type" (NST; previously called invasive ductal carcinoma NOS). The remaining are special types.'),
h2('8.1 Invasive Carcinoma of No Special Type (NST / IDC-NOS)'),
bullet('Most common (70-80%), also called "invasive ductal carcinoma"'),
bullet('Location: upper outer quadrant (50%), central (20%)'),
bullet('Gross: hard, irregular, gritty mass; grating sound when cut (due to desmoplasia + calcifications)'),
bullet('Micro: wide morphologic spectrum - glands, trabeculae, solid sheets, or single cells; associated desmoplastic stromal reaction'),
bullet('Medullary pattern subtype: sheets of large anaplastic cells + prominent lymphocytic (T-cell) infiltrate; circumscribed margins; almost always triple-negative; >50% of BRCA1 tumors; NOT a separate diagnosis in current WHO classification'),
h2('8.2 Invasive Lobular Carcinoma (ILC)'),
bullet('10-15% of invasive breast carcinomas; second most common type'),
bullet('Key feature: loss of E-cadherin (CDH1 mutation/silencing) → loss of cell cohesion'),
bullet('Micro: single cells infiltrating stroma in "Indian file" (single-file) arrangement; or concentric rings around ducts ("targetoid" pattern)'),
bullet('Cells: small, uniform with scant cytoplasm; may contain intracytoplasmic mucin (signet ring morphology)'),
bullet('Imaging: may be occult on mammography (no desmoplasia = no density)'),
bullet('Receptor status: almost always ER+ and PR+; HER2 negative'),
bullet('Unique metastatic pattern: CSF (leptomeningeal), serosal surfaces, GI tract (peritoneal/gastric), ovary/uterus, bone marrow'),
noteBox('ILC: Indian file pattern, E-cadherin NEGATIVE, ER+/PR+, HER2-, metastasizes to unusual sites (GI, meninges, ovary).'),
h2('8.3 Special Histologic Subtypes'),
makeTable(
['Subtype', 'Key Features', 'Receptor Status', 'Prognosis'],
[
['Tubular carcinoma', 'Well-formed angulated tubules; low-grade nuclei; open lumens; detected by screening', 'ER+, PR+; HER2-', 'Excellent (rare LN mets)'],
['Mucinous (colloid) carcinoma', 'Nests of cells floating in extracellular mucin pools; soft gelatinous mass; circumscribed', 'ER+, PR+; HER2-', 'Favorable'],
['Cribriform carcinoma', '"Cookie cutter" spaces; low-grade; resembles cribriform DCIS pattern', 'ER+, PR+', 'Excellent'],
['Metaplastic carcinoma', 'Adenocarcinoma with squamous or sarcomatoid differentiation; chemotherapy-resistant', 'Triple negative', 'Poor'],
['Micropapillary carcinoma', 'Small clusters in clear stromal spaces (pseudo-lacunar spaces); high LVI', 'Variable', 'Poor (frequent LN mets)'],
['Adenoid cystic carcinoma', 'Cribriform pattern with basaloid cells; rare; similar to salivary gland ADC', 'Triple negative', 'Favorable (low met rate)'],
['Inflammatory carcinoma', 'Clinical diagnosis; dermal lymphatic invasion; peau d\'orange; swollen erythematous breast; NO palpable mass', 'Any (often triple neg)', 'Poor - Stage IIIB at minimum']
]
),
new Paragraph({ spacing: { before: 200 } }),
h2('8.4 Inflammatory Breast Carcinoma'),
para('Defined by CLINICAL presentation, not a specific morphology. It is a Stage IIIB cancer by definition at diagnosis.'),
bullet('Presents with: erythema, warmth, edema, skin thickening (peau d\'orange = "orange peel" skin)'),
bullet('Usually NO palpable mass - diffuse infiltration'),
bullet('Underlying tumor: poorly differentiated, obstructs dermal lymphatics → edema and skin thickening'),
bullet('NO true inflammation - mimics cellulitis/mastitis'),
bullet('Management: neoadjuvant chemotherapy → surgery → radiation (modified radical mastectomy)'),
bullet('5-year survival: ~30-40% even with aggressive treatment'),
noteBox('Inflammatory carcinoma = CLINICAL diagnosis (not histologic). Peau d\'orange from dermal lymphatic obstruction (NOT inflammation). Always Stage III.'),
new Paragraph({ children: [new PageBreak()] }),
// ─────────────────────────────────────────────
// SECTION 9: HISTOLOGIC GRADING
// ─────────────────────────────────────────────
h1('9. HISTOLOGIC GRADING (NOTTINGHAM SCORE)'),
para('All invasive breast carcinomas are graded 1-3 using the Nottingham Histologic Score (Elston-Ellis modification of Scarff-Bloom-Richardson). Three parameters, each scored 1-3:'),
makeTable(
['Parameter', 'Score 1', 'Score 2', 'Score 3'],
[
['Tubule formation', '>75% of tumor forms glands', '10-75% forms glands', '<10% forms glands'],
['Nuclear pleomorphism', 'Small, uniform nuclei', 'Moderate variation', 'Marked variation, prominent nucleoli'],
['Mitotic rate', 'Low (count varies with field size)', 'Moderate', 'High']
]
),
new Paragraph({ spacing: { before: 120 } }),
bullet('Total score 3-5 = Grade 1 (well differentiated) - best prognosis'),
bullet('Total score 6-7 = Grade 2 (moderately differentiated)'),
bullet('Total score 8-9 = Grade 3 (poorly differentiated) - worst prognosis'),
noteBox('Tubule formation + Nuclear pleomorphism + Mitotic rate = Nottingham Grade. Remember: 3-5 = G1, 6-7 = G2, 8-9 = G3.'),
new Paragraph({ children: [new PageBreak()] }),
// ─────────────────────────────────────────────
// SECTION 10: MOLECULAR SUBTYPES
// ─────────────────────────────────────────────
h1('10. MOLECULAR SUBTYPES OF BREAST CANCER'),
para('Breast cancers cluster into three major molecular groups based on gene expression profiling and IHC markers. These subtypes have distinct biology, prognosis, and treatment implications.'),
makeTable(
['Subtype', 'IHC Profile', 'Grade', 'Key Mutations', 'Prognosis', 'Treatment'],
[
['Luminal A', 'ER+, PR+, HER2-, Ki-67 LOW', 'Usually G1-2', 'PIK3CA, CDH1', 'Best - late recurrence (>10 yrs)', 'Endocrine therapy (tamoxifen/AI)'],
['Luminal B', 'ER+, PR± HER2±, Ki-67 HIGH', 'Usually G2-3', 'PIK3CA, TP53', 'Intermediate', 'Endocrine ± chemo; HER2 inhibitor if HER2+'],
['HER2-enriched', 'ER-, PR-, HER2+', 'G3', 'HER2 amp, TP53', 'Formerly poor; now good with targeted Rx', 'Trastuzumab (Herceptin) ± pertuzumab + chemo'],
['Triple Negative (TNBC)', 'ER-, PR-, HER2-', 'G3', 'TP53, BRCA1 (50%), PTEN', 'Poor - early recurrence (≤8 yrs)', 'Chemotherapy; PARP inhibitors (if BRCA+); immunotherapy']
]
),
new Paragraph({ spacing: { before: 200 } }),
h2('Key Points on Molecular Subtypes'),
boldBullet('Luminal A vs B', 'Key difference is proliferation (Ki-67). Luminal A = low Ki-67; Luminal B = high Ki-67. Both are ER+ but Luminal B has worse prognosis and may need chemotherapy.'),
boldBullet('HER2 (ERBB2)', 'Located on chromosome 17q12. Amplified in 15-20% of invasive breast cancers. Activates RAS/MAPK and PI3K/AKT. Trastuzumab (Herceptin): monoclonal antibody targeting HER2 extracellular domain.'),
boldBullet('Triple-Negative', 'Associated with BRCA1 mutations (50% of TNBC). Includes basal-like subtype (cytokeratin 5/6+, EGFR+). No targeted therapy available except for BRCA-mutated (PARP inhibitors). Neoadjuvant chemo; pathologic complete response = excellent prognosis.'),
boldBullet('Recurrence Patterns', 'Luminal A: low but sustained recurrence risk >10 years (late recurrence). TNBC: almost all recurrences within 8 years. HER2+: bimodal (early and late peaks).'),
noteBox('Remember: Luminal A = best prognosis, late recurrence. Triple negative = worst prognosis, early recurrence. BRCA1 → triple negative. BRCA2 → luminal (ER+).'),
new Paragraph({ children: [new PageBreak()] }),
// ─────────────────────────────────────────────
// SECTION 11: CLINICAL FEATURES & STAGING
// ─────────────────────────────────────────────
h1('11. CLINICAL FEATURES & STAGING'),
h2('11.1 Clinical Presentation'),
bullet('Most common presentation: painless, irregular, firm mass (palpation or screening)'),
bullet('Upper outer quadrant (50%) > central (20%)'),
bullet('Skin changes: dimpling, retraction, peau d\'orange (inflammatory)'),
bullet('Nipple changes: retraction, Paget disease (eczema-like lesion of nipple areola complex)'),
bullet('Advanced: axillary lymphadenopathy, bone pain, dyspnea, jaundice'),
h2('11.2 Paget Disease of the Nipple'),
bullet('Eczematoid change of the nipple/areola'),
bullet('Intraepidermal spread of DCIS/invasive carcinoma cells (Paget cells) along ducts to skin'),
bullet('Paget cells: large, pale cells with clear halos (mucin) within squamous epithelium'),
bullet('~50% of patients have palpable underlying mass'),
bullet('IHC: CK7+ and HER2+ in most cases'),
bullet('Always indicates underlying carcinoma (in situ or invasive)'),
noteBox('Paget disease of nipple = eczematoid nipple + underlying breast carcinoma. Paget cells in epidermis: large clear cells (HER2+, CK7+).'),
h2('11.3 Metastatic Patterns'),
bullet('Axillary lymph nodes: most common first site; critical for staging'),
bullet('Bone (most common distant site): osteolytic lesions; pain, pathologic fractures, hypercalcemia'),
bullet('Lung and pleura'),
bullet('Liver'),
bullet('Brain'),
bullet('Lobular carcinoma specific: GI tract (stomach mimicking linitis plastica), meninges, ovary, uterus'),
h2('11.4 TNM Staging (AJCC 8th Edition)'),
para('The 8th edition AJCC combines anatomic stage with molecular group (biologic type) to create Prognostic Stage Groups for better survival estimates.'),
makeTable(
['T Stage', 'Description'],
[
['Tis', 'DCIS or Paget disease without underlying tumor'],
['T1', 'Tumor ≤2 cm (T1a ≤0.1, T1b >0.1-0.5, T1c >0.5-2 cm)'],
['T2', 'Tumor >2 cm and ≤5 cm'],
['T3', 'Tumor >5 cm'],
['T4', 'Any size with: (a) chest wall invasion, (b) skin ulceration/edema/satellite nodules, (c) both, (d) inflammatory carcinoma']
]
),
new Paragraph({ spacing: { before: 100 } }),
makeTable(
['N Stage', 'Description'],
[
['N0', 'No regional lymph node metastasis'],
['N1', '1-3 ipsilateral axillary lymph nodes; OR internal mammary nodes (sentinel biopsy)'],
['N2', '4-9 axillary lymph nodes; OR internal mammary nodes (clinical)'],
['N3', '≥10 axillary nodes; OR infraclavicular; OR supraclavicular']
]
),
new Paragraph({ spacing: { before: 100 } }),
makeTable(
['Stage', 'TNM', 'Notes'],
[
['Stage 0', 'Tis N0 M0', 'In situ disease only'],
['Stage I', 'T1 N0 M0', 'Small, node-negative'],
['Stage IIA', 'T0-1 N1 or T2 N0', 'Early regional'],
['Stage IIB', 'T2 N1 or T3 N0', ''],
['Stage IIIA', 'T0-3 N2 or T3 N1', 'Locally advanced'],
['Stage IIIB', 'T4 any N or inflammatory', 'Includes all T4 and inflammatory'],
['Stage IIIC', 'Any T N3 M0', ''],
['Stage IV', 'Any T, Any N, M1', 'Distant metastases']
]
),
new Paragraph({ spacing: { before: 200 } }),
new Paragraph({ children: [new PageBreak()] }),
// ─────────────────────────────────────────────
// SECTION 12: PROGNOSTIC & PREDICTIVE FACTORS
// ─────────────────────────────────────────────
h1('12. PROGNOSTIC & PREDICTIVE FACTORS'),
para('Prognosis depends on both biologic features and anatomic stage. Predictive factors determine response to specific therapies.'),
makeTable(
['Factor', 'Good Prognosis', 'Poor Prognosis'],
[
['Tumor size', 'Small (<1 cm)', 'Large (>5 cm)'],
['Lymph node status', 'Negative', 'Positive (↑ number = ↑ worse)'],
['Histologic grade', 'Grade 1 (Nottingham 3-5)', 'Grade 3 (Nottingham 8-9)'],
['ER/PR status', 'Positive (responds to endocrine Rx)', 'Negative'],
['HER2 status', 'Negative (no targeted Rx needed)', 'Positive (if untreated); Good with trastuzumab'],
['Lymphovascular invasion (LVI)', 'Absent', 'Present'],
['Molecular subtype', 'Luminal A', 'Triple negative'],
['Ki-67 (proliferation index)', 'Low (<14%)', 'High (>30%)'],
['Distant metastases', 'None (M0)', 'Present (M1)']
]
),
new Paragraph({ spacing: { before: 200 } }),
h2('Gene Expression Profiling Assays'),
boldBullet('Oncotype DX (21-gene Recurrence Score)', 'Used in ER+/HER2-, node-negative or limited node-positive disease. Guides decision for chemotherapy. Low RS (<26): endocrine therapy alone. High RS (≥26): add chemotherapy.'),
boldBullet('MammaPrint (70-gene signature)', 'Classifies as low or high genomic risk. Used in ER+, stage I-II, HER2-.'),
boldBullet('Prosigna (PAM50)', 'Determines intrinsic subtype and ROR (Risk of Recurrence) score.'),
new Paragraph({ children: [new PageBreak()] }),
// ─────────────────────────────────────────────
// SECTION 13: TREATMENT OVERVIEW
// ─────────────────────────────────────────────
h1('13. TREATMENT OVERVIEW'),
h2('13.1 Surgical Options'),
bullet('Breast-conserving surgery (BCS/lumpectomy): for most Stage I-II; requires adequate margins + whole breast radiation'),
bullet('Modified radical mastectomy: removes breast + axillary nodes (pectoralis muscles spared)'),
bullet('Sentinel lymph node biopsy (SLNB): mapping with radiotracer/dye; if SLN negative, formal axillary dissection avoided'),
h2('13.2 Radiation'),
bullet('After BCS: whole breast radiation mandatory (reduces local recurrence)'),
bullet('After mastectomy: post-mastectomy radiation for T3/T4, ≥4 positive nodes, close margins'),
h2('13.3 Systemic Therapy'),
makeTable(
['Therapy Type', 'Target/Mechanism', 'Examples', 'Indication'],
[
['Endocrine therapy', 'ER pathway', 'Tamoxifen (SERM; pre+postmenop), Aromatase inhibitors (postmenop): anastrozole, letrozole, exemestane', 'All ER+ tumors'],
['HER2-targeted', 'HER2 extracellular domain', 'Trastuzumab (Herceptin), Pertuzumab, T-DM1 (ado-trastuzumab emtansine), Lapatinib (TKI)', 'HER2+ tumors'],
['CDK4/6 inhibitors', 'Cell cycle G1→S', 'Palbociclib, Ribociclib, Abemaciclib', 'ER+/HER2- metastatic + early high-risk'],
['PARP inhibitors', 'DNA repair', 'Olaparib, Talazoparib', 'BRCA1/2-mutated HER2-negative'],
['PI3K inhibitors', 'PIK3CA pathway', 'Alpelisib', 'PIK3CA-mutated ER+ metastatic'],
['Immunotherapy', 'PD-L1', 'Atezolizumab, Pembrolizumab', 'TNBC (PD-L1+)'],
['Antibody-drug conjugate', 'HER2, TROP-2', 'T-DXd (trastuzumab deruxtecan), Sacituzumab govitecan', 'HER2-low, TNBC']
]
),
new Paragraph({ spacing: { before: 200 } }),
new Paragraph({ children: [new PageBreak()] }),
// ─────────────────────────────────────────────
// SECTION 14: MALE BREAST CANCER
// ─────────────────────────────────────────────
h1('14. MALE BREAST CANCER'),
bullet('Rare: ~1% of all breast cancers'),
bullet('Median age: 65 years (10 years older than female)'),
bullet('Risk factors: BRCA2 mutation (most important hereditary factor), Klinefelter syndrome (47,XXY), hyperestrogenic states (liver disease, obesity, estrogen therapy), radiation'),
bullet('Most common: invasive ductal carcinoma (NST)'),
bullet('Usually ER+ and PR+ (>90%)'),
bullet('Gynecomastia is NOT a precursor but is a common benign condition in males'),
bullet('Prognosis: stage for stage, similar to female breast cancer; often diagnosed later = worse overall'),
new Paragraph({ children: [new PageBreak()] }),
// ─────────────────────────────────────────────
// SECTION 15: HIGH-YIELD SUMMARY TABLE
// ─────────────────────────────────────────────
h1('15. HIGH-YIELD USMLE SUMMARY'),
makeTable(
['Condition', 'Age/Demographics', 'Presentation', 'Key Pathology', 'High-Yield Facts'],
[
['Fibroadenoma', '15-35 years', 'Mobile, rubbery, nontender mass', 'Biphasic; slitlike glands; low cellularity', 'Most common benign breast tumor; MED12 mutation; "breast mouse"'],
['Phyllodes tumor', '45-55 years', 'Large, rapidly growing mass', 'Leaf-like (phyllodes) pattern; stromal overgrowth', 'Can recur; malignant type metastasizes (lung); wide excision required'],
['Fibrocystic changes', '30-50 years', 'Bilateral cyclic pain, nodularity', 'Cysts, apocrine metaplasia, adenosis, fibrosis', 'Non-proliferative = no cancer risk; blue-dome cysts'],
['ADH', '35-60 years', 'Mammographic finding', 'Some DCIS features but incomplete', '4-5x cancer risk; 10x if family history; excision recommended'],
['DCIS', '50-70 years', 'Microcalcifications on mammogram', 'Malignant cells in ducts; E-cadherin+; necrosis in high-grade', 'Comedo = high grade; graded by NUCLEAR features; same-breast risk'],
['LCIS', '40-50 years', 'Incidental finding on biopsy', 'Small uniform cells; E-cadherin NEGATIVE; fills lobules', 'Bilateral risk marker; 1%/year; E-cadherin loss; ER+'],
['IDC (NST)', '>50 years', 'Irregular hard mass', 'Variable; desmoplasia; gritty', 'Most common (70-80%); Nottingham grade 1-3'],
['ILC', '55-65 years', 'May be occult; diffuse thickening', 'Indian file; E-cadherin NEGATIVE; single cells', 'Mets to GI/meninges/ovary; ER+; no desmoplastic response'],
['Inflammatory carcinoma', 'Variable', 'Red, swollen, warm breast; peau d\'orange; NO mass', 'Dermal lymphatic invasion; poorly differentiated', 'Stage IIIB minimum; clinical dx; 5-yr survival ~30-40%'],
['Paget disease', 'Variable', 'Eczematoid nipple lesion', 'Large clear Paget cells in squamous epithelium', 'Always underlying carcinoma; CK7+, HER2+; ≠ bone Paget'],
['TNBC', '<50 years; BRCA1', 'Large, fast-growing; hard mass', 'G3; minimal stroma; TILs; ER-, PR-, HER2-', 'Worst prognosis; chemo only; PARP inhibitors if BRCA+'],
['HER2-enriched', 'Variable', 'Rapid growth; aggressive', 'G3; HER2 amplification (17q12)', 'Responds to trastuzumab; formerly poor prognosis'],
['Mucinous carcinoma', '>70 years', 'Soft, gelatinous mass', 'Tumor cells floating in mucin pools', 'Favorable prognosis; ER+'],
['Tubular carcinoma', 'Screening age', 'Small mass (mammogram)', 'Well-formed tubules; angulated open lumens', 'Excellent prognosis; rare LN mets; ER+'],
['Male breast cancer', '65 years (male)', 'Subareolar mass; nipple discharge', 'IDC (NST) most common; ER+ usually', 'BRCA2 most important gene; Klinefelter syndrome risk']
]
),
new Paragraph({ spacing: { before: 200 } }),
new Paragraph({ children: [new PageBreak()] }),
// ─────────────────────────────────────────────
// SECTION 16: HIGH-YIELD MNEMONICS
// ─────────────────────────────────────────────
h1('16. HIGH-YIELD MNEMONICS & QUICK FACTS'),
h2('Benign vs. Malignant Mass'),
bullet('Benign: Soft/rubbery, Round/oval, Well-defined borders, MOBILE, Usually nontender'),
bullet('Malignant: Hard/stony, Irregular, Ill-defined/spiculated borders, FIXED, May be painless'),
h2('Risk Factors Mnemonic: "F-CANDLES"'),
bullet('F - Family history (BRCA1/2)'),
bullet('C - Cancer history (prior breast/ovarian)'),
bullet('A - Age (risk increases with age)'),
bullet('N - Nulliparity / Late first pregnancy'),
bullet('D - Dense breasts / prior Dense biopsy with atypia'),
bullet('L - Late menopause / Long estrogen exposure'),
bullet('E - Early menarche'),
bullet('S - Smoking, radiation, Synthetic estrogen (HRT)'),
h2('E-cadherin Quick Reference'),
bullet('E-cadherin POSITIVE: Normal breast epithelium, IDC, UDH, ADH, DCIS'),
bullet('E-cadherin NEGATIVE: ALH, LCIS, Invasive Lobular Carcinoma (ILC)'),
h2('Molecular Subtype Quick Reference'),
bullet('ER+ / HER2- / Low Ki67 = Luminal A (best prognosis)'),
bullet('ER+ / HER2- / High Ki67 = Luminal B (intermediate)'),
bullet('ER- / HER2+ = HER2-enriched (trastuzumab)'),
bullet('ER- / PR- / HER2- = Triple Negative (BRCA1, worst prognosis)'),
h2('Nottingham Grading Memory Trick'),
bullet('"The NuMber" = Nuclei + Mitoses + (Tu)bules → N+M+T = Nottingham'),
bullet('Score 3-5 = G1 (low), 6-7 = G2 (moderate), 8-9 = G3 (high)'),
h2('DCIS vs LCIS Summary'),
bullet('DCIS: Ductal = Same-breast risk, E-cadherin+, Calcifications, Comedo necrosis (high grade), Graded by NUCLEAR features'),
bullet('LCIS: Lobular = biLateral risk, E-cadherin LOST, No calcifications (classic), Incidental finding, Risk marker'),
new Paragraph({ spacing: { before: 200 } }),
// References
h1('SOURCES'),
bullet('Robbins & Kumar Basic Pathology, 11th Edition, Chapter 17 (Female Genital Tract and Breast)'),
bullet('Robbins, Cotran & Kumar Pathologic Basis of Disease, 10th Edition, Chapter 23 (Breast)'),
new Paragraph({ spacing: { before: 200 } })
]
}]
});
Packer.toBuffer(doc).then(buffer => {
fs.writeFileSync('/home/daytona/workspace/breast-pathology/Breast_Pathology_Complete_USMLE.docx', buffer);
console.log('Document created successfully!');
}).catch(err => {
console.error('Error:', err);
process.exit(1);
});
cd /home/daytona/workspace/breast-pathology && node generate.js 2>&1