I need a quick summarized algorithm of difficult airway from DAS ( intubation and extubation), AIDAA (intubation and extubation) , DAS for obstetrics airway DAS for pediatric airway,

Reading File
Finding Sources
Searching the Web

DAS difficult airway society intubation extubation guidelines algorithm 2015 2022 summary

Searching the Web

AIDAA difficult airway guidelines algorithm intubation extubation India 2022 2023

Reading Web Page

https://openairway.org/wp-content/uploads/2016/06/FCA2-Refre…

Reading File
Reading Web Page

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

Reading Web Page

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

Searching the Web

AIDAA 2016 obstetric pediatric difficult airway guidelines algorithm summary

Finding Sources
I now have comprehensive information to compile a thorough summarized algorithm reference. Let me put it all together.

Difficult Airway Algorithms — Quick Reference Summary

1. DAS 2015 — Unanticipated Difficult Intubation in Adults

Core Concept: Plan A → B → C → D (stop-and-think between each)

Pre-induction: Assess airway, pre-oxygenate, state a backup plan before every induction.

PLAN A — Facemask ventilation + Tracheal intubation

  • Optimize head/neck position (ramping in obese); use NODESAT/THRIVE nasal O₂
  • ≤3 laryngoscopy attempts (include 1 by experienced colleague)
  • Use video laryngoscopy, bougie, external laryngeal manipulation
  • Confirm intubation with capnography (6 consecutive waveforms)
  • ✅ Succeed → proceed | ❌ Fail → call for help → Plan B

PLAN B — Supraglottic Airway (SAD) for oxygenation

  • Insert 2nd-generation SAD (e.g., ProSeal, i-gel, Supreme)
  • Max 2 attempts
  • SAD can be used to: (a) oxygenate + wake up, (b) intubate through SAD, (c) proceed without intubating
  • ✅ Oxygenation restored → STOP AND THINK (4 options below) | ❌ Fail → Plan C
STOP AND THINK — 4 options:
  1. Wake the patient up
  2. Intubate through the SAD (fibreoptic-guided)
  3. Proceed without intubation (if surgery permits)
  4. Tracheostomy/cricothyroidotomy (elective)

PLAN C — Final attempt at facemask ventilation

  • 2-person technique + airway adjuncts (OPA/NPA)
  • ✅ Success → wake up the patient | ❌ Fail → CICOPlan D

PLAN D — Emergency Front-of-Neck Access (eFONA) — CICO situation

  • Scalpel-bougie-tube cricothyroidotomy (preferred over cannula)
  • Landmark: transverse stab incision → caudal traction → bougie → 6.0 cuffed tube
Post-event: Monitor for complications, complete airway alert form, explain to patient in writing, notify GP and local database.

2. DAS 2013 — Extubation Guidelines

Step 1: Classify Risk

Low-Risk"At-Risk"
No airway difficulty at intubation, no ongoing risk factorsKnown/suspected difficult airway, access issues, obesity, OSA, surgical factors, haemodynamic instability

LOW-RISK Extubation

  1. Optimize patient (position, reversal of NMB, warm, oxygenated)
  2. Suction (direct vision)
  3. Awake extubation (preferred routine) OR asleep extubation (select cases only)
  4. Post-extubation: O₂ supplementation, recovery position, monitoring

AT-RISK Extubation (structured approach)

Step 1 — Formulate Plan:
  • Can patient tolerate re-intubation? Is airway expected to deteriorate?
  • Technique choice: awake (standard), awake-advanced, or asleep
Step 2 — Awake extubation (standard):
  • Ensure full reversal of NMB (quantitative TOF preferred)
  • Suction under direct vision; ensure cooperative, oxygenated patient
  • Have re-intubation plan and equipment ready
Step 3 — Advanced techniques (if standard too risky):
  • Airway Exchange Catheter (AEC): Leave in situ as a rail for re-intubation (max 72h); always confirm with capnography if re-intubated via AEC
  • Remifentanil infusion: Provides smooth extubation while maintaining respiratory drive and airway reflexes
  • SAD exchange: Replace ETT with LMA, allow recovery, then remove SAD
Step 4 — Post-extubation care:
  • O₂ throughout transfer; document difficulties; handover to recovery team

3. DAS/OAA 2015 — Obstetric Difficult Airway

Key Principles

  • RSI is standard (full stomach/aspiration risk); left lateral tilt
  • Lower SpO₂ threshold for action (faster desaturation than non-pregnant)
  • Fetal welfare and maternal safety both considered
  • Team communication is critical: call obstetrician early

Master Algorithm (GA Caesarean Section)

Pre-induction:
  • Pre-oxygenate (3-5 min or 8 vital capacity breaths with tight-fitting mask, +HFNO)
  • Ramped/head-up position; antacid prophylaxis (ranitidine/sodium citrate)
  • RSI: cricoid pressure + propofol/thiopentone + suxamethonium
PLAN A — Tracheal intubation:
  • Optimized direct or video laryngoscopy; bougie
  • Max 2 attempts (1 retry with optimized conditions/different device)
  • ✅ Intubated → confirm capnography, maintain cricoid pressure until cuff inflated
FAILED INTUBATION → STOP AND THINK:
Immediate decision based on: urgency of surgery, ability to ventilate
ScenarioAction
Can ventilate + non-urgentWake up → regional/awake fibreoptic
Can ventilate + life-threatening (maternal/fetal)Proceed with SAD (2nd-generation, e.g., i-gel)
CICOEmergency FONA (scalpel cricothyroidotomy)
PLAN B — Oxygenation with SAD:
  • 2nd-generation SAD; max 2 attempts
  • If successful and proceeding with surgery: maintain cricoid pressure, use lowest leak pressure, continuous capnography
PLAN C — Face mask ventilation (2-person if needed)
PLAN D — Emergency FONA / cricothyroidotomy
Post-event:
  • Maintain cricoid through extubation (if risk of aspiration)
  • Complete airway alert form; debrief patient and team

4. DAS/APA — Pediatric Difficult Airway

Key Differences from Adults

  • Anatomy: Large head, short neck, anterior/cephalad larynx, short trachea, large tongue
  • Maintain spontaneous ventilation where possible (less reserve, faster desaturation)
  • Sedation preferred over paralysis in anticipated difficulty
  • Smaller SAD sizes; straight blade often preferred <2 years
  • FONA = needle cricothyroidotomy in small children (<8 yr); surgical in older

Algorithm 1: Difficult Mask Ventilation

  1. Reposition (neutral in infant, sniffing in older child)
  2. OPA/NPA; 2-person technique
  3. If persistent failure → SAD insertion
  4. CICO → emergency needle cricothyroidotomy (< 8yr) or scalpel cricothyroidotomy (≥ 8yr)

Algorithm 2: Unanticipated Difficult Tracheal Intubation (1–8 yr, paralysed)

PLAN A: Direct laryngoscopy with optimization (OELM, pillow under shoulders)
  • Max 2 attempts; call for senior help after 1st failure
PLAN B: Alternative laryngoscopy/device
  • Videolaryngoscope (e.g., C-MAC, Storz), or smaller tube with stylet
  • 1–2 attempts
PLAN C: SAD insertion (i-gel, LMA Classic)
  • Oxygenate; STOP AND THINK → wake up or proceed through SAD
PLAN D: CICO → Emergency airway access
  • Age < 8yr: wide-bore cannula cricothyroidotomy (jet ventilation via Manujet or 50ml syringe)
  • Age ≥ 8yr: scalpel-bougie-tube (as per adult technique with smaller tube)

