Create a treatment protocol document for IgE-lowering therapies

Reading File
Asking for Preferences
Finding Sources
Finding Sources
Searching PubMed

omalizumab IgE allergic asthma treatment guidelines

Searching the Web

IgE-lowering biologics allergic asthma treatment protocol 2024 2025 omalizumab tezepelumab dupilumab

Reading File
Reading File
Reading File
Reading Web Page

https://ginasthma.org/wp-content/uploads/2025/11/GINA-Severe…

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

mkdir -p /home/daytona/workspace/ige-protocol && ls /home/daytona/workspace/

Writing File

~/ige-protocol/build_protocol.py

from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm, mm
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    HRFlowable, PageBreak, KeepTogether
)
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_JUSTIFY
from reportlab.pdfgen import canvas
from datetime import date

OUTPUT = "/home/daytona/workspace/ige-protocol/IgE_Lowering_Therapy_Protocol.pdf"

# ── Colour palette ────────────────────────────────────────────────────────────
NAVY   = colors.HexColor("#1B3A6B")
TEAL   = colors.HexColor("#0D7377")
LTBLUE = colors.HexColor("#EAF4FB")
AMBER  = colors.HexColor("#F5A623")
RED    = colors.HexColor("#C0392B")
LGREY  = colors.HexColor("#F4F6F8")
DGREY  = colors.HexColor("#4A4A4A")
WHITE  = colors.white
BLACK  = colors.black

# ── Styles ────────────────────────────────────────────────────────────────────
styles = getSampleStyleSheet()

def make_style(name, parent="Normal", **kw):
    return ParagraphStyle(name, parent=styles[parent], **kw)

H1 = make_style("H1", "Heading1",
    fontSize=18, textColor=NAVY, spaceAfter=6, spaceBefore=18,
    fontName="Helvetica-Bold", leading=22)

H2 = make_style("H2", "Heading2",
    fontSize=13, textColor=TEAL, spaceAfter=4, spaceBefore=12,
    fontName="Helvetica-Bold", leading=17, borderPad=2)

H3 = make_style("H3", "Heading3",
    fontSize=11, textColor=NAVY, spaceAfter=3, spaceBefore=8,
    fontName="Helvetica-Bold", leading=14)

BODY = make_style("BODY", fontSize=10, textColor=DGREY,
    leading=14, spaceAfter=4, alignment=TA_JUSTIFY)

BODYBOLD = make_style("BODYBOLD", fontSize=10, textColor=DGREY,
    leading=14, spaceAfter=4, fontName="Helvetica-Bold")

SMALL = make_style("SMALL", fontSize=8.5, textColor=colors.HexColor("#666666"),
    leading=12, spaceAfter=3)

BULLET = make_style("BULLET", fontSize=10, textColor=DGREY,
    leading=14, spaceAfter=3, leftIndent=14, bulletIndent=4)

WARN = make_style("WARN", fontSize=10, textColor=RED,
    leading=14, spaceAfter=4, fontName="Helvetica-Bold")

CENTRE = make_style("CENTRE", fontSize=9, textColor=DGREY,
    alignment=TA_CENTER, leading=12)

TH = make_style("TH", fontSize=9, textColor=WHITE,
    fontName="Helvetica-Bold", alignment=TA_CENTER, leading=12)

TD = make_style("TD", fontSize=9, textColor=DGREY, leading=12, alignment=TA_LEFT)

TD_C = make_style("TD_C", fontSize=9, textColor=DGREY, leading=12, alignment=TA_CENTER)

# ── Header / Footer canvas ────────────────────────────────────────────────────
def on_page(canvas_obj, doc):
    w, h = A4
    canvas_obj.saveState()
    # Header bar
    canvas_obj.setFillColor(NAVY)
    canvas_obj.rect(0, h - 28*mm, w, 28*mm, fill=1, stroke=0)
    canvas_obj.setFillColor(AMBER)
    canvas_obj.rect(0, h - 31*mm, w, 3*mm, fill=1, stroke=0)
    canvas_obj.setFillColor(WHITE)
    canvas_obj.setFont("Helvetica-Bold", 13)
    canvas_obj.drawString(18*mm, h - 16*mm,
        "IgE-Lowering Therapy in Allergic Asthma & Atopic Disease")
    canvas_obj.setFont("Helvetica", 9)
    canvas_obj.drawString(18*mm, h - 23*mm, "Treatment Protocol for General Practitioners")
    canvas_obj.drawRightString(w - 18*mm, h - 23*mm, f"Version 1.0 | May 2026")
    # Footer
    canvas_obj.setFillColor(NAVY)
    canvas_obj.rect(0, 0, w, 12*mm, fill=1, stroke=0)
    canvas_obj.setFillColor(WHITE)
    canvas_obj.setFont("Helvetica", 8)
    canvas_obj.drawString(18*mm, 4.5*mm,
        "For GP clinical use | Based on GINA 2025 & current evidence | Review annually")
    canvas_obj.drawRightString(w - 18*mm, 4.5*mm, f"Page {doc.page}")
    canvas_obj.restoreState()

def on_first_page(canvas_obj, doc):
    on_page(canvas_obj, doc)

# ── Helper builders ───────────────────────────────────────────────────────────
def section_rule():
    return HRFlowable(width="100%", thickness=1, color=TEAL, spaceAfter=4, spaceBefore=4)

def info_box(title, lines, bg=LTBLUE, title_color=NAVY):
    """Returns a Table acting as a coloured info box."""
    content = [Paragraph(f"<b>{title}</b>", make_style("BT", fontSize=10,
        textColor=title_color, fontName="Helvetica-Bold", leading=14))]
    for l in lines:
        content.append(Paragraph(f"• {l}", make_style("BL", fontSize=9.5,
            textColor=DGREY, leading=13, leftIndent=8)))
    t = Table([[content]], colWidths=["100%"])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), bg),
        ("LEFTPADDING", (0,0), (-1,-1), 10),
        ("RIGHTPADDING", (0,0), (-1,-1), 10),
        ("TOPPADDING", (0,0), (-1,-1), 8),
        ("BOTTOMPADDING", (0,0), (-1,-1), 8),
        ("ROUNDEDCORNERS", (0,0), (-1,-1), [4,4,4,4]),
    ]))
    return t

def warn_box(text):
    t = Table([[Paragraph(f"⚠ {text}", make_style("WB", fontSize=9.5,
        textColor=RED, fontName="Helvetica-Bold", leading=13))]], colWidths=["100%"])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), colors.HexColor("#FFF3F3")),
        ("BOX", (0,0), (-1,-1), 1, RED),
        ("LEFTPADDING", (0,0), (-1,-1), 10),
        ("RIGHTPADDING", (0,0), (-1,-1), 10),
        ("TOPPADDING", (0,0), (-1,-1), 6),
        ("BOTTOMPADDING", (0,0), (-1,-1), 6),
    ]))
    return t

