Make me a note on labour analgesia

Reading File
Finding Sources
Finding Sources
Searching PubMed

"labor analgesia"[MeSH Terms] AND "epidural"[MeSH Terms]

Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
Reading File
I now have more than enough material to write a comprehensive, well-structured note. Let me compile it.

Labour Analgesia

Sources: Miller's Anesthesia 10e, Barash's Clinical Anesthesia 9e, Creasy & Resnik's Maternal-Fetal Medicine

1. Pain Pathways in Labour

  • First stage (uterine contractions + cervical dilation): pain transmitted via T10-L1 visceral afferents
  • Second stage (perineal distension): somatic pain via S2-S4 (pudendal nerve)
  • Pain intensity is variable; influenced by parity, fetal size/position, induction, augmentation, maternal anxiety, cultural background, and genetic factors (e.g. β2-adrenergic SNPs)

2. Non-Pharmacologic Methods

MethodEvidence
Continuous labour support (doula/partner)Cochrane review (26 trials, 15,858 women): shorter labour, more spontaneous vaginal delivery, less pharmacologic analgesia requested
Hydrotherapy (water baths)Reduced pain and analgesia use; no change in operative delivery or neonatal outcome
MassageReduces pain in first stage; no effect in second/third stages
AcupunctureMinimal pain reduction vs. sham; may improve satisfaction; acupressure showed no effect
HypnosisReduces systemic analgesia use; no clear difference in neuraxial use or birth outcomes
TENSGenerally ineffective for labour pain reduction
Breathing/Lamaze techniquesPsychoprophylaxis; inconsistent pain reduction but can influence affective response
Intradermal sterile water injectionsConflicting evidence; meta-analysis (7 studies) found little robust evidence for low back pain

3. Systemic Pharmacologic Analgesia

Opioids

All opioids cross the placenta and can cause fetal respiratory depression and reduced FHR variability.
Meperidine (Pethidine)
  • IV: 25-50 mg; IM: 50-100 mg
  • Maternal half-life ~2.5-3 h; active metabolite normeperidine half-life 13-23 h (3x longer in neonate)
  • Normeperidine is neurotoxic and accumulates with repeated doses
  • Risk of lower Apgar scores and prolonged neonatal respiratory depression
  • Largely fallen out of favour; rarely used now
Morphine
  • Used for sedation/rest in latent labour (IM)
  • Onset 10-20 min; active metabolite morphine-6-glucuronide prolonged in neonates
  • Side effects: maternal respiratory depression, pruritus (histamine release)
Mixed Agonist-Antagonist Opioids
  • Nalbuphine: 10-20 mg IV/IM/SC q4-6h; potency similar to morphine
  • Butorphanol: 1-2 mg IV/IM; 5x as potent as morphine, 40x more potent than meperidine
  • Generally well tolerated; lower risk of neonatal depression vs. meperidine
Fentanyl
  • IV: 50-100 mcg/h
  • Highly lipid-soluble; rapid onset (2-4 min), short action (30-45 min); no active metabolites
  • Suitable for patient-controlled IV analgesia (PCIA)
  • No significant difference in neonatal Apgar scores at standard doses
Remifentanil PCIA
  • Ultra-short-acting; half-life ~3-4 min
  • Titrated to contraction peaks
  • Requires one-to-one nursing and continuous SpO2 monitoring (significant maternal respiratory depression risk)
  • Provides better analgesia than other systemic opioids but still inferior to neuraxial methods
  • Serious maternal desaturation reported; careful monitoring mandatory
Neonatal reversal: Naloxone 0.1 mg/kg IV or IM if neonatal depression occurs after maternal opioid administration.

4. Neuraxial Analgesia

This is the gold standard for labour analgesia - the most effective method available.

4a. Epidural Analgesia

  • Technique: Catheter placed in lumbar epidural space (most commonly L3-L4 or L2-L3 interspace)
  • Test dose: 3 mL of 1.5% lidocaine with 1:200,000 epinephrine to exclude intravascular or intrathecal catheter placement
  • Drugs: Low-concentration local anaesthetic (e.g. bupivacaine 0.0625-0.125%, or ropivacaine) combined with an opioid (fentanyl 2 mcg/mL or sufentanil 0.5-1 mcg/mL)
  • Delivery modes:
    • Continuous epidural infusion (CEI)
    • Patient-controlled epidural analgesia (PCEA) - allows patient-titrated top-ups
    • Programmed intermittent epidural bolus (PIEB) - improves spread and may reduce breakthrough pain
Benefits beyond analgesia:
  • Blunts sympathetic surges from painful contractions, reducing maternal HR/BP swings
  • Reduces catecholamine secretion - may convert dysfunctional labour to normal
  • Prevents maternal hyperventilation (which shifts the O2-Hb dissociation curve left, reducing fetal oxygenation)
  • Allows "laboring down" in second stage - uterine contractions lower fetal station before active pushing

4b. Combined Spinal-Epidural (CSE)

  • Intrathecal opioid (fentanyl 10-25 mcg ± low-dose bupivacaine) provides rapid-onset analgesia
  • Epidural catheter sited simultaneously for ongoing maintenance and top-ups
  • Offers fastest onset among neuraxial techniques
  • Ideal for advanced labour or when rapid pain relief is needed

4c. Timing of Neuraxial Analgesia

  • ASA guidelines: maternal request is sufficient indication; timing should not be dictated by cervical dilation
  • Meta-analysis (6 studies, 15,399 parturients): epidural at ≤3 cm does not prolong first stage or increase caesarean section rate
  • There is no point in the first stage that is "too early"

4d. Effect on Labour Progress

  • Caesarean delivery rate: Multiple RCTs and 2018 Cochrane review (33 studies, 10,350 women) - no increase in caesarean delivery rate
  • Second stage: Modest prolongation (~15 min) possible; may be due to dense motor block impairing coordinated pushing; modern low-dose epidurals largely eliminate this effect
  • Assisted vaginal delivery: Some older data showed increase; post-2005 studies show no effect with modern low-concentration epidurals

5. Regional Blocks (Non-Neuraxial)

Paracervical Block

  • Anaesthetises uterine and cervical afferents for first stage pain
  • Associated with fetal bradycardia in 25-35% of cases (rapid absorption from highly vascular paracervical space)
  • Risk of direct fetal injection
  • Use 1-2% chloroprocaine if repeated doses required; reserved for hospitals without epidural services

Pudendal Block

  • Anaesthetises S2-S4 for second stage perineal pain
  • Used for episiotomy, spontaneous delivery, low forceps/vacuum extraction, and laceration repair
  • Does not significantly affect uteroplacental blood flow or FHR (unlike paracervical block)
  • Complications: vaginal haematoma, retropsoas/pelvic abscess (rare)

Low Spinal ("Saddle Block")

  • Hyperbaric tetracaine 4 mg at L4-L5, patient sitting
  • Effective for spontaneous or instrumental vaginal delivery
  • Risk of profound hypotension and sympathetic block; interferes with voluntary pushing more than epidural
  • Largely replaced by epidural analgesia

6. Inhalation Analgesia

  • Entonox (50% N₂O / 50% O₂): Self-administered; reduces but does not eliminate pain; widely used in UK/Australia
  • Methoxyflurane (Penthrox): Handheld inhaler; short-duration use
  • Neither provides complete analgesia but both are acceptable, non-invasive options

7. Pre-procedure Considerations

  • Antenatal anaesthetic assessment recommended for all patients admitted to labour ward
  • Moderate clear liquids permitted throughout labour with neuraxial analgesia (ASA guidelines)
  • Solid foods should be avoided in labouring patients (aspiration risk)
  • Routine laboratory testing not required for healthy patients

8. Summary Table

MethodEfficacyFetal ConcernNotes
Non-pharmacologicLow-moderateNonePatient preference; reduce pharmacologic need
Systemic opioidsModerateRespiratory depression, ↓FHR variabilityLargely sedation + anxiolysis
Remifentanil PCIAModerate-goodMaternal desaturation1:1 nursing + SpO2 monitoring essential
Epidural (low-dose)ExcellentMinimalGold standard
CSEExcellent, fast onsetMinimalBest for rapid/advanced labour
Paracervical blockGood (1st stage only)Bradycardia riskUse cautiously
Pudendal blockGood (2nd stage)MinimalFor delivery/perineal repair
EntonoxModerateMinimalSimple, self-administered

Key point: Labour analgesia should be individualized. Maternal request is adequate justification for neuraxial analgesia. The combination of low-dose local anaesthetic + opioid via epidural or CSE provides optimal pain relief without clinically significant effects on labour progress or caesarean delivery rates when modern techniques are used.
  • Miller's Anesthesia 10e, pp. 8840-8852
  • Barash's Clinical Anesthesia 9e, pp. 3486-3495
  • Creasy & Resnik's Maternal-Fetal Medicine, pp. 967-970

Make e w

Asking for Preferences
Reading File
Running Command

ls -la /home/daytona/workspace/ && ls /home/daytona/skills/docx/

Running Command

mkdir -p /home/daytona/workspace/labour-analgesia

Writing File

~/labour-analgesia/create_doc.js

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

// ─── Colour palette ───────────────────────────────────────────────
const DARK_BLUE  = "1B3A6B";
const MID_BLUE   = "2E5FA3";
const LIGHT_BLUE = "D6E4F7";
const ACCENT     = "C0392B";
const GRAY_BG    = "F4F6F9";
const WHITE      = "FFFFFF";
const BORDER_CLR = "A0B4D0";

// ─── Helper: bold run ─────────────────────────────────────────────
function bold(text, size=20, color=DARK_BLUE) {
  return new TextRun({ text, bold: true, size, color, font: "Calibri" });
}
function normal(text, size=20, color="222222") {
  return new TextRun({ text, size, color, font: "Calibri" });
}
function italic(text, size=20, color="444444") {
  return new TextRun({ text, italics: true, size, color, font: "Calibri" });
}

// ─── Section heading ──────────────────────────────────────────────
function sectionHeading(text) {
  return new Paragraph({
    children: [new TextRun({ text, bold: true, size: 26, color: WHITE, font: "Calibri" })],
    heading: HeadingLevel.HEADING_1,
    spacing: { before: 200, after: 100 },
    shading: { type: ShadingType.SOLID, color: DARK_BLUE, fill: DARK_BLUE },
    indent: { left: 120, right: 120 },
  });
}

// ─── Sub-heading ─────────────────────────────────────────────────
function subHeading(text) {
  return new Paragraph({
    children: [new TextRun({ text, bold: true, size: 22, color: MID_BLUE, font: "Calibri" })],
    heading: HeadingLevel.HEADING_2,
    spacing: { before: 180, after: 60 },
    border: {
      bottom: { style: BorderStyle.SINGLE, size: 4, color: MID_BLUE }
    }
  });
}

// ─── Body paragraph ──────────────────────────────────────────────
function bodyPara(runs, spacing={before:60, after:60}) {
  return new Paragraph({ children: runs, spacing });
}

// ─── Bullet ──────────────────────────────────────────────────────
function bullet(text, level=0) {
  return new Paragraph({
    children: [normal(text)],
    bullet: { level },
    spacing: { before: 40, after: 40 },
    indent: { left: 360 * (level + 1), hanging: 360 }
  });
}
function bulletBold(label, rest, level=0) {
  return new Paragraph({
    children: [bold(label), normal(rest)],
    bullet: { level },
    spacing: { before: 40, after: 40 },
    indent: { left: 360 * (level + 1), hanging: 360 }
  });
}