5. AIDAA 2025 — Unanticipated Difficult Airway in Adults (Updated)

Core Concept: Maintain SpO₂ ≥95% at every step; "Code D" as emergency alert

Primary Airway Plan (intubation, SGA, facemask, or TIVA + oxygen):
  • Use video laryngoscopy as first-line where available
  • Confirm intubation with 6 consecutive sustained capnography waveforms

If Primary Plan Fails:
  1. Declare "Code D" — hospital emergency code for difficult airway; call for experienced help immediately
  2. Maintain depth of anaesthesia throughout rescue attempts
  3. Deliver nasal O₂ throughout (THRIVE/HFNO preferred)
  4. Track SpO₂ and time elapsed continuously
Airway Rescue — No hierarchy between devices:
  • Switch promptly between tracheal tube (TT), SGA, and facemask
  • Max 3 attempts each with TT, SGA, and mask ventilation
  • Proceed to next attempt only if SpO₂ ≥95%
  • If SpO₂ not maintained or bradycardia → bypass steps → emergency cricothyroidotomy immediately
Complete Ventilation Failure (CVF) — all three fail:
  • Emergency cricothyroidotomy without delay
Post-event: Document, airway alert form, patient communication, follow-up

6. AIDAA 2025 — Extubation of the "At-Risk" Airway

Framework: SAFE

LetterAction
S — Stratify RiskClassify: routine vs. "at-risk" (known difficult airway, airway edema, obesity, OSA, prolonged intubation, neck surgery, etc.)
A — Assemble & AnticipateAssemble equipment, experienced personnel, re-intubation plan; anticipate complications
F — Facilitate ExtubationExecute extubation using the appropriate technique (see below)
E — Evaluate & EscalateMonitor post-extubation; escalate early if deterioration

AT-RISK Extubation — 3 Limbs (3 Ds + 3 Ss)

Limb 1 — Routine at-risk extubation (conditions manageable with standard care)
Limb 2 — 3 Ds (difficult conditions):
  • Difficult re-intubation expected
  • Deteriorating airway (edema, bleeding, hematoma)
  • Dependency on tube (e.g., tracheomalacia, cervical instability)
Limb 3 — 3 Ss (special techniques):
  • Staged Sequential Extubation (SSE): Remove ETT over an Airway Exchange Catheter (AEC), allowing re-intubation if needed; or step down to SAD then remove
  • Supervised extubation in controlled environment (HDU/ICU) with senior presence
  • Stay intubated: Delayed extubation when airway is not safe yet
Post-extubation for all at-risk: Continue O₂ (PerEOx — peri-extubation oxygenation), handover with re-intubation plan, stay alert for laryngospasm, bronchospasm, stridor, NPPE, aspiration.

Quick Comparison Table

FeatureDAS 2015 (Adult Intubation)DAS ExtubationDAS ObstetricsDAS PediatricAIDAA 2025 IntubationAIDAA 2025 Extubation
StructurePlan A→B→C→DRisk classify → techniqueRSI → Plan A→B→C→DPlan A→B→C→D (age-adjusted)Primary plan → Code D → rescueSAFE framework
Max intubation attempts3 total (Plan A)2 (more conservative)2–33 TT + 3 SGA + 3 mask
CICO rescueScalpel-bougie (surgical)Scalpel-bougie (surgical)Needle (<8yr) / scalpel (≥8yr)Emergency cricothyroidotomy
Key triggerFailed intubationRisk stratificationFailed intubation during RSIFailed intubationSpO₂ <95% / bradycardiaAny at-risk feature
Key innovationSimplified overview + detailed versionAEC / remifentanil techniques2 attempts max; wake up vs. proceed decisionSpontaneous ventilation preference"Code D" + no-hierarchy device switchingSAFE + SSE + 3Ds/3Ss
Confirm intubationCapnographyCapnography + cricoid until cuff inflatedCapnography6 consecutive capnography waveforms

Key references:

Waiting

The full summary is ready above! Here's a quick orientation to help you navigate it:
What's included:
  1. DAS 2015 Adult Intubation — Plan A→B→C→D with attempt limits and FONA (scalpel-bougie)
  2. DAS 2013 Extubation — Risk stratify (low-risk vs. at-risk) → AEC / remifentanil / SAD exchange techniques
  3. DAS/OAA 2015 Obstetrics — RSI-based, max 2 intubation attempts, wake-up vs. proceed decision tree, CICO management
  4. DAS/APA Pediatrics — Age-adjusted plans, spontaneous ventilation preference, needle vs. scalpel FONA by age
  5. AIDAA 2025 Adult Intubation — "Code D" activation, no-hierarchy device switching (TT/SGA/mask), SpO₂ ≥95% gate before each attempt
  6. AIDAA 2025 Extubation — SAFE framework + 3 Ds / 3 Ss limb system + Staged Sequential Extubation (SSE)
A few high-yield distinctions to remember:
  • DAS obstetrics allows only 2 laryngoscopy attempts (vs. 3 in adult general)
  • AIDAA's "Code D" is a unique institutional emergency activation concept
  • AIDAA explicitly states no hierarchy between TT, SGA, and mask during rescue — switch freely
  • DAS pediatric FONA differs by age: needle (<8 yr) vs. scalpel (≥8 yr)
  • AIDAA 2025 extubation introduced SSE (Staged Sequential Extubation) as a formal strategy
Let me know if you'd like any section expanded, a printable table, or a specific scenario walked through.

Need all and need summarise to write in exam

Here is a tight, exam-ready write-up for all six algorithms — structured so you can reproduce it in an exam in logical order.

DIFFICULT AIRWAY ALGORITHMS — EXAM WRITE-UP


1. DAS 2015 — Unanticipated Difficult Intubation in Adults

Pre-induction essentials:
  • Airway assessment + pre-oxygenation (3–5 min or 8 vital capacity breaths)
  • State a backup plan before every induction
  • Nasal O₂ (THRIVE/HFNO) throughout

Plan A — Facemask ventilation + Tracheal intubation

  • Optimise position (ramp obese patients), use video laryngoscopy + bougie
  • Maximum 3 attempts (one may be by a senior colleague)
  • Confirm with capnography
  • Fail → call for help → Plan B

Plan B — SAD insertion (oxygenation priority)

  • Insert 2nd-generation SAD (i-gel, ProSeal, Supreme)
  • Maximum 2 attempts
  • If SAD ventilates → STOP AND THINK → 4 options:
    1. Wake patient up
    2. Intubate through SAD (fibreoptic)
    3. Proceed without intubation (if appropriate)
    4. Elective surgical airway
  • Fail → Plan C

Plan C — Final facemask ventilation attempt

  • 2-person technique + OPA/NPA
  • Success → wake up | Fail → CICO → Plan D

Plan D — Emergency Front-of-Neck Access (eFONA)

  • Scalpel-bougie-tube cricothyroidotomy
  • Stab incision → caudal traction → bougie → size 6.0 cuffed tube
Post-event: Airway alert form, written explanation to patient, notify GP

2. DAS 2012/2013 — Extubation Guidelines

Step 1: Stratify Risk

Low RiskAt Risk
Easy intubation, no complications, no ongoing risk factorsDifficult intubation, obesity, OSA, airway oedema, restricted access, haemodynamic instability