def drug_table(headers, rows, col_widths):
    data = [[Paragraph(h, TH) for h in headers]]
    for row in rows:
        data.append([Paragraph(cell, TD) for cell in row])
    t = Table(data, colWidths=col_widths, repeatRows=1)
    style = [
        ("BACKGROUND", (0,0), (-1,0), NAVY),
        ("ROWBACKGROUNDS", (0,1), (-1,-1), [WHITE, LGREY]),
        ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#CCCCCC")),
        ("VALIGN", (0,0), (-1,-1), "TOP"),
        ("LEFTPADDING", (0,0), (-1,-1), 6),
        ("RIGHTPADDING", (0,0), (-1,-1), 6),
        ("TOPPADDING", (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ]
    t.setStyle(TableStyle(style))
    return t

# ── Document build ────────────────────────────────────────────────────────────
def build():
    doc = SimpleDocTemplate(
        OUTPUT, pagesize=A4,
        topMargin=35*mm, bottomMargin=20*mm,
        leftMargin=18*mm, rightMargin=18*mm,
        title="IgE-Lowering Therapy Protocol",
        author="Clinical Protocols Unit",
    )

    story = []

    # ── SECTION 1: Overview ───────────────────────────────────────────────────
    story.append(Paragraph("1. Overview", H1))
    story.append(section_rule())
    story.append(Paragraph(
        "Elevated immunoglobulin E (IgE) is a hallmark of allergic (atopic) disease. "
        "In allergic asthma, IgE binds high-affinity receptors (FcεRI) on mast cells and basophils, "
        "triggering mediator release upon allergen exposure. IgE-lowering and IgE-pathway biologics "
        "represent a cornerstone of add-on therapy for patients whose disease remains uncontrolled "
        "despite optimised standard treatment.", BODY))
    story.append(Paragraph(
        "This protocol guides general practitioners on patient selection, dosing, monitoring, "
        "and safety of biologic agents targeting the IgE pathway in <b>allergic asthma and "
        "atopic disease</b>, in alignment with GINA 2025 recommendations.", BODY))
    story.append(Spacer(1, 4))

    story.append(info_box("Scope of this Protocol", [
        "Severe allergic (atopic) asthma — uncontrolled despite high-dose ICS/LABA (GINA Step 4–5)",
        "Atopic dermatitis with significant respiratory comorbidity (shared biologics)",
        "Chronic rhinosinusitis with nasal polyposis (CRSwNP) — relevant overlap",
        "Adults and children ≥6 years (biologic eligibility varies by agent and age)",
    ]))
    story.append(Spacer(1, 8))

    # ── SECTION 2: Pathophysiology ───────────────────────────────────────────
    story.append(Paragraph("2. IgE Pathway in Allergic Asthma", H1))
    story.append(section_rule())
    story.append(Paragraph(
        "Allergen exposure activates B lymphocytes (with T-helper 2 cell support via IL-4/IL-13) "
        "to produce IgE antibodies. These IgE molecules bind FcεRI on mast cells and basophils. "
        "Re-exposure to allergen cross-links receptor-bound IgE, causing immediate degranulation "
        "(histamine, leukotrienes, prostaglandins) and a late-phase eosinophilic response.", BODY))
    story.append(Paragraph(
        "Key upstream mediators triggering this cascade include epithelial cell-derived alarmins: "
        "<b>TSLP</b> (thymic stromal lymphopoietin), IL-25, and IL-33. Targeting these alarmins "
        "(e.g., tezepelumab) or downstream effectors (IgE, IL-4Rα) forms the basis of modern "
        "biologic therapy.", BODY))
    story.append(Spacer(1, 6))

    # Pathway summary table
    pathway_rows = [
        ["Allergen sensitisation", "IL-4, IL-13", "IgE production by B cells"],
        ["IgE binding to mast cells", "FcεRI receptor", "Mast cell priming"],
        ["Allergen re-exposure", "IgE cross-linking", "Degranulation → bronchoconstriction"],
        ["Late-phase response", "IL-5, eotaxin", "Eosinophil recruitment & airway remodelling"],
        ["Upstream epithelial alarm", "TSLP, IL-25, IL-33", "Th2 polarisation & amplification"],
    ]
    story.append(Paragraph("Table 1. IgE Inflammatory Pathway Summary", H3))
    story.append(drug_table(
        ["Trigger / Step", "Key Mediator", "Downstream Effect"],
        pathway_rows,
        [5.5*cm, 4.5*cm, 7*cm]
    ))
    story.append(Spacer(1, 8))

    # ── SECTION 3: Patient Selection ─────────────────────────────────────────
    story.append(Paragraph("3. Patient Selection Criteria", H1))
    story.append(section_rule())

    story.append(Paragraph("3.1 General Criteria for Biologic Referral / Initiation", H2))
    story.append(Paragraph(
        "Before considering any biologic therapy, confirm that standard therapy has been optimised:", BODY))

    prereqs = [
        "Correct inhaler technique verified and compliance assessed",
        "Comorbidities treated (rhinitis, GERD, obesity, OSA)",
        "High-dose ICS/LABA at GINA Step 4 (consider LAMA add-on at Step 5)",
        "Two or more severe exacerbations requiring OCS in the past 12 months, OR continuous OCS dependency",
        "Type 2 inflammatory biomarkers assessed: total serum IgE, specific IgE / skin-prick tests, blood eosinophil count, FeNO",
    ]
    for p in prereqs:
        story.append(Paragraph(f"✓  {p}", BULLET))
    story.append(Spacer(1, 6))

    story.append(Paragraph("3.2 Biomarker-Guided Eligibility (GINA 2025 Framework)", H2))
    eligibility_rows = [
        ["<b>Anti-IgE</b>\nOmalizumab",
         "≥6 years",
         "• Allergic sensitisation (positive SPT or specific IgE)\n• Total serum IgE 30–1,500 IU/mL\n• Weight within dosing chart range\n• ≥1 exacerbation in past year",
         "Severe allergic asthma, CRSwNP, chronic spontaneous urticaria"],
        ["<b>Anti-IL-4Rα</b>\nDupilumab",
         "≥6 years",
         "• Blood eosinophils ≥150 cells/µL, OR FeNO ≥25 ppb, OR OCS-dependent\n• ≥1 exacerbation in past year",
         "Severe eosinophilic/T2 asthma, atopic dermatitis, CRSwNP"],
        ["<b>Anti-TSLP</b>\nTezepelumab",
         "≥12 years",
         "• ≥1 exacerbation in past year\n• No biomarker threshold required\n• Useful in T2-low or mixed phenotype",
         "Severe asthma (all phenotypes), including T2-low"],
        ["<b>Anti-IL-5</b>\nMepolizumab\nBenralizumab\nReslizumab",
         "≥6–18 yrs (varies)",
         "• Blood eosinophils ≥150 cells/µL at screening, OR ≥300 cells/µL in past year\n• ≥1 exacerbation in past year",
         "Severe eosinophilic asthma, EGPA, HES"],
    ]
    # Build table with multi-line content
    hdrs = ["Drug Class / Agent", "Min. Age", "Eligibility Criteria", "Approved Indications"]
    col_w = [4*cm, 2*cm, 7*cm, 5.5*cm]
    data = [[Paragraph(h, TH) for h in hdrs]]
    for row in eligibility_rows:
        data.append([Paragraph(cell.replace("\n","<br/>"), TD) for cell in row])
    t = Table(data, colWidths=col_w, repeatRows=1)
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,0), NAVY),
        ("ROWBACKGROUNDS", (0,1), (-1,-1), [WHITE, LGREY]),
        ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#CCCCCC")),
        ("VALIGN", (0,0), (-1,-1), "TOP"),
        ("LEFTPADDING", (0,0), (-1,-1), 6),
        ("RIGHTPADDING", (0,0), (-1,-1), 6),
        ("TOPPADDING", (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ]))
    story.append(Paragraph("Table 2. Biologic Agent Eligibility Overview", H3))
    story.append(t)
    story.append(Spacer(1, 6))

    story.append(info_box(
        "Note on Overlapping Eligibility",
        [
            "Patients eligible for multiple biologics should be referred to an allergist/respiratory physician for shared decision-making.",
            "Dupilumab and tezepelumab show superiority over anti-IL-5 agents in reducing exacerbations and improving FEV1 in recent network meta-analyses (Allergy, 2026).",
            "Omalizumab is specifically indicated for allergic (IgE-driven) disease; total IgE and weight must fall within the manufacturer dosing table.",
        ]
    ))
    story.append(Spacer(1, 8))

    # ── SECTION 4: Drug Details ───────────────────────────────────────────────
    story.append(PageBreak())
    story.append(Paragraph("4. Dosing & Administration", H1))
    story.append(section_rule())

    # ── 4.1 Omalizumab ────────────────────────────────────────────────────────
    story.append(Paragraph("4.1 Omalizumab (Xolair®) — Anti-IgE", H2))
    story.append(Paragraph(
        "Omalizumab is a recombinant humanised IgG1 monoclonal antibody that binds the Fc region "
        "of circulating free IgE, blocking its interaction with FcεRI on mast cells, basophils, "
        "dendritic cells, and other inflammatory cells. It reduces both early and late-phase "
        "bronchoconstriction and significantly lowers circulating IgE levels.", BODY))

    oma_rows = [
        ["<b>Mechanism</b>", "Binds free IgE Fc region; blocks FcεRI and FcεRII binding; downregulates FcεRI expression on dendritic cells; enhances type I interferon response to rhinovirus"],
        ["<b>Route &amp; Frequency</b>", "Subcutaneous injection every 2 OR 4 weeks (frequency and dose depend on weight and baseline total IgE — consult dosing chart)"],
        ["<b>Dose Range</b>", "75–600 mg per visit (up to 3 × 150 mg injections per visit); determined by pre-treatment IgE level and body weight"],
        ["<b>IgE Range</b>", "30–1,500 IU/mL. Caution: if IgE >700 IU/mL, dose exceeds limits for heavier patients — check dosing table"],
        ["<b>Weight Limit</b>", "Do not use if baseline IgE >300 IU/mL and body weight >90 kg; or IgE approaching 700 IU/mL at any normal weight"],
        ["<b>Onset of Benefit</b>", "Clinical assessment at 4 months (16 weeks); discontinue if no meaningful response"],
        ["<b>Duration</b>", "Review every 6–12 months; withdrawal may increase exacerbations — taper cautiously"],
        ["<b>Self-administration</b>", "Pre-filled syringe option available; allow to reach room temperature before injection"],
    ]
    data = [[Paragraph(r[0], TD), Paragraph(r[1], TD)] for r in oma_rows]
    t = Table(data, colWidths=[4.5*cm, 13*cm])
    t.setStyle(TableStyle([
        ("ROWBACKGROUNDS", (0,0), (-1,-1), [LTBLUE, WHITE]),
        ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#BBDDEE")),
        ("VALIGN", (0,0), (-1,-1), "TOP"),
        ("LEFTPADDING", (0,0), (-1,-1), 6),
        ("RIGHTPADDING", (0,0), (-1,-1), 6),
        ("TOPPADDING", (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ]))
    story.append(t)
    story.append(Spacer(1, 4))
    story.append(info_box("Clinical Outcomes (Omalizumab)", [
        "44% decrease in severe exacerbations in severe allergic asthma (meta-analysis of RCTs, GINA 2025)",
        "59% reduction in exacerbation rate in observational registry data",
        "88% reduction in exacerbations requiring hospitalisation (Katzung's Pharmacology)",
        "Significant ICS and OCS dose reduction; improved quality of life scores",
        "Additional benefit: reduces viral exacerbations via enhanced interferon response",
    ], bg=colors.HexColor("#E8F8F5"), title_color=TEAL))
    story.append(Spacer(1, 10))

    # ── 4.2 Dupilumab ────────────────────────────────────────────────────────
    story.append(Paragraph("4.2 Dupilumab (Dupixent®) — Anti-IL-4Rα", H2))
    story.append(Paragraph(
        "Dupilumab blocks the shared IL-4Rα subunit, thereby inhibiting both IL-4 and IL-13 signalling. "
        "While not a direct anti-IgE agent, it suppresses the upstream drivers of IgE class switching and "
        "is a critical complementary therapy for patients with a T2-high phenotype. It is the preferred "
        "option when atopic dermatitis or CRSwNP coexist with asthma.", BODY))

    dup_rows = [
        ["<b>Mechanism</b>", "Blocks IL-4Rα subunit; inhibits IL-4 and IL-13 signalling; reduces IgE class switching, eosinophilic inflammation, and FeNO"],
        ["<b>Route &amp; Frequency</b>", "Subcutaneous injection every 2 weeks (q2w)"],
        ["<b>Dose</b>", "Adults &amp; adolescents ≥12 years: 200–300 mg q2w (weight-based in children 6–11 yrs). Add-on maintenance therapy"],
        ["<b>Biomarkers</b>", "Blood eosinophils ≥150 cells/µL OR FeNO ≥25 ppb OR OCS-dependent asthma"],
        ["<b>Comorbidities</b>", "Approved for atopic dermatitis, CRSwNP, eosinophilic oesophagitis, prurigo nodularis — ideal when multiple atopic comorbidities present"],
        ["<b>Helminth Risk</b>", "Treat pre-existing helminth infections before initiating; hold if new infection develops"],
        ["<b>Vaccines</b>", "Avoid live attenuated vaccines during therapy"],
    ]
    data = [[Paragraph(r[0], TD), Paragraph(r[1], TD)] for r in dup_rows]
    t = Table(data, colWidths=[4.5*cm, 13*cm])
    t.setStyle(TableStyle([
        ("ROWBACKGROUNDS", (0,0), (-1,-1), [LTBLUE, WHITE]),
        ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#BBDDEE")),
        ("VALIGN", (0,0), (-1,-1), "TOP"),
        ("LEFTPADDING", (0,0), (-1,-1), 6),
        ("RIGHTPADDING", (0,0), (-1,-1), 6),
        ("TOPPADDING", (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ]))
    story.append(t)
    story.append(Spacer(1, 10))

    # ── 4.3 Tezepelumab ─────────────────────────────────────────────────────
    story.append(Paragraph("4.3 Tezepelumab (Tezspire®) — Anti-TSLP", H2))
    story.append(Paragraph(
        "Tezepelumab is a fully human IgG2 monoclonal antibody targeting thymic stromal lymphopoietin "
        "(TSLP), an epithelial alarmin. By acting upstream of IgE, IL-5, and IL-4/13 pathways, "
        "it is unique in its efficacy across <i>all asthma phenotypes</i>, including T2-low and "
        "non-eosinophilic disease. It indirectly reduces total serum IgE.", BODY))

    tez_rows = [
        ["<b>Mechanism</b>", "Binds circulating TSLP; blocks downstream Th2, Th17, ILC2 activation; reduces IgE, eosinophils, FeNO, and IL-5/13"],
        ["<b>Route &amp; Frequency</b>", "Subcutaneous injection 210 mg every 4 weeks (q4w)"],
        ["<b>Age</b>", "≥12 years (syringe or auto-injector pen)"],
        ["<b>Biomarker Flexibility</b>", "No minimum IgE or eosinophil threshold required — suitable for T2-low asthma with no elevated biomarkers"],
        ["<b>Exacerbation Requirement</b>", "≥1 severe exacerbation in past 12 months (most payer criteria)"],
        ["<b>Cessation</b>", "Biomarker rebound (IgE, eosinophils) occurs after stopping; extended follow-up from DESTINATION trial (2024) shows IgE and eosinophil levels return to baseline within months"],
    ]
    data = [[Paragraph(r[0], TD), Paragraph(r[1], TD)] for r in tez_rows]
    t = Table(data, colWidths=[4.5*cm, 13*cm])
    t.setStyle(TableStyle([
        ("ROWBACKGROUNDS", (0,0), (-1,-1), [LTBLUE, WHITE]),
        ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#BBDDEE")),
        ("VALIGN", (0,0), (-1,-1), "TOP"),
        ("LEFTPADDING", (0,0), (-1,-1), 6),
        ("RIGHTPADDING", (0,0), (-1,-1), 6),
        ("TOPPADDING", (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ]))
    story.append(t)
    story.append(Spacer(1, 6))

    story.append(info_box("Note on Anti-IL-5 Agents (Mepolizumab, Benralizumab, Reslizumab)", [
        "These agents target downstream eosinophilic inflammation rather than IgE directly.",
        "Indicated for severe eosinophilic asthma (blood eosinophils ≥150–300 cells/µL).",
        "Reduce exacerbations by ~50% and enable OCS reduction by ≥50% in appropriate patients.",
        "Refer to specialist for initiation; not covered in full detail within this IgE-pathway protocol.",
    ], bg=LGREY, title_color=DGREY))
    story.append(Spacer(1, 8))

    # ── SECTION 5: Decision Pathway ──────────────────────────────────────────
    story.append(PageBreak())
    story.append(Paragraph("5. GP Decision Pathway", H1))
    story.append(section_rule())

    steps = [
        ("Step 1: Confirm Diagnosis & Severity",
         ["Confirm asthma diagnosis (spirometry with reversibility / bronchial challenge)",
          "Classify as moderate–severe, uncontrolled (ACQ-5 >1.5, ACT <20, or ≥2 OCS courses/year)",
          "Rule out alternative diagnoses: COPD, vocal cord dysfunction, cardiac disease"]),
        ("Step 2: Optimise Standard Therapy",
         ["High-dose ICS/LABA at GINA Steps 4–5",
          "Add LAMA (tiotropium) for uncontrolled symptoms at Step 5",
          "Treat all comorbidities: allergic rhinitis (intranasal corticosteroids), GERD, obesity, OSA",
          "Verify inhaler technique and adherence at every visit"]),
        ("Step 3: Assess Inflammatory Phenotype",
         ["Total serum IgE (IU/mL) + specific IgE panel or skin-prick test (SPT)",
          "Blood eosinophil count (cells/µL) — most recent value in past 12 months",
          "FeNO (fractional exhaled nitric oxide, ppb) — where available",
          "Body weight (for omalizumab dosing chart)"]),
        ("Step 4: Apply Biologic Eligibility Algorithm",
         ["Allergic (positive SPT/specific IgE) + IgE 30–1,500 IU/mL: consider OMALIZUMAB",
          "Eosinophils ≥150 cells/µL or FeNO ≥25 ppb or OCS-dependent: consider DUPILUMAB",
          "No clear T2 phenotype OR eligible for multiple agents: consider TEZEPELUMAB",
          "Predominant eosinophilia ≥300 cells/µL without other T2 markers: consider anti-IL-5 agents",
          "Multiple T2-driven comorbidities (AD, CRSwNP): favour DUPILUMAB"]),
        ("Step 5: Refer to Specialist",
         ["All biologic initiations should involve or be confirmed by an allergist, clinical immunologist, or respiratory physician",
          "Submit prior authorisation / payer documentation with biomarker results",
          "Provide patient education: SC injection technique, recognition of anaphylaxis, avoidance of live vaccines"]),
        ("Step 6: Monitor & Review",
         ["Formal response assessment at 4 months (omalizumab) / 3–6 months (other biologics)",
          "Assess: exacerbation frequency, OCS use, symptom control scores, lung function (FEV1)",
          "If no meaningful response: discontinue and consider switching class",
          "Review every 6–12 months; consider step-down if sustained remission achieved"]),
    ]

    for title, bullets in steps:
        step_content = [Paragraph(f"<b>{title}</b>",
            make_style("SH", fontSize=11, textColor=NAVY, fontName="Helvetica-Bold", leading=15))]
        for b in bullets:
            step_content.append(Paragraph(f"→  {b}",
                make_style("SB", fontSize=9.5, textColor=DGREY, leading=13, leftIndent=10)))
        t = Table([[step_content]], colWidths=["100%"])
        t.setStyle(TableStyle([
            ("BACKGROUND", (0,0), (-1,-1), LGREY),
            ("LEFTPADDING", (0,0), (-1,-1), 12),
            ("RIGHTPADDING", (0,0), (-1,-1), 10),
            ("TOPPADDING", (0,0), (-1,-1), 8),
            ("BOTTOMPADDING", (0,0), (-1,-1), 8),
            ("BOX", (0,0), (-1,-1), 1.5, TEAL),
        ]))
        story.append(KeepTogether([t, Spacer(1, 6)]))

    story.append(Spacer(1, 6))

    # ── SECTION 6: Safety & Monitoring ───────────────────────────────────────
    story.append(PageBreak())
    story.append(Paragraph("6. Safety Considerations & Monitoring", H1))
    story.append(section_rule())

    safety_rows = [
        ["Omalizumab", "Anaphylaxis (<0.1%); local injection-site reactions (~50%); diffuse urticaria (rare); possible association with malignancy (historical concern — not confirmed in large registries)", "Observe patient 30–60 min after first 3 doses; emergency adrenaline available at injection visits; subsequent doses may be home-administered with auto-injector"],
        ["Dupilumab", "Injection-site reactions; transient blood eosinophilia (monitor); conjunctivitis (common in AD patients); rare eosinophilic pneumonia/vasculitis reported", "Monitor eosinophil count at baseline and 3 months; hold and refer if new systemic symptoms develop"],
        ["Tezepelumab", "Injection-site reactions; anaphylaxis (rare); adverse event rates similar to placebo in NAVIGATOR trial", "Standard post-injection monitoring; biomarker rebound on cessation — plan discontinuation with specialist"],
        ["All biologics", "Live attenuated vaccines: avoid during therapy; attenuated vaccines may be given", "Screen for helminth infection in endemic areas before initiating; do not initiate during acute severe asthma exacerbation"],
    ]
    story.append(Paragraph("Table 3. Safety Profile by Biologic Agent", H3))
    story.append(drug_table(
        ["Agent", "Key Adverse Effects", "Monitoring / Risk Mitigation"],
        safety_rows,
        [3.5*cm, 7.5*cm, 7*cm]
    ))
    story.append(Spacer(1, 8))

    story.append(warn_box(
        "Anaphylaxis Risk: All biologic agents carry a risk of anaphylaxis. The first dose should "
        "be administered in a healthcare setting with resuscitation equipment available. "
        "Omalizumab specifically: first-dose observation ≥30–60 minutes is recommended."
    ))
    story.append(Spacer(1, 8))

    # ── SECTION 7: Response Assessment ───────────────────────────────────────
    story.append(Paragraph("7. Assessing Treatment Response", H1))
    story.append(section_rule())
    story.append(Paragraph(
        "A structured response assessment should be completed at 4 months for omalizumab and "
        "within 3–6 months for all other biologics. Both subjective and objective outcomes should "
        "be evaluated:", BODY))

    response_rows = [
        ["Exacerbation rate", "≥50% reduction in severe exacerbations vs. pre-treatment year", "Primary outcome; most reliable indicator"],
        ["OCS dose", "≥50% reduction or complete cessation of maintenance OCS", "Key in OCS-sparing trials"],
        ["Symptom control", "ACQ-5 score ≤0.75 (well-controlled) or ACT ≥20", "Patient-reported outcome"],
        ["Lung function", "FEV1 improvement ≥100–200 mL or ≥10% predicted", "Spirometry at 6-monthly intervals"],
        ["FeNO", "Reduction in FeNO (primarily dupilumab)", "Not reliable for omalizumab monitoring"],
        ["Blood eosinophils", "Reduction to near-zero (benralizumab); modest fall (dupilumab)", "Not primary endpoint for omalizumab"],
        ["Quality of life", "AQLQ or EQ-5D improvement", "Supplement objective measures"],
    ]
    story.append(Paragraph("Table 4. Response Criteria", H3))
    story.append(drug_table(
        ["Parameter", "Target Response", "Notes"],
        response_rows,
        [4.5*cm, 6.5*cm, 7*cm]
    ))
    story.append(Spacer(1, 4))
    story.append(info_box("Discontinuation Guidance", [
        "If no meaningful response at 4 months (omalizumab) or 6 months (others): discontinue and refer back to specialist for reassessment.",
        "Do not reinitiate the same biologic after confirmed non-response.",
        "Switching between biologic classes may be considered for partial responders — specialist decision.",
        "Sustained remission (no exacerbations, normal lung function, low biomarkers): discuss step-down with specialist after ≥12 months of stability.",
    ]))
    story.append(Spacer(1, 8))

    # ── SECTION 8: Special Populations ───────────────────────────────────────
    story.append(Paragraph("8. Special Populations", H1))
    story.append(section_rule())

    sp_rows = [
        ["Children (6–11 yrs)", "Omalizumab and dupilumab approved ≥6 years. Mepolizumab ≥6 years (eosinophilic asthma). Tezepelumab ≥12 years. Dose adjusted by weight in children. Meta-analysis (BMC Pediatrics, 2026) confirms safety and efficacy of omalizumab in children aged 6–11 years."],
        ["Adolescents (12–17 yrs)", "All agents except reslizumab (≥18 yrs). Tezepelumab approved ≥12 yrs. Consider dupilumab if concomitant atopic dermatitis."],
        ["Pregnancy", "Limited RCT data. Observational registry data for omalizumab: no increased risk of major congenital anomalies vs. disease-matched unexposed cohort (Fishman's Pulmonary). Specialist guidance required. Benefits vs. risks to be weighed individually."],
        ["Elderly (≥65 yrs)", "No dose adjustment required for most agents. Monitor for injection-site reactions and falls risk with self-administration."],
        ["Severe obesity", "Check omalizumab dosing chart carefully — weight limits apply at higher IgE levels. Consider dupilumab or tezepelumab without weight-based dosing restrictions."],
        ["Helminth-endemic regions", "Screen and treat helminth infection before initiating any biologic. These agents impair Th2 responses that may be protective against parasitic disease."],
    ]
    story.append(drug_table(
        ["Population", "Guidance"],
        sp_rows,
        [4*cm, 14.5*cm]
    ))
    story.append(Spacer(1, 8))

    # ── SECTION 9: Quick Reference ───────────────────────────────────────────
    story.append(PageBreak())
    story.append(Paragraph("9. Quick Reference Summary", H1))
    story.append(section_rule())

    qr_rows = [
        ["Omalizumab\n(Xolair®)",
         "IgE (FcεRI/II blockade)",
         "SC q2–4 weeks\n75–600 mg\n(weight + IgE chart)",
         "IgE 30–1500 IU/mL\nAllergic sensitisation\n≥6 years",
         "Anaphylaxis <0.1%\nInj. site reactions",
         "Asthma, CSU, CRSwNP, food allergy"],
        ["Dupilumab\n(Dupixent®)",
         "IL-4Rα blockade\n(IL-4 + IL-13)",
         "SC q2 weeks\n200–300 mg adults",
         "Eos ≥150 cells/µL\nOR FeNO ≥25 ppb\nOR OCS-dependent\n≥6 years",
         "Conjunctivitis\nInj. site reactions\nEosinophilia",
         "Asthma, AD, CRSwNP, EoE, PN"],
        ["Tezepelumab\n(Tezspire®)",
         "TSLP blockade\n(upstream alarmin)",
         "SC q4 weeks\n210 mg fixed",
         "≥1 exacerbation/yr\nNo biomarker threshold\n≥12 years",
         "Inj. site reactions\nAnaphylaxis (rare)",
         "Severe asthma\n(all phenotypes incl. T2-low)"],
        ["Mepolizumab\n(Nucala®)",
         "IL-5 blockade",
         "SC q4 weeks\n100 mg",
         "Eos ≥150 cells/µL\n(≥300 cells/µL preferred)\n≥6 years",
         "Inj. site reactions\nHeadache",
         "Severe eosinophilic asthma, EGPA, HES, CRSwNP"],
        ["Benralizumab\n(Fasenra®)",
         "IL-5Rα blockade\n(causes eosinophil apoptosis)",
         "SC 30 mg q4 wks × 3\nthen q8 weeks",
         "Eos ≥150–300 cells/µL\n≥12 years",
         "Inj. site reactions\nAnaphylaxis (rare)",
         "Severe eosinophilic asthma"],
    ]
    hdrs_qr = ["Drug", "Target", "Dose / Route", "Eligibility", "Key AEs", "Indications"]
    col_w_qr = [2.8*cm, 3*cm, 3.5*cm, 3.5*cm, 3.2*cm, 3*cm]
    data = [[Paragraph(h, TH) for h in hdrs_qr]]
    for row in qr_rows:
        data.append([Paragraph(cell.replace("\n","<br/>"), make_style("TDS", fontSize=8.5,
            textColor=DGREY, leading=11)) for cell in row])
    t = Table(data, colWidths=col_w_qr, repeatRows=1)
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,0), NAVY),
        ("ROWBACKGROUNDS", (0,1), (-1,-1), [WHITE, LGREY]),
        ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#CCCCCC")),
        ("VALIGN", (0,0), (-1,-1), "TOP"),
        ("LEFTPADDING", (0,0), (-1,-1), 4),
        ("RIGHTPADDING", (0,0), (-1,-1), 4),
        ("TOPPADDING", (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ]))
    story.append(t)
    story.append(Spacer(1, 8))

    # ── SECTION 10: References ────────────────────────────────────────────────
    story.append(Paragraph("10. References & Guidelines", H1))
    story.append(section_rule())

    refs = [
        "GINA. <i>Difficult-to-Treat and Severe Asthma in Adolescent and Adult Patients. A GINA Pocket Guide</i>. GINA 2025 (updated).",
        "Barnes PJ. Biologic Therapies for Severe Asthma. In: <i>Goodman &amp; Gilman's The Pharmacological Basis of Therapeutics</i>, 14th ed. McGraw-Hill, 2023.",
        "Fishman AP, et al. Anti-IgE Therapy. In: <i>Fishman's Pulmonary Diseases and Disorders</i>, 5th ed. McGraw-Hill.",
        "Katzung BG, et al. Anti-IgE Monoclonal Antibodies. In: <i>Katzung's Basic and Clinical Pharmacology</i>, 16th ed. McGraw-Hill, 2021.",
        "Janeway CA, et al. IgE-mediated allergic disease. In: <i>Janeway's Immunobiology</i>, 10th ed. Norton, 2022.",
        "Yang Y, Fang C, Jiang Z. Safety and efficacy of omalizumab in children aged 6–11 years with asthma: a systematic review and meta-analysis of RCTs. <i>BMC Pediatrics</i>. 2026;PMID 41652440.",
        "Zheng Y, Li YC, Li SJ. Patterns and clinical efficacy of biologics switching in patients with severe asthma: a systematic review and meta-analysis. <i>Allergy</i>. 2026 May;PMID 41934326.",
        "Santos AF, et al. EAACI guidelines on the management of IgE-mediated food allergy. <i>Allergy</i>. 2025 Jan;PMID 39473345.",
        "Brightling CE, et al. Biomarkers and clinical outcomes after tezepelumab cessation: extended follow-up from the DESTINATION study. <i>Ann Allergy Asthma Immunol</i>. 2024;133:310–317.",
        "Teach SJ, et al. Preseasonal treatment with omalizumab and exacerbations. <i>N Engl J Med</i>. 2015.",
    ]
    for i, ref in enumerate(refs, 1):
        story.append(Paragraph(f"{i}.  {ref}",
            make_style("REF", fontSize=8.5, textColor=DGREY, leading=13, spaceAfter=3,
                leftIndent=18, firstLineIndent=-18)))
    story.append(Spacer(1, 10))

    # Disclaimer
    disc = Table([[Paragraph(
        "<b>Disclaimer:</b> This protocol is intended as a clinical guidance tool for general "
        "practitioners and does not replace individual clinical judgment or locally approved "
        "formulary decisions. Biologic therapy initiation and oversight should involve specialist "
        "review (allergist / respiratory physician / clinical immunologist). Dosing should always "
        "be verified against the current approved product information and local payer criteria. "
        "Review annually or when new evidence emerges.",
        make_style("DISC", fontSize=8.5, textColor=DGREY, leading=12))]], colWidths=["100%"])
    disc.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), colors.HexColor("#FFFBE6")),
        ("BOX", (0,0), (-1,-1), 1, AMBER),
        ("LEFTPADDING", (0,0), (-1,-1), 10),
        ("RIGHTPADDING", (0,0), (-1,-1), 10),
        ("TOPPADDING", (0,0), (-1,-1), 8),
        ("BOTTOMPADDING", (0,0), (-1,-1), 8),
    ]))
    story.append(disc)

    doc.build(story, onFirstPage=on_first_page, onLaterPages=on_page)
    print(f"PDF generated: {OUTPUT}")

