Make notes and add explanations n extra notes wherever possible

Reading File
Reading File
Running Command

cd /home/daytona/workspace && python3 -c " import pdfplumber pdf_path = '/home/daytona/workspace/attachments/c19905e7-3601-47a7-bdb7-9b0929e2b435/lesson 11 Medical Investigations in Gynecological patients-1.pdf' with pdfplumber.open(pdf_path) as pdf: print(f'Total pages: {len(pdf.pages)}') for i, page in enumerate(pdf.pages): print(f'\n===== PAGE {i+1} =====') text = page.extract_text() if text: print(text) else: print('[No text extracted]') "

Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Running Command

mkdir -p /home/daytona/workspace/gynae-notes && ls /home/daytona/workspace/gynae-notes/

Writing File

~/gynae-notes/create_notes.js

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

// ─── Helper functions ──────────────────────────────────────────────────────
const h1 = (text) => new Paragraph({
  text,
  heading: HeadingLevel.HEADING_1,
  spacing: { before: 360, after: 120 },
  shading: { type: ShadingType.SOLID, color: '1F4E79', fill: '1F4E79' },
  run: { color: 'FFFFFF' }
});

// Custom H1 with background via run shading trick
const heading1 = (text) => new Paragraph({
  children: [new TextRun({ text, color: 'FFFFFF', bold: true, size: 30, font: 'Calibri' })],
  heading: HeadingLevel.HEADING_1,
  spacing: { before: 400, after: 160 },
  shading: { type: ShadingType.SOLID, color: '1F4E79', fill: '1F4E79' },
  alignment: AlignmentType.LEFT,
  indent: { left: 240 }
});

const heading2 = (text) => new Paragraph({
  children: [new TextRun({ text, color: '2E74B5', bold: true, size: 26, font: 'Calibri' })],
  heading: HeadingLevel.HEADING_2,
  spacing: { before: 320, after: 100 },
  border: { bottom: { style: BorderStyle.SINGLE, size: 6, color: '2E74B5', space: 4 } }
});

const heading3 = (text) => new Paragraph({
  children: [new TextRun({ text, color: '1F6B3A', bold: true, size: 24, font: 'Calibri' })],
  heading: HeadingLevel.HEADING_3,
  spacing: { before: 240, after: 80 },
});

const body = (text) => new Paragraph({
  children: [new TextRun({ text, size: 22, font: 'Calibri' })],
  spacing: { before: 60, after: 60 },
});

const bullet = (text) => new Paragraph({
  children: [new TextRun({ text, size: 22, font: 'Calibri' })],
  bullet: { level: 0 },
  spacing: { before: 40, after: 40 },
  indent: { left: 360 }
});

const subBullet = (text) => new Paragraph({
  children: [new TextRun({ text, size: 21, font: 'Calibri' })],
  bullet: { level: 1 },
  spacing: { before: 30, after: 30 },
  indent: { left: 720 }
});

const noteBox = (label, text) => new Paragraph({
  children: [
    new TextRun({ text: `📌 ${label}: `, bold: true, size: 22, color: '7B2D00', font: 'Calibri' }),
    new TextRun({ text, size: 22, color: '3D1C00', font: 'Calibri' })
  ],
  shading: { type: ShadingType.SOLID, color: 'FFF2CC', fill: 'FFF2CC' },
  spacing: { before: 100, after: 100 },
  indent: { left: 360, right: 360 },
  border: {
    left: { style: BorderStyle.THICK, size: 12, color: 'F4A623', space: 12 }
  }
});

const clinicalNote = (text) => new Paragraph({
  children: [
    new TextRun({ text: '🩺 Clinical Pearl: ', bold: true, size: 22, color: '1A5276', font: 'Calibri' }),
    new TextRun({ text, size: 22, color: '1B2631', font: 'Calibri' })
  ],
  shading: { type: ShadingType.SOLID, color: 'D6EAF8', fill: 'D6EAF8' },
  spacing: { before: 100, after: 100 },
  indent: { left: 360, right: 360 },
  border: {
    left: { style: BorderStyle.THICK, size: 12, color: '2E86C1', space: 12 }
  }
});

const examTip = (text) => new Paragraph({
  children: [
    new TextRun({ text: '⭐ Exam Tip: ', bold: true, size: 22, color: '1B5E20', font: 'Calibri' }),
    new TextRun({ text, size: 22, color: '1B5E20', font: 'Calibri' })
  ],
  shading: { type: ShadingType.SOLID, color: 'E8F5E9', fill: 'E8F5E9' },
  spacing: { before: 100, after: 100 },
  indent: { left: 360, right: 360 },
  border: {
    left: { style: BorderStyle.THICK, size: 12, color: '2E7D32', space: 12 }
  }
});

const divider = () => new Paragraph({
  children: [new TextRun({ text: '' })],
  border: { bottom: { style: BorderStyle.SINGLE, size: 3, color: 'CCCCCC' } },
  spacing: { before: 200, after: 200 }
});

const boldBody = (label, text) => new Paragraph({
  children: [
    new TextRun({ text: label + ': ', bold: true, size: 22, font: 'Calibri', color: '1F4E79' }),
    new TextRun({ text, size: 22, font: 'Calibri' })
  ],
  spacing: { before: 60, after: 60 },
});

// ─── Two-column comparison table ──────────────────────────────────────────
const twoColTable = (headers, rows) => {
  const headerRow = new TableRow({
    children: headers.map(h => new TableCell({
      children: [new Paragraph({
        children: [new TextRun({ text: h, bold: true, color: 'FFFFFF', size: 22 })],
        alignment: AlignmentType.CENTER
      })],
      shading: { type: ShadingType.SOLID, color: '2E74B5', fill: '2E74B5' },
      verticalAlign: VerticalAlign.CENTER,
      width: { size: 100 / headers.length, type: WidthType.PERCENTAGE }
    }))
  });
  const dataRows = rows.map((row, i) => new TableRow({
    children: row.map(cell => new TableCell({
      children: [new Paragraph({ children: [new TextRun({ text: cell, size: 21 })], spacing: { before: 40, after: 40 } })],
      shading: { type: ShadingType.SOLID, color: i % 2 === 0 ? 'EBF5FB' : 'FFFFFF', fill: i % 2 === 0 ? 'EBF5FB' : 'FFFFFF' },
      width: { size: 100 / row.length, type: WidthType.PERCENTAGE }
    }))
  }));
  return new Table({
    rows: [headerRow, ...dataRows],
    width: { size: 100, type: WidthType.PERCENTAGE },
    margins: { top: 80, bottom: 80, left: 120, right: 120 }
  });
};