Low-Risk Extubation

  1. Fully reverse NMB; optimise position + oxygenation
  2. Suction under direct vision
  3. Awake extubation (preferred) OR asleep (selected cases)
  4. Post-extubation O₂ + monitoring

At-Risk Extubation — 3 Techniques

  1. Awake extubation (standard) — full reversal, co-operative, oxygenated patient; re-intubation plan ready
  2. Airway Exchange Catheter (AEC) — leave in situ after extubation; re-intubate over AEC if needed; confirm with capnography
  3. SAD exchange / Remifentanil technique — replace ETT with LMA; remifentanil infusion maintains spontaneous ventilation + reflexes during extubation
Post-extubation: O₂ throughout transfer, detailed handover, document all difficulties

3. DAS/OAA 2015 — Obstetric Difficult Airway

Key differences from general adult:
  • RSI is standard (full stomach risk); left lateral tilt
  • Faster desaturation → lower threshold for action
  • Only 2 laryngoscopy attempts (more conservative than general DAS)
  • Dual concern: maternal and fetal safety
  • Always include obstetrician in decision-making

Algorithm (GA Caesarean Section)

Pre-induction:
  • Pre-oxygenate + HFNO; antacid prophylaxis
  • RSI: cricoid pressure + propofol/thiopentone + suxamethonium
Plan A — Tracheal intubation (max 2 attempts):
  • Optimised DL or VL + bougie; maintain cricoid pressure
  • Confirm with capnography; maintain cricoid until cuff inflated
Failed intubation → STOP AND THINK:
SituationAction
Can ventilate + non-urgent surgeryWake up → regional/awake FOI
Can ventilate + life-threatening (maternal or fetal)Proceed with 2nd-gen SAD (i-gel preferred)
CICOEmergency eFONA (scalpel cricothyroidotomy)
Plan B: 2nd-generation SAD — max 2 attempts Plan C: 2-person facemask ventilation Plan D: Scalpel cricothyroidotomy
Post-event: Cricoid maintained till full airway protection; airway alert form; debrief team + patient

4. DAS/APA — Paediatric Difficult Airway

Key anatomical/physiological differences:
  • Large head, short neck, anterior/cephalad larynx, large tongue, short trachea
  • Faster desaturation; less respiratory reserve
  • Prefer to maintain spontaneous ventilation in anticipated difficulty
  • Straight blade preferred < 2 years

Algorithm 1: Difficult Mask Ventilation

  1. Reposition (neutral infant; sniffing in older child)
  2. OPA/NPA + 2-person technique
  3. Fail → SAD insertion
  4. CICO → emergency airway access (age-dependent — see below)

Algorithm 2: Unanticipated Difficult Tracheal Intubation (1–8 yr, paralysed)

Plan A: DL with optimisation (OELM, shoulder roll) — max 2 attempts; call for help after 1st failure
Plan B: Alternative device — VL (C-MAC/Storz), stylet — 1–2 attempts
Plan C: SAD insertion (i-gel/LMA Classic) — oxygenate → STOP AND THINK → wake up or intubate through SAD
Plan D — CICO — Emergency airway (age-based):
AgeTechnique
< 8 yearsWide-bore cannula cricothyroidotomy → jet ventilation (Manujet/50 mL syringe)
≥ 8 yearsScalpel-bougie-tube (adult technique, smaller tube)

5. AIDAA 2025 — Unanticipated Difficult Airway in Adults

Key innovations vs. DAS:
  • No fixed hierarchy between rescue devices
  • "Code D" as a formal hospital emergency code
  • SpO₂ ≥95% gate before every attempt
  • 6 consecutive capnography waveforms to confirm intubation

Algorithm

Primary Airway Plan (intubation / SGA / facemask / TIVA + O₂):
  • Video laryngoscopy as first-line where available
  • If successful → continue; if any difficulty → declare Code D immediately
Rescue Phase (no hierarchy — switch freely):
  • Attempt Tracheal tube (TT)SGAFacemask in any order
  • Max 3 attempts each
  • Proceed to next attempt only if SpO₂ ≥ 95%
  • Deliver nasal O₂ (HFNO preferred) throughout
  • Track SpO₂ + elapsed time continuously
  • Maintain depth of anaesthesia throughout
If SpO₂ drops / bradycardia develops at any point:Bypass remaining steps → Emergency cricothyroidotomy immediately
Complete Ventilation Failure (all 3 devices fail):Emergency cricothyroidotomy without further delay
Post-event: Airway alert form, patient communication, follow-up

6. AIDAA 2025 — Extubation of the "At-Risk" Airway

Framework: SAFE

StepContent
SStratify RiskIdentify at-risk features: known difficult airway, airway oedema, obesity, OSA, prolonged intubation, neck surgery, cervical instability
AAssemble & AnticipateGather equipment + experienced personnel; formulate written re-intubation plan; anticipate complications
FFacilitate ExtubationExecute using appropriate limb/technique (see below)
EEvaluate & EscalateMonitor continuously post-extubation; escalate early; maintain O₂ (PerEOx)

At-Risk Extubation — 3 Limbs

Limb 1 — Standard at-risk extubation:
  • Full NMB reversal (quantitative TOF), co-operative patient, O₂ supplementation
Limb 2 — 3 Ds (for high-risk conditions):
  • Difficult re-intubation expected
  • Deteriorating airway (oedema, haematoma, bleeding)
  • Dependency on tube (tracheomalacia, unstable cervical spine)
  • → Use AEC or staged techniques
Limb 3 — 3 Ss (special strategies):
  • Staged Sequential Extubation (SSE): remove ETT over AEC → step down to SAD → then remove SAD
  • Supervised extubation in controlled environment (HDU/ICU)
  • Stay intubated (delayed extubation) when airway is unsafe
Post-extubation for all at-risk:
  • PerEOx (peri-extubation oxygenation) — continue O₂ throughout transfer
  • Handover with explicit re-intubation plan
  • Watch for: laryngospasm, bronchospasm, stridor, NPPE, aspiration, apnoea

EXAM MEMORY ANCHORS

AlgorithmMemory Hook
DAS adult intubationA-B-C-D (3 tries A, 2 tries B, 1 last C, scalpel D)
DAS extubationLow vs. At-risk → AEC / Remi / SAD exchange
DAS obstetricsRSI + max 2 attempts + Wake OR Proceed + eFONA
DAS paediatricSpontaneous ventilation + needle (<8yr) vs. scalpel (≥8yr)
AIDAA intubationCode D + no hierarchy + SpO₂ ≥95% gate + 3 each
AIDAA extubationSAFE + 3 Ds + 3 Ss + SSE

One-line rule that applies to ALL algorithms:
"Oxygenation takes priority over intubation at every step — if you cannot oxygenate, surgical airway without delay."

Waiting

The full exam-ready write-up is complete above. Here's how to use it efficiently:

For a short answer (5–10 marks): Write the algorithm name → state the core concept → list Plans A→B→C→D with attempt limits → end with eFONA + post-event care. One paragraph per plan.
For a long answer (15–20 marks): Add the comparison table, key differences (obstetric = max 2 attempts; pediatric = age-based FONA; AIDAA = Code D + no hierarchy), and the SAFE/3Ds/3Ss framework for extubation.
Highest-yield points examiners test:
  • Max attempts: DAS adult = 3, DAS obstetric = 2, AIDAA = 3 each device
  • CICO rescue: adults = scalpel-bougie, pediatric <8yr = cannula/needle
  • AIDAA's unique terms: Code D, SpO₂ ≥95% gate, 6 capnography waveforms, no hierarchy
  • AIDAA extubation mnemonic: SAFE + 3 Ds + 3 Ss + SSE
  • Universal rule: oxygenation > intubation; surgical airway if CICO