build()
Running Command

cd /home/daytona/workspace/ige-protocol && python build_protocol.py

Running Command

ls -lh /home/daytona/workspace/ige-protocol/

The protocol document is ready. Here's your download link:

IgE Lowering Therapy Protocol

PDF Document · PDF


What's in the Document

The PDF is a professionally formatted, 4-section, multi-page clinical protocol covering:
SectionContent
1. OverviewPurpose, scope, target disease areas
2. IgE PathwayPathophysiology table: triggers → mediators → downstream effects
3. Patient SelectionStandard therapy prerequisites + biomarker-guided eligibility table (GINA 2025)
4. Dosing & AdministrationDetailed drug sheets for omalizumab, dupilumab, and tezepelumab; note on anti-IL-5 agents
5. GP Decision Pathway6-step structured workflow from diagnosis to monitoring
6. Safety & MonitoringPer-agent adverse effect table; anaphylaxis warning box
7. Response AssessmentCriteria table: exacerbations, OCS dose, FEV1, FeNO, QoL
8. Special PopulationsChildren, pregnancy, elderly, obesity, helminth-endemic regions
9. Quick ReferenceFull comparison table of all 5 biologics (target, dose, eligibility, AEs, indications)
10. References10 citations including GINA 2025, Goodman & Gilman, Katzung, PubMed 2024–2026
Sources used: Goodman & Gilman's Pharmacological Basis (14th ed), Katzung's Basic & Clinical Pharmacology (16th ed), Fishman's Pulmonary Diseases, Janeway's Immunobiology (10th ed), GINA 2025 Severe Asthma Guide, and recent PubMed systematic reviews (PMIDs 41652440, 41934326).

