viva question and answer for acute attack of brachial asthma \

Your credits are exhausted. You can purchase a top-up or subscribe to a plan to continue using Orris. If you're already subscribed, your daily credits will reset tomorrow.

Create a study guide PDF on asthma attack pathophysiology

Your credits are exhausted. You can purchase a top-up or subscribe to a plan to continue using Orris. If you're already subscribed, your daily credits will reset tomorrow.

viva question and answer for acute attack of brachial asthma

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

Create a study guide PDF on asthma attack pathophysiology

Reading File
Running Command

mkdir -p /tmp/workspace/asthma-study-guide && ls /tmp/workspace/

Writing File

~/asthma-study-guide/create_pdf.py

from reportlab.lib.pagesizes import A4
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import mm, cm
from reportlab.lib.colors import HexColor, white, black
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    HRFlowable, KeepTogether, PageBreak
)
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_JUSTIFY
from reportlab.platypus import Flowable

OUTPUT = "/tmp/workspace/asthma-study-guide/Asthma_Attack_Pathophysiology_Study_Guide.pdf"

# --- Colour palette ---
BLUE_DARK  = HexColor("#1a3a5c")
BLUE_MID   = HexColor("#2563a8")
BLUE_LIGHT = HexColor("#dbeafe")
TEAL       = HexColor("#0e7490")
TEAL_LIGHT = HexColor("#cffafe")
RED        = HexColor("#b91c1c")
RED_LIGHT  = HexColor("#fee2e2")
GREEN      = HexColor("#15803d")
GREEN_LIGHT= HexColor("#dcfce7")
ORANGE     = HexColor("#c2410c")
ORANGE_LIGHT= HexColor("#ffedd5")
GREY_LIGHT = HexColor("#f1f5f9")
GREY_MID   = HexColor("#94a3b8")
YELLOW_LIGHT = HexColor("#fef9c3")

# --- Styles ---
styles = getSampleStyleSheet()

def style(name, **kw):
    s = ParagraphStyle(name, **kw)
    return s

TITLE_STYLE = style("MyTitle",
    fontSize=26, fontName="Helvetica-Bold",
    textColor=white, alignment=TA_CENTER, leading=32)

SUBTITLE_STYLE = style("MySub",
    fontSize=13, fontName="Helvetica",
    textColor=HexColor("#bfdbfe"), alignment=TA_CENTER, leading=18)

H1 = style("H1", fontSize=15, fontName="Helvetica-Bold",
    textColor=white, leading=20, spaceAfter=2)

H2 = style("H2", fontSize=12, fontName="Helvetica-Bold",
    textColor=BLUE_DARK, leading=16, spaceBefore=6, spaceAfter=4)

H3 = style("H3", fontSize=10.5, fontName="Helvetica-Bold",
    textColor=TEAL, leading=14, spaceBefore=4, spaceAfter=2)

BODY = style("Body", fontSize=9.5, fontName="Helvetica",
    textColor=HexColor("#1e293b"), leading=14, spaceAfter=3,
    alignment=TA_JUSTIFY)

BULLET = style("Bullet", fontSize=9.5, fontName="Helvetica",
    textColor=HexColor("#1e293b"), leading=13, spaceAfter=2,
    leftIndent=14, bulletIndent=0)

SMALL = style("Small", fontSize=8.5, fontName="Helvetica",
    textColor=HexColor("#475569"), leading=12)

NOTE = style("Note", fontSize=9, fontName="Helvetica-Oblique",
    textColor=HexColor("#64748b"), leading=12, alignment=TA_CENTER)

MNEM = style("Mnem", fontSize=11, fontName="Helvetica-Bold",
    textColor=BLUE_DARK, leading=16, alignment=TA_CENTER)

QA_Q = style("QQ", fontSize=10, fontName="Helvetica-Bold",
    textColor=BLUE_DARK, leading=14, spaceBefore=6, spaceAfter=2)

QA_A = style("QA", fontSize=9.5, fontName="Helvetica",
    textColor=HexColor("#1e293b"), leading=13, leftIndent=12,
    spaceAfter=4, alignment=TA_JUSTIFY)

# ---------- helper flowables ----------

def colored_box(content_rows, bg=BLUE_LIGHT, border=BLUE_MID, padding=8):
    """Wrap a list of Paragraphs in a single-cell table (colored box)."""
    from reportlab.platypus import Table, TableStyle
    t = Table([[content_rows]], colWidths=[165*mm])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), bg),
        ("BOX", (0,0), (-1,-1), 1, border),
        ("ROUNDEDCORNERS", [6,6,6,6]),
        ("TOPPADDING", (0,0), (-1,-1), padding),
        ("BOTTOMPADDING", (0,0), (-1,-1), padding),
        ("LEFTPADDING", (0,0), (-1,-1), padding+2),
        ("RIGHTPADDING", (0,0), (-1,-1), padding),
    ]))
    return t