Let me know if you want this converted into a downloadable PDF or Word document for printing.

But i need everything in pdf

Reading File
Running Command

ls -la /home/daytona/workspace/ 2>/dev/null || mkdir -p /home/daytona/workspace

Running Command

mkdir -p /home/daytona/workspace/difficult-airway-pdf

Writing File

~/difficult-airway-pdf/generate_pdf.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
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    HRFlowable, PageBreak, KeepTogether
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus import BaseDocTemplate, Frame, PageTemplate

OUTPUT = "/home/daytona/workspace/difficult-airway-pdf/Difficult_Airway_Algorithms.pdf"

# ── Colour palette ──────────────────────────────────────────────────────────
NAVY   = colors.HexColor("#1a2e4a")
TEAL   = colors.HexColor("#1a7f7a")
AMBER  = colors.HexColor("#e07b00")
PINK   = colors.HexColor("#b5294e")
GREEN  = colors.HexColor("#2e7d32")
LGRAY  = colors.HexColor("#f4f6f8")
MGRAY  = colors.HexColor("#dde2e8")
WHITE  = colors.white

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

title_style = ParagraphStyle("MainTitle",
    fontSize=20, leading=26, textColor=WHITE, fontName="Helvetica-Bold",
    alignment=TA_CENTER, spaceAfter=4)

subtitle_style = ParagraphStyle("SubTitle",
    fontSize=11, leading=14, textColor=MGRAY, fontName="Helvetica",
    alignment=TA_CENTER, spaceAfter=0)

h1 = ParagraphStyle("H1",
    fontSize=13, leading=17, textColor=WHITE, fontName="Helvetica-Bold",
    spaceBefore=10, spaceAfter=4, leftIndent=0)

h2 = ParagraphStyle("H2",
    fontSize=11, leading=14, textColor=NAVY, fontName="Helvetica-Bold",
    spaceBefore=8, spaceAfter=3)

h3 = ParagraphStyle("H3",
    fontSize=10, leading=13, textColor=TEAL, fontName="Helvetica-Bold",
    spaceBefore=5, spaceAfter=2)

body = ParagraphStyle("Body",
    fontSize=9, leading=13, textColor=colors.HexColor("#222222"),
    fontName="Helvetica", spaceAfter=3, leftIndent=6, justified=TA_JUSTIFY)

bullet = ParagraphStyle("Bullet",
    fontSize=9, leading=13, textColor=colors.HexColor("#222222"),
    fontName="Helvetica", spaceAfter=2, leftIndent=14, bulletIndent=4)

bold_body = ParagraphStyle("BoldBody",
    fontSize=9, leading=13, textColor=NAVY,
    fontName="Helvetica-Bold", spaceAfter=3, leftIndent=6)

note_style = ParagraphStyle("Note",
    fontSize=8.5, leading=12, textColor=colors.HexColor("#555555"),
    fontName="Helvetica-Oblique", spaceAfter=3, leftIndent=6)

warn_style = ParagraphStyle("Warn",
    fontSize=9, leading=13, textColor=PINK, fontName="Helvetica-Bold",
    spaceAfter=3, leftIndent=6)

def section_header(title, color=NAVY):
    """Returns a coloured banner paragraph."""
    data = [[Paragraph(title, h1)]]
    t = Table(data, colWidths=[17*cm])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), color),
        ("LEFTPADDING", (0,0), (-1,-1), 10),
        ("RIGHTPADDING", (0,0), (-1,-1), 10),
        ("TOPPADDING", (0,0), (-1,-1), 6),
        ("BOTTOMPADDING", (0,0), (-1,-1), 6),
        ("ROUNDEDCORNERS", [4,4,4,4]),
    ]))
    return t

def plan_box(plan_label, content_lines, color=TEAL):
    """Compact plan box with label and bullet lines."""
    label_para = Paragraph(plan_label, ParagraphStyle("PlanLabel",
        fontSize=10, leading=13, textColor=WHITE, fontName="Helvetica-Bold"))
    content = "\n".join(f"• {l}" for l in content_lines)
    content_para = Paragraph(content.replace("\n","<br/>"),
        ParagraphStyle("PlanContent", fontSize=8.5, leading=12,
                       textColor=colors.HexColor("#222222"), fontName="Helvetica"))
    data = [[label_para], [content_para]]
    col = 17*cm
    t = Table(data, colWidths=[col])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (0,0), color),
        ("BACKGROUND", (0,1), (0,1), LGRAY),
        ("LEFTPADDING", (0,0), (-1,-1), 8),
        ("RIGHTPADDING", (0,0), (-1,-1), 8),
        ("TOPPADDING", (0,0), (-1,-1), 5),
        ("BOTTOMPADDING", (0,0), (-1,-1), 5),
        ("BOX", (0,0), (-1,-1), 0.5, MGRAY),
    ]))
    return t

def two_col_table(headers, rows, col_widths=None):
    if col_widths is None:
        col_widths = [6*cm, 11*cm]
    header_style = ParagraphStyle("TH", fontSize=9, fontName="Helvetica-Bold",
                                  textColor=WHITE, leading=12)
    cell_style   = ParagraphStyle("TD", fontSize=8.5, fontName="Helvetica",
                                  textColor=colors.HexColor("#222222"), leading=12)
    data = [[Paragraph(h, header_style) for h in headers]]
    for row in rows:
        data.append([Paragraph(str(c), cell_style) for c in row])
    t = Table(data, colWidths=col_widths)
    style = TableStyle([
        ("BACKGROUND", (0,0), (-1,0), NAVY),
        ("ROWBACKGROUNDS", (0,1), (-1,-1), [WHITE, LGRAY]),
        ("GRID", (0,0), (-1,-1), 0.3, MGRAY),
        ("LEFTPADDING", (0,0), (-1,-1), 6),
        ("RIGHTPADDING", (0,0), (-1,-1), 6),
        ("TOPPADDING", (0,0), (-1,-1), 4),
        ("BOTTOMPADDING", (0,0), (-1,-1), 4),
        ("VALIGN", (0,0), (-1,-1), "TOP"),
    ])
    t.setStyle(style)
    return t

def multi_col_table(headers, rows, col_widths):
    header_style = ParagraphStyle("TH2", fontSize=8, fontName="Helvetica-Bold",
                                  textColor=WHITE, leading=10)
    cell_style   = ParagraphStyle("TD2", fontSize=7.5, fontName="Helvetica",
                                  textColor=colors.HexColor("#222222"), leading=10)
    data = [[Paragraph(h, header_style) for h in headers]]
    for row in rows:
        data.append([Paragraph(str(c), cell_style) for c in row])
    t = Table(data, colWidths=col_widths)
    style = TableStyle([
        ("BACKGROUND", (0,0), (-1,0), NAVY),
        ("ROWBACKGROUNDS", (0,1), (-1,-1), [WHITE, LGRAY]),
        ("GRID", (0,0), (-1,-1), 0.3, MGRAY),
        ("LEFTPADDING", (0,0), (-1,-1), 4),
        ("RIGHTPADDING", (0,0), (-1,-1), 4),
        ("TOPPADDING", (0,0), (-1,-1), 3),
        ("BOTTOMPADDING", (0,0), (-1,-1), 3),
        ("VALIGN", (0,0), (-1,-1), "TOP"),
    ])
    t.setStyle(style)
    return t