Create a treatment protocol document for IgE-lowering therapies

Asking for Preferences
Reading File
Reading File
Finding Sources
Finding Sources
Searching PubMed

chronic urticaria omalizumab treatment guidelines

Searching the Web

chronic urticaria IgE biologic therapy protocol 2025 omalizumab dupilumab ligelizumab guidelines

Finding Sources
Finding Sources
Reading Web Page

https://pmc.ncbi.nlm.nih.gov/articles/PMC12874352

Reading File
Reading File
Reading File
Reading File
Reading File
Running Command

ls /home/daytona/skills/docx/scripts/office/ 2>/dev/null && ls /home/daytona/wor…

Writing File

~/ige-protocol/build_urticaria_docx.js

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

const OUT = "/home/daytona/workspace/ige-protocol/IgE_CU_Treatment_Protocol.docx";

// ── Colour tokens ─────────────────────────────────────────────────────────────
const NAVY    = "1B3A6B";
const TEAL    = "0D7377";
const AMBER   = "F5A623";
const LTBLUE  = "EAF4FB";
const LGREY   = "F4F6F8";
const WHITE   = "FFFFFF";
const DGREY   = "4A4A4A";
const RED     = "C0392B";
const LTRED   = "FFF3F3";
const LTYELL  = "FFFBE6";