def section_header(text, bg=BLUE_MID):
    t = Table([[Paragraph(text, H1)]], colWidths=[165*mm])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), bg),
        ("TOPPADDING", (0,0), (-1,-1), 7),
        ("BOTTOMPADDING", (0,0), (-1,-1), 7),
        ("LEFTPADDING", (0,0), (-1,-1), 10),
        ("RIGHTPADDING", (0,0), (-1,-1), 10),
    ]))
    return t

def two_col_table(rows, col_widths=(60*mm, 105*mm),
                  header=None, hdr_bg=BLUE_MID):
    data = []
    if header:
        data.append([Paragraph(header[0], style("th", fontSize=9,
            fontName="Helvetica-Bold", textColor=white, leading=12)),
                     Paragraph(header[1], style("th2", fontSize=9,
            fontName="Helvetica-Bold", textColor=white, leading=12))])
    for r in rows:
        data.append([Paragraph(r[0], SMALL), Paragraph(r[1], SMALL)])
    t = Table(data, colWidths=col_widths)
    ts = [
        ("GRID", (0,0), (-1,-1), 0.4, GREY_MID),
        ("TOPPADDING", (0,0), (-1,-1), 4),
        ("BOTTOMPADDING", (0,0), (-1,-1), 4),
        ("LEFTPADDING", (0,0), (-1,-1), 5),
        ("RIGHTPADDING", (0,0), (-1,-1), 5),
        ("ROWBACKGROUNDS", (0, 1 if header else 0), (-1,-1),
         [white, GREY_LIGHT]),
        ("VALIGN", (0,0), (-1,-1), "TOP"),
    ]
    if header:
        ts += [("BACKGROUND", (0,0), (-1,0), hdr_bg),
               ("TEXTCOLOR", (0,0), (-1,0), white)]
    t.setStyle(TableStyle(ts))
    return t

def qa_block(q, a, bg=BLUE_LIGHT, qbg=BLUE_MID):
    """Single Q&A card."""
    inner = [
        [Paragraph(f"Q: {q}", style("QQi", fontSize=9.5,
            fontName="Helvetica-Bold", textColor=white, leading=13))],
        [Paragraph(f"A: {a}", style("QAi", fontSize=9,
            fontName="Helvetica", textColor=HexColor("#1e293b"),
            leading=13, leftIndent=4, alignment=TA_JUSTIFY))]
    ]
    t = Table(inner, colWidths=[165*mm])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (0,0), qbg),
        ("BACKGROUND", (0,1), (0,1), bg),
        ("BOX", (0,0), (-1,-1), 0.8, BLUE_MID),
        ("LINEBELOW", (0,0), (0,0), 0.4, BLUE_MID),
        ("TOPPADDING", (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
        ("LEFTPADDING", (0,0), (-1,-1), 8),
        ("RIGHTPADDING", (0,0), (-1,-1), 8),
    ]))
    return t

# ============================
# BUILD DOCUMENT
# ============================
doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=A4,
    leftMargin=20*mm, rightMargin=20*mm,
    topMargin=18*mm, bottomMargin=18*mm,
    title="Asthma Attack Pathophysiology – Study Guide",
    author="Orris Medical AI"
)

story = []
SP = lambda h=4: Spacer(1, h*mm)
HR = lambda c=GREY_MID: HRFlowable(width="100%", thickness=0.5, color=c,
                                    spaceAfter=3, spaceBefore=3)

# ─────────────────────────────────────────────────────────────────────────────
# COVER / TITLE BLOCK
# ─────────────────────────────────────────────────────────────────────────────
cover_data = [[
    Paragraph("ASTHMA ATTACK", TITLE_STYLE),
    Paragraph("Pathophysiology & Clinical Management", SUBTITLE_STYLE),
    Spacer(1, 6),
    Paragraph("Comprehensive Study Guide  |  Viva Edition", NOTE),
]]
cover = Table([cover_data[0]], colWidths=[165*mm])
cover.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), BLUE_DARK),
    ("TOPPADDING", (0,0), (-1,-1), 16),
    ("BOTTOMPADDING", (0,0), (-1,-1), 16),
    ("LEFTPADDING", (0,0), (-1,-1), 14),
    ("RIGHTPADDING", (0,0), (-1,-1), 14),
]))
story.append(cover)
story.append(SP(5))

# ─────────────────────────────────────────────────────────────────────────────
# QUICK-REFERENCE BOX
# ─────────────────────────────────────────────────────────────────────────────
story.append(section_header("1. DEFINITION & OVERVIEW", BLUE_MID))
story.append(SP(2))
story.append(Paragraph(
    "Bronchial (brachial) asthma is a <b>chronic inflammatory airway disease</b> "
    "characterised by variable, recurring symptoms, airflow obstruction, and "
    "bronchial hyperresponsiveness. An <b>acute asthma attack</b> is an acute "
    "exacerbation of this underlying condition, driven by superimposed inflammatory "
    "and bronchoconstrictor mediators that narrow the airway lumen, trap air, and "
    "impair gas exchange.", BODY))