def highlight_box(text, color=AMBER):
    p = Paragraph(text, ParagraphStyle("HL", fontSize=9, leading=13,
                  textColor=WHITE, fontName="Helvetica-Bold",
                  alignment=TA_CENTER))
    t = Table([[p]], colWidths=[17*cm])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), color),
        ("LEFTPADDING", (0,0), (-1,-1), 8),
        ("TOPPADDING", (0,0), (-1,-1), 6),
        ("BOTTOMPADDING", (0,0), (-1,-1), 6),
    ]))
    return t

def bp(text):
    return Paragraph(f"• {text}", bullet)

def b(text):
    return Paragraph(text, bold_body)

def p(text):
    return Paragraph(text, body)

def h(text):
    return Paragraph(text, h2)

def h3p(text):
    return Paragraph(text, h3)

def sp(n=4):
    return Spacer(1, n)

def hr():
    return HRFlowable(width="100%", thickness=0.5, color=MGRAY, spaceAfter=4, spaceBefore=4)

# ═══════════════════════════════════════════════════════════════════════════
# BUILD CONTENT
# ═══════════════════════════════════════════════════════════════════════════
story = []

# ── COVER PAGE ──────────────────────────────────────────────────────────────
cover_data = [[
    Paragraph("DIFFICULT AIRWAY ALGORITHMS", title_style),
    Paragraph("Exam-Ready Reference Guide", subtitle_style),
    Spacer(1, 6),
    Paragraph("DAS 2015 Intubation  •  DAS Extubation  •  DAS/OAA Obstetrics", subtitle_style),
    Paragraph("DAS/APA Paediatrics  •  AIDAA 2025 Intubation  •  AIDAA 2025 Extubation", subtitle_style),
    Spacer(1, 10),
    Paragraph("May 2026", ParagraphStyle("Dt", fontSize=9, textColor=MGRAY,
              fontName="Helvetica", alignment=TA_CENTER)),
]]
cover_table = Table([cover_data[0]], colWidths=[17*cm])
cover_table.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), NAVY),
    ("LEFTPADDING", (0,0), (-1,-1), 20),
    ("RIGHTPADDING", (0,0), (-1,-1), 20),
    ("TOPPADDING", (0,0), (-1,-1), 30),
    ("BOTTOMPADDING", (0,0), (-1,-1), 30),
]))
story.append(cover_table)
story.append(sp(14))
story.append(highlight_box(
    "UNIVERSAL RULE: Oxygenation > Intubation — If CICO, surgical airway WITHOUT DELAY",
    color=PINK))
story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════
# 1. DAS 2015 — ADULT INTUBATION
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_header("1.  DAS 2015 — Unanticipated Difficult Intubation in Adults", NAVY))
story.append(sp(6))

story.append(h("Pre-Induction Essentials"))
for t in [
    "Airway assessment + state a backup plan before every induction",
    "Pre-oxygenation: 3–5 min tidal breathing OR 8 vital capacity breaths (tight-fitting mask)",
    "Nasal O₂ (THRIVE/HFNO) throughout — maintain apnoeic oxygenation",
    "Optimise position: ramping for obese patients (ear-to-sternal-notch line)",
]:
    story.append(bp(t))
story.append(sp(4))

story.append(plan_box("PLAN A — Facemask Ventilation + Tracheal Intubation", [
    "Optimise position; video laryngoscopy + bougie as primary tools",
    "MAXIMUM 3 laryngoscopy attempts (one may be by senior colleague)",
    "Confirm intubation with CAPNOGRAPHY",
    "FAIL → call for help → Plan B",
], TEAL))
story.append(sp(4))

story.append(plan_box("PLAN B — SAD Insertion (Oxygenation Priority)", [
    "Insert 2nd-generation SAD (i-gel / ProSeal / Supreme)",
    "MAXIMUM 2 attempts",
    "If oxygenation restored → STOP AND THINK (4 options):",
    "  1. Wake the patient up",
    "  2. Intubate through SAD (fibreoptic-guided)",
    "  3. Proceed without intubation (if surgery permits)",
    "  4. Elective surgical airway (tracheostomy/cricothyroidotomy)",
    "FAIL → Plan C",
], GREEN))
story.append(sp(4))

story.append(plan_box("PLAN C — Final Facemask Ventilation Attempt", [
    "2-person technique + OPA/NPA adjuncts",
    "SUCCESS → wake patient up",
    "FAIL → CICO → Plan D",
], AMBER))
story.append(sp(4))

story.append(plan_box("PLAN D — Emergency Front-of-Neck Access (eFONA) — CICO", [
    "Technique: SCALPEL-BOUGIE-TUBE cricothyroidotomy",
    "Transverse stab incision → caudal traction on trachea → bougie → size 6.0 cuffed ETT",
    "Confirm with capnography",
], PINK))
story.append(sp(6))

story.append(h("Post-Event Care"))
for t in [
    "Monitor for complications in recovery",
    "Complete Airway Alert Form",
    "Explain to patient in person AND in writing",
    "Written report to GP + local difficult airway database",
]:
    story.append(bp(t))

story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════
# 2. DAS EXTUBATION
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_header("2.  DAS 2012/2013 — Extubation Guidelines", TEAL))
story.append(sp(6))

story.append(h("Step 1: Stratify Risk"))
story.append(two_col_table(
    ["LOW RISK", "AT RISK"],
    [["Easy intubation, no airway complications, no ongoing risk factors",
      "Known/suspected difficult airway, obesity, OSA, airway oedema, restricted access, haemodynamic instability, surgical risk factors"]],
    col_widths=[8.5*cm, 8.5*cm]
))
story.append(sp(8))

story.append(h("LOW-RISK Extubation"))
for t in [
    "Fully reverse NMB; optimise position and oxygenation",
    "Suction under direct vision",
    "Awake extubation (preferred) OR asleep extubation (selected cases only)",
    "Post-extubation: O₂ supplementation + monitoring in recovery",
]:
    story.append(bp(t))
story.append(sp(8))

story.append(h("AT-RISK Extubation — 3 Advanced Techniques"))
story.append(sp(3))

story.append(h3p("Technique 1 — Awake Extubation (Standard)"))
for t in [
    "Full NMB reversal (quantitative TOF preferred)",
    "Co-operative, oxygenated, haemodynamically stable patient",
    "Re-intubation plan + equipment ready at bedside",
    "Suction under direct vision before extubation",
]:
    story.append(bp(t))
story.append(sp(4))

story.append(h3p("Technique 2 — Airway Exchange Catheter (AEC)"))
for t in [
    "Leave AEC in situ after removing ETT (acts as a rail for re-intubation)",
    "AEC can remain up to 72 hours",
    "If re-intubation needed: railroad ETT over AEC under direct vision",
    "ALWAYS confirm re-intubation with capnography",
    "Warn patient of discomfort; supplemental O₂ throughout",
]:
    story.append(bp(t))
story.append(sp(4))

story.append(h3p("Technique 3 — SAD Exchange / Remifentanil Technique"))
for t in [
    "SAD exchange: Replace ETT with LMA → allow recovery → remove SAD when awake",
    "Remifentanil infusion: maintains spontaneous ventilation + airway reflexes during extubation",
    "Titratable, short-acting — smooth emergence without coughing/straining",
]:
    story.append(bp(t))
story.append(sp(6))