// ── Helper: shading ────────────────────────────────────────────────────────────
function shade(fill) { return { type: ShadingType.CLEAR, fill, color: "auto" }; }

// ── Helper: thin border set ────────────────────────────────────────────────────
function thinBorder(color = "CCCCCC") {
  const b = { style: BorderStyle.SINGLE, size: 4, color };
  return { top: b, bottom: b, left: b, right: b };
}

// ── Helper: no border ─────────────────────────────────────────────────────────
function noBorder() {
  const b = { style: BorderStyle.NONE, size: 0, color: "auto" };
  return { top: b, bottom: b, left: b, right: b };
}

// ── Paragraph helpers ─────────────────────────────────────────────────────────
function h1(text) {
  return new Paragraph({
    heading: HeadingLevel.HEADING_1,
    spacing: { before: 320, after: 120 },
    children: [new TextRun({ text, bold: true, color: NAVY, size: 30, font: "Calibri" })],
  });
}

function h2(text) {
  return new Paragraph({
    heading: HeadingLevel.HEADING_2,
    spacing: { before: 240, after: 80 },
    children: [new TextRun({ text, bold: true, color: TEAL, size: 26, font: "Calibri" })],
  });
}

function h3(text) {
  return new Paragraph({
    heading: HeadingLevel.HEADING_3,
    spacing: { before: 200, after: 60 },
    children: [new TextRun({ text, bold: true, color: NAVY, size: 22, font: "Calibri" })],
  });
}

function body(text, opts = {}) {
  return new Paragraph({
    spacing: { before: 60, after: 80 },
    alignment: AlignmentType.JUSTIFIED,
    children: [new TextRun({ text, size: 20, font: "Calibri", color: DGREY, ...opts })],
  });
}

function bullet(text, level = 0) {
  return new Paragraph({
    bullet: { level },
    spacing: { before: 40, after: 40 },
    children: [new TextRun({ text, size: 20, font: "Calibri", color: DGREY })],
  });
}

function note(label, text) {
  return new Paragraph({
    spacing: { before: 60, after: 60 },
    children: [
      new TextRun({ text: label + " ", bold: true, size: 19, font: "Calibri", color: NAVY }),
      new TextRun({ text, size: 19, font: "Calibri", color: DGREY }),
    ],
  });
}

function smallItalic(text) {
  return new Paragraph({
    spacing: { before: 40, after: 40 },
    children: [new TextRun({ text, italics: true, size: 17, font: "Calibri", color: "666666" })],
  });
}

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

// ── Table helpers ─────────────────────────────────────────────────────────────
function headerCell(text, widthPct) {
  return new TableCell({
    width: { size: widthPct, type: WidthType.PERCENTAGE },
    shading: shade(NAVY),
    verticalAlign: VerticalAlign.CENTER,
    margins: { top: 80, bottom: 80, left: 100, right: 100 },
    borders: thinBorder(NAVY),
    children: [new Paragraph({
      alignment: AlignmentType.CENTER,
      children: [new TextRun({ text, bold: true, color: WHITE, size: 18, font: "Calibri" })],
    })],
  });
}

function dataCell(text, widthPct, bgColor = WHITE, bold = false, center = false) {
  const runs = [];
  // Support inline bold via **text** markers
  const parts = text.split(/(\*\*[^*]+\*\*)/g);
  for (const p of parts) {
    if (p.startsWith("**") && p.endsWith("**")) {
      runs.push(new TextRun({ text: p.slice(2, -2), bold: true, size: 18, font: "Calibri", color: DGREY }));
    } else if (p) {
      runs.push(new TextRun({ text: p, bold, size: 18, font: "Calibri", color: DGREY }));
    }
  }
  return new TableCell({
    width: { size: widthPct, type: WidthType.PERCENTAGE },
    shading: shade(bgColor),
    verticalAlign: VerticalAlign.TOP,
    margins: { top: 80, bottom: 80, left: 100, right: 100 },
    borders: thinBorder(),
    children: [new Paragraph({
      alignment: center ? AlignmentType.CENTER : AlignmentType.LEFT,
      children: runs,
    })],
  });
}

function makeTable(headers, rows, widths) {
  const headerRow = new TableRow({
    tableHeader: true,
    children: headers.map((h, i) => headerCell(h, widths[i])),
  });
  const dataRows = rows.map((row, ri) => new TableRow({
    children: row.map((cell, ci) => dataCell(cell, widths[ci], ri % 2 === 0 ? WHITE : LGREY)),
  }));
  return new Table({
    width: { size: 100, type: WidthType.PERCENTAGE },
    rows: [headerRow, ...dataRows],
  });
}

// ── Coloured box (single-cell table) ─────────────────────────────────────────
function colorBox(titleText, lines, bg, borderColor, titleColor = NAVY) {
  const paras = [
    new Paragraph({
      spacing: { before: 0, after: 60 },
      children: [new TextRun({ text: titleText, bold: true, size: 20, font: "Calibri", color: titleColor })],
    }),
    ...lines.map(l => new Paragraph({
      spacing: { before: 30, after: 30 },
      bullet: { level: 0 },
      children: [new TextRun({ text: l, size: 18, font: "Calibri", color: DGREY })],
    })),
  ];
  return new Table({
    width: { size: 100, type: WidthType.PERCENTAGE },
    rows: [new TableRow({
      children: [new TableCell({
        shading: shade(bg),
        margins: { top: 120, bottom: 120, left: 160, right: 160 },
        borders: {
          top: { style: BorderStyle.SINGLE, size: 12, color: borderColor },
          bottom: { style: BorderStyle.SINGLE, size: 12, color: borderColor },
          left: { style: BorderStyle.SINGLE, size: 12, color: borderColor },
          right: { style: BorderStyle.SINGLE, size: 12, color: borderColor },
        },
        children: paras,
      })],
    })],
  });
}

function warnBox(text) {
  return new Table({
    width: { size: 100, type: WidthType.PERCENTAGE },
    rows: [new TableRow({
      children: [new TableCell({
        shading: shade(LTRED),
        margins: { top: 100, bottom: 100, left: 160, right: 160 },
        borders: {
          top: { style: BorderStyle.SINGLE, size: 12, color: RED },
          bottom: { style: BorderStyle.SINGLE, size: 12, color: RED },
          left: { style: BorderStyle.THICK, size: 20, color: RED },
          right: { style: BorderStyle.SINGLE, size: 4, color: RED },
        },
        children: [new Paragraph({
          children: [
            new TextRun({ text: "⚠  ", bold: true, size: 20, font: "Calibri", color: RED }),
            new TextRun({ text, bold: true, size: 18, font: "Calibri", color: RED }),
          ],
        })],
      })],
    })],
  });
}

function space(pts = 100) {
  return new Paragraph({ spacing: { before: pts, after: 0 }, children: [] });
}

// ── Header & Footer ────────────────────────────────────────────────────────────
function buildHeader() {
  return new Header({
    children: [
      new Table({
        width: { size: 100, type: WidthType.PERCENTAGE },
        rows: [new TableRow({
          children: [
            new TableCell({
              shading: shade(NAVY),
              width: { size: 70, type: WidthType.PERCENTAGE },
              borders: noBorder(),
              margins: { top: 80, bottom: 80, left: 160, right: 80 },
              children: [
                new Paragraph({ children: [new TextRun({ text: "IgE-Lowering Therapies in Chronic Urticaria", bold: true, color: WHITE, size: 22, font: "Calibri" })] }),
                new Paragraph({ children: [new TextRun({ text: "Treatment Protocol for General Practitioners", color: "AACCEE", size: 18, font: "Calibri" })] }),
              ],
            }),
            new TableCell({
              shading: shade(NAVY),
              width: { size: 30, type: WidthType.PERCENTAGE },
              borders: noBorder(),
              margins: { top: 80, bottom: 80, left: 80, right: 160 },
              verticalAlign: VerticalAlign.CENTER,
              children: [new Paragraph({
                alignment: AlignmentType.RIGHT,
                children: [new TextRun({ text: "Version 1.0 | May 2026", color: "AACCEE", size: 17, font: "Calibri" })],
              })],
            }),
          ],
        })],
      }),
      new Paragraph({
        spacing: { before: 0, after: 80 },
        border: { bottom: { style: BorderStyle.SINGLE, size: 8, color: AMBER } },
        children: [],
      }),
    ],
  });
}

function buildFooter() {
  return new Footer({
    children: [
      new Paragraph({
        border: { top: { style: BorderStyle.SINGLE, size: 4, color: "CCCCCC" } },
        spacing: { before: 60, after: 0 },
        alignment: AlignmentType.CENTER,
        children: [
          new TextRun({ text: "For GP clinical use | Based on EAACI 2022, AAAAI/ACAAI guidelines & current evidence | ", size: 16, font: "Calibri", color: "888888" }),
          new TextRun({ text: "Page ", size: 16, font: "Calibri", color: "888888" }),
          new PageNumber({ size: 16, font: "Calibri", color: "888888" }),
        ],
      }),
    ],
  });
}

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