// ─── Table builder ───────────────────────────────────────────────
function makeTable(headers, rows, colWidths) {
  const headerRow = new TableRow({
    tableHeader: true,
    children: headers.map((h, i) => new TableCell({
      children: [new Paragraph({
        children: [new TextRun({ text: h, bold: true, size: 18, color: WHITE, font: "Calibri" })],
        alignment: AlignmentType.CENTER,
        spacing: { before: 60, after: 60 }
      })],
      shading: { type: ShadingType.SOLID, color: DARK_BLUE, fill: DARK_BLUE },
      verticalAlign: VerticalAlign.CENTER,
      width: { size: colWidths[i], type: WidthType.DXA },
    }))
  });

  const dataRows = rows.map((row, ri) => new TableRow({
    children: row.map((cell, ci) => new TableCell({
      children: [new Paragraph({
        children: [new TextRun({ text: cell, size: 18, color: "222222", font: "Calibri" })],
        spacing: { before: 50, after: 50 },
        indent: { left: 80 }
      })],
      shading: { type: ShadingType.SOLID, color: ri % 2 === 0 ? WHITE : GRAY_BG, fill: ri % 2 === 0 ? WHITE : GRAY_BG },
      width: { size: colWidths[ci], type: WidthType.DXA },
      borders: {
        top: { style: BorderStyle.SINGLE, size: 2, color: BORDER_CLR },
        bottom: { style: BorderStyle.SINGLE, size: 2, color: BORDER_CLR },
        left: { style: BorderStyle.SINGLE, size: 2, color: BORDER_CLR },
        right: { style: BorderStyle.SINGLE, size: 2, color: BORDER_CLR },
      }
    }))
  }));

  return new Table({
    rows: [headerRow, ...dataRows],
    width: { size: 9200, type: WidthType.DXA },
    margins: { top: 60, bottom: 60, left: 80, right: 80 }
  });
}

// ─── Spacer ──────────────────────────────────────────────────────
function spacer(size=100) {
  return new Paragraph({ children: [], spacing: { before: size, after: size } });
}

// ─── Highlighted box (key point) ─────────────────────────────────
function keyBox(text) {
  return new Paragraph({
    children: [
      new TextRun({ text: "KEY POINT  ", bold: true, size: 20, color: ACCENT, font: "Calibri" }),
      new TextRun({ text, size: 20, color: "222222", font: "Calibri" })
    ],
    shading: { type: ShadingType.SOLID, color: "FEF9E7", fill: "FEF9E7" },
    border: {
      left: { style: BorderStyle.THICK, size: 10, color: ACCENT }
    },
    indent: { left: 200 },
    spacing: { before: 100, after: 100 },
  });
}

// ═══════════════════════════════════════════════════════════════════
// DOCUMENT CONTENT
// ═══════════════════════════════════════════════════════════════════

const children = [

  // ── TITLE ──────────────────────────────────────────────────────
  new Paragraph({
    children: [new TextRun({ text: "LABOUR ANALGESIA", bold: true, size: 52, color: WHITE, font: "Calibri" })],
    alignment: AlignmentType.CENTER,
    shading: { type: ShadingType.SOLID, color: DARK_BLUE, fill: DARK_BLUE },
    spacing: { before: 0, after: 0 },
    indent: { left: 0, right: 0 },
  }),
  new Paragraph({
    children: [new TextRun({ text: "Clinical Reference Note  |  Obstetric Anaesthesia", size: 22, color: LIGHT_BLUE, italics: true, font: "Calibri" })],
    alignment: AlignmentType.CENTER,
    shading: { type: ShadingType.SOLID, color: MID_BLUE, fill: MID_BLUE },
    spacing: { before: 0, after: 0 },
  }),
  new Paragraph({
    children: [new TextRun({ text: "Sources: Miller's Anesthesia 10e  |  Barash's Clinical Anesthesia 9e  |  Creasy & Resnik's Maternal-Fetal Medicine", size: 18, color: "888888", italics: true, font: "Calibri" })],
    alignment: AlignmentType.CENTER,
    spacing: { before: 80, after: 200 },
  }),

  // ── 1. PAIN PATHWAYS ──────────────────────────────────────────
  sectionHeading("1.  Pain Pathways in Labour"),
  spacer(60),

  makeTable(
    ["Stage", "Source of Pain", "Afferent Pathway"],
    [
      ["First stage", "Uterine contractions + cervical dilation", "Visceral afferents → T10–L1"],
      ["Second stage", "Perineal distension + fetal descent", "Somatic (pudendal nerve) → S2–S4"],
    ],
    [2000, 4000, 3200]
  ),
  spacer(100),

  bodyPara([normal("Pain intensity is highly variable and influenced by:")]),
  bullet("Parity, fetal size/position, induction or augmentation of labour"),
  bullet("Maternal anxiety, pain tolerance, and psychological support"),
  bullet("Cultural background and genetic factors (e.g. β2-adrenergic SNPs)"),
  bullet("Asian women reported more pain in labour in one study (association with β2-adrenergic SNP)"),

  spacer(80),

  // ── 2. NON-PHARMACOLOGIC ───────────────────────────────────────
  sectionHeading("2.  Non-Pharmacologic Methods"),
  spacer(60),

  makeTable(
    ["Method", "Evidence Summary"],
    [
      ["Continuous labour support\n(doula/partner)", "Cochrane review (26 trials, 15,858 women): shorter labour, more spontaneous vaginal delivery, less pharmacologic analgesia — BEST EVIDENCE"],
      ["Hydrotherapy (water baths)", "Reduced pain and analgesia use; no change in operative delivery rate or neonatal outcome"],
      ["Massage", "Reduces pain in first stage only; improved satisfaction"],
      ["Acupuncture", "Minimal pain reduction vs sham; may improve satisfaction; acupressure showed no effect"],
      ["Hypnosis", "Reduces systemic analgesia use; no clear difference in neuraxial use or birth outcomes"],
      ["TENS", "Generally ineffective for labour pain reduction"],
      ["Breathing/Lamaze", "Inconsistent pain reduction; can reduce affective response and anxiety"],
      ["Intradermal sterile water\ninjections", "Meta-analysis (7 studies): little robust evidence for low back pain relief"],
    ],
    [2400, 6800]
  ),
  spacer(100),

  // ── 3. SYSTEMIC OPIOIDS ────────────────────────────────────────
  sectionHeading("3.  Systemic Pharmacologic Analgesia"),
  spacer(60),
  bodyPara([italic("All opioids cross the placenta and can cause fetal respiratory depression and reduced FHR variability.")]),
  spacer(80),

  subHeading("3a.  Opioids — Drug Reference"),
  spacer(40),

  makeTable(
    ["Drug", "Dose", "Key Notes"],
    [
      ["Meperidine\n(Pethidine)", "IV: 25–50 mg\nIM: 50–100 mg", "t½ 2.5–3 h (maternal); normeperidine t½ 13–23 h (3× longer in neonate). Neurotoxic metabolite accumulates with repeat doses. ↓ Apgar scores. Largely OBSOLETE."],
      ["Morphine", "IM for latent labour", "Onset 10–20 min. Active metabolite (M6G) prolonged in neonates. Side effects: respiratory depression, pruritus (histamine release). Used for sedation/rest in latent phase."],
      ["Nalbuphine", "10–20 mg IV/IM/SC\nq4–6h", "Mixed agonist–antagonist. Potency similar to morphine. Better tolerated than meperidine."],
      ["Butorphanol", "1–2 mg IV/IM", "Mixed agonist–antagonist. 5× potency of morphine, 40× of meperidine. Well tolerated."],
      ["Fentanyl", "50–100 mcg/h IV (PCIA)", "Rapid onset (2–4 min), short action (30–45 min), no active metabolites. No significant ↓ in Apgar scores at standard doses."],
      ["Remifentanil\n(PCIA)", "Titrated to contractions", "Ultra-short t½ (3–4 min). Best systemic option. Risk of serious maternal desaturation — requires 1:1 nursing + continuous SpO2 monitoring."],
    ],
    [1600, 2000, 5600]
  ),
  spacer(100),

  keyBox("Naloxone 0.1 mg/kg IV or IM for neonatal opioid-induced respiratory depression."),
  spacer(120),

  // ── 4. NEURAXIAL ───────────────────────────────────────────────
  sectionHeading("4.  Neuraxial Analgesia — Gold Standard"),
  spacer(80),

  subHeading("4a.  Epidural Analgesia"),
  bulletBold("Site: ", "Lumbar epidural space, typically L2-L3 or L3-L4"),
  bulletBold("Test dose: ", "3 mL of 1.5% lidocaine + 1:200,000 epinephrine — rules out intravascular or intrathecal catheter placement"),
  bulletBold("Drug combination: ", "Low-concentration local anaesthetic + opioid"),
  bullet("Bupivacaine 0.0625–0.125% OR ropivacaine + fentanyl 2 mcg/mL or sufentanil 0.5–1 mcg/mL", 1),
  bulletBold("Delivery modes:", ""),
  bullet("Continuous epidural infusion (CEI)", 1),
  bullet("Patient-controlled epidural analgesia (PCEA) — patient-titrated boluses", 1),
  bullet("Programmed intermittent epidural bolus (PIEB) — improves spread, reduces breakthrough pain", 1),
  spacer(80),

  bodyPara([bold("Benefits beyond analgesia:", 20, MID_BLUE)]),
  bullet("Blunts sympathetic surges from contractions → reduces maternal HR/BP swings"),
  bullet("Reduces catecholamine secretion → may convert dysfunctional labour to normal"),
  bullet("Prevents maternal hyperventilation → prevents leftward shift of O2-Hb dissociation curve → preserves fetal oxygenation"),
  bullet("Allows 'laboring down' in second stage — fetal station lowered by contractions before active pushing begins"),
  spacer(80),

  subHeading("4b.  Combined Spinal-Epidural (CSE)"),
  bullet("Intrathecal opioid (fentanyl 10–25 mcg ± low-dose bupivacaine) gives rapid-onset analgesia"),
  bullet("Epidural catheter sited simultaneously for maintenance and top-ups"),
  bullet("Fastest onset among neuraxial techniques — ideal for advanced or rapidly progressing labour"),
  spacer(80),

  subHeading("4c.  Timing of Neuraxial Analgesia"),
  keyBox("ASA guidelines: maternal request is sufficient indication. Timing should NOT be dictated by cervical dilation."),
  spacer(60),
  bullet("Meta-analysis (6 studies, 15,399 parturients): epidural at ≤3 cm does not prolong the first stage or increase caesarean section rate"),
  bullet("There is no point in the first stage that is 'too early' to initiate neuraxial analgesia"),
  spacer(80),

  subHeading("4d.  Effect on Labour Progress"),
  makeTable(
    ["Outcome", "Evidence"],
    [
      ["Caesarean delivery rate", "NO increase — Cochrane review 2018 (33 RCTs, 10,350 women)"],
      ["First stage duration", "Not prolonged with modern low-dose epidural"],
      ["Second stage duration", "Modest prolongation (~15 min) with dense motor block; eliminated with low-dose regimens"],
      ["Assisted vaginal delivery", "Pre-2005 studies showed increase; post-2005 studies show NO effect with modern techniques"],
    ],
    [3000, 6200]
  ),
  spacer(120),

  // ── 5. REGIONAL BLOCKS ─────────────────────────────────────────
  sectionHeading("5.  Regional Blocks (Non-Neuraxial)"),
  spacer(80),

  subHeading("5a.  Paracervical Block"),
  bullet("Anaesthetises uterine and cervical afferents — effective for FIRST stage pain only"),
  bullet("Fetal bradycardia in 25–35% of cases (rapid uptake from highly vascular paracervical space)"),
  bullet("Risk of direct fetal injection if not carefully placed"),
  bullet("Use 1–2% chloroprocaine if repeated doses required; avoid lidocaine/mepivacaine for repeat dosing"),
  bullet("Reserved for settings without epidural services"),
  spacer(80),

  subHeading("5b.  Pudendal Block"),
  bullet("Anaesthetises S2–S4 — for SECOND stage perineal pain"),
  bullet("Used for: episiotomy, spontaneous delivery, low forceps/vacuum extraction, laceration repair"),
  bullet("Does NOT significantly affect uteroplacental blood flow or FHR (unlike paracervical block)"),
  bulletBold("Complications: ", "vaginal haematoma; retropsoas/pelvic abscess (rare but serious)"),
  spacer(80),

  subHeading("5c.  Low Spinal ('Saddle Block')"),
  bullet("Hyperbaric tetracaine 4 mg at L4-L5, patient sitting"),
  bullet("Effective for spontaneous or instrumental vaginal delivery"),
  bullet("Risk of profound hypotension (sympathetic block); interferes with voluntary pushing"),
  bullet("Largely replaced by epidural analgesia"),
  spacer(120),

  // ── 6. INHALATION ─────────────────────────────────────────────
  sectionHeading("6.  Inhalation Analgesia"),
  spacer(80),

  makeTable(
    ["Agent", "Concentration", "Notes"],
    [
      ["Entonox", "50% N₂O / 50% O₂", "Self-administered. Reduces but does not eliminate pain. Widely used in UK/Australia. Simple, non-invasive."],
      ["Methoxyflurane\n(Penthrox)", "Handheld inhaler", "Short-duration use only. Analgesic effect. Acceptable alternative where neuraxial not available/desired."],
    ],
    [1800, 2000, 5400]
  ),
  spacer(120),

  // ── 7. PRE-PROCEDURE CONSIDERATIONS ───────────────────────────
  sectionHeading("7.  Pre-procedure Considerations"),
  spacer(80),
  bullet("Antenatal anaesthetic assessment recommended for all patients admitted to the labour ward"),
  bullet("Assess for comorbidities that may complicate labour, obstetric procedures, or anaesthesia"),
  bullet("Routine laboratory testing NOT required for healthy patients"),
  bullet("ASA guidelines: moderate clear liquids permitted throughout labour with neuraxial analgesia"),
  bullet("Solid foods should be avoided in labouring patients (aspiration risk)"),
  spacer(120),

  // ── 8. SUMMARY TABLE ──────────────────────────────────────────
  sectionHeading("8.  Summary Comparison"),
  spacer(80),

  makeTable(
    ["Method", "Efficacy", "Fetal Concern", "Notes"],
    [
      ["Non-pharmacologic", "Low–Moderate", "None", "Patient preference; reduces pharmacologic need"],
      ["Systemic opioids\n(meperidine, morphine)", "Moderate\n(mainly sedation)", "Respiratory depression\n↓ FHR variability", "Largely replaced by newer agents"],
      ["Remifentanil PCIA", "Moderate–Good", "Maternal desaturation", "1:1 nursing + SpO2 monitoring mandatory"],
      ["Epidural (low-dose)", "Excellent", "Minimal", "GOLD STANDARD for labour analgesia"],
      ["CSE", "Excellent,\nfast onset", "Minimal", "Best for rapid/advanced labour"],
      ["Paracervical block", "Good\n(1st stage only)", "Bradycardia risk\n(25–35%)", "Use cautiously; avoid if epidural available"],
      ["Pudendal block", "Good\n(2nd stage)", "Minimal", "For delivery/perineal repair"],
      ["Entonox", "Moderate", "Minimal", "Simple, self-administered"],
    ],
    [1800, 1400, 1800, 4200]
  ),
  spacer(120),

  // ── KEY TAKE-AWAY ─────────────────────────────────────────────
  keyBox("Labour analgesia should be individualised. Maternal request alone is adequate justification for neuraxial analgesia. Low-dose epidural or CSE provides optimal pain relief without clinically significant effects on labour progress or caesarean delivery rates when modern techniques are used."),

  spacer(100),
  bodyPara([
    italic("References: Miller's Anesthesia 10e pp.8840–8852  |  Barash's Clinical Anesthesia 9e pp.3486–3495  |  Creasy & Resnik's Maternal-Fetal Medicine pp.967–970", 18, "888888")
  ], { before: 60, after: 60 }),
];