story.append(h("Post-Extubation Care (ALL Patients)"))
for t in [
    "O₂ supplementation throughout transfer to recovery",
    "Detailed handover to recovery nurse including re-intubation plan",
    "Document all difficulties on airway alert form",
]:
    story.append(bp(t))

story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════
# 3. DAS/OAA OBSTETRICS
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_header("3.  DAS/OAA 2015 — Obstetric Difficult Airway", colors.HexColor("#6a1b9a")))
story.append(sp(6))

story.append(h("Key Differences from General Adult DAS"))
story.append(two_col_table(
    ["Feature", "Obstetric Consideration"],
    [
        ["Intubation attempts", "MAX 2 (more conservative — faster desaturation)"],
        ["Induction technique", "RSI is STANDARD (full stomach / aspiration risk)"],
        ["Patient position", "Left lateral tilt (aortocaval compression)"],
        ["Cricoid pressure", "Applied at induction; maintained until cuff inflated"],
        ["Airway oedema", "Pregnancy-related → smaller ETT (6.0–7.0 mm)"],
        ["Decision-making", "Dual concern: maternal AND fetal safety"],
        ["Team", "Obstetrician involved in wake-up vs. proceed decision"],
    ],
    col_widths=[5*cm, 12*cm]
))
story.append(sp(8))

story.append(h("Pre-Induction"))
for t in [
    "Pre-oxygenate 3–5 min + HFNO nasal O₂; antacid prophylaxis (sodium citrate + H2 blocker)",
    "RSI: propofol or thiopentone + suxamethonium; cricoid pressure applied",
    "Ramped/head-up position; smaller ETT (6.0–7.0 mm)",
]:
    story.append(bp(t))
story.append(sp(4))

story.append(plan_box("PLAN A — Tracheal Intubation (MAX 2 attempts)", [
    "Optimised DL or VL + bougie; maintain cricoid pressure throughout",
    "Confirm with capnography; maintain cricoid until ETT cuff inflated",
    "FAIL after 2 attempts → STOP AND THINK",
], TEAL))
story.append(sp(6))

story.append(h("FAILED INTUBATION — Decision Table"))
story.append(two_col_table(
    ["Clinical Situation", "Action"],
    [
        ["Can ventilate + NON-URGENT surgery", "WAKE PATIENT UP → regional anaesthesia or awake fibreoptic intubation"],
        ["Can ventilate + LIFE-THREATENING (maternal or fetal)", "PROCEED with 2nd-gen SAD (i-gel preferred); maintain cricoid; lowest seal pressure"],
        ["CANNOT ventilate (CICO)", "EMERGENCY eFONA — scalpel cricothyroidotomy immediately"],
    ],
    col_widths=[6*cm, 11*cm]
))
story.append(sp(6))

story.append(plan_box("PLAN B — 2nd-Generation SAD", [
    "i-gel preferred in obstetrics; max 2 attempts",
    "If successful and proceeding: continuous capnography; lowest leak pressure",
    "FAIL → Plan C",
], GREEN))
story.append(sp(4))

story.append(plan_box("PLAN C — 2-Person Facemask Ventilation", [
    "Use OPA/NPA; 2-person technique",
    "FAIL → CICO → Plan D",
], AMBER))
story.append(sp(4))

story.append(plan_box("PLAN D — Emergency eFONA", [
    "Scalpel-bougie-tube cricothyroidotomy (as adult technique)",
    "Confirm with capnography",
], PINK))
story.append(sp(6))

story.append(h("Post-Event"))
for t in [
    "Maintain cricoid pressure until full airway protection restored (if aspiration risk remains)",
    "Complete airway alert form; debrief full team + patient",
    "Neonatologist present if emergency — document fetal outcome",
]:
    story.append(bp(t))

story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════
# 4. DAS/APA PAEDIATRICS
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_header("4.  DAS/APA — Paediatric Difficult Airway", colors.HexColor("#1565c0")))
story.append(sp(6))

story.append(h("Key Anatomical & Physiological Differences"))
story.append(two_col_table(
    ["Feature", "Implication"],
    [
        ["Large occiput, short neck", "Neutral position in infants; sniffing in older children"],
        ["Anterior, cephalad larynx; large tongue", "Straight blade preferred < 2 years"],
        ["Short trachea", "Risk of right mainstem intubation — confirm depth carefully"],
        ["High O₂ consumption, low FRC", "Rapid desaturation — pre-oxygenation critical"],
        ["Less respiratory reserve", "Prefer SPONTANEOUS VENTILATION in anticipated difficulty"],
        ["Smaller structures", "Smaller SAD sizes; needle cricothyroidotomy for CICO < 8 yr"],
    ],
    col_widths=[5*cm, 12*cm]
))
story.append(sp(8))

story.append(h("Algorithm 1: Difficult Mask Ventilation"))
story.append(sp(3))
for t in [
    "Reposition: neutral in infant; sniffing position in older child",
    "Insert OPA/NPA; 2-person technique (one holds mask, one squeezes bag)",
    "Fail → SAD insertion (appropriately sized LMA/i-gel)",
    "Fail → CICO → Emergency airway access (see age table below)",
]:
    story.append(bp(t))
story.append(sp(8))

story.append(h("Algorithm 2: Unanticipated Difficult Tracheal Intubation (Age 1–8 yr, paralysed)"))
story.append(sp(3))

story.append(plan_box("PLAN A — Direct Laryngoscopy with Optimisation", [
    "Shoulder roll + OELM (optimal external laryngeal manipulation)",
    "MAX 2 attempts; call for SENIOR HELP after 1st failure",
    "FAIL → Plan B",
], TEAL))
story.append(sp(4))

story.append(plan_box("PLAN B — Alternative Laryngoscopy / Device", [
    "Videolaryngoscope (C-MAC, Storz) or smaller tube with stylet",
    "1–2 attempts maximum",
    "FAIL → Plan C",
], GREEN))
story.append(sp(4))

story.append(plan_box("PLAN C — SAD Insertion", [
    "i-gel or LMA Classic (appropriately sized)",
    "Oxygenate the child → STOP AND THINK:",
    "  → Wake up the child (preferred if possible)",
    "  → Intubate through SAD (fibreoptic-guided)",
    "FAIL → CICO → Plan D",
], AMBER))
story.append(sp(4))

story.append(plan_box("PLAN D — CICO Emergency Airway Access (AGE-DEPENDENT)", [
    "< 8 years: Wide-bore CANNULA cricothyroidotomy → jet ventilation (Manujet / 50 mL syringe)",
    "≥ 8 years: SCALPEL-BOUGIE-TUBE (adult technique, smaller tube size 4.0–5.0 cuffed)",
], PINK))
story.append(sp(6))

story.append(h("FONA Age Summary"))
story.append(two_col_table(
    ["Age Group", "Emergency Airway Technique"],
    [
        ["< 8 years", "Needle/cannula cricothyroidotomy → jet ventilation (Manujet or 50 mL syringe)"],
        ["≥ 8 years", "Scalpel-bougie-tube cricothyroidotomy (as adult; tube 4.0–5.0 cuffed)"],
    ],
    col_widths=[4*cm, 13*cm]
))

story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════
# 5. AIDAA 2025 — ADULT INTUBATION
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_header("5.  AIDAA 2025 — Unanticipated Difficult Airway in Adults", colors.HexColor("#b71c1c")))
story.append(sp(6))