story.append(SP(3))

key_facts = [
    ["Reversibility", "Airflow obstruction is largely reversible (spontaneously or with treatment)"],
    ["Hallmark cell", "Mast cell (early phase) + Eosinophil (late phase)"],
    ["Key cytokines", "IL-4, IL-5, IL-13 from Th2 / ILC2 cells"],
    ["Physiological marker", "Increased airway resistance; decreased FEV1 & PEF"],
    ["Trigger (allergic)", "Allergen + IgE-mediated mast cell degranulation"],
    ["Trigger (non-allergic)", "Exercise, cold air, viral URTI, NSAIDs, irritants, stress"],
]
story.append(two_col_table(key_facts, header=["Feature", "Detail"],
    col_widths=(55*mm, 110*mm)))
story.append(SP(4))

# ─────────────────────────────────────────────────────────────────────────────
# PATHOPHYSIOLOGY
# ─────────────────────────────────────────────────────────────────────────────
story.append(section_header("2. PATHOPHYSIOLOGY OF AN ACUTE ATTACK", TEAL))
story.append(SP(2))

story.append(Paragraph("2a. The Sensitisation Phase (before the attack)", H2))
story.append(Paragraph(
    "In atopic asthma, initial allergen exposure activates dendritic cells "
    "which present antigen to naive T-cells, driving <b>Th2 polarisation</b>. "
    "Th2 cells secrete IL-4 and IL-13 (B-cell class switching → IgE production) "
    "and IL-5 (eosinophil recruitment). IgE binds high-affinity receptors (FcεRI) "
    "on <b>mast cells and basophils</b>, priming them for future allergen exposure.", BODY))
story.append(SP(3))

story.append(Paragraph("2b. Early-Phase Reaction (0–60 minutes after exposure)", H2))

early_rows = [
    ["Step", "Event", "Mediator / Effect"],
    ["1", "Allergen cross-links IgE on mast cell surface",
         "Mast cell activation"],
    ["2", "Mast cell degranulation",
         "Histamine → vasodilation, mucosal oedema, bronchoconstriction"],
    ["3", "Arachidonic acid cascade activated",
         "Leukotrienes (LTC4, LTD4, LTE4) → potent bronchoconstriction & mucus secretion; "
         "PGD2, TXA2 → further constriction"],
    ["4", "Smooth muscle constriction",
         "Airway calibre reduced → ↑ resistance, ↓ FEV1/PEF"],
    ["5", "Mucosal oedema & goblet cell secretion",
         "Further airway narrowing; impaired mucociliary clearance"],
]
t_early = Table(
    [[Paragraph(c, style(f"eh{i}", fontSize=8.5,
        fontName="Helvetica-Bold" if i == 0 else "Helvetica",
        textColor=white if i == 0 else HexColor("#1e293b"),
        leading=12)) for c in row] for i, row in enumerate(early_rows)],
    colWidths=[15*mm, 62*mm, 88*mm]
)
t_early.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), TEAL),
    ("ROWBACKGROUNDS", (0,1), (-1,-1), [white, TEAL_LIGHT]),
    ("GRID", (0,0), (-1,-1), 0.3, GREY_MID),
    ("VALIGN", (0,0), (-1,-1), "TOP"),
    ("TOPPADDING", (0,0), (-1,-1), 4),
    ("BOTTOMPADDING", (0,0), (-1,-1), 4),
    ("LEFTPADDING", (0,0), (-1,-1), 5),
    ("RIGHTPADDING", (0,0), (-1,-1), 5),
]))
story.append(t_early)
story.append(SP(3))

story.append(Paragraph("2c. Late-Phase Reaction (2–24 hours)", H2))
story.append(Paragraph(
    "Cytokines released in the early phase drive recruitment of "
    "<b>eosinophils, basophils, neutrophils, and CD4+ Th2 lymphocytes</b> from the "
    "circulation. Upon activation, eosinophils release <b>major basic protein (MBP)</b>, "
    "eosinophil cationic protein (ECP), and reactive oxygen species, causing "
    "epithelial damage, neuronal sensitisation, and prolonged airway "
    "hyperresponsiveness. This is the phase responsible for <b>ongoing symptoms "
    "after the initial bronchoconstriction resolves</b>.", BODY))
story.append(SP(3))

story.append(Paragraph("2d. Neural Mechanisms", H2))
neural_rows = [
    ["Cholinergic (M3 receptors)",
     "Reflex parasympathetic activation by inhaled irritants → bronchoconstriction "
     "& mucus hypersecretion. Basis for ipratropium therapy."],
    ["Beta-adrenergic",
     "Reduced β2-receptor responsiveness during acute attack → less endogenous "
     "bronchodilation. Basis for salbutamol therapy."],
    ["Non-adrenergic non-cholinergic (NANC)",
     "Substance P and neuropeptides released from sensory nerves → "
     "neurogenic inflammation & oedema."],
]
story.append(two_col_table(neural_rows,
    header=["Pathway", "Effect"],
    col_widths=(52*mm, 113*mm)))