// ─── Build document ───────────────────────────────────────────────
const doc = new Document({
  creator: "Orris",
  title: "Labour Analgesia",
  description: "Clinical reference note on labour analgesia",
  styles: {
    default: {
      document: {
        run: { font: "Calibri", size: 20, color: "222222" },
        paragraph: { spacing: { line: 276 } }
      }
    }
  },
  sections: [{
    properties: {
      page: {
        margin: { top: 720, bottom: 720, left: 900, right: 900 }
      }
    },
    headers: {
      default: new Header({
        children: [new Paragraph({
          children: [
            new TextRun({ text: "LABOUR ANALGESIA  |  Clinical Reference Note", size: 16, color: "888888", font: "Calibri" }),
          ],
          alignment: AlignmentType.RIGHT,
          border: { bottom: { style: BorderStyle.SINGLE, size: 4, color: BORDER_CLR } }
        })]
      })
    },
    footers: {
      default: new Footer({
        children: [new Paragraph({
          children: [
            new TextRun({ text: "Page ", size: 16, color: "888888", font: "Calibri" }),
            new PageNumber({ size: 16 }),
            new TextRun({ text: "  |  Sources: Miller's Anesthesia 10e, Barash's Clinical Anesthesia 9e, Creasy & Resnik's MFM", size: 16, color: "888888", font: "Calibri" }),
          ],
          alignment: AlignmentType.CENTER,
          border: { top: { style: BorderStyle.SINGLE, size: 4, color: BORDER_CLR } }
        })]
      })
    },
    children
  }]
});

Packer.toBuffer(doc).then(buffer => {
  fs.writeFileSync("/home/daytona/workspace/labour-analgesia/Labour_Analgesia.docx", buffer);
  console.log("Done");
});
Running Command

cd /home/daytona/workspace/labour-analgesia && node create_doc.js 2>&1

Editing File

~/labour-analgesia/create_doc.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/labour-analgesia/create_doc.js'
Running Command

cd /home/daytona/workspace/labour-analgesia && node create_doc.js 2>&1

Running Command

python /home/daytona/skills/docx/scripts/office/validate.py /home/daytona/workspace/labour-analgesia/Labour_Analgesia.docx 2>&1

Running Command

ls -lh /home/daytona/workspace/labour-analgesia/Labour_Analgesia.docx && python3 -c " import zipfile with zipfile.ZipFile('/home/daytona/workspace/labour-analgesia/Labour_Analgesia.docx') as z: print('Valid ZIP. Files:', z.namelist()[:8]) "

The document is valid and ready. Here's your Word document:

Labour Analgesia

Word Document · DOCX

The document includes:
  • Title block with subtitle and source references
  • 8 sections matching the full note: Pain Pathways, Non-Pharmacologic Methods, Systemic Opioids, Neuraxial Analgesia, Regional Blocks, Inhalation Analgesia, Pre-procedure Considerations, and a Summary Comparison table
  • Formatted tables for all drug comparisons and evidence summaries
  • Highlighted key point boxes for the ASA guideline on timing and the naloxone dose
  • Header and footer with page numbers on every page

Will you make a word file and explain the pain pathway of lahour in detail

Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Finding Sources
Reading File
Finding Sources
Finding Sources
Reading File
Writing File

~/labour-analgesia/pain_pathway_doc.js

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

// ── Palette ──────────────────────────────────────────────────────
const NAVY       = "1B3A6B";
const ROYAL      = "2E5FA3";
const LIGHTBLUE  = "D6E4F7";
const TEAL       = "1A7A6E";
const AMBER      = "B7651B";
const RED        = "C0392B";
const LAVENDER   = "EEF2FB";
const MINT       = "EAF6F4";
const CREAM      = "FFFBEF";
const WHITE      = "FFFFFF";
const GRAY_BG    = "F4F6F9";
const BORDER_CLR = "A0B4D0";

// ── Run helpers ──────────────────────────────────────────────────
const R = (text, opts={}) => new TextRun({ text, font:"Calibri", size:20, color:"222222", ...opts });
const Rb = (text, opts={}) => R(text, { bold:true, ...opts });
const Ri = (text, opts={}) => R(text, { italics:true, color:"444444", ...opts });
const Rsm = (text, opts={}) => R(text, { size:18, color:"666666", ...opts });

// ── Paragraph builders ───────────────────────────────────────────
function para(runs, opts={}) {
  return new Paragraph({ children: Array.isArray(runs)?runs:[runs], spacing:{before:60,after:60}, ...opts });
}

function title1(text) {
  return new Paragraph({
    children: [new TextRun({ text, bold:true, size:52, color:WHITE, font:"Calibri" })],
    alignment: AlignmentType.CENTER,
    shading: { type:ShadingType.SOLID, color:NAVY, fill:NAVY },
    spacing: { before:0, after:0 },
  });
}
function title2(text) {
  return new Paragraph({
    children: [new TextRun({ text, italics:true, size:24, color:LIGHTBLUE, font:"Calibri" })],
    alignment: AlignmentType.CENTER,
    shading: { type:ShadingType.SOLID, color:ROYAL, fill:ROYAL },
    spacing: { before:0, after:0 },
  });
}
function title3(text) {
  return new Paragraph({
    children: [new TextRun({ text, italics:true, size:18, color:"888888", font:"Calibri" })],
    alignment: AlignmentType.CENTER,
    spacing: { before:80, after:240 },
  });
}

function h1(text, bg=NAVY) {
  return new Paragraph({
    children: [new TextRun({ text, bold:true, size:28, color:WHITE, font:"Calibri" })],
    shading: { type:ShadingType.SOLID, color:bg, fill:bg },
    spacing: { before:280, after:120 },
    indent: { left:120, right:120 },
  });
}

function h2(text, color=ROYAL) {
  return new Paragraph({
    children: [new TextRun({ text, bold:true, size:24, color, font:"Calibri" })],
    spacing: { before:200, after:80 },
    border: { bottom:{ style:BorderStyle.SINGLE, size:6, color } }
  });
}

function h3(text, color=TEAL) {
  return new Paragraph({
    children: [new TextRun({ text, bold:true, size:21, color, font:"Calibri" })],
    spacing: { before:160, after:60 },
  });
}

function bullet(text, level=0, color="222222") {
  return new Paragraph({
    children: [R(text, {color})],
    bullet: { level },
    spacing: { before:40, after:40 },
    indent: { left:360*(level+1), hanging:360 }
  });
}

function bulletB(label, rest, level=0) {
  return new Paragraph({
    children: [Rb(label, {color:NAVY}), R(rest)],
    bullet: { level },
    spacing: { before:40, after:40 },
    indent: { left:360*(level+1), hanging:360 }
  });
}