story.append(h("Key Innovations vs. DAS"))
story.append(two_col_table(
    ["AIDAA Feature", "Detail"],
    [
        ["Code D", "Formal hospital emergency code — declare immediately when difficulty encountered"],
        ["No device hierarchy", "Switch freely between TT, SGA, facemask — whichever works fastest"],
        ["SpO₂ ≥ 95% gate", "Only proceed to next attempt if SpO₂ ≥ 95%"],
        ["Intubation confirmation", "6 consecutive SUSTAINED capnography waveforms (without CO₂ fall)"],
        ["Nasal O₂", "HFNO throughout all rescue attempts (apnoeic oxygenation)"],
        ["CVF trigger", "Complete Ventilation Failure = all 3 devices failed = immediate cricothyroidotomy"],
    ],
    col_widths=[5*cm, 12*cm]
))
story.append(sp(8))

story.append(h("Algorithm Steps"))
story.append(sp(3))

story.append(plan_box("PRIMARY AIRWAY PLAN (Intubation / SGA / Facemask / TIVA + O₂)", [
    "Video laryngoscopy as FIRST-LINE where available",
    "Confirm intubation with 6 consecutive sustained capnography waveforms",
    "SUCCESS → continue as planned",
    "ANY DIFFICULTY → DECLARE CODE D immediately → call for experienced help",
], TEAL))
story.append(sp(4))

story.append(plan_box("RESCUE PHASE — No Hierarchy — Switch Freely", [
    "Attempt: Tracheal Tube (TT) AND/OR SGA AND/OR Facemask — in any order",
    "MAX 3 attempts with each device",
    "ONLY proceed to next attempt if SpO₂ ≥ 95%",
    "Deliver NASAL O₂ (HFNO preferred) THROUGHOUT",
    "Track SpO₂ + time elapsed continuously",
    "Maintain DEPTH OF ANAESTHESIA throughout rescue",
], GREEN))
story.append(sp(4))

story.append(highlight_box(
    "IF SpO₂ DROPS / BRADYCARDIA DEVELOPS AT ANY POINT → BYPASS REMAINING STEPS → EMERGENCY CRICOTHYROIDOTOMY IMMEDIATELY",
    color=PINK))
story.append(sp(4))

story.append(plan_box("COMPLETE VENTILATION FAILURE (CVF) — All 3 Devices Failed", [
    "EMERGENCY CRICOTHYROIDOTOMY without further delay",
    "No further airway device attempts",
], PINK))
story.append(sp(6))

story.append(h("Post-Event"))
for t in [
    "Complete airway alert form (standard AIDAA format)",
    "Patient communication — verbal + written",
    "Follow-up appointment to explain events",
    "Report to institutional database",
]:
    story.append(bp(t))

story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════
# 6. AIDAA 2025 — EXTUBATION
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_header("6.  AIDAA 2025 — Extubation of the 'At-Risk' Airway", colors.HexColor("#e65100")))
story.append(sp(6))

story.append(h("Framework: SAFE"))
story.append(two_col_table(
    ["Letter", "Action & Content"],
    [
        ["S — Stratify Risk",
         "Identify at-risk features: known difficult airway, airway oedema, obesity, OSA, prolonged intubation (> 24 h), neck surgery, cervical instability, post-op haematoma, restricted mouth opening, NMB residue"],
        ["A — Assemble & Anticipate",
         "Gather re-intubation equipment; ensure experienced personnel present; formulate WRITTEN re-intubation plan; anticipate: laryngospasm, bronchospasm, stridor, NPPE, aspiration, apnoea"],
        ["F — Facilitate Extubation",
         "Execute using appropriate limb/technique (see 3 Limbs below). Full NMB reversal (quantitative TOF). Continue PerEOx (peri-extubation oxygenation) throughout."],
        ["E — Evaluate & Escalate",
         "Monitor continuously post-extubation. Escalate EARLY. Maintain O₂ during transfer (PerEOx). Handover with explicit re-intubation plan. Watch for complications listed above."],
    ],
    col_widths=[4*cm, 13*cm]
))
story.append(sp(8))

story.append(h("At-Risk Extubation — 3 Limbs"))
story.append(sp(3))

story.append(plan_box("LIMB 1 — Standard At-Risk Extubation", [
    "Routine extubation with additional safeguards",
    "Full NMB reversal confirmed (quantitative TOF ratio ≥ 0.9)",
    "Co-operative, awake, oxygenated patient",
    "Re-intubation plan and equipment at bedside",
    "Senior anaesthetist present",
], TEAL))
story.append(sp(4))

story.append(plan_box("LIMB 2 — 3 Ds (High-Risk Conditions)", [
    "D1 — Difficult re-intubation expected (known difficult airway — use AEC technique)",
    "D2 — Deteriorating airway (oedema, haematoma, bleeding — defer extubation / delayed extubation)",
    "D3 — Dependency on tube (tracheomalacia, cervical instability — SSE or stay intubated)",
], AMBER))
story.append(sp(4))

story.append(plan_box("LIMB 3 — 3 Ss (Special Strategies)", [
    "S1 — Staged Sequential Extubation (SSE): Remove ETT over AEC → step down to SAD → remove SAD when fully awake",
    "S2 — Supervised extubation: Controlled environment (HDU/ICU), senior presence, full monitoring",
    "S3 — Stay intubated: Delayed extubation when airway deemed unsafe — reassess at planned interval",
], GREEN))
story.append(sp(6))

story.append(h("Post-Extubation (All At-Risk Patients)"))
for t in [
    "PerEOx — continue supplemental O₂ throughout transfer to PACU/HDU/ICU",
    "Handover with explicit re-intubation plan and team briefing",
    "Watch for and act on: laryngospasm, bronchospasm, stridor, NPPE, aspiration, vomiting, apnoea",
    "Document difficulties during extubation, adverse events, and strategies used on airway alert form",
]:
    story.append(bp(t))

story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════
# 7. MASTER COMPARISON TABLE
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_header("7.  Master Comparison Table", NAVY))
story.append(sp(8))

cw = [3.2*cm, 2.5*cm, 2.5*cm, 2.7*cm, 2.8*cm, 2.8*cm]
headers = ["Feature", "DAS Adult\nIntubation", "DAS\nExtubation", "DAS\nObstetrics", "AIDAA 2025\nIntubation", "AIDAA 2025\nExtubation"]
rows = [
    ["Structure", "Plan A→B→C→D", "Risk classify → technique", "RSI + Plan A→B→C→D", "Primary plan → Code D → rescue", "SAFE + 3Ds/3Ss"],
    ["Max intubation attempts", "3 (Plan A)", "—", "2 (Plan A)", "3 per device (TT/SGA/mask)", "—"],
    ["Device hierarchy", "A→B→C sequential", "—", "A→B→C sequential", "NO hierarchy — switch freely", "—"],
    ["CICO rescue", "Scalpel-bougie\n(adult)", "—", "Scalpel-bougie\n(adult)", "Emergency\ncricothyroidotomy", "—"],
    ["Paediatric CICO", "—", "—", "—", "Needle <8yr,\nScalpel ≥8yr", "—"],
    ["Key trigger", "Failed intubation", "Risk\nstratification", "Failed intubation\nduring RSI", "SpO₂ <95% or\nbradycardia", "Any at-risk\nfeature"],
    ["Confirm intubation", "Capnography", "—", "Capnography + cricoid\ntill cuff inflated", "6 consecutive\ncapno waveforms", "—"],
    ["Key innovation", "Simplified overview\n+ detailed version;\nbougie emphasis", "AEC / Remi /\nSAD exchange", "Max 2 attempts;\nwake vs. proceed\ndecision table", "Code D; no\nhierarchy;\nSpO₂ gate", "SAFE framework\n+ SSE +\n3Ds/3Ss"],
    ["Emergency code", "—", "—", "—", "CODE D", "—"],
    ["Extubation special technique", "—", "AEC stays in situ;\nrailroad if needed", "—", "—", "SSE (Staged\nSequential\nExtubation)"],
]
story.append(multi_col_table(headers, rows, cw))