story.append(SP(3))

story.append(Paragraph("2e. Physiological Consequences", H2))
phys_rows = [
    ["Airflow obstruction", "↑ Raw (airway resistance); ↓ FEV1, ↓ FVC, ↓ FEV1/FVC, ↓ PEF"],
    ["Air trapping", "↑ RV (residual volume); ↑ FRC; barrel-chest appearance"],
    ["V/Q mismatch", "Hypoxaemia (low PaO2) – early finding; compensated by hyperventilation"],
    ["Hypocapnia", "Early/moderate attack: PaCO2 ↓ due to hyperventilation"],
    ["Normo/Hypercapnia", "DANGER SIGN – respiratory muscle fatigue; impending respiratory failure"],
    ["Pulsus paradoxus", "Exaggerated fall in SBP (>10 mmHg) on inspiration → sign of severe attack"],
    ["Hyperinflation on CXR", "Depressed diaphragm, increased AP diameter, hyperlu-cent fields"],
]
story.append(two_col_table(phys_rows,
    header=["Change", "Mechanism / Finding"],
    col_widths=(52*mm, 113*mm)))
story.append(SP(4))

# ─────────────────────────────────────────────────────────────────────────────
# MEDIATORS TABLE
# ─────────────────────────────────────────────────────────────────────────────
story.append(section_header("3. KEY MEDIATORS AT A GLANCE", ORANGE))
story.append(SP(2))

med_rows = [
    ["Mediator", "Source", "Main Effect in Attack"],
    ["Histamine", "Mast cells, basophils",
     "Bronchoconstriction, ↑ vascular permeability, mucosal oedema"],
    ["LTC4 / LTD4 / LTE4\n(Cysteinyl leukotrienes)", "Mast cells, eosinophils",
     "Potent prolonged bronchoconstriction, ↑ mucus, oedema"],
    ["PGD2 / TXA2", "Mast cells, platelets",
     "Bronchoconstriction, platelet aggregation"],
    ["PAF (Platelet Activating Factor)", "Mast cells, macrophages",
     "Eosinophil chemotaxis, bronchoconstriction"],
    ["IL-4", "Th2 cells, mast cells", "B-cell switch to IgE; ↑ Th2 differentiation"],
    ["IL-5", "Th2 cells, ILC2", "Eosinophil maturation, survival, & recruitment"],
    ["IL-13", "Th2 cells, ILC2",
     "Goblet cell metaplasia; mucus hypersecretion; airway hyperresponsiveness"],
    ["Major Basic Protein (MBP)", "Eosinophils",
     "Epithelial damage, neuronal sensitisation"],
    ["TNF-α", "Macrophages, mast cells",
     "Amplifies inflammation; upregulates adhesion molecules"],
    ["Acetylcholine", "Parasympathetic nerves",
     "Smooth muscle contraction, hypersecretion (→ blocked by ipratropium)"],
]
t_med = Table(
    [[Paragraph(c, style(f"mh{j}", fontSize=8.5,
        fontName="Helvetica-Bold" if i == 0 else "Helvetica",
        textColor=white if i == 0 else HexColor("#1e293b"),
        leading=12)) for j, c in enumerate(row)]
     for i, row in enumerate(med_rows)],
    colWidths=[38*mm, 35*mm, 92*mm]
)
t_med.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), ORANGE),
    ("ROWBACKGROUNDS", (0,1), (-1,-1), [white, ORANGE_LIGHT]),
    ("GRID", (0,0), (-1,-1), 0.3, GREY_MID),
    ("VALIGN", (0,0), (-1,-1), "TOP"),
    ("TOPPADDING", (0,0), (-1,-1), 4),
    ("BOTTOMPADDING", (0,0), (-1,-1), 4),
    ("LEFTPADDING", (0,0), (-1,-1), 5),
    ("RIGHTPADDING", (0,0), (-1,-1), 5),
]))
story.append(t_med)
story.append(SP(4))

# ─────────────────────────────────────────────────────────────────────────────
# SEVERITY GRADING
# ─────────────────────────────────────────────────────────────────────────────
story.append(PageBreak())
story.append(section_header("4. SEVERITY ASSESSMENT OF ACUTE ATTACK", RED))
story.append(SP(2))