// ─── COVER PAGE ───────────────────────────────────────────────────────────
const coverPage = [
  new Paragraph({ children: [new TextRun({ text: '' })], spacing: { before: 1200 } }),
  new Paragraph({
    children: [new TextRun({ text: 'MEDICAL INVESTIGATIONS', bold: true, size: 52, color: '1F4E79', font: 'Calibri' })],
    alignment: AlignmentType.CENTER,
    spacing: { after: 80 }
  }),
  new Paragraph({
    children: [new TextRun({ text: 'IN A GYNECOLOGICAL PATIENT', bold: true, size: 44, color: '2E74B5', font: 'Calibri' })],
    alignment: AlignmentType.CENTER,
    spacing: { after: 200 }
  }),
  new Paragraph({
    children: [new TextRun({ text: '─────────────────────────────────────────', color: '2E74B5', size: 24 })],
    alignment: AlignmentType.CENTER,
    spacing: { after: 200 }
  }),
  new Paragraph({
    children: [new TextRun({ text: 'Lesson 11 — Comprehensive Study Notes', size: 28, color: '555555', font: 'Calibri', italics: true })],
    alignment: AlignmentType.CENTER,
    spacing: { after: 100 }
  }),
  new Paragraph({
    children: [new TextRun({ text: 'With Expanded Explanations & Clinical Pearls', size: 26, color: '777777', font: 'Calibri', italics: true })],
    alignment: AlignmentType.CENTER,
    spacing: { after: 600 }
  }),
  new Paragraph({
    children: [new TextRun({ text: 'Prepared May 2026', size: 22, color: '999999', font: 'Calibri' })],
    alignment: AlignmentType.CENTER
  }),
  new Paragraph({ children: [new TextRun({ text: '' })], pageBreakBefore: true })
];

// ─── SECTION 1: INTRODUCTION ──────────────────────────────────────────────
const section1 = [
  heading1('SECTION 1: INTRODUCTION'),
  body('The health care of women encompasses all aspects of medical science and therapeutics. A complete gynecologic evaluation requires understanding of the patient\'s age, reproductive status, and reproductive desire.'),
  noteBox('Why it matters', 'A woman\'s health needs differ vastly across life stages. A 16-year-old presenting with pelvic pain has a different differential diagnosis than a 55-year-old postmenopausal woman with the same complaint.'),
  body('For the proper evaluation, diagnosis, and treatment of a gynecological patient, a variety of investigative methods are essential. These methods range from simple history-taking to advanced imaging.'),
  clinicalNote('The single most valuable investigation in gynecology is still a thorough, well-structured patient history. Most diagnoses can be narrowed to 2–3 possibilities from the history alone before any test is ordered.'),
  divider(),
];

// ─── SECTION 2: PATIENT HISTORY ───────────────────────────────────────────
const section2 = [
  heading1('SECTION 2: PATIENT HISTORY'),
  body('History-taking is the cornerstone of gynecologic evaluation. The history should be concise but thorough, covering general information plus specialized reproductive history.'),
  noteBox('Key Principle', 'Do NOT interrupt the patient. Cutting off her story may obscure important clues. Let her speak for at least 60–90 seconds before directing with questions.'),

  heading2('2.1 Identifying Data'),
  boldBody('Age', 'Problems and management approaches vary by life stage: pubescence, adolescence, childbearing years, perimenopausal, and postmenopausal.'),
  noteBox('Why Age Matters Clinically', 'Abnormal bleeding in a 16-year-old is most likely anovulatory/hormonal; in a 55-year-old, endometrial carcinoma must be excluded until proven otherwise. Age is thus the single most important filtering variable in gynecology.'),
  boldBody('Last Normal Menstrual Period (LNMP)', 'A missed period, irregular periods, erratic or abnormal bleeding can all imply specific events (pregnancy, hormonal imbalance, malignancy). The LNMP date anchors the clinical timeline.'),
  noteBox('LNMP vs LMP', 'LNMP (Last NORMAL Menstrual Period) is specifically the last period that was normal in timing, flow, and duration — not just any bleeding. This distinction is clinically important in early pregnancy and in anovulatory patients.'),
  boldBody('Gravidity and Parity — TPAL System', 'Recorded as a 4-digit code:'),
  bullet('T = Term pregnancies (≥37 weeks)'),
  bullet('P = Premature deliveries (20–36 weeks)'),
  bullet('A = Abortions (spontaneous or induced, <20 weeks)'),
  bullet('L = Living children'),
  noteBox('Example', 'G4P3 (T2P1A1L3) = 4 pregnancies, 2 term, 1 premature, 1 abortion, 3 living children. A woman can be G4P3 in different ways — TPAL prevents ambiguity.'),
  examTip('TPAL is a favorite exam format. Remember: Gravidity = total pregnancies ever (including current). Parity = pregnancies carried past 20 weeks.'),

  heading2('2.2 Chief Complaint'),
  body('Best elicited with open-ended questions: "What kind of problem are you having?" or "How can I help you?" This avoids leading the patient and allows her to prioritize her concerns.'),

  heading2('2.3 Present Illness'),
  body('Each problem described must be explored in full:'),
  bullet('What exactly is the problem?'),
  bullet('Where exactly is it occurring?'),
  bullet('Date and time of onset'),
  bullet('Is it improving or worsening?'),
  bullet('Duration of symptoms'),
  bullet('How do symptoms relate to her menstrual cycle, sexual activity, or other life events?'),
  clinicalNote('Always ask how symptoms relate to the menstrual cycle. Cyclical pelvic pain worsening with menstruation strongly suggests endometriosis. Mid-cycle pain (Mittelschmerz) is ovulatory. Pre-menstrual pain may indicate premenstrual dysphoric disorder (PMDD).'),

  heading2('2.4 Past History'),
  bullet('Contraceptive history (type and duration — affects hormone levels, STD risk)'),
  bullet('Medications and habits (OCP, HRT, smoking, alcohol)'),
  bullet('Previous medical and surgical history (especially pelvic/abdominal surgeries — adhesion risk)'),
  bullet('Allergies'),
  bullet('Obstetric, gynecological, and sexual history'),
  bullet('Social history (domestic violence, sexual partners, occupational exposure)'),

  heading2('2.5 Family History'),
  bullet('Health of immediate relatives'),
  bullet('Familial heart disease and hypertension'),
  bullet('Diabetes mellitus'),
  bullet('Breast, ovarian, or other cancers'),
  bullet('Genetic illnesses (e.g., BRCA1/2 mutations relevant to breast and ovarian cancer risk)'),
  noteBox('BRCA1/2 Clinical Significance', 'Women with BRCA1 mutation have a 40–87% lifetime risk of breast cancer and 40–60% risk of ovarian cancer. Family history of these cancers should prompt genetic counseling and possible testing. This directly affects screening and management decisions.'),
  divider(),
];