function spacer(size=120) {
  return new Paragraph({ children:[], spacing:{before:size,after:size} });
}

// Coloured info box
function infoBox(labelText, bodyText, bgColor=CREAM, accentColor=AMBER) {
  return new Paragraph({
    children: [
      new TextRun({ text: labelText+"  ", bold:true, size:20, color:accentColor, font:"Calibri" }),
      new TextRun({ text: bodyText, size:20, color:"333333", font:"Calibri" })
    ],
    shading: { type:ShadingType.SOLID, color:bgColor, fill:bgColor },
    border: { left:{ style:BorderStyle.THICK, size:12, color:accentColor } },
    indent: { left:240 },
    spacing: { before:120, after:120 },
  });
}

// Step box — numbered step in pathway
function stepBox(num, title, body, bgColor, titleColor) {
  return new Table({
    rows: [new TableRow({ children: [
      // number cell
      new TableCell({
        children: [new Paragraph({
          children: [new TextRun({ text: String(num), bold:true, size:48, color:WHITE, font:"Calibri" })],
          alignment: AlignmentType.CENTER,
          spacing: { before:80, after:80 }
        })],
        shading: { type:ShadingType.SOLID, color:titleColor, fill:titleColor },
        verticalAlign: VerticalAlign.CENTER,
        width: { size:900, type:WidthType.DXA },
      }),
      // content cell
      new TableCell({
        children: [
          new Paragraph({
            children: [new TextRun({ text: title, bold:true, size:22, color:titleColor, font:"Calibri" })],
            spacing: { before:60, after:40 }
          }),
          new Paragraph({
            children: [new TextRun({ text: body, size:20, color:"333333", font:"Calibri" })],
            spacing: { before:0, after:80 }
          })
        ],
        shading: { type:ShadingType.SOLID, color:bgColor, fill:bgColor },
        width: { size:8300, type:WidthType.DXA },
        margins: { left:200, right:200, top:80, bottom:80 }
      }),
    ]})],
    width: { size:9200, type:WidthType.DXA },
    margins: { top:60, bottom:60 }
  });
}

// Standard table
function makeTable(headers, rows, colWidths, headerBg=NAVY) {
  const hRow = new TableRow({
    tableHeader: true,
    children: headers.map((h,i) => new TableCell({
      children: [new Paragraph({
        children: [new TextRun({ text:h, bold:true, size:19, color:WHITE, font:"Calibri" })],
        alignment: AlignmentType.CENTER,
        spacing: { before:60, after:60 }
      })],
      shading: { type:ShadingType.SOLID, color:headerBg, fill:headerBg },
      verticalAlign: VerticalAlign.CENTER,
      width: { size:colWidths[i], type:WidthType.DXA },
    }))
  });
  const dRows = rows.map((row, ri) => new TableRow({
    children: row.map((cell, ci) => new TableCell({
      children: [new Paragraph({
        children: [new TextRun({ text:cell, size:19, color:"222222", font:"Calibri" })],
        spacing: { before:50, after:50 },
        indent: { left:100 }
      })],
      shading: { type:ShadingType.SOLID, color: ri%2===0?WHITE:GRAY_BG, fill: ri%2===0?WHITE:GRAY_BG },
      width: { size:colWidths[ci], type:WidthType.DXA },
      borders: {
        top:    { style:BorderStyle.SINGLE, size:2, color:BORDER_CLR },
        bottom: { style:BorderStyle.SINGLE, size:2, color:BORDER_CLR },
        left:   { style:BorderStyle.SINGLE, size:2, color:BORDER_CLR },
        right:  { style:BorderStyle.SINGLE, size:2, color:BORDER_CLR },
      }
    }))
  }));
  return new Table({
    rows: [hRow, ...dRows],
    width: { size:9200, type:WidthType.DXA },
  });
}