sev_rows = [
    ["Parameter", "MILD", "MODERATE", "SEVERE", "LIFE-THREATENING"],
    ["Dyspnoea", "On walking", "On talking", "At rest", "Silent chest"],
    ["Speech", "Sentences", "Phrases", "Words only", "Cannot speak"],
    ["Alertness", "Normal", "Normal / agitated", "Agitated", "Drowsy / confused"],
    ["RR (/min)", "<20", "20–30", ">30", "Paradoxical breathing"],
    ["HR (/min)", "<100", "100–120", ">120", "Bradycardia"],
    ["Wheeze", "Moderate", "Loud", "Loud", "Absent (silent chest)"],
    ["PEF (% predicted)", ">80%", "60–80%", "<60% (<100 L/min)", "<33% (near fatal)"],
    ["SpO2 (%)", ">95%", "91–95%", "<91%", "<91%"],
    ["PaO2 (mmHg)", "Normal", "≥60", "<60", "<60"],
    ["PaCO2 (mmHg)", "<45", "<45", "≥45 (DANGER)", ">45"],
]
col_w = [35*mm, 30*mm, 32*mm, 35*mm, 33*mm]
sev_styles = [
    HexColor("#15803d"), HexColor("#ca8a04"), RED, HexColor("#7c3aed")
]
t_sev = Table(
    [[Paragraph(c, style(f"svh{j}", fontSize=7.5,
        fontName="Helvetica-Bold" if i == 0 or j == 0 else "Helvetica",
        textColor=white if i == 0 else (white if j == 0 else HexColor("#1e293b")),
        leading=11)) for j, c in enumerate(row)]
     for i, row in enumerate(sev_rows)],
    colWidths=col_w
)
sev_ts = [
    ("BACKGROUND", (0,0), (-1,0), BLUE_DARK),
    ("BACKGROUND", (0,0), (0,-1), HexColor("#334155")),
    ("BACKGROUND", (1,1), (1,-1), GREEN_LIGHT),
    ("BACKGROUND", (2,1), (2,-1), YELLOW_LIGHT),
    ("BACKGROUND", (3,1), (3,-1), RED_LIGHT),
    ("BACKGROUND", (4,1), (4,-1), HexColor("#ede9fe")),
    ("GRID", (0,0), (-1,-1), 0.3, GREY_MID),
    ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
    ("TOPPADDING", (0,0), (-1,-1), 3),
    ("BOTTOMPADDING", (0,0), (-1,-1), 3),
    ("LEFTPADDING", (0,0), (-1,-1), 4),
    ("RIGHTPADDING", (0,0), (-1,-1), 4),
]
t_sev.setStyle(TableStyle(sev_ts))
story.append(t_sev)
story.append(SP(2))
story.append(Paragraph(
    "★ Normal or rising PaCO2 in a wheezing patient = respiratory failure is imminent. "
    "Prepare for intubation / ICU transfer.", NOTE))
story.append(SP(4))

# ─────────────────────────────────────────────────────────────────────────────
# SPUTUM FINDINGS
# ─────────────────────────────────────────────────────────────────────────────
story.append(section_header("5. CHARACTERISTIC SPUTUM FINDINGS", TEAL))
story.append(SP(2))
sputum_rows = [
    ["Charcot-Leyden crystals",
     "Crystallised eosinophil lysophospholipase; elongated bipyramidal crystals"],
    ["Curschmann spirals",
     "Bronchiolar casts of mucus + cells; whorled mucus plugs"],
    ["Creola bodies",
     "Clusters of shed airway epithelial cells with identifiable cilia"],
    ["Eosinophils",
     "Increased in allergic asthma; key biomarker for Th2-high disease"],
]
story.append(two_col_table(sputum_rows,
    header=["Finding", "Description"],
    col_widths=(52*mm, 113*mm)))
story.append(SP(4))

# ─────────────────────────────────────────────────────────────────────────────
# MANAGEMENT
# ─────────────────────────────────────────────────────────────────────────────
story.append(section_header("6. ACUTE MANAGEMENT – STEPWISE APPROACH", GREEN))
story.append(SP(2))

story.append(Paragraph("Immediate (all patients)", H2))
imm_rows = [
    ["O2 supplementation",
     "Target SpO2 93–95%; high-flow if severe. Avoid hyperoxia."],
    ["SABA – Salbutamol (albuterol)",
     "2.5–5 mg nebulised every 20 min × 3 doses (or 4–8 puffs MDI + spacer); "
     "stimulates β2 receptors → smooth muscle relaxation"],
    ["Systemic corticosteroids",
     "Prednisolone 40–50 mg oral OR hydrocortisone 200 mg IV; "
     "reduce airway inflammation within 4–6 hours; continue 5–7 days"],
    ["Ipratropium bromide",
     "0.5 mg nebulised with first 3 SABA doses (moderate–severe); "
     "anticholinergic → blocks M3 → additive bronchodilation"],
]
story.append(two_col_table(imm_rows,
    header=["Intervention", "Dose / Rationale"],
    col_widths=(45*mm, 120*mm),
    hdr_bg=GREEN))
story.append(SP(3))

story.append(Paragraph("Severe / Refractory Attack", H2))
sev2_rows = [
    ["IV Magnesium sulfate",
     "2 g IV over 20 min; Ca2+ channel blocker → smooth muscle relaxation; "
     "also stabilises mast cells. Use if PEF <25% predicted or persistent hypoxia."],
    ["IV Salbutamol",
     "Reserved for patients unable to use inhaled route; 5–20 mcg/min infusion"],
    ["Heliox",
     "Helium–oxygen mixture; lower density reduces turbulent airflow resistance"],
    ["NIV / Intubation",
     "For respiratory failure (rising PaCO2, GCS drop, exhaustion). "
     "Intubation carries high risk in severe asthma; use only as last resort"],
]
story.append(two_col_table(sev2_rows,
    header=["Intervention", "Notes"],
    col_widths=(45*mm, 120*mm),
    hdr_bg=RED))