// ─── SECTION 3: PHYSICAL EXAMINATION ─────────────────────────────────────
const section3 = [
  heading1('SECTION 3: PHYSICAL EXAMINATION'),
  body('The physical examination is most useful in a comfortable, private environment. A female assistant should ideally be present, especially during pelvic examination. The physician must explain each step before performing it.'),
  clinicalNote('Informed consent for examination is both ethical and legal. Explaining each step also reduces patient anxiety, which leads to better muscle relaxation — making the pelvic exam more accurate.'),

  heading2('3.1 General Examination'),
  bullet('Vital signs: BP, pulse, temperature, respiratory rate'),
  bullet('Weight and height (BMI) — obesity is a major risk factor for endometrial cancer, PCOS, and infertility'),
  bullet('General appearance, signs of endocrine disorders (hirsutism, acne, striae)'),
  noteBox('Why BMI Matters in Gynecology', 'Adipose tissue produces estrone (a weak estrogen) from androgen precursors. Obese women have higher circulating estrogen → increased endometrial stimulation → higher risk of endometrial hyperplasia and carcinoma. Obesity also raises the risk of anovulation and PCOS.'),

  heading2('3.2 Abdominal Examination'),
  bullet('Auscultation first (bowel sounds before palpation to avoid falsely altering them)'),
  bullet('Palpation for tenderness or organ enlargement'),
  bullet('Suprapubic palpation for uterine or bladder enlargement'),
  bullet('Percussion for ascites (shifting dullness, fluid thrill)'),
  clinicalNote('A uterine fibroid large enough to be palpable abdominally usually corresponds to a pregnancy of 12 weeks or more in size. Always measure the mass relative to the umbilicus for documentation.'),

  heading2('3.3 Pelvic Examination'),
  bullet('Inspect pubic hair for folliculitis or pubic lice (pediculosis pubis)'),
  bullet('Inspect glans clitoridis and labia for dermatological lesions, ulcers, or masses'),
  bullet('Palpate Bartholin\'s glands (located at 5 and 7 o\'clock of the vaginal introitus) for enlargement or tenderness — enlargement may indicate Bartholin\'s cyst or abscess'),
  bullet('Inspect perianal region for hemorrhoids, fissures, condylomata, or neoplastic lesions'),
  noteBox('Bartholin\'s Glands', 'These are vestibular glands that produce lubricating mucus. They are not normally palpable. A palpable Bartholin\'s gland in a woman over 40 must raise suspicion for carcinoma.'),

  heading2('3.4 Vaginal (Speculum) Examination'),
  bullet('The speculum allows direct visualization of the vagina and cervix'),
  bullet('Assess vaginal walls for discharge (color, consistency, odor), ulcers, or lesions'),
  bullet('Inspect the cervix for erosions, ectropion, polyps, and lesions'),
  bullet('Normal cervical os is small in nulliparous women; parous women have a wider, transverse slit'),
  noteBox('Cervical Ectropion vs Erosion', 'Cervical ectropion (also called cervical erosion informally) is the normal appearance of columnar epithelium from the endocervix extending onto the visible ectocervix — it looks red and velvety. True erosion is an ulcer. Ectropion is more common in young women, OCP users, and during pregnancy.'),

  heading2('3.5 Bimanual Examination'),
  body('Two fingers of the dominant hand are inserted into the vagina while the opposite hand presses on the lower abdomen. Together they sandwich the pelvic organs for assessment.'),
  bullet('Uterus: position (anteverted/retroverted), size, shape, mobility, consistency, tenderness'),
  bullet('Adnexa (ovaries and tubes): any masses, tenderness (suggestive of PID or ectopic)'),
  noteBox('Uterine Positions', 'Anteverted and anteflexed is the most common normal position (80% of women). Retroversion is normal in ~20% but can be associated with endometriosis or adhesions if the uterus is fixed. A mobile retroverted uterus alone is NOT pathological.'),
  clinicalNote('Cervical motion tenderness (CMT or "chandelier sign") — pain on moving the cervix during bimanual exam — is a hallmark sign of Pelvic Inflammatory Disease (PID). It reflects peritoneal irritation from infection spreading from the uterus/tubes.'),

  heading2('3.6 Rectovaginal Examination'),
  body('Should always be performed, especially in women over 40. The middle finger is gently inserted into the rectum while the index finger remains in the vagina.'),
  bullet('Detects tenderness, masses, or irregularities posterior to the uterus'),
  bullet('Palpation of uterosacral ligaments — tender nodules suggest endometriosis'),
  bullet('Rectal masses or blood on the glove may indicate colorectal pathology'),
  noteBox('Uterosacral Ligaments and Endometriosis', 'The uterosacral ligaments run from the cervix/lower uterine segment to the sacrum. Endometriotic implants preferentially deposit here. Nodularity on rectovaginal exam is one of the most specific clinical findings for deep infiltrating endometriosis.'),
  examTip('Exam question classic: "A patient has deep dyspareunia, dysmenorrhea, and tender nodules on rectovaginal examination along the uterosacral ligaments." Diagnosis = endometriosis. Gold standard diagnosis = laparoscopy with biopsy.'),
  divider(),
];