// ─────────────────────────────────────────────────────────────────────────────
// SECTION 1: Overview
// ─────────────────────────────────────────────────────────────────────────────
children.push(h1("1. Overview & Scope"));
children.push(body(
  "Chronic urticaria (CU) is defined as the recurrent occurrence of wheals, angioedema, or both for more than 6 weeks. " +
  "Immunoglobulin E (IgE) plays a central pathophysiological role: IgE bound to high-affinity FcεRI receptors on mast cells " +
  "triggers mediator release upon allergen exposure, producing the characteristic wheal-and-flare response. " +
  "In chronic spontaneous urticaria (CSU), approximately one third of patients have autoantibodies directed against these IgE receptors."
));
children.push(body(
  "This protocol guides general practitioners on the stepwise management of chronic urticaria, with emphasis on " +
  "IgE-targeted and IgE-pathway biologics. It aligns with the EAACI/GA²LEN/EDF/WAO urticaria guidelines (2022), " +
  "AAAAI/ACAAI practice recommendations, and the most current evidence as of May 2026."
));
children.push(space(80));
children.push(colorBox("Scope of This Protocol", [
  "Chronic spontaneous urticaria (CSU) — lasting >6 weeks without consistent identifiable trigger",
  "Chronic inducible urticaria (CIndU) — symptomatic dermographism, cold, cholinergic, pressure, solar urticaria",
  "Urticaria with concomitant angioedema",
  "Adults and children ≥6 years; specific agent eligibility by age noted throughout",
  "Excludes hereditary angioedema (HAE) — managed under a separate protocol",
], LTBLUE, TEAL));
children.push(space(120));

// ─────────────────────────────────────────────────────────────────────────────
// SECTION 2: Classification & Pathophysiology
// ─────────────────────────────────────────────────────────────────────────────
children.push(h1("2. Classification & Pathophysiology"));
children.push(h2("2.1 Classification"));
children.push(makeTable(
  ["Type", "Subtype", "Key Feature"],
  [
    ["**Chronic Spontaneous**\n(CSU)", "Autoimmune Type IIb\nAutoimmune Type I\nIdiopathic", "Autoantibodies vs FcεRI (IgG → mast cell activation)\nIgE vs self-antigens (e.g. IL-24, thyroid peroxidase)\nNo identifiable immunological trigger"],
    ["**Chronic Inducible**\n(CIndU)", "Symptomatic dermographism\nCold urticaria\nCholinergic\nPressure, solar, aquagenic", "Physical or environmental trigger reproducibly elicits wheals"],
  ],
  [22, 35, 43]
));
children.push(space(100));
children.push(h2("2.2 IgE Pathway in Chronic Urticaria"));
children.push(body(
  "Allergen or autoantibody binding → IgE/FcεRI cross-linking on mast cells → degranulation → histamine, " +
  "prostaglandins, leukotrienes, cytokines → vasodilatation, plasma extravasation, neural sensitisation → wheal and flare. " +
  "Sustained IgE production is driven by IL-4 and IL-13 (via IL-4Rα signalling) and upstream epithelial alarmins (TSLP, IL-33, IL-25). " +
  "Blocking free IgE (omalizumab) or its upstream drivers (dupilumab) interrupts this cascade."
));
children.push(space(120));

// ─────────────────────────────────────────────────────────────────────────────
// SECTION 3: Diagnosis
// ─────────────────────────────────────────────────────────────────────────────
children.push(h1("3. Diagnosis & Initial Assessment"));
children.push(h2("3.1 Clinical Diagnosis"));
children.push(body(
  "Diagnosis is clinical. Wheals are transient (<24 h), migratory, pruritic, and leave no residual skin change. " +
  "Angioedema involves deeper dermis/subcutaneous tissue and resolves within 72 hours. " +
  "Lesions lasting >36 hours, burning rather than itching, or leaving pigmentation warrant skin biopsy to exclude urticarial vasculitis."
));
children.push(h2("3.2 Recommended Investigations"));
children.push(makeTable(
  ["Investigation", "Indication", "Notes"],
  [
    ["CBC with differential", "All patients at baseline", "Screen for eosinophilia, haematological causes"],
    ["ESR or CRP", "All patients at baseline", "Elevated in vasculitic or autoinflammatory urticaria"],
    ["Thyroid function (TSH, anti-TPO)", "Suspected autoimmune association", "Thyroid autoimmunity in ~10–30% of CSU"],
    ["Specific IgE / skin-prick test", "History suggesting allergen trigger", "Most CSU is not truly allergen-driven"],
    ["Total serum IgE", "Before biologic initiation", "Not a threshold for omalizumab in CSU — used for monitoring"],
    ["C4 level", "Isolated angioedema without wheals", "Low C4 suggests HAE or acquired C1INH deficiency"],
    ["Skin biopsy", "Lesions >36 h, burning, non-pruritic", "Exclude urticarial vasculitis (fibrinoid necrosis)"],
    ["Autologous serum skin test (ASST)", "Research/specialist setting", "Indicates autoimmune subtype; not routine"],
  ],
  [28, 30, 42]
));
children.push(space(80));
children.push(note("Note:", "Extensive laboratory investigation is not recommended routinely. ~95% of CSU has no identifiable systemic cause. Testing should be directed by clinical findings."));
children.push(space(80));
children.push(h2("3.3 Disease Activity Scoring"));
children.push(makeTable(
  ["Tool", "What It Measures", "Interpretation"],
  [
    ["**UAS7** (Urticaria Activity Score — 7 days)", "Weekly sum of wheal count + itch intensity (0–6/day)", "0 = urticaria-free; 1–6 = well-controlled; 7–15 = moderate; 16–27 = severe; 28–42 = very severe"],
    ["**UCT** (Urticaria Control Test)", "4-item retrospective 4-week symptom control", "Score ≥12 = well-controlled; <12 = inadequately controlled"],
    ["**CU-Q2oL**", "Quality of life impact", "Higher score = worse QoL"],
    ["**AAS7** (Angioedema Activity Score)", "Angioedema burden over 7 days", "Weekly score 0–35"],
  ],
  [28, 35, 37]
));
children.push(space(120));

// ─────────────────────────────────────────────────────────────────────────────
// SECTION 4: Stepwise Treatment Algorithm
// ─────────────────────────────────────────────────────────────────────────────
children.push(pageBreakPara());
children.push(h1("4. Stepwise Treatment Algorithm"));
children.push(body("Therapy follows a stepwise escalation model. Advance to the next step only when the current step has been adequately trialled (minimum 2–4 weeks per step, except where indicated)."));
children.push(space(80));

const steps = [
  {
    step: "Step 1 (First-Line) — Second-Generation H1-Antihistamines",
    color: TEAL,
    items: [
      "Cetirizine 10 mg once daily, OR levocetirizine 5 mg once daily, OR fexofenadine 180 mg once daily, OR loratadine 10 mg once daily, OR desloratadine 5 mg once daily",
      "Duration: trial for at least 2–4 weeks before escalating",
      "Avoid first-generation antihistamines (diphenhydramine, chlorphenamine) as first-line — sedation, psychomotor impairment, anticholinergic effects (especially in elderly)",
      "Avoid NSAIDs and opioids — exacerbate urticaria in up to 30% of patients",
    ],
  },
  {
    step: "Step 2 — Up-Dose Antihistamine",
    color: TEAL,
    items: [
      "If Step 1 is insufficient after 2 weeks: increase to up to 4× the standard daily dose",
      "Titrate upward gradually: add second tablet in evening → third in morning → fourth (2 morning, 2 evening)",
      "Note: fexofenadine has limited evidence of benefit with up-dosing; switch if no response at standard dose",
      "Optional adjuncts (limited evidence): H2-blocker (famotidine), leukotriene receptor antagonist (montelukast 10 mg daily), or bedtime first-generation antihistamine",
      "Topical corticosteroids, antihistamines, and anaesthetics have no role in CU management",
    ],
  },
  {
    step: "Step 3 (Second-Line) — Add Omalizumab",
    color: NAVY,
    items: [
      "Initiate omalizumab 300 mg SC every 4 weeks when Step 2 fails",
      "Continue background second-generation antihistamine (taper as tolerated as symptoms improve)",
      "No pre-treatment IgE threshold required for CSU (unlike in asthma): IgE level does not determine eligibility",
      "Response assessment at 3 months: UAS7 reduction ≥75% from baseline = good response",
      "If no or partial response at 3 months: consider dose increase to 300 mg every 2 weeks (off-label) or switch agent",
      "Prescribe epinephrine autoinjector and counsel on anaphylaxis recognition (rare but reported)",
    ],
  },
  {
    step: "Step 4 — Dupilumab (if Omalizumab Insufficient or Contraindicated)",
    color: NAVY,
    items: [
      "Dupilumab 300 mg SC every 2 weeks — approved April 2025 (FDA) for CSU in patients ≥12 years failing H1-antihistamines",
      "Indicated for antihistamine-refractory CSU regardless of prior omalizumab status",
      "CUPID A trial (omalizumab-naïve): UAS7 reduction −20.5 vs −12.0 (placebo); p=0.0003",
      "Note: CUPID B (omalizumab-refractory patients) did not demonstrate superiority over placebo — dupilumab may not rescue omalizumab failures",
      "Avoid live attenuated vaccines; treat helminth infections before initiation",
    ],
  },
  {
    step: "Step 5 (Third-Line) — Cyclosporine or Specialist Referral",
    color: "8B0000",
    items: [
      "Cyclosporine 3–5 mg/kg/day (in divided doses) — for severe, refractory CSU unresponsive to omalizumab",
      "Monitor: renal function (creatinine, eGFR), blood pressure, serum potassium at baseline and every 2 weeks for 3 months, then monthly",
      "Limit treatment duration to minimum required; taper when remission achieved",
      "Alternative immunomodulators (specialist-supervised): hydroxychloroquine, mycophenolate mofetil, dapsone, sulfasalazine, tacrolimus",
      "Short-course oral corticosteroids only for acute flare control (5–10 days); avoid long-term use",
      "Emerging: Remibrutinib (BTK inhibitor) — Phase III data promising for antihistamine-refractory CSU (PMID 41005705)",
    ],
  },
];