story.append(SP(3))

story.append(Paragraph("Drugs NOT Recommended in Acute Attack", H2))
not_rec = [
    "• Theophylline IV – not recommended (no additional benefit; risk of toxicity)",
    "• Sedatives / antihistamines – contraindicated (respiratory depression)",
    "• Antibiotics – only if clear evidence of bacterial infection (most exacerbations are viral)",
    "• Mucolytics / expectorants – no benefit; may worsen symptoms",
]
for item in not_rec:
    story.append(Paragraph(item, BULLET))
story.append(SP(4))

# ─────────────────────────────────────────────────────────────────────────────
# MNEMONICS
# ─────────────────────────────────────────────────────────────────────────────
story.append(section_header("7. MNEMONICS & MEMORY AIDS", BLUE_MID))
story.append(SP(3))

mnem_data = [
    ["ASTHMA (triggers)", "A – Allergens\nS – Smoke / irritants\nT – Temperature changes (cold air)\nH – Hyperventilation (exercise)\nM – Medications (NSAIDs, β-blockers, aspirin)\nA – Anxiety / stress"],
    ["Silent Chest", "Most dangerous sign – no wheeze because no air movement\n= impending respiratory arrest → emergency intubation"],
    ["SABA mechanism", "β2 agonist → ↑ cAMP (via adenylyl cyclase) → PKA activation\n→ smooth muscle relaxation → bronchodilation"],
    ["Mediator cascade", "IgE → Mast cell → Histamine + Leukotrienes + Prostaglandins\n→ Bronchoconstriction + Oedema + Mucus"],
]

for m in mnem_data:
    row_data = [
        [Paragraph(m[0], style("mt", fontSize=9.5, fontName="Helvetica-Bold",
            textColor=white, leading=13)),
         Paragraph(m[1], style("mc", fontSize=9, fontName="Helvetica",
            textColor=HexColor("#1e293b"), leading=13))]
    ]
    mt = Table(row_data, colWidths=[55*mm, 110*mm])
    mt.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (0,0), BLUE_MID),
        ("BACKGROUND", (1,0), (1,0), BLUE_LIGHT),
        ("BOX", (0,0), (-1,-1), 0.8, BLUE_MID),
        ("TOPPADDING", (0,0), (-1,-1), 7),
        ("BOTTOMPADDING", (0,0), (-1,-1), 7),
        ("LEFTPADDING", (0,0), (-1,-1), 8),
        ("RIGHTPADDING", (0,0), (-1,-1), 8),
        ("VALIGN", (0,0), (-1,-1), "TOP"),
    ]))
    story.append(mt)
    story.append(SP(2))
story.append(SP(3))

# ─────────────────────────────────────────────────────────────────────────────
# VIVA Q&A
# ─────────────────────────────────────────────────────────────────────────────
story.append(PageBreak())
story.append(section_header("8. VIVA VOCE – QUESTIONS & ANSWERS", BLUE_DARK))
story.append(SP(3))