// ─── SECTION 4: DIAGNOSTIC OFFICE PROCEDURES ─────────────────────────────
const section4 = [
  heading1('SECTION 4: DIAGNOSTIC OFFICE PROCEDURES'),

  heading2('4.1 Tests for Vaginal Infection'),
  body('If abnormal vaginal discharge is present, a sample should be examined. Vaginal pH testing is a simple initial step.'),

  twoColTable(
    ['Condition', 'pH', 'Key Finding'],
    [
      ['Normal vagina', '3.8–4.5', 'Dominated by Lactobacilli'],
      ['Fungal (Candida)', '4.0–5.0 (acidic)', 'White curdy discharge, pseudohyphae'],
      ['Bacterial Vaginosis', '5.5–7.0 (alkaline)', 'Clue cells, "fishy" amine odor'],
      ['Trichomonas vaginalis', '5.5–7.0 (alkaline)', 'Motile trichomonads, frothy green discharge'],
    ]
  ),

  new Paragraph({ children: [new TextRun({ text: '' })], spacing: { before: 120 } }),
  noteBox('Why pH Matters', 'Normal vaginal pH is maintained at 3.8–4.5 by Lactobacillus species, which produce lactic acid. This acidic environment inhibits most pathogens. Anything that disrupts the Lactobacillus flora (antibiotics, semen, menstruation, douching) raises the pH and predisposes to BV.'),

  heading3('4.1.1 Saline (Wet Mount / Plain Slide)'),
  bullet('Mix 1 drop of vaginal discharge + 1 drop of normal saline on a warm slide with coverslip'),
  bullet('Examine immediately while warm'),
  subBullet('Trichomonas: actively motile, pear-shaped, flagellated protozoa (loses motility when slide cools — hence examine warm)'),
  subBullet('Candida: segmented branching filaments (pseudohyphae/mycelia)'),
  subBullet('Bacterial vaginosis: "clue cells" — epithelial cells covered edge-to-edge with coccobacilli (Gardnerella vaginalis), obscuring the cell border'),
  clinicalNote('Clue cells are pathognomonic of Bacterial Vaginosis. A clue cell looks like a stippled or "salt and pepper" epithelial cell — the bacteria coat its surface so densely that the cell border disappears. >20% clue cells on saline wet mount = diagnostic.'),

  heading3('4.1.2 Potassium Hydroxide (KOH) Preparation'),
  bullet('Add 1 drop of KOH to vaginal discharge on a slide'),
  bullet('KOH lyses epithelial cells and RBCs but leaves fungal elements intact (hyphae/pseudohyphae of Candida are resistant to KOH)'),
  bullet('Whiff test: if discharge has a "fishy" amine odor when KOH is added, this is the positive whiff (amine) test — strongly suggestive of Bacterial Vaginosis'),
  noteBox('KOH Mechanism', 'KOH is a strong alkali (base). It denatures most cellular proteins and destroys human cells, but the fungal cell wall (containing chitin) is more resistant — this allows the fungi to be visualized in isolation, making diagnosis of candidiasis much easier.'),
  examTip('The classic BV diagnosis uses Amsel\'s Criteria (3 of 4 required): (1) Homogeneous gray-white discharge, (2) pH >4.5, (3) Positive whiff (amine) test with KOH, (4) Clue cells on wet mount.'),

  heading2('4.2 Fern Test for Ovulation'),
  body('A simple office test using cervical mucus to assess the phase of the menstrual cycle.'),
  bullet('Cervical mucus is spread on a clean, dry glass slide and allowed to air-dry'),
  bullet('Viewed under the microscope'),
  bullet('Fern (palm-leaf) pattern present → indicates HIGH estrogen, LOW progesterone → pre-ovulatory or estrogen dominance phase'),
  bullet('No fern pattern → progesterone is present → ovulation has occurred (or patient is in luteal phase)'),
  noteBox('Mechanism of Ferning', 'Under estrogenic influence, cervical mucus becomes thin, watery, and rich in NaCl (sodium chloride). As it dries, salt crystals form in a dendritic "fern" pattern. Progesterone makes mucus thick and viscous (no salt crystal formation) — hence no ferning after ovulation.'),
  clinicalNote('The fern test is rarely used in isolation today. It has been largely replaced by basal body temperature charting, LH surge kits (ovulation predictor kits), and transvaginal ultrasound follicle tracking (folliculometry).'),

  heading2('4.3 Schiller / Acetic Acid Test for Neoplasia'),
  body('Used when cancer or precancerous changes of the cervix or vaginal mucosa are suspected. Less accurate than colposcopy but can be performed in lower-resource settings.'),

  heading3('4.3.1 Schiller Test (Iodine/Lugol\'s Solution)'),
  bullet('The suspect area is painted with Lugol\'s solution (strong iodine)'),
  bullet('Normal glycogen-rich cervical epithelium: stains BROWN (Schiller-negative) → iodine reacts with glycogen'),
  bullet('Abnormal epithelium (neoplastic, scarred, columnar): does NOT stain (Schiller-positive, YELLOW/unstained) → lack of glycogen'),
  noteBox('Lugol\'s Solution', 'Contains iodine and potassium iodide. The iodine reacts with glycogen stored in squamous epithelial cells to produce a dark brown color. Columnar epithelium, scar tissue, and dysplastic cells contain little or no glycogen and thus remain unstained (iodine-negative).'),

  heading3('4.3.2 Acetic Acid Test (VIA — Visual Inspection with Acetic Acid)'),
  bullet('3–5% acetic acid is applied to the cervix'),
  bullet('Abnormal (dysplastic/pre-cancerous) cells turn WHITE (aceto-white) — this is the positive test'),
  bullet('Normal cells remain pink'),
  noteBox('Mechanism of Acetowhitening', 'Acetic acid causes temporary coagulation/precipitation of intracellular proteins. Dysplastic and cancerous cells have a high nuclear-to-cytoplasmic ratio (large, dense nuclei packed with proteins). More protein → more coagulation → more intense white color. The effect is transient (reverses within minutes).'),
  examTip('VIA (Visual Inspection with Acetic Acid) and VILI (Visual Inspection with Lugol\'s Iodine) are WHO-recommended low-resource screening strategies for cervical cancer in settings where Pap smear infrastructure is lacking.'),

  heading2('4.4 Biopsy Procedures'),
  heading3('4.4.1 Vulva and Vaginal Biopsy'),
  bullet('Local anesthetic injected around the suspicious area (1–2% aqueous solution)'),
  bullet('Tissue sampled using a skin punch or sharp scalpel'),
  bullet('Bleeding controlled by pressure or Monsel\'s solution (ferric subsulfate — a hemostatic agent)'),
  bullet('Occasional suturing required'),
  noteBox('Monsel\'s Solution', 'Ferric subsulfate solution causes chemical cauterization of small bleeding vessels. It forms an eschar (scab) at the biopsy site. It is NOT suitable for large bleeding vessels but is extremely effective for small punch biopsy sites on the vulva or cervix.'),

  heading3('4.4.2 Cervical Biopsy'),
  bullet('Colposcopically directed biopsy is the gold standard for diagnosing cervical lesions'),
  bullet('Indicated after an abnormal Pap smear or suspicious colposcopic findings'),
  bullet('"4-Quadrant Biopsy": samples taken at 12, 3, 6, and 9 o\'clock positions when colposcopy is not available'),
  bullet('Schiller test guides the physician to which area should be biopsied'),
  clinicalNote('The transformation zone (TZ) — where columnar epithelium meets squamous epithelium at the cervical os — is the origin of nearly all cervical cancers (squamous cell carcinoma and adenocarcinoma). Colposcopy targets this zone precisely.'),

  heading3('4.4.3 Endometrial Biopsy'),
  bullet('Indications: ovarian dysfunction/infertility evaluation, irregular uterine bleeding, suspected endometrial carcinoma'),
  bullet('Performed with flexible disposable cannulas (e.g., Pipelle device)'),
  bullet('The Pipelle is inserted through the cervical os into the uterine cavity; negative pressure is created by withdrawing the inner stylet, and the cannula is moved in and out to collect tissue'),
  bullet('Procedure causes cramping (prostaglandin release) — warn patient in advance; NSAIDs may be given prophylactically'),
  noteBox('Endometrial Sampling Accuracy', 'The Pipelle endometrial biopsy has a sensitivity of ~91% for detecting endometrial carcinoma in pre-menopausal women and ~99% in post-menopausal women. It samples ~4% of the endometrial surface, so a negative result in a high-risk patient may still require hysteroscopy with directed biopsy.'),
  divider(),
];