story.append(PageBreak())

# ═══════════════════════════════════════════════════════════════════════════
# 8. EXAM MEMORY ANCHORS
# ═══════════════════════════════════════════════════════════════════════════
story.append(section_header("8.  Exam Memory Anchors & High-Yield Points", TEAL))
story.append(sp(8))

story.append(h("Mnemonics"))
story.append(two_col_table(
    ["Algorithm", "Memory Hook"],
    [
        ["DAS Adult Intubation", "A-B-C-D | 3 tries A, 2 tries B, 1 last C, SCALPEL D"],
        ["DAS Extubation", "Low vs. At-risk → AEC / Remifentanil / SAD exchange"],
        ["DAS Obstetrics", "RSI + MAX 2 + WAKE or PROCEED + eFONA"],
        ["DAS Paediatric", "Spontaneous ventilation preferred + NEEDLE (<8yr) vs. SCALPEL (≥8yr)"],
        ["AIDAA 2025 Intubation", "Code D + NO HIERARCHY + SpO₂ ≥95% gate + 3 each"],
        ["AIDAA 2025 Extubation", "SAFE + 3 Ds + 3 Ss + SSE"],
    ],
    col_widths=[5*cm, 12*cm]
))
story.append(sp(8))

story.append(h("Top Examiner-Tested Points"))
story.append(sp(3))
exam_pts = [
    ("Attempt limits", "DAS adult = 3 | DAS obstetric = 2 | AIDAA = 3 each device (TT + SGA + mask)"),
    ("CICO technique", "Adults: scalpel-bougie-tube | Paediatric <8yr: cannula + jet ventilation"),
    ("AIDAA's Code D", "Hospital emergency code declared at FIRST sign of difficulty — not after failure"),
    ("AIDAA SpO₂ gate", "Proceed to NEXT attempt ONLY if SpO₂ ≥ 95%"),
    ("AIDAA confirmation", "6 consecutive SUSTAINED capnography waveforms without CO₂ fall"),
    ("AIDAA no hierarchy", "TT / SGA / Facemask — switch freely — whichever achieves oxygenation fastest"),
    ("AIDAA CVF", "Complete Ventilation Failure = immediate cricothyroidotomy, no further device attempts"),
    ("AIDAA SSE", "Staged Sequential Extubation = ETT → AEC → SAD → remove (step-by-step airway handover)"),
    ("AIDAA SAFE", "S-Stratify, A-Assemble/Anticipate, F-Facilitate, E-Evaluate/Escalate"),
    ("AIDAA 3 Ds", "Difficult re-intubation / Deteriorating airway / Dependency on tube"),
    ("AIDAA 3 Ss", "SSE / Supervised extubation / Stay intubated"),
    ("DAS obstetric SAD", "i-gel preferred; maintain cricoid; lowest leak pressure; continuous capnography"),
    ("DAS paediatric", "Maintain spontaneous ventilation in anticipated difficulty; straight blade <2yr"),
    ("DAS AEC", "Can remain up to 72 h; ALWAYS confirm re-intubation with capnography"),
    ("Universal rule", "OXYGENATION > INTUBATION — surgical airway if CICO without further delay"),
]
for label, detail in exam_pts:
    row_data = [[
        Paragraph(label, ParagraphStyle("EL", fontSize=8.5, fontName="Helvetica-Bold",
                  textColor=NAVY, leading=12)),
        Paragraph(detail, ParagraphStyle("ED", fontSize=8.5, fontName="Helvetica",
                  textColor=colors.HexColor("#222222"), leading=12)),
    ]]
    et = Table(row_data, colWidths=[5*cm, 12*cm])
    et.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (0,0), LGRAY),
        ("GRID", (0,0), (-1,-1), 0.3, MGRAY),
        ("LEFTPADDING", (0,0), (-1,-1), 6),
        ("RIGHTPADDING", (0,0), (-1,-1), 6),
        ("TOPPADDING", (0,0), (-1,-1), 4),
        ("BOTTOMPADDING", (0,0), (-1,-1), 4),
        ("VALIGN", (0,0), (-1,-1), "TOP"),
    ]))
    story.append(et)
    story.append(sp(2))

story.append(sp(10))
story.append(highlight_box(
    "UNIVERSAL RULE FOR ALL ALGORITHMS: OXYGENATION > INTUBATION — If CICO, SURGICAL AIRWAY WITHOUT DELAY",
    color=PINK))

# ── FOOTER NOTE ─────────────────────────────────────────────────────────────
story.append(sp(14))
story.append(Paragraph(
    "References: DAS 2015 (Frerk et al., BJA 2015) | DAS Extubation 2012 (Mitchell et al., Anaesthesia) | "
    "DAS/OAA Obstetrics 2015 (Mushambi et al., Anaesthesia) | DAS/APA Paediatrics 2015 | "
    "AIDAA 2025 Intubation (PMC12643155) | AIDAA 2025 Extubation (PMC12643154)",
    ParagraphStyle("Ref", fontSize=7.5, textColor=colors.HexColor("#888888"),
                   fontName="Helvetica-Oblique", leading=11, alignment=TA_CENTER)
))

# ═══════════════════════════════════════════════════════════════════════════
# BUILD PDF
# ═══════════════════════════════════════════════════════════════════════════
doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=A4,
    leftMargin=2*cm, rightMargin=2*cm,
    topMargin=1.8*cm, bottomMargin=1.8*cm,
    title="Difficult Airway Algorithms — Exam Reference",
    author="Orris Medical"
)
doc.build(story)
print(f"PDF created: {OUTPUT}")
Running Command

cd /home/daytona/workspace/difficult-airway-pdf && python generate_pdf.py 2>&1

Running Command

ls -lh /home/daytona/workspace/difficult-airway-pdf/Difficult_Airway_Algorithms.pdf

Your PDF is ready. Download it here:

Difficult Airway Algorithms

PDF Document · PDF


What's inside (8 sections, colour-coded):
  1. DAS 2015 Adult Intubation — Plans A→B→C→D with attempt limits, STOP AND THINK options, eFONA technique
  2. DAS Extubation — Low-risk vs. at-risk stratification, AEC/Remifentanil/SAD exchange techniques
  3. DAS/OAA Obstetrics — RSI, max 2 attempts, wake vs. proceed decision table, CICO
  4. DAS/APA Paediatrics — Age-based algorithms, FONA by age (<8yr needle vs. ≥8yr scalpel)
  5. AIDAA 2025 Intubation — Code D, no-hierarchy rescue, SpO₂ ≥95% gate, CVF trigger
  6. AIDAA 2025 Extubation — SAFE framework, 3 Ds, 3 Ss, Staged Sequential Extubation
  7. Master Comparison Table — All 6 algorithms side by side
  8. Exam Memory Anchors — 15 high-yield examiner-tested points + mnemonics
This is a shared conversation. Sign in to Orris to start your own chat.