qas = [
    ("What is the definition of bronchial asthma?",
     "Bronchial asthma is a chronic inflammatory disorder of the airways characterised by recurrent "
     "episodes of wheezing, breathlessness, chest tightness, and cough (often worse at night/early "
     "morning), associated with widespread but variable airflow obstruction that is often reversible "
     "spontaneously or with treatment, and bronchial hyperresponsiveness to various stimuli."),
    ("What is the pathophysiology of an acute asthmatic attack?",
     "An acute attack involves: (1) Trigger exposure (allergen, viral URTI, exercise, cold air) → "
     "(2) Mast cell degranulation (IgE-mediated or direct) releasing histamine, cysteinyl "
     "leukotrienes, and prostaglandins → (3) Bronchial smooth muscle constriction, mucosal oedema, "
     "and mucus hypersecretion → (4) Increased airway resistance, air trapping, V/Q mismatch, and "
     "hypoxaemia. In the late phase (2–24 h), eosinophil and Th2-cell recruitment perpetuates "
     "inflammation and airway hyperresponsiveness."),
    ("What is the most important early mediator in acute allergic asthma?",
     "Histamine is the first mediator released from mast cell degranulation and causes immediate "
     "bronchoconstriction, increased vascular permeability, and mucosal oedema. However, the "
     "cysteinyl leukotrienes (LTC4, LTD4, LTE4) are far more potent and longer-acting "
     "bronchoconstrictors and are largely responsible for the sustained phase of the attack."),
    ("What do you find in the sputum of an asthmatic patient?",
     "Characteristic findings include: (1) Charcot-Leyden crystals (crystallised eosinophil "
     "lysophospholipase), (2) Curschmann spirals (whorled bronchiolar mucus casts), "
     "(3) Creola bodies (clusters of shed ciliated epithelial cells), and (4) eosinophils. "
     "These reflect eosinophilic airway inflammation and mucosal shedding."),
    ("What is the significance of a 'silent chest' in acute asthma?",
     "A silent chest (absent wheeze) in a severely dyspnoeic asthmatic indicates minimal or no "
     "airflow through the airways – the obstruction is so severe that no sound is generated. "
     "It is a pre-terminal sign indicating impending respiratory arrest requiring immediate "
     "intubation and ICU transfer."),
    ("Why does PaCO2 first fall and then rise in progressive asthma?",
     "In early/moderate asthma, hypoxia drives hyperventilation → CO2 is blown off → "
     "PaCO2 falls (respiratory alkalosis). As the attack worsens, respiratory muscle fatigue "
     "develops; the patient can no longer maintain compensatory hyperventilation → CO2 "
     "accumulates → PaCO2 rises to normal or above (respiratory acidosis). A normal/rising "
     "PaCO2 in a wheezing patient is therefore an ominous sign indicating respiratory failure."),
    ("What is the mechanism of action of salbutamol (albuterol)?",
     "Salbutamol is a selective short-acting β2-adrenergic agonist. It binds β2 receptors on "
     "bronchial smooth muscle → activates Gs protein → stimulates adenylyl cyclase → ↑ cAMP "
     "→ activates protein kinase A (PKA) → phosphorylates myosin light chain kinase (MLCK), "
     "reducing its activity → smooth muscle relaxation → bronchodilation. Onset: 5 min; "
     "duration: 4–6 hours."),
    ("What is the mechanism of action of inhaled corticosteroids (ICS)?",
     "ICS (e.g., budesonide, fluticasone) diffuse across cell membranes and bind cytoplasmic "
     "glucocorticoid receptors (GR). The GR–steroid complex translocates to the nucleus and "
     "(1) inhibits NF-κB and AP-1 transcription → reduced production of pro-inflammatory "
     "cytokines (IL-4, IL-5, IL-13, TNF-α), (2) reduces mast cell, eosinophil, and "
     "Th2-cell numbers in the airway mucosa, (3) decreases mucosal oedema and mucus "
     "secretion. ICS are the cornerstone of long-term controller therapy."),
    ("Why is ipratropium bromide used in acute severe asthma?",
     "Ipratropium is a quaternary ammonium anticholinergic. It blocks muscarinic M3 receptors "
     "on bronchial smooth muscle and submucosal glands → prevents ACh-mediated "
     "bronchoconstriction and mucus secretion. In severe acute asthma, adding ipratropium "
     "to a SABA results in fewer hospitalisations and greater improvement in PEF compared to "
     "SABA alone. It has a slower onset (30–120 min) and lower potency than SABAs and is "
     "not used alone."),
    ("What is the role of magnesium sulfate in acute asthma?",
     "IV magnesium sulfate (2 g over 20 min) is used in severe or refractory asthma "
     "(PEF <25% predicted or persistent hypoxia). Magnesium acts as a calcium channel blocker "
     "on bronchial smooth muscle → reduces intracellular Ca2+ → smooth muscle relaxation. "
     "Additional effects include mast cell and T-lymphocyte stabilisation, and stimulation "
     "of nitric oxide and prostacyclin."),
    ("What are the ABG changes in a severe acute asthma attack?",
     "Early attack: ↓ PaO2 (hypoxaemia); ↓ PaCO2 (hyperventilation); ↑ pH (respiratory "
     "alkalosis). Severe attack: ↓ PaO2; normal or ↑ PaCO2 (CO2 retention due to fatigue); "
     "↓ pH (respiratory acidosis). Near-fatal: severe hypoxaemia + hypercapnia + acidosis "
     "+ altered consciousness."),
    ("Name the characteristic histological changes in asthmatic airways.",
     "(1) Infiltration with eosinophils, mast cells, and Th2 lymphocytes. "
     "(2) Goblet cell metaplasia and mucus hypersecretion. "
     "(3) Subepithelial fibrosis (thickened reticular basement membrane – collagen types III & IV). "
     "(4) Airway smooth muscle hypertrophy and hyperplasia. "
     "(5) Subepithelial angiogenesis. "
     "(6) Epithelial denudation (Creola bodies shed into lumen). "
     "These changes collectively = 'airway remodelling'."),
    ("What is status asthmaticus?",
     "Status asthmaticus is a severe, prolonged acute asthma attack that fails to respond "
     "to conventional initial bronchodilator therapy (typically defined as no improvement "
     "after 30–60 min of optimal therapy). It carries risk of respiratory failure and death. "
     "Management requires IV corticosteroids, continuous nebulised SABA + ipratropium, "
     "IV magnesium, and consideration of IV salbutamol, heliox, NIV, or intubation."),
    ("What differentiates cardiac asthma from bronchial asthma?",
     "Cardiac asthma (acute pulmonary oedema): wheeze due to engorged bronchial mucosa "
     "from elevated pulmonary capillary pressure; associated with orthopnoea, PND, "
     "pink frothy sputum, elevated JVP, basal crackles, and S3 gallop; CXR shows "
     "cardiomegaly and pulmonary oedema; BNP elevated; responds to diuretics and nitrates. "
     "Bronchial asthma: allergic/atopic history; sputum contains Charcot-Leyden crystals; "
     "responds to bronchodilators and corticosteroids; no cardiomegaly."),
]