// ─── SECTION 5: LABORATORY PROCEDURES ────────────────────────────────────
const section5 = [
  heading1('SECTION 5: DIAGNOSTIC LABORATORY PROCEDURES'),

  heading2('5.1 Routine Investigations'),
  bullet('Glucose screening — rule out diabetes (relevant to PCOS, gestational diabetes, surgical risk)'),
  bullet('Lipid profile — cardiovascular risk, especially in menopausal women on HRT'),
  bullet('Urinalysis — rule out UTI, proteinuria (preeclampsia in pregnancy)'),
  bullet('Thyroid panel (TSH, FT4) — thyroid dysfunction frequently presents with menstrual irregularities'),
  noteBox('Thyroid and Menstruation', 'Hypothyroidism → menorrhagia (heavy periods) due to reduced clotting factors and elevated prolactin. Hyperthyroidism → oligomenorrhea or amenorrhea due to altered GnRH pulsatility. Always check thyroid function in patients with menstrual irregularities!'),

  heading2('5.2 Cultures'),
  bullet('Urine culture: for suspected UTI — "clean catch" midstream urine sent for microscopy, culture and sensitivity (MCS)'),
  bullet('Urethral and cervical swabs: for STI investigation (gonorrhea, chlamydia)'),
  bullet('Vaginal culture: for vaginitis investigation'),
  noteBox('NAAT (Nucleic Acid Amplification Testing)', 'NAAT has replaced culture as the gold standard for Chlamydia trachomatis and Neisseria gonorrhoeae diagnosis. It is far more sensitive (>95%) than culture and can be performed on urine, vaginal swabs (self-collected), or cervical swabs. No need for viable organisms.'),

  heading2('5.3 Specific Pathogen Tests'),
  twoColTable(
    ['Pathogen', 'Test Method', 'Notes'],
    [
      ['Herpes Simplex Virus (HSV)', 'Culture or PCR', 'PCR is more sensitive; culture requires active ulcer'],
      ['HPV and subtypes', 'PCR (cervical swab)', 'High-risk types: 16, 18, 31, 33 (oncogenic)'],
      ['Chlamydia trachomatis', 'NAAT', 'Most common bacterial STI worldwide'],
      ['Neisseria gonorrhoeae', 'NAAT', 'Co-infection with Chlamydia common'],
      ['HIV', 'Blood test (ELISA + Western blot)', '4th gen tests detect p24 antigen + antibody'],
      ['Hepatitis B & C', 'Serology (HBsAg, Anti-HCV)', 'Screen all new gynecology patients'],
      ['Lymphogranuloma venereum', 'Serology (complement fixation)', 'Caused by Chlamydia trachomatis L1-L3 subtypes'],
      ['Group B Streptococcus', 'Culture swab (35–37 weeks gestation)', 'Vagina → anus swab; treat if positive to prevent neonatal sepsis'],
    ]
  ),
  new Paragraph({ children: [new TextRun({ text: '' })], spacing: { before: 120 } }),
  clinicalNote('Group B Streptococcus (GBS) screening at 35–37 weeks is critical. If positive, IV penicillin is given intrapartum to prevent early-onset neonatal GBS sepsis — a potentially fatal condition in newborns.'),

  heading2('5.4 Pregnancy Test'),
  bullet('Detects beta-hCG (human Chorionic Gonadotropin) in urine or blood'),
  bullet('Urine: rapid qualitative test (positive/negative), detects hCG ≥20–25 mIU/mL'),
  bullet('Serum quantitative beta-hCG: precise measurement, doubles every 48–72 hours in normal early pregnancy'),
  noteBox('Ectopic Pregnancy Surveillance', 'In a suspected ectopic pregnancy, serial quantitative serum hCG levels are measured every 48 hours. In a normal intrauterine pregnancy, hCG should double every 48–72 hours. A rise of less than 66% in 48 hours is abnormal and raises suspicion for ectopic or non-viable pregnancy.'),
  divider(),
];

// ─── SECTION 6: PAP SMEAR ─────────────────────────────────────────────────
const section6 = [
  heading1('SECTION 6: PAPANICOLAOU (PAP) SMEAR'),
  body('The Pap smear is a screening test for cervical cancer and precancerous changes. It is one of the most successful cancer screening tools in medical history — it has reduced cervical cancer mortality by over 70% since its introduction.'),

  heading2('6.1 Key Facts'),
  bullet('Screening test only — positive results require further diagnostic procedures (colposcopy ± biopsy)'),
  bullet('Sensitivity: ~95% for carcinoma of the cervix; ~50% for endometrial pathology (polyps, hyperplasia, cancer)'),
  bullet('For women with 3 consecutive normal smears: screening every 2–3 years is adequate'),
  noteBox('Updated Cervical Cancer Screening Guidelines (ASCCP 2019)', 'Age <21: No screening. Age 21–29: Pap smear alone every 3 years. Age 30–65: Co-testing (Pap + HPV) every 5 years preferred, OR Pap alone every 3 years. Age >65: Discontinue if adequate prior normal screening.'),

  heading2('6.2 Technique'),
  bullet('Patient must NOT have douched for ≥24 hours before exam'),
  bullet('Patient must NOT be menstruating (blood obscures the smear)'),
  bullet('Speculum lubricated with water only (NOT gel, which can distort cells)'),
  bullet('A specially designed spatula (Ayre\'s spatula — wooden or plastic) is rotated 360° around the cervical os to scrape the transformation zone'),
  bullet('A small brush (endocervical brush / cytobrush) is inserted into the endocervical canal and rotated 360°'),
  bullet('Two specimens may be placed on the same slide or separately'),
  bullet('A fixative (e.g., 95% ethanol spray or CytoRich fixative) is applied IMMEDIATELY to prevent air-drying artifact'),
  noteBox('Why Immediate Fixation?', 'Air-drying causes cells to shrink and distort, making them uninterpretable. This is the most common pre-analytical error in Pap smears. Always spray fixative or immerse in liquid medium within seconds of sampling.'),
  clinicalNote('Liquid-based cytology (LBC — ThinPrep or SurePath) is the modern alternative to conventional Pap smear. The spatula and brush are rinsed into a liquid preservative vial, cells are processed in the lab to form a thin layer. LBC reduces unsatisfactory samples from ~5% to ~1%, and the same vial can be used for reflex HPV testing.'),
  examTip('The Pap smear SCREENS; it does NOT diagnose. An abnormal Pap smear requires colposcopy → directed biopsy → histological diagnosis. The Bethesda System 2014 is the standard classification for Pap smear results: NILM, ASC-US, ASC-H, LSIL, HSIL, AGC, AIS, carcinoma.'),
  divider(),
];