for (const s of steps) {
  children.push(colorBox(s.step, s.items, LGREY, s.color, s.color));
  children.push(space(80));
}

children.push(warnBox("Important: Do not initiate omalizumab or dupilumab during an acute severe urticaria flare. Ensure baseline disease activity is documented with UAS7 before starting."));
children.push(space(120));

// ─────────────────────────────────────────────────────────────────────────────
// SECTION 5: Drug Reference — Omalizumab
// ─────────────────────────────────────────────────────────────────────────────
children.push(pageBreakPara());
children.push(h1("5. Drug Reference: IgE-Pathway Biologics"));
children.push(h2("5.1 Omalizumab (Xolair®) — Anti-IgE"));
children.push(body(
  "Omalizumab is a recombinant humanised IgG1 monoclonal antibody that binds the Fc region of free circulating IgE, " +
  "preventing its interaction with FcεRI and FcεRII receptors on mast cells and basophils. It does not bind receptor-bound IgE " +
  "and therefore does not trigger mast cell degranulation. It reduces both early and late-phase urticarial reactions and " +
  "lowers FcεRI expression on mast cells over time."
));
children.push(space(60));
children.push(makeTable(
  ["Parameter", "Details"],
  [
    ["**Mechanism**", "Binds free IgE Fc region → blocks FcεRI/FcεRII; reduces circulating IgE levels; downregulates FcεRI surface expression"],
    ["**Approved Indication (CU)**", "Chronic spontaneous urticaria (CSU) in adults and adolescents ≥12 years who remain symptomatic despite H1-antihistamine therapy"],
    ["**Off-label use (younger children)**", "Case series and systematic review (PMID 40545961, Pediatric Allergy Immunol 2025) support use in children <12 years; specialist oversight required"],
    ["**Dose**", "300 mg SC every 4 weeks (standard). A 150 mg dose may be trialled in mild-moderate CSU but 300 mg is preferred per evidence base"],
    ["**Route & Administration**", "Subcutaneous injection; single-use pre-filled syringe or auto-injector pen; allow to reach room temperature before injection"],
    ["**IgE eligibility**", "No IgE threshold required for CSU (unlike asthma). IgE level does not determine dose in urticaria — fixed 300 mg regimen"],
    ["**Onset of Action**", "Rapid in many patients: itch reduction within 1–2 weeks; wheal resolution by 3 months in responders"],
    ["**Response Rate**", "~60–70% achieve complete or near-complete response (UAS7 = 0); ~30% partial response; ~10–15% non-responders"],
    ["**Duration of Therapy**", "Reassess every 3–6 months; consider discontinuation trial after 6–12 months of disease control; disease often recurs after stopping"],
    ["**Pregnancy**", "Observational registry data: no increased risk of major congenital anomalies vs. disease-matched unexposed cohort; preferred over cyclosporine in refractory CU during pregnancy"],
    ["**Co-prescriptions**", "Continue H1-antihistamine during initiation; taper antihistamine as control is achieved"],
  ],
  [30, 70]
));
children.push(space(120));

children.push(h2("5.2 Dupilumab (Dupixent®) — Anti-IL-4Rα"));
children.push(body(
  "Dupilumab blocks the shared IL-4Rα subunit, inhibiting both IL-4 and IL-13 signalling. " +
  "Although not a direct anti-IgE antibody, IL-4 drives IgE class-switching in B cells; " +
  "blockade of IL-4Rα therefore reduces IgE production upstream and modulates mast cell priming and inflammatory amplification. " +
  "FDA-approved for CSU in April 2025."
));
children.push(space(60));
children.push(makeTable(
  ["Parameter", "Details"],
  [
    ["**Mechanism**", "Blocks IL-4Rα → inhibits IL-4 and IL-13 signalling → reduces IgE class switching, mast cell priming, and Th2 amplification"],
    ["**Approved Indication (CU)**", "CSU in adults and adolescents ≥12 years who remain symptomatic despite H1-antihistamine therapy (FDA approval April 2025)"],
    ["**Dose**", "300 mg SC every 2 weeks"],
    ["**Route**", "Subcutaneous injection; pre-filled syringe or pen"],
    ["**Clinical Evidence**", "CUPID A (omalizumab-naïve): UAS7 −20.5 vs −12.0 placebo (p=0.0003). CUPID B (omalizumab-refractory): did not meet primary endpoint — dupilumab unlikely to rescue omalizumab failures"],
    ["**Best use case**", "Antihistamine-refractory CSU in patients who are omalizumab-naïve OR who have type 2 inflammatory comorbidities (atopic dermatitis, eosinophilic oesophagitis, CRSwNP)"],
    ["**Precautions**", "Treat helminth infections before initiation; avoid live attenuated vaccines during treatment; monitor for eosinophilia"],
    ["**Adverse Effects**", "Injection-site reactions; conjunctivitis (common in atopic dermatitis patients); transient eosinophilia"],
  ],
  [30, 70]
));
children.push(space(120));

children.push(h2("5.3 Emerging & Investigational IgE-Pathway Agents"));
children.push(makeTable(
  ["Agent", "Target / Mechanism", "Status (2025–2026)", "Notes"],
  [
    ["**Ligelizumab**", "Anti-IgE (40–50× higher affinity than omalizumab)", "Development terminated", "PEARL1/2 trials showed superiority over placebo (UAS7 −19–20 points) but failed to demonstrate superiority over omalizumab; development stopped"],
    ["**Omalizumab biosimilars** (e.g. CT-P39)", "Anti-IgE (identical mechanism)", "FDA-approved (CT-P39)", "Equivalent efficacy; potential cost benefit"],
    ["**Tezepelumab**", "Anti-TSLP (upstream epithelial alarmin)", "Phase 2b (INCEPTION trial)", "Phase 2b in CSU: did not meet primary endpoint in overall population; sustained post-treatment effect in anti-IgE-naïve subgroup; lower baseline IgE subgroup showed promise"],
    ["**Remibrutinib** (BTK inhibitor)", "Bruton tyrosine kinase — mast cell activation", "Phase 3 completed (FDA submission expected)", "Phase 3 data promising for antihistamine-refractory CSU; PMID 41005705"],
    ["**Barzolvolimab**", "Anti-KIT (c-Kit / CD117) — mast cell depletion", "Phase 2 — positive results", "Significantly reduces CSU activity; mast cell depletion approach"],
  ],
  [18, 28, 22, 32]
));
children.push(space(120));

// ─────────────────────────────────────────────────────────────────────────────
// SECTION 6: Safety & Monitoring
// ─────────────────────────────────────────────────────────────────────────────
children.push(pageBreakPara());
children.push(h1("6. Safety Monitoring"));
children.push(makeTable(
  ["Agent", "Key Adverse Effects", "Monitoring Requirements"],
  [
    ["**Omalizumab**", "Anaphylaxis (<0.1%); injection-site reactions (local swelling, erythema ~50%); diffuse urticaria (rare); historical malignancy signal not confirmed in registries", "Observe 30–60 min post-injection for first 3 doses in clinical setting. Prescribe epinephrine autoinjector. Subsequent doses may be home-administered. Review every 3–6 months."],
    ["**Dupilumab**", "Injection-site reactions; conjunctivitis; transient blood eosinophilia; rare eosinophilic pneumonia", "CBC with eosinophil count at baseline and 3 months. Ophthalmic review if persistent conjunctivitis develops. Avoid live vaccines."],
    ["**Cyclosporine**", "Nephrotoxicity, hypertension, dyslipidaemia, infections, gingival hyperplasia, hirsutism, drug interactions (CYP3A4)", "Serum creatinine, eGFR, BP, potassium at baseline; fortnightly for 3 months, then monthly. Lipid profile 3-monthly."],
    ["**All biologics**", "Live vaccine contraindication; helminth risk in endemic regions; potential masking of symptoms on discontinuation", "Screen for helminth infection in endemic areas before starting. Do not give live vaccines during therapy. Do not initiate during acute severe exacerbation."],
  ],
  [18, 40, 42]
));
children.push(space(80));
children.push(warnBox("Anaphylaxis Protocol: All patients initiating omalizumab must be observed for a minimum of 30–60 minutes after the first three injections in a clinical setting with resuscitation equipment. An epinephrine autoinjector (e.g. EpiPen 0.3 mg) must be prescribed and patient education on use provided at the first visit."));
children.push(space(120));

// ─────────────────────────────────────────────────────────────────────────────
// SECTION 7: Response Assessment & Follow-Up
// ─────────────────────────────────────────────────────────────────────────────
children.push(h1("7. Response Assessment & Follow-Up"));
children.push(makeTable(
  ["Timepoint", "Actions"],
  [
    ["**Baseline (before biologic)**", "Document UAS7, UCT score. Review and document antihistamine failure. Record weight, renal function (if cyclosporine planned). Educate on injection technique and anaphylaxis."],
    ["**4–6 weeks (early check)**", "Assess tolerability. Check for injection-site reactions. Confirm correct technique. Patient-reported UAS7 diary review."],
    ["**3 months (formal assessment)**", "UAS7, UCT, AAS7 (if angioedema). Compare to baseline. Good response: UAS7 reduction ≥75% or UAS7 ≤6. Partial response: ≥50% but <75% reduction. Non-response: <50% reduction."],
    ["**6 months**", "Continue if good response. Consider antihistamine dose reduction. Plan discontinuation trial if sustained remission (UAS7 = 0 for ≥3 months)."],
    ["**12 months**", "Review for disease remission. In spontaneous remission or well-controlled disease: consider structured biologic withdrawal with close monitoring. Restart if relapse."],
    ["**Ongoing**", "6-monthly review. Recheck renal function (if on cyclosporine). Reassess need for continuing therapy annually."],
  ],
  [22, 78]
));
children.push(space(80));
children.push(colorBox("Response Definitions", [
  "Complete response: UAS7 = 0 (urticaria-free) for ≥4 consecutive weeks",
  "Well-controlled: UAS7 1–6 with minimal impact on daily life",
  "Partial response: UAS7 reduction ≥50% from baseline",
  "Non-response / treatment failure: UAS7 reduction <50% at 3 months — reassess diagnosis, advance therapy, refer to specialist",
], LTBLUE, TEAL));
children.push(space(120));