for q, a in qas:
    story.append(qa_block(q, a))
    story.append(SP(2))

story.append(SP(4))

# ─────────────────────────────────────────────────────────────────────────────
# QUICK REVISION SUMMARY BOX
# ─────────────────────────────────────────────────────────────────────────────
story.append(section_header("9. ONE-PAGE RAPID REVISION", BLUE_DARK))
story.append(SP(2))

rev_items = [
    "<b>Pathophysiology:</b> Allergen → IgE on mast cell → degranulation → "
    "Histamine + Leukotrienes + Prostaglandins → Bronchoconstriction + Oedema + Mucus → "
    "Late phase: Eosinophil + Th2 recruitment → Epithelial damage + Remodelling",
    "<b>Early ABG:</b> ↓PaO2, ↓PaCO2, ↑pH (respiratory alkalosis)",
    "<b>Late / Severe ABG:</b> ↓PaO2, ↑PaCO2, ↓pH (respiratory acidosis = danger sign)",
    "<b>Sputum triad:</b> Charcot-Leyden crystals | Curschmann spirals | Creola bodies",
    "<b>Acute Rx pyramid:</b> O2 → SABA → Steroids → Ipratropium → MgSO4 → ICU",
    "<b>Silent chest</b> = pre-terminal; <b>Normal PaCO2 in wheezing</b> = impending arrest",
    "<b>SABA MOA:</b> β2 → ↑cAMP → PKA → ↓MLCK → smooth muscle relaxation",
    "<b>Steroid MOA:</b> GR → nucleus → ↓NF-κB → ↓IL-4/5/13/TNF-α",
    "<b>ICS MOA:</b> ↓ mast cells, eosinophils, Th2 cells in mucosa",
    "<b>Ipratropium MOA:</b> Block M3 → ↓ACh bronchoconstriction (adjunct only)",
    "<b>MgSO4 MOA:</b> Ca2+ channel blocker → smooth muscle relaxation",
    "<b>Remodelling features:</b> Subepithelial fibrosis | SMC hypertrophy | Goblet hyperplasia | Angiogenesis",
]

for item in rev_items:
    story.append(Paragraph(f"• {item}", BULLET))

story.append(SP(4))
story.append(HR(GREY_MID))
story.append(Paragraph(
    "Sources: Goldman-Cecil Medicine 26e | Rosen's Emergency Medicine 9e | "
    "Murray & Nadel Respiratory Medicine 7e | Fishman's Pulmonary Diseases | "
    "Textbook of Family Medicine 9e", NOTE))
story.append(SP(2))
story.append(Paragraph(
    "Compiled by Orris Medical AI  •  For educational use only  •  "
    "Always verify against current clinical guidelines", NOTE))

# ─── BUILD ────────────────────────────────────────────────────────────────────
doc.build(story)
print(f"PDF created: {OUTPUT}")
Running Command

cd /tmp/workspace/asthma-study-guide && python create_pdf.py 2>&1

Running Command

ls -lh /tmp/workspace/asthma-study-guide/

Your study guide PDF is ready! Download it here:

Asthma Attack Pathophysiology Study Guide

PDF Document · PDF


What's inside (9 colour-coded sections):
SectionContent
1. Definition & OverviewKey features, hallmark cells, reversibility
2. PathophysiologySensitisation → Early phase → Late phase → Neural mechanisms → Physiological consequences
3. Key MediatorsFull table: histamine, leukotrienes, IL-4/5/13, MBP, PAF, ACh
4. Severity AssessmentMILD / MODERATE / SEVERE / LIFE-THREATENING grading (PEF, SpO2, HR, RR, ABG, speech)
5. Sputum FindingsCharcot-Leyden crystals, Curschmann spirals, Creola bodies, eosinophils
6. Acute ManagementSABA, steroids, ipratropium, MgSO4 with doses + mechanism; drugs NOT to use
7. MnemonicsASTHMA triggers, silent chest, SABA mechanism, mediator cascade
8. Viva Q&A14 high-yield viva questions with detailed model answers
9. Rapid RevisionSingle-page bullet summary of all key points
Sources: Goldman-Cecil Medicine, Rosen's Emergency Medicine, Murray & Nadel Respiratory Medicine, and Fishman's Pulmonary Diseases.
This is a shared conversation. Sign in to Orris to start your own chat.