// ─── SECTION 7: COLPOSCOPY ────────────────────────────────────────────────
const section7 = [
  heading1('SECTION 7: COLPOSCOPY'),
  body('The colposcope is a binocular microscope used for direct high-magnification visualization of the cervix, vagina, and vulva. It is the bridge between an abnormal Pap smear and tissue biopsy.'),

  heading2('7.1 Technical Details'),
  bullet('Magnification range: up to 60x; most clinical instruments use 13.5x magnification'),
  bullet('Some colposcopes have cameras for photographic documentation of pathological findings'),
  bullet('Green filter ("red-free light") used to highlight vascular patterns (punctation, mosaic, atypical vessels)'),
  noteBox('Colposcopic Features of Severity', 'The IFCPC (International Federation for Cervical Pathology and Colposcopy) 2011 nomenclature grades colposcopic findings. Major changes (Grade 2): dense acetowhite, coarse punctation, coarse mosaic, sharp border = suggest high-grade CIN. Atypical vessels = suspect invasive cancer.'),

  heading2('7.2 Procedure'),
  bullet('Acetic acid (3–5%) applied to cervix → acetowhite areas become visible'),
  bullet('Lugol\'s iodine (Schiller test) applied to assess glycogen content'),
  bullet('Colposcopically directed biopsies taken from the most abnormal areas'),
  bullet('Endocervical curettage (ECC) performed when the transformation zone is not fully visible'),
  clinicalNote('Adequate (satisfactory) colposcopy = the entire transformation zone is visible. Inadequate colposcopy = TZ not fully seen → ECC or cervical cone biopsy required to exclude invasive disease.'),
  body('Colposcopy has significantly reduced the need for blind cervical biopsies and allows targeted tissue sampling from the highest-grade lesion.'),
  examTip('Colposcopy is indicated for: (1) Abnormal Pap smear results (HSIL, ASC-H, AGC), (2) Positive high-risk HPV test, (3) Clinically suspicious cervix, (4) Abnormal Schiller/VIA test, (5) DES exposure in utero.'),
  divider(),
];

// ─── SECTION 8: HYSTEROSCOPY ──────────────────────────────────────────────
const section8 = [
  heading1('SECTION 8: HYSTEROSCOPY'),
  body('Hysteroscopy is the direct visual examination of the uterine cavity using a fiberoptic instrument — the hysteroscope — inserted through the cervical os.'),

  heading2('8.1 Distension Media'),
  bullet('Normal saline — most commonly used; safe for diagnostic hysteroscopy'),
  bullet('Glycine (1.5%) — non-conductive; used when electrosurgery is needed (e.g., resection)'),
  bullet('Dextran 70 (Hyskon) — highly viscous; less common today'),
  bullet('Carbon dioxide (CO₂) gas — excellent visualization but cannot be used if bleeding is present'),
  noteBox('Distension Media Complication', 'Fluid overload (hysteroscopy distension syndrome) can occur if large volumes of hypotonic media (glycine, sorbitol) are absorbed into circulation. This causes hyponatremia, cerebral edema, and cardiovascular collapse — the same mechanism as TURP syndrome in urology. Use isotonic saline with a fluid deficit monitoring system to mitigate this risk.'),

  heading2('8.2 Indications'),
  bullet('Evaluation of abnormal uterine bleeding (AUB)'),
  bullet('Resection of uterine synechiae (Asherman\'s syndrome)'),
  bullet('Resection of uterine septa (congenital malformation)'),
  bullet('Removal of polyps and misplaced/embedded IUDs'),
  bullet('Resection of submucous myomas'),
  bullet('Endometrial ablation (destruction of the endometrium to treat heavy bleeding)'),
  clinicalNote('Asherman\'s Syndrome (intrauterine adhesions / synechiae) is caused by trauma to the endometrium — most commonly over-vigorous curettage after miscarriage or postpartum. Symptoms: scanty periods or amenorrhea, infertility, recurrent miscarriage. Diagnosis and treatment = hysteroscopy.'),

  heading2('8.3 Anesthesia'),
  bullet('Paracervical block (local anesthetic injected at the cervico-vaginal junction at 4 and 8 o\'clock)'),
  bullet('IV sedation (conscious sedation) for operative hysteroscopy'),
  bullet('General anesthesia rarely required for diagnostic hysteroscopy'),

  heading2('8.4 Contraindications and Failures'),
  bullet('Cervical stenosis (the hysteroscope cannot be passed)'),
  bullet('Inadequate uterine cavity distension'),
  bullet('Active uterine bleeding (obscures vision)'),
  bullet('Excessive mucus secretion'),
  bullet('Active pelvic infection (risk of spreading infection)'),

  heading2('8.5 Complications'),
  bullet('Uterine perforation — usually at the fundus (the thinnest wall); complication rate ~1%'),
  bullet('Bleeding'),
  bullet('Infection/endometritis'),
  bullet('Intravascular extravasation of distension medium → fluid overload'),
  bullet('Gas embolism (rare, with CO₂)'),
  examTip('Uterine perforation during hysteroscopy typically occurs at the fundus because the fundal myometrium is thinner than the lower uterine segment. Perforation is managed by observation if the instrument is small and no electrosurgery was used; laparoscopy or laparotomy may be required if bowel injury is suspected.'),
  divider(),
];

// ─── SECTION 9: CULDOCENTESIS ─────────────────────────────────────────────
const section9 = [
  heading1('SECTION 9: CULDOCENTESIS'),
  body('Culdocentesis is the passage of a needle through the posterior vaginal fornix into the pouch of Douglas (cul-de-sac / rectouterine pouch) to aspirate fluid.'),

  heading2('9.1 Fluid Interpretation'),
  twoColTable(
    ['Fluid Obtained', 'Clinical Interpretation'],
    [
      ['Frank blood (does not clot)', 'Ruptured ectopic pregnancy (hemoperitoneum)'],
      ['Blood that clots', 'Needle entered a blood vessel — non-diagnostic (false positive)'],
      ['Pus (turbid, foul-smelling)', 'Pelvic abscess, acute salpingitis/PID'],
      ['Ascitic fluid (clear/straw-colored)', 'Ovarian malignancy or other cause of ascites; malignant cells may be found on cytology'],
      ['No fluid / dry tap', 'No fluid in cul-de-sac — does NOT rule out ectopic pregnancy'],
    ]
  ),
  new Paragraph({ children: [new TextRun({ text: '' })], spacing: { before: 120 } }),
  noteBox('Why Non-Clotting Blood Matters', 'Blood that collects in the peritoneal cavity is defibrinated by the movement of organs — it loses its fibrinogen and does not clot. This is called "old" or defibrinated blood. If the aspirated blood clots, it means a blood vessel (artery or vein) was punctured — this is a false positive and the tap is non-diagnostic.'),
  clinicalNote('Culdocentesis has largely been replaced by transvaginal ultrasound (TVUS), which is non-invasive, highly accurate, and can simultaneously identify an ectopic mass, intrauterine pregnancy, or free fluid. TVUS is now the first-line investigation for suspected ectopic pregnancy.'),
  divider(),
];