// ════════════════════════════════════════════════════════════════
// DOCUMENT CONTENT
// ════════════════════════════════════════════════════════════════
const children = [

  // ── TITLE BLOCK ──────────────────────────────────────────────
  title1("PAIN PATHWAYS OF LABOUR"),
  title2("Detailed Neuroanatomical Review  |  Obstetric Anaesthesia"),
  title3("Sources: Morgan & Mikhail's Clinical Anesthesiology 7e  |  Miller's Anesthesia 10e  |  Barash's Clinical Anesthesia 9e"),

  // ── OVERVIEW ─────────────────────────────────────────────────
  h1("OVERVIEW"),
  spacer(60),
  para([R("Labour pain is one of the most severe forms of pain a person can experience. It arises from multiple anatomical sources and is transmitted via distinct neural pathways depending on the stage of labour. Understanding these pathways is fundamental to effective obstetric analgesia — it explains why different analgesic techniques target different spinal levels and why no single block covers all of labour.")]),
  spacer(60),
  infoBox("CORE PRINCIPLE:", "Labour pain has TWO distinct components — visceral pain in the first stage (T10–L1) and somatic pain in the second stage (S2–S4) — requiring neuraxial blockade of T10–S4 for complete analgesia.", CREAM, AMBER),
  spacer(120),

  // ── SECTION 1: SOURCES ───────────────────────────────────────
  h1("1.  ANATOMICAL SOURCES OF LABOUR PAIN"),
  spacer(80),
  para([R("The pain of labour arises from three distinct anatomical processes:")]),
  spacer(60),

  bullet("Contraction of the myometrium against the resistance of the cervix and perineum", 0, "222222"),
  bullet("Progressive dilation of the cervix and lower uterine segment", 0, "222222"),
  bullet("Stretching and compression of pelvic and perineal structures as the fetus descends", 0, "222222"),
  spacer(100),

  makeTable(
    ["Structure", "Process Causing Pain", "Stage Involved"],
    [
      ["Myometrium", "Ischaemia during powerful contractions (similar to cardiac angina)", "Throughout labour"],
      ["Cervix", "Mechanical dilation and effacement", "First stage (latent + active)"],
      ["Lower uterine segment", "Stretching and distension as fetus descends", "Late first + second stage"],
      ["Vagina and perineum", "Stretching, compression, tearing of soft tissue", "Second stage"],
      ["Pelvic floor muscles", "Compression and distension by presenting part", "Second stage"],
      ["Lumbosacral ligaments", "Traction and pressure from engaged fetal head", "Transition and second stage"],
    ],
    [2400, 3800, 3000]
  ),
  spacer(120),

  // ── SECTION 2: FIRST STAGE ───────────────────────────────────
  h1("2.  FIRST STAGE OF LABOUR — VISCERAL PAIN"),
  spacer(80),

  h2("2a.  Character of Pain"),
  para([R("First stage pain is predominantly "), Rb("visceral"), R(" in nature — dull, cramping, poorly localised, and difficult to pinpoint. It is perceived initially in the lower abdomen and can be referred to the lumbosacral area, gluteal region, and thighs as labour intensifies.")]),
  spacer(80),

  h2("2b.  Dermatomal Distribution"),
  makeTable(
    ["Phase", "Dermatomes Involved", "Clinical Correlate"],
    [
      ["Latent phase\n(early first stage)", "T11–T12", "Lower abdominal cramping; mild–moderate intensity"],
      ["Active phase\n(cervix 6–10 cm)", "T10–L1", "More intense pain; may radiate to back, hips, thighs"],
      ["Transition\n(approaching 2nd stage)", "T10–S1", "Severe pain; perineal pressure begins"],
    ],
    [2600, 2600, 4000]
  ),
  spacer(80),
  infoBox("WHY REFERRED PAIN?", "Visceral afferents converge on the same spinal cord segments as somatic afferents from the back, hips, and thighs. The brain cannot distinguish the source, so pain is 'referred' to the dermatomes of T10–L1.", LAVENDER, ROYAL),
  spacer(120),

  h2("2c.  Neural Pathway — Step by Step"),
  spacer(80),

  stepBox(1, "Stimulus — Uterine Contraction",
    "Myometrial ischaemia and mechanical distension activate nociceptors (free nerve endings) in the uterine wall, cervix, and lower uterine segment. Chemical mediators released include bradykinin, prostaglandins, histamine, serotonin, and substance P.",
    LAVENDER, ROYAL),
  spacer(60),
  stepBox(2, "Visceral Afferent Fibres",
    "Pain signals travel along thin unmyelinated C-fibres and lightly myelinated Aδ-fibres. These visceral afferents run alongside sympathetic nerve fibres (NOT parasympathetic) — a key anatomical distinction.",
    "#EBF5EB", TEAL),
  spacer(60),
  stepBox(3, "Uterovaginal (Frankenhauser's) Plexus",
    "Afferent fibres first pass through the uterovaginal plexus (also called Frankenhauser's plexus), a network of nerves located at the base of the broad ligament, adjacent to the cervix. This is why paracervical block at this site relieves first-stage pain.",
    CREAM, AMBER),
  spacer(60),
  stepBox(4, "Inferior Hypogastric Plexus",
    "From the uterovaginal plexus, fibres ascend to the inferior hypogastric plexus (pelvic plexus), located at the level of S2–S4 anterolaterally. Fibres continue upward through the superior hypogastric plexus.",
    LAVENDER, ROYAL),
  spacer(60),
  stepBox(5, "Lumbar and Lower Thoracic Sympathetic Chain",
    "Fibres travel along sympathetic nerve fibres up through the lumbar sympathetic chain (L2–L4), passing through the aortic plexus and eventually joining the thoracic sympathetic chain.",
    "#EBF5EB", TEAL),
  spacer(60),
  stepBox(6, "Entry to Spinal Cord — T10–L1",
    "Visceral afferent fibres enter the spinal cord via the posterior (dorsal) roots of T10, T11, T12, and L1. They synapse in the dorsal horn (Rexed laminae I, II, and V).",
    CREAM, AMBER),
  spacer(60),
  stepBox(7, "Spinothalamic Tract — Ascending Pathway",
    "Second-order neurons cross in the anterior commissure and ascend via the lateral spinothalamic tract to the thalamus (ventroposterolateral nucleus). Third-order neurons project to the somatosensory cortex, anterior cingulate cortex, and insular cortex for pain perception and emotional processing.",
    LAVENDER, ROYAL),
  spacer(120),

  // ── SECTION 3: SECOND STAGE ─────────────────────────────────
  h1("3.  SECOND STAGE OF LABOUR — SOMATIC PAIN"),
  spacer(80),

  h2("3a.  Character of Pain"),
  para([R("Second stage pain is predominantly "), Rb("somatic"), R(" — sharp, intense, and precisely localised to the perineum, vagina, and rectum. It begins with perineal pressure as the presenting part descends and intensifies sharply as crowning occurs.")]),
  spacer(80),

  h2("3b.  Dermatomal Distribution"),
  infoBox("KEY:", "The onset of perineal pain signals fetal descent and the beginning of the second stage. Complete neuraxial coverage now requires blockade of T10–S4.", MINT, TEAL),
  spacer(80),

  makeTable(
    ["Structure", "Nerve Supply", "Spinal Roots"],
    [
      ["Perineum, vulva, labia", "Pudendal nerve (anterior branches)", "S2, S3, S4"],
      ["Vagina (lower two-thirds)", "Pudendal nerve", "S2, S3, S4"],
      ["Rectum and anus", "Inferior rectal nerve (branch of pudendal)", "S2, S3, S4"],
      ["Clitoris and mons pubis", "Ilioinguinal + genitofemoral nerve", "L1, L2"],
      ["Inner thigh", "Medial cutaneous nerve of thigh", "L2, L3"],
      ["Anterior perineal skin", "Perineal branch of posterior femoral cutaneous nerve", "S1, S2, S3"],
    ],
    [2800, 3200, 3200]
  ),
  spacer(100),

  h2("3c.  The Pudendal Nerve — Key Nerve of the Second Stage"),
  para([R("The pudendal nerve (S2–S4) is the principal nerve of the perineum and provides the majority of sensory and motor innervation during the second stage.")]),
  spacer(60),
  bulletB("Origin: ", "Sacral plexus (anterior divisions of S2, S3, S4)"),
  bulletB("Course: ", "Exits the pelvis via the greater sciatic foramen below piriformis, wraps around the ischial spine, re-enters the pelvis through the lesser sciatic foramen, and runs in the pudendal (Alcock's) canal in the lateral wall of the ischiorectal fossa"),
  bulletB("Branches: ", "Inferior rectal nerve → dorsal nerve of clitoris/penis → perineal nerve"),
  bulletB("Clinical relevance: ", "Pudendal nerve block at the ischial spine provides perineal analgesia for delivery, episiotomy, and laceration repair"),
  spacer(120),

  // ── SECTION 4: COMPLETE PATHWAY SUMMARY ─────────────────────
  h1("4.  COMPLETE PATHWAY SUMMARY TABLE"),
  spacer(80),

  makeTable(
    ["Stage", "Source of Pain", "Type", "Nerve Pathway", "Spinal Entry", "Dermatomes"],
    [
      ["First stage\n(Latent)", "Uterine contractions,\ncervical dilation", "Visceral", "Uterovaginal plexus → Inferior hypogastric plexus → Sympathetic chain", "T11–T12 dorsal roots", "T11–T12"],
      ["First stage\n(Active)", "Intensifying contractions,\nrapid cervical dilation", "Visceral", "As above — wider spread", "T10–L1 dorsal roots", "T10–L1"],
      ["Transition / Late\nfirst stage", "Lower uterine distension,\nperineal pressure", "Visceral +\nearly somatic", "Visceral via T10–L1 +\nearly pudendal activation", "T10–S1", "T10–S1"],
      ["Second stage", "Perineal/vaginal stretching,\ncompression of pelvic floor", "Somatic", "Pudendal nerve (S2–S4) +\nilioinguinal/genitofemoral (L1)", "S2–S4 dorsal roots", "T10–S4\n(complete)"],
    ],
    [1200, 1800, 1000, 2200, 1500, 1500],
    NAVY
  ),
  spacer(120),

  // ── SECTION 5: MODULATING FACTORS ───────────────────────────
  h1("5.  FACTORS THAT MODULATE LABOUR PAIN INTENSITY"),
  spacer(80),

  h2("5a.  Physiological Factors"),
  bulletB("Parity: ", "Nulliparous women experience greater first-stage pain than multiparous women (cervix more resistant to dilation)"),
  bulletB("Fetal size and presentation: ", "Larger fetus or occiput-posterior presentation increases pain (greater mechanical force required)"),
  bulletB("Oxytocin/augmentation: ", "Augmented contractions are more powerful and painful than spontaneous ones"),
  bulletB("Cervical resistance: ", "Greater resistance → greater uterine work → more ischaemia → more pain"),
  spacer(80),

  h2("5b.  Neurochemical Mediators"),
  makeTable(
    ["Mediator", "Role in Labour Pain", "Analgesic Target?"],
    [
      ["Prostaglandins (PGE2, PGF2α)", "Sensitise uterine nociceptors; promote myometrial contraction", "NSAIDs (limited use in labour)"],
      ["Bradykinin", "Activates C-fibre nociceptors in myometrium during ischaemia", "No direct target in obstetric use"],
      ["Substance P", "Neurotransmitter at dorsal horn; central pain signalling", "Neuraxial opioids reduce release"],
      ["Serotonin (5-HT)", "Peripheral sensitisation of uterine nociceptors", "No direct target"],
      ["Histamine", "Released from mast cells; nociceptor sensitisation", "No direct target"],
      ["Endorphins (β-endorphin)", "Endogenous inhibitory; released with exercise, support, hypnosis", "Enhanced by neuraxial opioids"],
    ],
    [2400, 3800, 3000]
  ),
  spacer(80),

  h2("5c.  Psychological and Genetic Factors"),
  bulletB("Anxiety: ", "Increases catecholamine release → uterine vasoconstriction → worsens ischaemic pain"),
  bulletB("Fear: ", "Lowers pain threshold via descending facilitatory pathways from the anterior cingulate cortex"),
  bulletB("Social support: ", "Reduces catecholamine surge; enhances endorphin release"),
  bulletB("Genetics: ", "Single nucleotide polymorphism in the β2-adrenergic receptor gene associated with greater pain intensity in Asian women"),
  bulletB("Pelvic size/shape: ", "Affects mechanical efficiency — android/anthropoid pelvis associated with greater pain from malposition"),
  spacer(120),

  // ── SECTION 6: DESCENDING MODULATION ────────────────────────
  h1("6.  DESCENDING PAIN MODULATION"),
  spacer(80),
  para([R("The brain is not a passive recipient of pain signals. Descending modulatory pathways from the brainstem and cortex can either "), Rb("inhibit"), R(" or "), Rb("facilitate"), R(" pain transmission at the dorsal horn.")]),
  spacer(80),

  h2("6a.  Inhibitory Pathways (pain reduction)"),
  bulletB("Periaqueductal grey (PAG) matter → Rostroventral medulla (RVM): ", "Major descending inhibitory system; activated by opioids and stress"),
  bulletB("Noradrenergic pathways (locus coeruleus): ", "Release noradrenaline in dorsal horn → inhibit pain; targeted by neuraxial clonidine"),
  bulletB("Serotonergic pathways: ", "Dual role — inhibitory at higher concentrations; activated by epidural opioids and tricyclic antidepressants"),
  bulletB("Endorphin/enkephalin system: ", "Endogenous opioid peptides released in dorsal horn; modulated by neuraxial opioids"),
  spacer(80),

  h2("6b.  Facilitatory Pathways (pain amplification)"),
  bulletB("Wind-up and central sensitisation: ", "Repeated C-fibre activation causes NMDA receptor-mediated amplification at the dorsal horn — prolonged or augmented labour worsens central sensitisation"),
  bulletB("Cortisol/catecholamine surge from anxiety: ", "Enhances descending facilitation → lowers pain threshold — justifies anxiolysis and good labour support"),
  spacer(120),

  // ── SECTION 7: CLINICAL IMPLICATIONS ────────────────────────
  h1("7.  CLINICAL IMPLICATIONS FOR ANALGESIA"),
  spacer(80),
  para([R("Understanding the pain pathways directly explains why specific analgesic techniques work — and at what level they need to act:")]),
  spacer(80),

  makeTable(
    ["Technique", "Level of Action", "Stage Covered", "Pathway Blocked"],
    [
      ["Paracervical block", "Uterovaginal (Frankenhauser's) plexus", "First stage only", "Visceral afferents from uterus and cervix before they enter sympathetic chain"],
      ["Lumbar epidural\n(T10–L1)", "Epidural space at L2-L4", "First stage", "Visceral afferents entering T10–L1 dorsal roots"],
      ["Lumbar epidural\n(T10–S4)", "Epidural space; volume/concentration adjusted", "Both stages", "Full coverage: visceral T10–L1 + somatic S2–S4 via pudendal roots"],
      ["Combined spinal-\nepidural (CSE)", "Intrathecal + epidural", "Both stages", "Rapid intrathecal onset + epidural maintenance; covers T10–S4"],
      ["Pudendal nerve block", "Ischial spine — Alcock's canal", "Second stage only", "Pudendal nerve (S2–S4) — perineal somatic pain"],
      ["Low spinal\n('Saddle block')", "Subarachnoid at L4-L5", "Second stage + delivery", "S1–S5 ('saddle area'); limited to perineal somatic pain"],
      ["Systemic opioids\n(IV/IM)", "Central + peripheral opioid receptors", "Both stages (partial)", "Reduce central processing; do not block specific pathways — hence inferior analgesia"],
      ["Remifentanil PCIA", "Central opioid receptors", "Both stages (partial)", "Short-acting central modulation; timed to contraction peaks"],
    ],
    [1800, 2000, 1600, 3800]
  ),
  spacer(120),

  // ── KEY SUMMARY BOX ──────────────────────────────────────────
  h1("8.  KEY SUMMARY — PAIN PATHWAYS AT A GLANCE", TEAL),
  spacer(80),

  infoBox("FIRST STAGE:", "Visceral pain (T10–L1) via uterovaginal plexus → inferior hypogastric plexus → thoracolumbar sympathetic chain → T10–L1 dorsal roots → spinothalamic tract → thalamus → cortex", LAVENDER, ROYAL),
  spacer(60),
  infoBox("SECOND STAGE:", "Somatic pain (S2–S4) via pudendal nerve → sacral plexus → S2–S4 dorsal roots → spinothalamic tract → thalamus → cortex. Also: ilioinguinal/genitofemoral (L1) for anterior perineum.", MINT, TEAL),
  spacer(60),
  infoBox("COMPLETE COVERAGE:", "Neuraxial blockade of T10–S4 is required to provide complete analgesia for both stages of labour. This is the anatomical basis for the epidural being the gold standard.", CREAM, AMBER),
  spacer(60),
  infoBox("REFERRED PAIN:", "Visceral afferents share spinal segments with somatic afferents from the back and thighs (T10–L1) — explaining why labour pain is referred to the lumbosacral area and inner thighs.", "#F5EEFF", RED),
  spacer(100),

  // ── REFERENCES ───────────────────────────────────────────────
  para([
    new TextRun({ text:"References: ", bold:true, size:18, color:"888888", font:"Calibri" }),
    new TextRun({ text:"Morgan & Mikhail's Clinical Anesthesiology 7e, p.1606–1607  |  Miller's Anesthesia 10e, pp.8840–8852  |  Barash's Clinical Anesthesia 9e, pp.3486–3495", italics:true, size:18, color:"888888", font:"Calibri" })
  ], { before:60, after:60 }),
];

// ── Build doc ─────────────────────────────────────────────────────
const doc = new Document({
  creator: "Orris",
  title: "Pain Pathways of Labour",
  styles: {
    default: {
      document: {
        run: { font:"Calibri", size:20, color:"222222" },
        paragraph: { spacing:{ line:288 } }
      }
    }
  },
  sections: [{
    properties: {
      page: { margin:{ top:720, bottom:720, left:900, right:900 } }
    },
    headers: {
      default: new Header({ children:[
        new Paragraph({
          children:[new TextRun({ text:"PAIN PATHWAYS OF LABOUR  |  Obstetric Anaesthesia Reference", size:16, color:"888888", font:"Calibri" })],
          alignment: AlignmentType.RIGHT,
          border:{ bottom:{ style:BorderStyle.SINGLE, size:4, color:BORDER_CLR } }
        })
      ]})
    },
    footers: {
      default: new Footer({ children:[
        new Paragraph({
          children:[new TextRun({ text:"Sources: Morgan & Mikhail 7e  |  Miller's Anesthesia 10e  |  Barash's Clinical Anesthesia 9e", size:16, color:"888888", font:"Calibri" })],
          alignment: AlignmentType.CENTER,
          border:{ top:{ style:BorderStyle.SINGLE, size:4, color:BORDER_CLR } }
        })
      ]})
    },
    children
  }]
});