// ─────────────────────────────────────────────────────────────────────────────
// SECTION 8: Special Populations
// ─────────────────────────────────────────────────────────────────────────────
children.push(h1("8. Special Populations"));
children.push(makeTable(
  ["Population", "Guidance"],
  [
    ["**Children <12 years**", "Omalizumab approved ≥12 years for CSU; systematic review (Pediatric Allergy Immunol 2025, PMID 40545961) supports off-label use in younger children with good efficacy and safety data. Requires specialist oversight. Standard dose 300 mg q4w regardless of weight (unlike asthma)."],
    ["**Adolescents (12–17 years)**", "Omalizumab and dupilumab both approved ≥12 years. Consider dupilumab if concomitant atopic dermatitis or other type 2 comorbidities."],
    ["**Pregnancy**", "Omalizumab preferred over cyclosporine for refractory CSU in pregnancy. Registry data shows no increased major congenital anomaly risk. Dupilumab: insufficient data — specialist guidance required. Avoid cyclosporine and systemic immunosuppressants where possible."],
    ["**Elderly (≥65 years)**", "Avoid first-generation antihistamines (falls risk, anticholinergic toxicity). Omalizumab well-tolerated; no dose adjustment required. Use cyclosporine cautiously — higher risk of renal impairment and hypertension."],
    ["**Autoimmune urticaria (Type IIb)**", "Patients with anti-FcεRI antibodies may have attenuated response to omalizumab. Cyclosporine may be more effective in this subgroup. Consider earlier specialist referral."],
    ["**Inducible urticaria (CIndU)**", "Omalizumab approved for chronic inducible urticaria (symptomatic dermographism, cold, cholinergic). Same dose and regimen as CSU. Response rates slightly lower than in CSU."],
  ],
  [22, 78]
));
children.push(space(120));

// ─────────────────────────────────────────────────────────────────────────────
// SECTION 9: GP Quick Reference
// ─────────────────────────────────────────────────────────────────────────────
children.push(pageBreakPara());
children.push(h1("9. GP Quick Reference Summary"));
children.push(makeTable(
  ["Drug", "Target", "Dose", "Eligibility", "Key AEs", "Key Notes"],
  [
    ["**Omalizumab**\n(Xolair®)", "Free IgE (FcεRI/II blockade)", "300 mg SC\nevery 4 weeks", "≥12 yrs (off-label <12)\nCSU failing antihistamines\nNo IgE threshold", "Anaphylaxis <0.1%\nInj. site reactions", "First biologic of choice.\nObserve 30–60 min first 3 doses."],
    ["**Dupilumab**\n(Dupixent®)", "IL-4Rα (IL-4 + IL-13 blockade)", "300 mg SC\nevery 2 weeks", "≥12 yrs\nCSU failing antihistamines (FDA 2025)", "Conjunctivitis\nInj. site reactions\nEosinophilia", "FDA approved Apr 2025.\nPreferred if type-2 comorbidities.\nNot shown to rescue omalizumab failures."],
    ["**Cyclosporine**\n(Neoral®)", "Calcineurin inhibitor (T-cell suppressor)", "3–5 mg/kg/day\norally (divided)", "Refractory CSU\nFailing omalizumab", "Nephrotoxicity\nHypertension\nInfections", "Intensive monitoring required.\nSpecialist supervision.\nLimit duration."],
    ["**Remibrutinib**\n(investigational)", "BTK (mast cell signalling)", "Oral (dose TBC)", "Antihistamine-refractory CSU", "GI effects, infections (early data)", "Phase 3 data positive.\nRegulatory submission expected 2025–2026."],
  ],
  [16, 18, 18, 20, 16, 22]
));
children.push(space(120));

// ─────────────────────────────────────────────────────────────────────────────
// SECTION 10: References
// ─────────────────────────────────────────────────────────────────────────────
children.push(h1("10. References"));
const refs = [
  "Zuberbier T, et al. The EAACI/GA²LEN/EDF/WAO guideline for the definition, classification, diagnosis and management of urticaria. Allergy. 2022;73:1393–1414.",
  "Goldman-Cecil Medicine, 26th ed (International). Chronic Urticaria. Elsevier, 2023.",
  "Harrison's Principles of Internal Medicine, 22nd ed (2025). Urticaria and Angioedema. McGraw-Hill.",
  "Andrews' Diseases of the Skin: Clinical Dermatology, 13th ed. Chronic Urticaria. Elsevier.",
  "Katzung BG, et al. Anti-IgE Monoclonal Antibodies. Katzung's Basic and Clinical Pharmacology, 16th ed. McGraw-Hill, 2021.",
  "Chronic Urticaria. StatPearls [Internet]. NCBI Bookshelf. NBK555910. Accessed May 2026.",
  "Khan AA, Riaz AA, Naseer F. Efficacy, Safety, and QoL outcomes of remibrutinib in CSU: systematic review and meta-analysis. J Allergy Clin Immunol Pract. 2025. PMID: 41005705.",
  "Alomari O, Ozceker D, Mokresh ME. Omalizumab in pediatric CSU: systematic review and meta-analysis. Pediatr Allergy Immunol. 2025 Jun. PMID: 40545961.",
  "Chu AWL, et al. Comparative efficacy and safety of biologics and systemic immunomodulatory treatments for chronic urticaria: network meta-analysis. J Allergy Clin Immunol. 2025 Oct. PMID: 40663028.",
  "Emerging IgE and non-IgE targeted therapies for chronic urticaria. PMC12874352. 2025.",
  "Dermatology Times. 2025 Year in Review: Chronic Spontaneous Urticaria. Dupilumab and remibrutinib FDA approvals.",
  "National Consensus on Diagnosis and Treatment of Chronic Urticaria (2025). Rev Med Chil. 2026 Feb. PMID: 42024696.",
];
for (let i = 0; i < refs.length; i++) {
  children.push(new Paragraph({
    spacing: { before: 40, after: 40 },
    indent: { left: convertInchesToTwip(0.3), hanging: convertInchesToTwip(0.3) },
    children: [
      new TextRun({ text: `${i + 1}.  `, bold: true, size: 17, font: "Calibri", color: DGREY }),
      new TextRun({ text: refs[i], size: 17, font: "Calibri", color: DGREY }),
    ],
  }));
}
children.push(space(120));

// Disclaimer
children.push(colorBox(
  "Disclaimer",
  [
    "This protocol is a clinical guidance tool for general practitioners and does not replace individual clinical judgement.",
    "Biologic therapy initiation and oversight should involve specialist review (allergist/clinical immunologist/dermatologist).",
    "Check current approved product information and local formulary/payer criteria before prescribing.",
    "Review annually or when updated guidelines are published.",
  ],
  LTYELL, AMBER, "856404"
));

// ── Build Document ─────────────────────────────────────────────────────────────
const doc = new Document({
  styles: {
    default: {
      document: {
        run: { font: "Calibri", size: 20, color: DGREY },
      },
    },
  },
  sections: [
    {
      properties: {
        page: {
          margin: {
            top: convertMillimetersToTwip(38),
            bottom: convertMillimetersToTwip(22),
            left: convertMillimetersToTwip(20),
            right: convertMillimetersToTwip(20),
          },
        },
      },
      headers: { default: buildHeader() },
      footers: { default: buildFooter() },
      children,
    },
  ],
});

Packer.toBuffer(doc).then(buf => {
  fs.writeFileSync(OUT, buf);
  console.log("DOCX written:", OUT);
}).catch(err => { console.error(err); process.exit(1); });
Running Command

cd /home/daytona/workspace/ige-protocol && node build_urticaria_docx.js 2>&1

Editing File

~/ige-protocol/build_urticaria_docx.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/ige-protocol/build_urticaria_docx.js'
Running Command

cd /home/daytona/workspace/ige-protocol && node build_urticaria_docx.js 2>&1

Running Command

cd /home/daytona/workspace/ige-protocol && python /home/daytona/skills/docx/scri…

Running Command

cd /home/daytona/workspace/ige-protocol && python3 -c " import zipfile, sys try:…

Running Command

ls -lh /home/daytona/workspace/ige-protocol/IgE_CU_Treatment_Protocol.docx

Your Word document is ready:

IgE CU Treatment Protocol

Word Document · DOCX


What's in the Document

A professionally formatted GP-focused Word protocol with a branded header/footer, coloured info boxes, and 10 sections:
SectionContent
1. Overview & ScopePurpose, clinical scope, exclusions (HAE)
2. Classification & PathophysiologyCSU vs. CIndU classification table; IgE pathway narrative
3. Diagnosis & Initial AssessmentClinical criteria; recommended investigations table (CBC, ESR, thyroid, IgE, C4, biopsy); disease activity scoring tools (UAS7, UCT, CU-Q2oL, AAS7)
4. Stepwise Treatment Algorithm5-step colour-coded escalation: antihistamine → up-dose → omalizumab → dupilumab → cyclosporine/specialist
5. Drug ReferenceFull tables for omalizumab and dupilumab (mechanism, dose, eligibility, evidence, AEs); emerging agents table (ligelizumab, tezepelumab, remibrutinib, barzolvolimab)
6. Safety MonitoringPer-agent adverse effect and monitoring table; anaphylaxis warning box
7. Response AssessmentTimepoint-based follow-up table (baseline → 4–6 wks → 3 m → 6 m → 12 m); response definitions
8. Special PopulationsChildren, adolescents, pregnancy, elderly, autoimmune CSU, inducible urticaria
9. Quick Reference SummarySingle-table comparison of omalizumab, dupilumab, cyclosporine, remibrutinib
10. References12 citations: Goldman-Cecil, Harrison's, Andrews', Katzung, EAACI 2022, StatPearls, and 5 recent PubMed papers (2025–2026)
Key 2025–2026 updates included:
  • Dupilumab FDA approval (April 2025) for CSU ≥12 years
  • Remibrutinib Phase 3 positive data (PMID 41005705)
  • Pediatric omalizumab meta-analysis (PMID 40545961)
  • Network meta-analysis of biologics vs. immunomodulators in CU (PMID 40663028)
This is a shared conversation. Sign in to Orris to start your own chat.