// ─── SECTION 10: RADIOGRAPHIC PROCEDURES ─────────────────────────────────
const section10 = [
  heading1('SECTION 10: RADIOGRAPHIC DIAGNOSTIC PROCEDURES'),

  heading2('10.1 Plain X-Ray (Flat Film)'),
  bullet('Can visualize calcified lesions (e.g., calcified leiomyomas/fibroids, ovarian dermoid cysts)'),
  bullet('Dermoid cyst: may show teeth (radiopaque) and a fat-density mass'),
  bullet('Pelvic masses may be suggested by intestinal loop displacement'),
  noteBox('Dermoid Cysts (Mature Cystic Teratoma)', 'These are the most common benign ovarian tumors in women under 30. They arise from totipotent germ cells and may contain hair, teeth, fat, and neural tissue. On plain X-ray, teeth are pathognomonic. On ultrasound, the appearance is highly variable ("tip of the iceberg" sign due to acoustic shadowing from hair/fat).'),

  heading2('10.2 Hysterosalpingography (HSG)'),
  body('Contrast medium is instilled through the cervix under fluoroscopic guidance to outline the uterine cavity and fallopian tube lumens.'),
  bullet('Primary use: infertility evaluation — assesses tubal patency (whether the tubes are open)'),
  bullet('If the tubes are patent: contrast spills from the fimbriated ends into the pelvic cavity (free spill visible on fluoroscopy)'),
  bullet('Identifies uterine abnormalities: congenital malformations (septate, bicornuate, unicornuate uterus), submucous fibroids, endometrial polyps'),
  bullet('Performed in the follicular phase (Days 7–10 of cycle) to avoid disrupting a potential early pregnancy'),
  noteBox('HSG vs Sonohysterography', 'HSG uses ionizing radiation and iodine contrast; it evaluates BOTH the uterine cavity AND tubal patency simultaneously. Sonohysterography (SIS) uses saline + ultrasound, no radiation, and is better for evaluating intrauterine pathology (polyps, fibroids) but cannot reliably assess tubal patency.'),
  clinicalNote('A therapeutic benefit of HSG has been noted: the procedure itself may improve subsequent pregnancy rates, possibly by "flushing" debris from the tubes or by an anti-inflammatory effect of the contrast medium. This is called the "HSG therapeutic effect."'),

  heading2('10.3 Sonohysterography (SIS — Saline Infusion Sonography)'),
  bullet('Saline is instilled into the uterine cavity via a small catheter while transvaginal ultrasound is performed simultaneously'),
  bullet('Saline distends the cavity, acting as a contrast medium for ultrasound'),
  bullet('Excellent for detecting endometrial polyps, submucous fibroids, and intrauterine adhesions'),
  bullet('More comfortable than HSG, no radiation, can be performed in the office'),

  heading2('10.4 Angiography'),
  body('Radiographic contrast is injected into pelvic vessels to visualize the vascular pattern.'),
  bullet('Diagnoses and localizes active pelvic hemorrhage (postoperative, post-traumatic, or tumor-related)'),
  bullet('Uterine artery embolization (UAE): therapeutic application — embolic particles are injected to occlude uterine arteries, reducing fibroid size and controlling acute uterine hemorrhage'),
  noteBox('Uterine Artery Embolization (UAE)', 'UAE is a minimally invasive radiological procedure for uterine fibroids. It reduces fibroid volume by 40–70% and controls heavy uterine bleeding. Advantages over myomectomy: no surgery, uterus preserved, shorter recovery. Main risk: post-embolization syndrome (fever, pain, nausea for 3–7 days).'),

  heading2('10.5 Computed Tomography (CT)'),
  bullet('High-resolution 2D cross-sectional images'),
  bullet('Iodine contrast outlines the GI and urinary tracts, distinguishing them from reproductive organs'),
  bullet('Best imaging for: retroperitoneal lymphadenopathy (staging gynecologic cancers), pelvic abscesses not localized by ultrasound'),
  bullet('Determines depth of myometrial invasion in endometrial carcinoma'),
  bullet('Diagnoses pelvic thrombophlebitis (septic pelvic vein thrombosis)'),
  noteBox('CT Staging Limitations', 'CT is excellent at detecting enlarged lymph nodes (>1 cm) but cannot detect micrometastases. It cannot distinguish between benign and malignant-looking lymph nodes based on morphology alone (PET-CT or lymph node biopsy needed for definitive staging).'),
  examTip('CT vs MRI in Gynecology: CT = better for lymph nodes, abscesses, calcifications, acute emergencies; MRI = better for soft tissue characterization, myometrial invasion depth, pelvic floor, fistulae, and staging local extent of cervical/endometrial cancer.'),

  heading2('10.6 Magnetic Resonance Imaging (MRI)'),
  body('Uses radiofrequency waves in a magnetic field (no ionizing radiation). Provides excellent soft tissue contrast.'),
  bullet('Advantages: no ionizing radiation, superior soft tissue differentiation, can distinguish inflammatory masses from cancers'),
  bullet('Disadvantages: expensive, time-consuming, poor visualization of calcifications, contraindicated with pacemakers/metal implants, claustrophobia'),
  bullet('Main gynecologic use: staging and follow-up of pelvic cancers (cervical, endometrial, ovarian)'),
  bullet('Also: characterizing adnexal masses, mapping fibroids pre-operatively, evaluating congenital uterine anomalies, diagnosing adenomyosis'),
  noteBox('MRI for Endometrial Carcinoma Staging', 'MRI is the most accurate modality for determining the depth of myometrial invasion in endometrial carcinoma. Stage IA = <50% myometrial invasion; Stage IB = ≥50% invasion. This determines the extent of surgery and whether pelvic lymph node dissection is needed.'),

  heading2('10.7 Ultrasonography'),
  body('The most widely used imaging modality in gynecology. Safe, readily available, inexpensive, real-time, and free from radiation.'),
  bullet('Transabdominal ultrasound (TAUS): requires full bladder (elevates uterus out of pelvis for better acoustic window); used for larger pelvic structures and abdominal organs'),
  bullet('Transvaginal ultrasound (TVUS): probe inserted into vagina, closer to pelvic organs, higher resolution. NO full bladder required. Preferred for early pregnancy, ovarian pathology, endometrium assessment'),
  bullet('Especially helpful in children, virginal women, obese patients, and uncooperative patients'),
  bullet('Normal early pregnancy visible from 5–6 weeks gestation on TVUS'),
  bullet('Diagnoses: incomplete/missed abortion, hydatidiform mole, ovarian cysts, fibroids, ectopic pregnancy, ovarian torsion, fetal anomalies'),
  noteBox('Doppler Ultrasound', 'Color Doppler and pulsed wave Doppler assess blood flow in pelvic vessels. Low resistance blood flow (high diastolic flow) in an adnexal mass is associated with malignancy (tumor angiogenesis creates abnormal, low-resistance vessels). Absent or reversed blood flow in the ovarian pedicle in torsion.'),
  clinicalNote('TVUS is the single most important imaging investigation in gynecology. It is always the first-line imaging study for: pelvic pain, abnormal uterine bleeding, infertility, adnexal mass, suspected ectopic pregnancy, and postmenopausal bleeding. An endometrial thickness ≤4 mm on TVUS effectively excludes endometrial carcinoma in postmenopausal women with a negative predictive value of ~99%.'),
  divider(),
];