Packer.toBuffer(doc).then(buf => {
  fs.writeFileSync("/home/daytona/workspace/labour-analgesia/Labour_Pain_Pathways.docx", buf);
  console.log("Done");
});
Running Command

cd /home/daytona/workspace/labour-analgesia && node pain_pathway_doc.js 2>&1

Running Command

python3 -c " import zipfile with zipfile.ZipFile('/home/daytona/workspace/labour-analgesia/Labour_Pain_Pathways.docx') as z: print('Valid ZIP. Size:', sum(i.file_size for i in z.infolist()), 'bytes uncompressed') print('Files:', z.namelist()[:10]) "

Your document is ready:

Labour Pain Pathways

Word Document · DOCX


Here's what's covered across 8 sections:
1. Anatomical Sources - table of every structure (myometrium, cervix, pelvic floor, perineum) and the process causing pain at each
2. First Stage - Visceral Pain - dermatomal spread by phase (latent T11-T12 → active T10-L1 → transition T10-S1), plus a 7-step colour-coded pathway diagram tracing the signal from:
  • Myometrial nociceptor activation (bradykinin, prostaglandins, substance P) → Visceral C/Aδ fibres → Uterovaginal (Frankenhauser's) plexus → Inferior hypogastric plexus → Lumbar sympathetic chain → T10-L1 dorsal roots → Spinothalamic tract → thalamus → cortex
3. Second Stage - Somatic Pain - the pudendal nerve (S2-S4) in detail: origin, full anatomical course, branches, and why pudendal block works at the ischial spine
4. Full pathway summary table - all stages side by side
5. Modulating Factors - physiological, neurochemical mediators (prostaglandins, bradykinin, endorphins), and psychological/genetic factors
6. Descending Modulation - inhibitory (PAG-RVM, noradrenergic, endorphin) and facilitatory (wind-up, central sensitisation) pathways
7. Clinical Implications table - every analgesic technique mapped to the exact pathway and level it blocks
8. Key Summary boxes - colour-highlighted quick-reference for first stage, second stage, complete coverage, and referred pain

Yes please

The document was already created in my previous response! You can download it right here:

Labour Pain Pathways

Word Document · DOCX

It's fully ready with all 8 sections covering the complete pain pathways of labour in detail. Just click the link above to download it.

Invalid?

Running Command

ls -lh /home/daytona/workspace/labour-analgesia/ && python3 -c " import zipfile try: with zipfile.ZipFile('/home/daytona/workspace/labour-analgesia/Labour_Pain_Pathways.docx') as z: print('ZIP valid, files:', len(z.namelist())) print(z.namelist()) except Exception as e: print('ERROR:', e) "

Running Command

python /home/daytona/skills/docx/scripts/office/soffice.py --headless --convert-to docx --outdir /home/daytona/workspace/labour-analgesia/ /home/daytona/workspace/labour-analgesia/Labour_Pain_Pathways.docx 2>&1

Running Command

python /home/daytona/skills/docx/scripts/office/soffice.py --headless --convert-to docx --outdir /home/daytona/workspace/labour-analgesia/ /home/daytona/workspace/labour-analgesia/Labour_Pain_Pathways.docx --output /home/daytona/workspace/labour-analgesia/Labour_Pain_Pathways_fixed.docx 2>&1; ls -lh /home/daytona/workspace/labour-analgesia/

Running Command

python3 -c " import zipfile, xml.etree.ElementTree as ET with zipfile.ZipFile('/home/daytona/workspace/labour-analgesia/Labour_Pain_Pathways.docx') as z: xml_data = z.read('word/document.xml') try: ET.fromstring(xml_data) print('document.xml parses OK') except ET.ParseError as e: print('XML ERROR:', e) # show surrounding context lines = xml_data.decode('utf-8', errors='replace').split('\n') print('Total chars:', len(xml_data)) " 2>&1

Running Command

# Try converting via pandoc as an alternative pandoc /home/daytona/workspace/labour-analgesia/Labour_Pain_Pathways.docx -o /home/daytona/workspace/labour-analgesia/Labour_Pain_Pathways_pandoc.docx 2>&1 ls -lh /home/daytona/workspace/labour-analgesia/

Running Command

python3 -c " import zipfile with zipfile.ZipFile('/home/daytona/workspace/labour-analgesia/Labour_Pain_Pathways_pandoc.docx') as z: print('Valid. Files:', len(z.namelist())) # check all XML files parse import xml.etree.ElementTree as ET errors = [] for name in z.namelist(): if name.endswith('.xml') or name.endswith('.rels'): try: ET.fromstring(z.read(name)) except ET.ParseError as e: errors.append((name, str(e))) if errors: print('XML errors:', errors) else: print('All XML valid') "

Running Command

python3 -c "import docx; print('python-docx available:', docx.__version__)"

Running Command

# Check what's in the original docx numbering.xml - often a source of Word rejection python3 -c " import zipfile, xml.etree.ElementTree as ET with zipfile.ZipFile('/home/daytona/workspace/labour-analgesia/Labour_Pain_Pathways.docx') as z: for fname in ['word/numbering.xml', 'word/settings.xml']: if fname in z.namelist(): data = z.read(fname).decode('utf-8', errors='replace') print(f'--- {fname} (first 500 chars) ---') print(data[:500]) print() "

Writing File

~/labour-analgesia/pain_pathway_v2.js

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

const NAVY      = "1B3A6B";
const ROYAL     = "2E5FA3";
const LIGHTBLUE = "D6E4F7";
const TEAL      = "1A7A6E";
const AMBER     = "B7651B";
const RED       = "C0392B";
const LAVENDER  = "EEF2FB";
const MINT      = "EAF6F4";
const CREAM     = "FFFBEF";
const WHITE     = "FFFFFF";
const GRAY_BG   = "F4F6F9";
const BORDER    = "A0B4D0";

const R  = (t, o={}) => new TextRun({ text: t, font: "Calibri", size: 20, color: "222222", ...o });
const Rb = (t, o={}) => R(t, { bold: true, ...o });
const Ri = (t, o={}) => R(t, { italics: true, color: "555555", ...o });

function sp(n=100) {
  return new Paragraph({ children: [], spacing: { before: n, after: n } });
}
function body(runs, opts={}) {
  return new Paragraph({ children: Array.isArray(runs) ? runs : [runs], spacing: { before: 60, after: 60 }, ...opts });
}

// TITLE BLOCK
function titleBlock() {
  return [
    new Paragraph({
      children: [R("PAIN PATHWAYS OF LABOUR", { bold: true, size: 56, color: WHITE })],
      alignment: AlignmentType.CENTER,
      shading: { type: ShadingType.SOLID, color: NAVY, fill: NAVY },
      spacing: { before: 0, after: 0 },
    }),
    new Paragraph({
      children: [R("Detailed Neuroanatomical Review  |  Obstetric Anaesthesia", { italics: true, size: 24, color: LIGHTBLUE })],
      alignment: AlignmentType.CENTER,
      shading: { type: ShadingType.SOLID, color: ROYAL, fill: ROYAL },
      spacing: { before: 0, after: 0 },
    }),
    new Paragraph({
      children: [Ri("Sources: Morgan & Mikhail's Clinical Anesthesiology 7e  |  Miller's Anesthesia 10e  |  Barash's Clinical Anesthesia 9e", { size: 18, color: "888888" })],
      alignment: AlignmentType.CENTER,
      spacing: { before: 80, after: 280 },
    }),
  ];
}

// SECTION HEADING (dark band)
function H1(text, bg = NAVY) {
  return new Paragraph({
    children: [R(text, { bold: true, size: 28, color: WHITE })],
    shading: { type: ShadingType.SOLID, color: bg, fill: bg },
    spacing: { before: 300, after: 120 },
    indent: { left: 120, right: 120 },
  });
}

// SUB HEADING (underline)
function H2(text, color = ROYAL) {
  return new Paragraph({
    children: [R(text, { bold: true, size: 24, color })],
    spacing: { before: 220, after: 80 },
    border: { bottom: { style: BorderStyle.SINGLE, size: 6, color } },
  });
}

// H3
function H3(text, color = TEAL) {
  return new Paragraph({
    children: [R(text, { bold: true, size: 21, color })],
    spacing: { before: 160, after: 60 },
  });
}

// BULLET using unicode bullet character (no numbering.xml dependency)
function bul(text, level = 0) {
  const indent = 360 + level * 360;
  return new Paragraph({
    children: [R("• " + text)],
    indent: { left: indent, hanging: 280 },
    spacing: { before: 40, after: 40 },
  });
}
function bulB(label, rest, level = 0) {
  const indent = 360 + level * 360;
  return new Paragraph({
    children: [R("• ", {}), Rb(label, { color: NAVY }), R(rest)],
    indent: { left: indent, hanging: 280 },
    spacing: { before: 40, after: 40 },
  });
}

// NUMBERED step (inline, no list)
function numBul(n, label, rest) {
  return new Paragraph({
    children: [Rb(`${n}.  ${label}  `, { color: ROYAL }), R(rest)],
    indent: { left: 360, hanging: 360 },
    spacing: { before: 60, after: 60 },
  });
}

// INFO BOX (shaded paragraph with left border)
function infoBox(label, text, bg = CREAM, accent = AMBER) {
  return new Paragraph({
    children: [
      R(label + "  ", { bold: true, size: 20, color: accent }),
      R(text, { size: 20, color: "333333" }),
    ],
    shading: { type: ShadingType.SOLID, color: bg, fill: bg },
    border: { left: { style: BorderStyle.THICK, size: 12, color: accent } },
    indent: { left: 240 },
    spacing: { before: 120, after: 120 },
  });
}

// STEP BOX (two-cell table row)
function stepBox(num, title, bodyText, bg, accent) {
  return new Table({
    width: { size: 9200, type: WidthType.DXA },
    rows: [
      new TableRow({
        children: [
          new TableCell({
            children: [
              new Paragraph({
                children: [R(String(num), { bold: true, size: 52, color: WHITE })],
                alignment: AlignmentType.CENTER,
                spacing: { before: 80, after: 80 },
              }),
            ],
            shading: { type: ShadingType.SOLID, color: accent, fill: accent },
            verticalAlign: VerticalAlign.CENTER,
            width: { size: 900, type: WidthType.DXA },
            margins: { top: 60, bottom: 60, left: 120, right: 120 },
          }),
          new TableCell({
            children: [
              new Paragraph({
                children: [R(title, { bold: true, size: 22, color: accent })],
                spacing: { before: 60, after: 40 },
              }),
              new Paragraph({
                children: [R(bodyText, { size: 20, color: "333333" })],
                spacing: { before: 0, after: 80 },
              }),
            ],
            shading: { type: ShadingType.SOLID, color: bg, fill: bg },
            width: { size: 8300, type: WidthType.DXA },
            margins: { top: 80, bottom: 80, left: 200, right: 200 },
          }),
        ],
      }),
    ],
  });
}

// TABLE
function tbl(headers, rows, widths, hBg = NAVY) {
  const hRow = new TableRow({
    tableHeader: true,
    children: headers.map((h, i) =>
      new TableCell({
        children: [
          new Paragraph({
            children: [R(h, { bold: true, size: 19, color: WHITE })],
            alignment: AlignmentType.CENTER,
            spacing: { before: 60, after: 60 },
          }),
        ],
        shading: { type: ShadingType.SOLID, color: hBg, fill: hBg },
        verticalAlign: VerticalAlign.CENTER,
        width: { size: widths[i], type: WidthType.DXA },
      })
    ),
  });

  const dRows = rows.map((row, ri) =>
    new TableRow({
      children: row.map((cell, ci) =>
        new TableCell({
          children: [
            new Paragraph({
              children: [R(cell, { size: 19 })],
              spacing: { before: 50, after: 50 },
              indent: { left: 100 },
            }),
          ],
          shading: {
            type: ShadingType.SOLID,
            color: ri % 2 === 0 ? WHITE : GRAY_BG,
            fill:  ri % 2 === 0 ? WHITE : GRAY_BG,
          },
          width: { size: widths[ci], type: WidthType.DXA },
          borders: {
            top:    { style: BorderStyle.SINGLE, size: 2, color: BORDER },
            bottom: { style: BorderStyle.SINGLE, size: 2, color: BORDER },
            left:   { style: BorderStyle.SINGLE, size: 2, color: BORDER },
            right:  { style: BorderStyle.SINGLE, size: 2, color: BORDER },
          },
        })
      ),
    })
  );

  return new Table({
    rows: [hRow, ...dRows],
    width: { size: 9200, type: WidthType.DXA },
  });
}

// ════════════════════════════════════════════════════════════
// BUILD CONTENT
// ════════════════════════════════════════════════════════════
const children = [

  ...titleBlock(),

  // ── 1. OVERVIEW ──────────────────────────────────────────
  H1("OVERVIEW"),
  sp(60),
  body([R("Labour pain is one of the most severe pain experiences a person can endure. It arises from multiple anatomical sources and is transmitted via distinct neural pathways that change with the stage of labour. A thorough understanding of these pathways is fundamental to effective obstetric analgesia — it directly explains why different techniques target different spinal levels, and why no single block covers all of labour.")]),
  sp(60),
  infoBox("CORE PRINCIPLE:", "Labour pain has TWO distinct components — visceral pain in the first stage (T10–L1) and somatic pain in the second stage (S2–S4). Complete analgesia requires neuraxial blockade of T10–S4.", CREAM, AMBER),
  sp(120),

  // ── 2. ANATOMICAL SOURCES ────────────────────────────────
  H1("1.  ANATOMICAL SOURCES OF LABOUR PAIN"),
  sp(60),
  body([R("The pain of labour arises from three primary processes:")]),
  sp(40),
  bul("Contraction of the myometrium against resistance of the cervix and perineum"),
  bul("Progressive dilation and effacement of the cervix and lower uterine segment"),
  bul("Stretching and compression of pelvic and perineal structures as the fetus descends"),
  sp(100),

  tbl(
    ["Structure", "Process Causing Pain", "Stage Involved"],
    [
      ["Myometrium", "Ischaemia during powerful contractions (analogous to cardiac angina)", "Throughout labour"],
      ["Cervix", "Mechanical dilation and effacement", "First stage (latent + active)"],
      ["Lower uterine segment", "Distension and stretching as fetus descends", "Late first + second stage"],
      ["Vagina and perineum", "Stretching, compression, and tearing of soft tissues", "Second stage"],
      ["Pelvic floor muscles", "Compression and distension by presenting part", "Second stage"],
      ["Lumbosacral ligaments", "Traction and pressure from engaged fetal head", "Transition + second stage"],
    ],
    [2400, 3900, 2900]
  ),
  sp(120),

  // ── 3. FIRST STAGE ───────────────────────────────────────
  H1("2.  FIRST STAGE OF LABOUR — VISCERAL PAIN"),
  sp(60),

  H2("2a.  Character of Pain"),
  body([
    R("First stage pain is predominantly "),
    Rb("visceral", { color: NAVY }),
    R(" — dull, cramping, poorly localised, and difficult to pinpoint. It is perceived in the lower abdomen and is referred to the lumbosacral area, gluteal region, and thighs as labour intensifies."),
  ]),
  sp(80),

  H2("2b.  Dermatomal Distribution by Phase"),
  tbl(
    ["Phase of Labour", "Dermatomes Involved", "Clinical Correlate"],
    [
      ["Latent phase (early first stage)", "T11–T12", "Lower abdominal cramping; mild–moderate intensity"],
      ["Active phase (cervix 6–10 cm)", "T10–L1", "Intense pain; may radiate to back, hips, and thighs"],
      ["Transition (approaching second stage)", "T10–S1", "Severe pain; early perineal pressure begins"],
    ],
    [2800, 2200, 4200]
  ),
  sp(80),
  infoBox("WHY REFERRED PAIN?", "Visceral afferents from the uterus converge on the same spinal cord segments (T10–L1) as somatic afferents from the back, hips, and thighs. The brain interprets the signal as coming from the skin surface — hence pain is 'referred' to those dermatomes.", LAVENDER, ROYAL),
  sp(120),

  H2("2c.  Neural Pathway — Step by Step (First Stage)"),
  sp(80),

  stepBox(1, "Stimulus: Uterine Contraction",
    "Myometrial ischaemia and mechanical distension of the uterine wall and cervix activate nociceptors (free nerve endings). Key chemical mediators released include: bradykinin, prostaglandins (PGE2, PGF2α), histamine, serotonin, and substance P.",
    LAVENDER, ROYAL),
  sp(60),
  stepBox(2, "Visceral Afferent Fibres",
    "Pain signals are carried by thin unmyelinated C-fibres (slow, burning/aching pain) and lightly myelinated Aδ-fibres (faster, sharper pain). These visceral afferents travel alongside SYMPATHETIC nerve fibres — NOT parasympathetic fibres.",
    "#EBF5EB", TEAL),
  sp(60),
  stepBox(3, "Uterovaginal (Frankenhauser's) Plexus",
    "Afferent fibres first pass through the uterovaginal plexus, also called Frankenhauser's plexus — a network of nerves at the base of the broad ligament, adjacent to the lateral cervix. This is why paracervical block at this site relieves first-stage pain.",
    CREAM, AMBER),
  sp(60),
  stepBox(4, "Inferior Hypogastric Plexus (Pelvic Plexus)",
    "Fibres ascend from the uterovaginal plexus into the inferior hypogastric plexus, located anterolateral to the rectum at the S2–S4 level. They continue upward through the superior hypogastric plexus anterior to the aortic bifurcation.",
    LAVENDER, ROYAL),
  sp(60),
  stepBox(5, "Lumbar and Lower Thoracic Sympathetic Chain",
    "Fibres travel along sympathetic nerve fibres up through the lumbar sympathetic chain (L2–L4), passing through the aortic plexus and ascending the thoracic sympathetic chain.",
    "#EBF5EB", TEAL),
  sp(60),
  stepBox(6, "Entry to Spinal Cord — T10 to L1 Dorsal Roots",
    "Visceral afferent fibres enter the spinal cord via the posterior (dorsal) roots of T10, T11, T12, and L1. They synapse on second-order neurons in the dorsal horn (Rexed laminae I, II, and V).",
    CREAM, AMBER),
  sp(60),
  stepBox(7, "Spinothalamic Tract — Ascending to Brain",
    "Second-order neurons cross in the anterior commissure and ascend via the lateral spinothalamic tract to the thalamus (ventroposterolateral nucleus). Third-order neurons project to the somatosensory cortex (sensory-discriminative), anterior cingulate cortex (affective component), and insular cortex (autonomic response).",
    LAVENDER, ROYAL),
  sp(120),

  // ── 4. SECOND STAGE ──────────────────────────────────────
  H1("3.  SECOND STAGE OF LABOUR — SOMATIC PAIN"),
  sp(60),

  H2("3a.  Character of Pain"),
  body([
    R("Second stage pain is predominantly "),
    Rb("somatic", { color: NAVY }),
    R(" — sharp, intense, burning, and precisely localised to the perineum, vagina, and rectum. It begins at the onset of fetal descent and intensifies sharply as crowning occurs."),
  ]),
  sp(80),

  H2("3b.  Dermatomal Distribution"),
  infoBox("KEY:", "The onset of perineal pain signals fetal descent and the beginning of the second stage. Complete neuraxial coverage now requires blockade of T10–S4.", MINT, TEAL),
  sp(80),
  tbl(
    ["Structure", "Nerve Supply", "Spinal Roots"],
    [
      ["Perineum, vulva, labia majora/minora", "Pudendal nerve (perineal branch)", "S2, S3, S4"],
      ["Vagina (lower two-thirds)", "Pudendal nerve", "S2, S3, S4"],
      ["Rectum and anus", "Inferior rectal nerve (branch of pudendal)", "S2, S3, S4"],
      ["Clitoris and mons pubis", "Ilioinguinal + genitofemoral nerves", "L1, L2"],
      ["Inner thigh", "Medial cutaneous nerve of thigh", "L2, L3"],
      ["Anterior perineal skin", "Perineal branch, posterior femoral cutaneous nerve", "S1, S2, S3"],
    ],
    [3000, 3200, 3000]
  ),
  sp(100),

  H2("3c.  The Pudendal Nerve — Principal Nerve of the Second Stage"),
  body([R("The pudendal nerve (S2–S4) provides the majority of sensory and motor innervation to the perineum during the second stage of labour.")]),
  sp(60),
  bulB("Origin: ", "Sacral plexus — anterior divisions of S2, S3, and S4"),
  bulB("Course: ", "Exits the pelvis via the greater sciatic foramen (below piriformis) → wraps around the ischial spine and sacrospinous ligament → re-enters the pelvis through the lesser sciatic foramen → runs in the pudendal canal (Alcock's canal) in the lateral wall of the ischiorectal fossa"),
  bulB("Terminal branches: ", "Inferior rectal nerve → perineal nerve → dorsal nerve of clitoris/penis"),
  bulB("Clinical relevance: ", "Pudendal nerve block injected at the ischial spine provides perineal analgesia for delivery, episiotomy, and laceration repair (covers S2–S4 somatic pain only)"),
  sp(120),

  // ── 5. COMPLETE SUMMARY TABLE ────────────────────────────
  H1("4.  COMPLETE PATHWAY SUMMARY"),
  sp(80),
  tbl(
    ["Stage", "Source of Pain", "Type", "Nerve Route", "Spinal Entry", "Dermatomes"],
    [
      ["First stage\n(Latent)", "Uterine contractions, cervical dilation (early)", "Visceral", "Uterovaginal plexus → Inferior hypogastric plexus → Thoracolumbar sympathetic chain", "T11–T12 dorsal roots", "T11–T12"],
      ["First stage\n(Active)", "Intensifying contractions, rapid cervical dilation", "Visceral", "Same route — wider dermatomal spread", "T10–L1 dorsal roots", "T10–L1"],
      ["Transition", "Lower uterine distension, early perineal pressure", "Visceral + early somatic", "T10–L1 visceral + early pudendal activation", "T10–S1", "T10–S1"],
      ["Second stage", "Perineal/vaginal stretching, pelvic floor compression", "Somatic", "Pudendal nerve (S2–S4) + ilioinguinal/genitofemoral (L1)", "S2–S4 dorsal roots", "T10–S4 (complete)"],
    ],
    [1100, 1800, 1100, 2100, 1500, 1600]
  ),
  sp(120),

  // ── 6. MODULATING FACTORS ────────────────────────────────
  H1("5.  FACTORS THAT MODULATE PAIN INTENSITY"),
  sp(60),

  H2("5a.  Physiological Factors"),
  bulB("Parity: ", "Nulliparous women experience greater first-stage pain — cervix is more resistant to dilation, requiring more uterine work"),
  bulB("Fetal size and presentation: ", "Larger fetus or occiput-posterior position increases mechanical force and pain"),
  bulB("Oxytocin/augmentation: ", "Augmented contractions are more powerful and painful than spontaneous ones — greater myometrial ischaemia"),
  bulB("Induction of labour: ", "Rapid cervical ripening causes abrupt onset of painful contractions without gradual sensitisation"),
  sp(80),

  H2("5b.  Neurochemical Mediators"),
  tbl(
    ["Mediator", "Role in Labour Pain", "Analgesic Target?"],
    [
      ["Prostaglandins\n(PGE2, PGF2α)", "Sensitise uterine nociceptors; promote myometrial contraction", "NSAIDs (limited use in labour)"],
      ["Bradykinin", "Activates C-fibre nociceptors during myometrial ischaemia", "No direct clinical target"],
      ["Substance P", "Neurotransmitter at dorsal horn; amplifies central pain signalling", "Reduced by neuraxial opioids"],
      ["Serotonin (5-HT)", "Peripheral sensitisation of uterine nociceptors", "No direct clinical target"],
      ["Histamine", "Released from mast cells; nociceptor sensitisation", "No direct clinical target"],
      ["β-Endorphins", "Endogenous inhibitory; released with support and relaxation", "Enhanced by neuraxial opioids"],
    ],
    [2200, 3900, 3100]
  ),
  sp(80),

  H2("5c.  Psychological and Genetic Factors"),
  bulB("Anxiety: ", "Raises catecholamine levels → uterine vasoconstriction → worsens ischaemic pain — justifies good labour support"),
  bulB("Fear: ", "Lowers pain threshold via descending facilitatory pathways from the anterior cingulate cortex"),
  bulB("Social/continuous support: ", "Reduces catecholamine surge; enhances endorphin release; Cochrane review (26 trials, 15,858 women) showed shorter labour and less pharmacologic analgesia requested"),
  bulB("Genetics: ", "A SNP in the β2-adrenergic receptor gene is associated with greater pain intensity — more common in Asian women in some studies"),
  sp(120),

  // ── 7. DESCENDING MODULATION ─────────────────────────────
  H1("6.  DESCENDING PAIN MODULATION"),
  sp(60),
  body([R("The brain actively modulates pain signals at the dorsal horn via descending pathways that can either inhibit or facilitate pain transmission.")]),
  sp(80),

  H2("6a.  Inhibitory (Pain-Reducing) Pathways"),
  bulB("Periaqueductal grey (PAG) → Rostroventral medulla (RVM): ", "The major descending inhibitory axis; activated by endogenous opioids, stress, and exogenous opioids"),
  bulB("Noradrenergic pathway (locus coeruleus): ", "Releases noradrenaline in the dorsal horn → inhibits pain transmission; targeted by neuraxial clonidine"),
  bulB("Serotonergic pathway: ", "Complex dual role; inhibitory at higher concentrations; contributes to epidural opioid analgesia"),
  bulB("Endorphin/enkephalin system: ", "Endogenous opioid peptides released in the dorsal horn and throughout the CNS; augmented by neuraxial opioids and stress"),
  sp(80),

  H2("6b.  Facilitatory (Pain-Amplifying) Pathways"),
  bulB("Wind-up and central sensitisation: ", "Repeated C-fibre activation causes NMDA receptor-mediated amplification at the dorsal horn — prolonged or augmented labour progressively worsens central sensitisation, making pain increasingly severe"),
  bulB("Cortisol/catecholamine-driven facilitation: ", "Anxiety and fear enhance descending facilitation from the anterior cingulate cortex → lowers pain threshold → reinforces the need for anxiolysis and supportive care"),
  sp(120),

  // ── 8. CLINICAL IMPLICATIONS ─────────────────────────────
  H1("7.  CLINICAL IMPLICATIONS FOR ANALGESIA"),
  sp(60),
  body([R("Knowledge of the pain pathways directly explains why specific analgesic techniques work — and at which anatomical level they must act:")]),
  sp(80),
  tbl(
    ["Technique", "Level of Action", "Stage Covered", "Pathway Blocked"],
    [
      ["Paracervical block", "Uterovaginal (Frankenhauser's) plexus", "First stage only", "Visceral afferents from uterus/cervix before they join the sympathetic chain"],
      ["Lumbar epidural (T10–L1)", "Epidural space, L2–L4", "First stage", "Visceral afferents entering T10–L1 dorsal roots"],
      ["Lumbar epidural (T10–S4)", "Epidural space; volume/concentration adjusted for 2nd stage", "Both stages", "Full coverage: visceral T10–L1 + somatic S2–S4 via pudendal roots"],
      ["Combined spinal-epidural (CSE)", "Intrathecal bolus + epidural catheter", "Both stages", "Rapid intrathecal onset + epidural maintenance; covers T10–S4"],
      ["Pudendal nerve block", "Ischial spine — Alcock's canal", "Second stage only", "Pudendal nerve (S2–S4) — perineal somatic pain only"],
      ["Low spinal ('saddle block')", "Subarachnoid space L4–L5", "Second stage + delivery", "S1–S5 saddle area; limited to perineal somatic pain"],
      ["Systemic opioids (IV/IM)", "Central and peripheral opioid receptors", "Both stages (partial)", "Modulate central processing; do NOT block specific pathways — hence inferior analgesia"],
      ["Remifentanil PCIA", "Central opioid receptors", "Both stages (partial)", "Short-acting central modulation; timed to contraction peaks"],
    ],
    [1700, 1900, 1500, 4100]
  ),
  sp(120),

  // ── 9. KEY SUMMARY ───────────────────────────────────────
  H1("8.  KEY SUMMARY", TEAL),
  sp(80),
  infoBox("FIRST STAGE PATHWAY:", "Uterine/cervical nociceptors → C/Aδ visceral afferents → Frankenhauser's plexus → Inferior hypogastric plexus → Thoracolumbar sympathetic chain → T10–L1 dorsal roots → Spinothalamic tract → Thalamus → Cortex", LAVENDER, ROYAL),
  sp(60),
  infoBox("SECOND STAGE PATHWAY:", "Perineal/vaginal nociceptors → Pudendal nerve (S2–S4) + Ilioinguinal/genitofemoral (L1) → Sacral plexus → S2–S4 dorsal roots → Spinothalamic tract → Thalamus → Cortex", MINT, TEAL),
  sp(60),
  infoBox("COMPLETE EPIDURAL COVERAGE:", "Neuraxial blockade of T10–S4 is required to provide complete analgesia for both stages of labour. This is the anatomical rationale for epidural anaesthesia as the gold standard.", CREAM, AMBER),
  sp(60),
  infoBox("REFERRED PAIN:", "Uterine visceral afferents share spinal segments with somatic afferents from the back and thighs (T10–L1) — explaining why labour pain is felt in the lumbosacral region and inner thighs, not only the abdomen.", "#F5EEFF", RED),
  sp(100),

  // ── REFERENCES ───────────────────────────────────────────
  body([
    Rb("References: ", { size: 18, color: "888888" }),
    Ri("Morgan & Mikhail's Clinical Anesthesiology 7e, p.1606–1607  |  Miller's Anesthesia 10e, pp.8840–8852  |  Barash's Clinical Anesthesia 9e, pp.3486–3495", { size: 18, color: "888888" }),
  ], { before: 60, after: 60 }),
];

// ── DOCUMENT ─────────────────────────────────────────────────────
const doc = new Document({
  creator: "Orris",
  title: "Pain Pathways of Labour",
  sections: [{
    properties: {
      page: { margin: { top: 720, bottom: 720, left: 900, right: 900 } },
    },
    headers: {
      default: new Header({
        children: [
          new Paragraph({
            children: [R("PAIN PATHWAYS OF LABOUR  |  Obstetric Anaesthesia Reference", { size: 16, color: "888888" })],
            alignment: AlignmentType.RIGHT,
            border: { bottom: { style: BorderStyle.SINGLE, size: 4, color: BORDER } },
          }),
        ],
      }),
    },
    footers: {
      default: new Footer({
        children: [
          new Paragraph({
            children: [R("Sources: Morgan & Mikhail 7e  |  Miller's Anesthesia 10e  |  Barash's Clinical Anesthesia 9e", { size: 16, color: "888888" })],
            alignment: AlignmentType.CENTER,
            border: { top: { style: BorderStyle.SINGLE, size: 4, color: BORDER } },
          }),
        ],
      }),
    },
    children,
  }],
});

Packer.toBuffer(doc).then(buf => {
  fs.writeFileSync("/home/daytona/workspace/labour-analgesia/Labour_Pain_Pathways_v2.docx", buf);
  console.log("Done");
});
Running Command

cd /home/daytona/workspace/labour-analgesia && node pain_pathway_v2.js 2>&1

Running Command

python3 -c " import zipfile, xml.etree.ElementTree as ET path = '/home/daytona/workspace/labour-analgesia/Labour_Pain_Pathways_v2.docx' with zipfile.ZipFile(path) as z: print('Files:', len(z.namelist())) errors = [] for name in z.namelist(): if name.endswith('.xml') or name.endswith('.rels'): try: ET.fromstring(z.read(name)) except ET.ParseError as e: errors.append((name, str(e))) if errors: print('XML ERRORS:', errors) else: print('All XML valid — no parse errors') # Check no numbering.xml (list dependency) has_num = 'word/numbering.xml' in z.namelist() print('Has numbering.xml:', has_num) import os print('File size:', os.path.getsize(path), 'bytes') "

Running Command

# Check numbering.xml content - if it has abstract/concrete numbering definitions it should be fine python3 -c " import zipfile, xml.etree.ElementTree as ET with zipfile.ZipFile('/home/daytona/workspace/labour-analgesia/Labour_Pain_Pathways_v2.docx') as z: num_xml = z.read('word/numbering.xml').decode('utf-8') # Count abstractNum and num elements tree = ET.fromstring(num_xml) ns = '{http://schemas.openxmlformats.org/wordprocessingml/2006/main}' abstract = tree.findall(f'{ns}abstractNum') concrete = tree.findall(f'{ns}num') print(f'abstractNum definitions: {len(abstract)}') print(f'num definitions: {len(concrete)}') # Check document.xml for w:numId references doc_xml = z.read('word/document.xml').decode('utf-8') import re numIds = re.findall(r'w:numId w:val=\"(\d+)\"', doc_xml) print(f'numId references in document: {set(numIds)}') # Check concrete num vals for n in concrete: val = n.get(f'{ns}numId') abstractRef = n.find(f'{ns}abstractNumId') if abstractRef is not None: print(f' num id={val}, abstractNumId={abstractRef.get(\"{http://schemas.openxmlformats.org/wordprocessingml/2006/main}val\")}') "

The document is clean - no numbering references in the document body at all (bullets use Unicode • characters), all XML is valid. The file is ready:

Labour Pain Pathways v2

Word Document · DOCX

This is a rebuilt version that removes all list/numbering dependencies that can cause Word compatibility issues. Bullets now use the • character directly instead of Word's numbering system. If you still have trouble opening it, let me know which version of Word or what device you're using and I can adjust the format further.
This is a shared conversation. Sign in to Orris to start your own chat.