// ─── QUICK REFERENCE TABLE ────────────────────────────────────────────────
const quickRef = [
  heading1('QUICK REFERENCE: INVESTIGATIONS SUMMARY'),
  new Paragraph({ children: [new TextRun({ text: '' })], spacing: { before: 80 } }),
  twoColTable(
    ['Investigation', 'Primary Purpose', 'Key Points'],
    [
      ['Vaginal pH', 'Differentiate vaginitis type', 'pH 4–5 = fungal; pH 5.5–7 = BV or Trichomonas'],
      ['Saline wet mount', 'Vaginal infection diagnosis', 'Clue cells (BV), motile trichomonads, hyphae (Candida)'],
      ['KOH preparation', 'Fungal infection', 'Pseudohyphae of Candida; positive whiff test = BV'],
      ['Fern test', 'Detect ovulation', 'Fern = estrogenic phase; no fern = post-ovulation (progesterone present)'],
      ['VIA (Acetic acid)', 'Cervical cancer screening', 'Acetowhitening = abnormal; used in low-resource settings'],
      ['Schiller test', 'Cervical neoplasia', 'Iodine-negative (yellow) = abnormal'],
      ['Pap smear', 'Cervical cancer screening', 'Detects ~95% cervical, ~50% endometrial pathology'],
      ['Colposcopy', 'Cervical visualization + biopsy', 'Indicated after abnormal Pap or positive HPV test'],
      ['HSG', 'Tubal patency + uterine cavity', 'Infertility workup; performed Day 7–10'],
      ['Sonohysterography', 'Intrauterine pathology', 'Saline + TVS; detects polyps, fibroids, adhesions'],
      ['Hysteroscopy', 'Direct uterine cavity view', 'Diagnose + treat: AUB, polyps, fibroids, Asherman\'s, septa'],
      ['Culdocentesis', 'Peritoneal fluid sampling', 'Non-clotting blood = hemoperitoneum (ectopic); largely replaced by TVUS'],
      ['CT scan', 'Cancer staging, lymph nodes', 'Best for retroperitoneal LN staging; uses ionizing radiation'],
      ['MRI', 'Soft tissue, cancer staging', 'No radiation; best for myometrial invasion, TZ, adenomyosis'],
      ['Ultrasound (TVUS)', 'First-line pelvic imaging', 'Safest, most versatile; endometrial thickness, adnexal masses, IUP'],
    ]
  ),
  new Paragraph({ children: [new TextRun({ text: '' })], spacing: { before: 120 } }),
  examTip('Mnemonics: "TPAL" for obstetric history. "3 of 4 AMSEL" for BV diagnosis. "Screen → Colposcopy → Biopsy → Treatment" is the cervical cancer pathway. TVUS is ALWAYS the first imaging modality in gynecology.'),
];

// ─── ASSEMBLE DOCUMENT ───────────────────────────────────────────────────
const doc = new Document({
  numbering: {
    config: [{
      reference: 'bullets',
      levels: [
        { level: 0, format: 'bullet', text: '•', alignment: AlignmentType.LEFT, style: { paragraph: { indent: { left: 360, hanging: 260 } } } },
        { level: 1, format: 'bullet', text: '◦', alignment: AlignmentType.LEFT, style: { paragraph: { indent: { left: 720, hanging: 260 } } } },
      ]
    }]
  },
  styles: {
    default: {
      document: { run: { font: 'Calibri', size: 22 } }
    }
  },
  sections: [{
    properties: { page: { margin: { top: 1080, bottom: 1080, left: 1080, right: 1080 } } },
    headers: {
      default: new Header({
        children: [new Paragraph({
          children: [new TextRun({ text: 'Medical Investigations in Gynecological Patients — Lesson 11 Study Notes', size: 18, color: '888888', font: 'Calibri', italics: true })],
          alignment: AlignmentType.RIGHT,
          border: { bottom: { style: BorderStyle.SINGLE, size: 3, color: 'CCCCCC', space: 4 } }
        })]
      })
    },
    footers: {
      default: new Footer({
        children: [new Paragraph({
          children: [
            new TextRun({ text: 'Page ', size: 18, color: '888888' }),
            new PageNumber({ size: 18, color: '888888' }),
          ],
          alignment: AlignmentType.CENTER
        })]
      })
    },
    children: [
      ...coverPage,
      ...section1,
      ...section2,
      ...section3,
      ...section4,
      ...section5,
      ...section6,
      ...section7,
      ...section8,
      ...section9,
      ...section10,
      ...quickRef,
    ]
  }]
});

Packer.toBuffer(doc).then(buffer => {
  fs.writeFileSync('/home/daytona/workspace/gynae-notes/Gynae_Investigations_Notes.docx', buffer);
  console.log('SUCCESS: Document created');
}).catch(err => {
  console.error('ERROR:', err);
});
Running Command

cd /home/daytona/workspace/gynae-notes && node create_notes.js 2>&1

Editing File

~/gynae-notes/create_notes.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/gynae-notes/create_notes.js'
Editing File

~/gynae-notes/create_notes.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/gynae-notes/create_notes.js'
Running Command

cd /home/daytona/workspace/gynae-notes && node create_notes.js 2>&1

You've run out of free credits. Sign up for a free account to continue using Orris.
This is a shared conversation. Sign in to Orris to start your own chat.