Below is the structured review of the entire PPT: “Diabetic and Anaesthesia Concerns”, using only the uploaded presentation. Concise to flowcharts ⸻ PHASE 1 – COMPLETE INFORMATION COLLECTION (NO SUMMARY) 1. Definition Source: Introduction slides Collected information: * Diabetes mellitus is a group of metabolic disorders characterized by chronic hyperglycemia due to defects in insulin secretion, insulin action, or both. * Chronic hyperglycemia causes long-term damage and dysfunction involving: * Eyes * Kidneys * Nerves * Heart * Blood vessels Diabetic and anesthesia concerns.pptx ⸻ 2. Classification of Diabetes (ADA) Collected information The PPT includes four categories: * Type 1 DM * Type 2 DM * Gestational diabetes * Specific diabetes due to other causes * MODY * Neonatal diabetes * Pancreatic diseases * Drug-induced diabetes (glucocorticoids) Diabetic and anesthesia concerns.pptx ⸻ 3. Diagnostic Criteria Collected * Diagnostic criteria slide included * (Values are present in figure/table form in PPT) Diabetic and anesthesia concerns.pptx ⸻ 4. Factors affecting Anaesthetic Management Collected * Type of diabetes * Duration * Oral drugs * Insulin * Glycaemic control * End organ damage * Autonomic dysfunction * Minor surgery * Major surgery Diabetic and anesthesia concerns.pptx ⸻ 5. Oral Hypoglycaemic Drugs Collected recommendations Sulfonylureas * Long acting: Stop 48–72 hours before surgery * Short acting: Omit previous night or morning dose Metformin * Stop 24 hours before surgery * Restart 48 hours after major surgery Thiazolidinediones * Omit morning dose Alpha-glucosidase inhibitors * No effect on fasting glucose Diabetic and anesthesia concerns.pptx ⸻ 6. Assessment of Glycaemic Control Collected History * Hyperglycaemia * Hypoglycaemia * Compliance Investigations * FBS * PPBS * GTT * HbA1c Diabetic and anesthesia concerns.pptx ⸻ 7. HbA1c Collected * Nonenzymatic glycosylation * Reflects previous 60–90 days * Normal 4–6% Diabetic and anesthesia concerns.pptx ⸻ 8. Respiratory Changes Collected * Increased respiratory infections * Reduced ventilatory response to hypoxia * Reduced ventilatory response to hypercarbia * Increased sensitivity to respiratory depressants * Reduced FEV1 * Reduced FVC * Reduced diffusion capacity * Reduced 2,3 DPG * Altered oxygen transport Diabetic and anesthesia concerns.pptx ⸻ 9. Neurological Changes Collected Mechanisms * Sorbitol accumulation * Vasa nervorum ischemia * Advanced glycation end products Diabetic and anesthesia concerns.pptx ⸻ 10. Diabetic Autonomic Neuropathy Collected Symptoms * Early satiety * Gastroparesis * Nausea * Vomiting * Reflux * Nocturnal diarrhoea * Constipation * Abdominal distension * Orthostatic hypotension * Bladder atony * Urinary retention * Erectile dysfunction * Retrograde ejaculation * Palpitations * Reduced sweating * Temperature dysregulation * Sensory discomfort Diabetic and anesthesia concerns.pptx ⸻ 11. Tests for DAN Collected Sympathetic * BP response to standing * Handgrip test * Valsalva Parasympathetic * Resting tachycardia * HR variability * HR response standing * Valsalva response DAN scoring system included Diabetic and anesthesia concerns.pptx ⸻ 12. Stiff Joint Syndrome Collected Assessment * Prayer sign * Palm print test * Short stature * Tight waxy skin * Cervical spine X-ray Diabetic and anesthesia concerns.pptx ⸻ 13. Anaesthetic Considerations Collected * GA * Regional anaesthesia * Nerve blocks Effects * Epidural suppresses stress hormone response * Less glucose derangement * GA causes increased stress hormones Diabetic and anesthesia concerns.pptx ⸻ 14. Effect of Anaesthetic Drugs Collected Etomidate * ↓ cortisol * ↓ hyperglycaemia Benzodiazepines * ↓ ACTH * ↓ cortisol High-dose opioids * Block sympathetic response * Abolish hyperglycaemia Halothane Enflurane Isoflurane * Reduce insulin secretion * Dose dependent * Reversible Diabetic and anesthesia concerns.pptx ⸻ 15. Preoperative Evaluation Collected Objectives * Determine type of diabetes * Assess duration * End organ damage * Improve glycaemic control * Short acting insulin conversion * Reduce mortality * Reduce cost * Short hospital stay Diabetic and anesthesia concerns.pptx ⸻ 16. Cardiovascular Screening Collected Recommended in * Elderly * Smokers * Hypertension * Hyperlipidaemia * Asymptomatic diabetics Diabetic and anesthesia concerns.pptx ⸻ 17. Investigations Collected * ECG * HbA1c * FBS * PPBS * KFT * Urine albumin * Fundus * Chest X-ray * Echo * Cervical spine * ABG * Ketones * Electrolytes Diabetic and anesthesia concerns.pptx ⸻ 18. Aims of Perioperative Glucose Management Collected Dedicated slide included. Diabetic and anesthesia concerns.pptx ⸻ 19. Minor vs Major Surgery Collected Minor * Day care surgery Major * Overnight admission Diabetic and anesthesia concerns.pptx ⸻ 20. Insulin Infusion Protocol Collected Target glucose 120–180 mg/dL Infusion 1–2 U/hour Potassium Supplement if <3.5 Detailed insulin algorithm <70 71–100 101–150 151–200 201–250 251–300 300 mg/dL Preparation 100 U insulin in 100 mL NS 1 U/mL 1 unit lowers glucose 25–30 mg/dL Hourly infusion Total daily dose/24 Approximate 0.02 U/kg/hour Diabetic and anesthesia concerns.pptx ⸻ 21. Regional Anaesthesia Collected Dedicated slide describing advantages in diabetic patients. Diabetic and anesthesia concerns.pptx ⸻ 22. Disadvantages of Regional Anaesthesia Collected Dedicated slide discussing disadvantages. Diabetic and anesthesia concerns.pptx ⸻ 23. General Anaesthesia Collected Dedicated section discussing general anaesthetic considerations. Diabetic and anesthesia concerns.pptx ⸻ PHASE 2 – GAP CHECK Strengths The PPT comprehensively covers: * Definition * Classification * Diagnosis * Preoperative assessment * End-organ involvement * Autonomic neuropathy * Airway assessment * Drug modifications * Insulin protocols * Intraoperative glucose management * Regional vs general anaesthesia Unique points * Detailed autonomic neuropathy testing. * Prayer sign and palm print test for airway prediction. * Drug-specific effects of anaesthetic agents on glucose metabolism. * Practical insulin infusion protocol with dose adjustments. * DAN scoring. Conflicting recommendations No major internal conflicts were identified. The PPT consistently targets an intraoperative glucose range of 120–180 mg/dL and recommends corresponding insulin infusion protocols. Diabetic and anesthesia concerns.pptx Important omissions The presentation does not adequately discuss: * Modern recommendations for SGLT2 inhibitors (e.g., withholding 3–4 days before surgery). * GLP-1 receptor agonists and current perioperative guidance. * Continuous glucose monitoring (CGM). * Enhanced Recovery After Surgery (ERAS) considerations. * Management of diabetic ketoacidosis (DKA) and hyperosmolar hyperglycaemic state (HHS). * Perioperative steroid management in diabetic patients. * Detailed postoperative glucose control protocols. * Obstetric anaesthesia considerations in gestational diabetes. * ASA, ADA, AACE, and ESAIC guideline updates beyond the information presented. ⸻ PHASE 3 – FINAL ASSESSMENT As a teaching presentation for MD Anaesthesia, this PPT is well structured and clinically relevant, particularly in its emphasis on: * End-organ assessment. * Diabetic autonomic neuropathy. * Airway evaluation (stiff joint syndrome). * Perioperative glucose targets. * Practical insulin infusion protocols. * Comparative anaesthetic considerations for regional versus general anaesthesia. For an MD university theory examination, however, it would benefit from the inclusion of current international guideline updates, newer antidiabetic medications, emergency diabetic states (DKA/HHS), and more detailed postoperative management to achieve a distinction-level standard.
mkdir -p /tmp/workspace/diabetic-anaesthesia && ls /tmp/workspace/
~/diabetic-anaesthesia/build_flowcharts.py
"""
Diabetic and Anaesthesia Concerns – Clinical Flowcharts (Word Document)
Three flowcharts:
1. Perioperative Management of the Diabetic Patient
2. Insulin Infusion Protocol
3. Anaesthesia Choice: Regional vs General Anaesthesia
"""
from docx import Document
from docx.shared import Pt, Inches, RGBColor
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.enum.table import WD_TABLE_ALIGNMENT, WD_ALIGN_VERTICAL
from docx.oxml.ns import qn
from docx.oxml import OxmlElement
# ──────────────────────────────────────────────
# Helper utilities
# ──────────────────────────────────────────────
def set_cell_background(cell, hex_color):
"""Fill a table cell with a solid colour (hex without #)."""
tc = cell._tc
tcPr = tc.get_or_add_tcPr()
shd = OxmlElement("w:shd")
shd.set(qn("w:val"), "clear")
shd.set(qn("w:color"), "auto")
shd.set(qn("w:fill"), hex_color)
tcPr.append(shd)
def set_cell_borders(cell, top=None, bottom=None, left=None, right=None):
"""Set individual cell borders. Pass hex colour string or None to skip."""
tc = cell._tc
tcPr = tc.get_or_add_tcPr()
tcBorders = OxmlElement("w:tcBorders")
for side, color in [("top", top), ("bottom", bottom), ("left", left), ("right", right)]:
if color is not None:
el = OxmlElement(f"w:{side}")
el.set(qn("w:val"), "single")
el.set(qn("w:sz"), "12")
el.set(qn("w:space"), "0")
el.set(qn("w:color"), color)
tcBorders.append(el)
tcPr.append(tcBorders)
def no_space_para(doc_or_table_cell):
"""Return a paragraph with zero space before/after (used inside cells)."""
pass
def box(doc, text, bg="1F4E79", fg="FFFFFF", size=11, bold=True,
width=None, align=WD_ALIGN_PARAGRAPH.CENTER):
"""Add a single-row single-cell table acting as a flowchart box."""
tbl = doc.add_table(rows=1, cols=1)
tbl.alignment = WD_TABLE_ALIGNMENT.CENTER
tbl.style = "Table Grid"
cell = tbl.rows[0].cells[0]
if width:
cell.width = Inches(width)
set_cell_background(cell, bg)
p = cell.paragraphs[0]
p.alignment = align
pPr = p._p.get_or_add_pPr()
spacing = OxmlElement("w:spacing")
spacing.set(qn("w:before"), "60")
spacing.set(qn("w:after"), "60")
pPr.append(spacing)
run = p.add_run(text)
run.font.bold = bold
run.font.size = Pt(size)
run.font.color.rgb = RGBColor(*bytes.fromhex(fg))
run.font.name = "Arial"
return tbl
def arrow(doc):
"""Add a centred down-arrow paragraph."""
p = doc.add_paragraph("▼")
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = p.runs[0]
run.font.size = Pt(14)
run.font.color.rgb = RGBColor(0x1F, 0x4E, 0x79)
run.font.bold = True
pPr = p._p.get_or_add_pPr()
spacing = OxmlElement("w:spacing")
spacing.set(qn("w:before"), "0")
spacing.set(qn("w:after"), "0")
pPr.append(spacing)
def diamond(doc, text, bg="C00000", fg="FFFFFF", size=10):
"""Decision box (red by default)."""
return box(doc, text, bg=bg, fg=fg, size=size, bold=True)
def section_title(doc, title):
p = doc.add_heading(title, level=2)
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
for run in p.runs:
run.font.name = "Arial"
run.font.color.rgb = RGBColor(0x1F, 0x4E, 0x79)
def spacer(doc, lines=1):
for _ in range(lines):
p = doc.add_paragraph("")
pPr = p._p.get_or_add_pPr()
sp = OxmlElement("w:spacing")
sp.set(qn("w:before"), "0")
sp.set(qn("w:after"), "40")
pPr.append(sp)
def two_col_box(doc, left_text, right_text,
left_bg="2E75B6", right_bg="375623",
fg="FFFFFF", size=9.5):
"""Two side-by-side boxes in one table row."""
tbl = doc.add_table(rows=1, cols=3)
tbl.alignment = WD_TABLE_ALIGNMENT.CENTER
tbl.style = "Table Grid"
# left box
cl = tbl.rows[0].cells[0]
cl.width = Inches(2.8)
set_cell_background(cl, left_bg)
pl = cl.paragraphs[0]
pl.alignment = WD_ALIGN_PARAGRAPH.CENTER
pl.add_run(left_text).font.color.rgb = RGBColor(*bytes.fromhex(fg))
pl.runs[0].font.bold = True
pl.runs[0].font.size = Pt(size)
pl.runs[0].font.name = "Arial"
# middle spacer
cm = tbl.rows[0].cells[1]
cm.width = Inches(0.4)
set_cell_background(cm, "FFFFFF")
# remove borders on spacer cell
tc = cm._tc
tcPr = tc.get_or_add_tcPr()
tcBorders = OxmlElement("w:tcBorders")
for side in ["top", "bottom", "left", "right"]:
el = OxmlElement(f"w:{side}")
el.set(qn("w:val"), "nil")
tcBorders.append(el)
tcPr.append(tcBorders)
# right box
cr = tbl.rows[0].cells[2]
cr.width = Inches(2.8)
set_cell_background(cr, right_bg)
pr = cr.paragraphs[0]
pr.alignment = WD_ALIGN_PARAGRAPH.CENTER
pr.add_run(right_text).font.color.rgb = RGBColor(*bytes.fromhex(fg))
pr.runs[0].font.bold = True
pr.runs[0].font.size = Pt(size)
pr.runs[0].font.name = "Arial"
return tbl
def multi_row_table(doc, headers, rows_data, header_bg="1F4E79", row_bg="DEEAF1",
alt_bg="BDD7EE"):
"""General purpose table with coloured header and alternating rows."""
num_cols = len(headers)
tbl = doc.add_table(rows=1 + len(rows_data), cols=num_cols)
tbl.style = "Table Grid"
tbl.alignment = WD_TABLE_ALIGNMENT.CENTER
# header
for i, h in enumerate(headers):
c = tbl.rows[0].cells[i]
set_cell_background(c, header_bg)
p = c.paragraphs[0]
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = p.add_run(h)
run.font.bold = True
run.font.size = Pt(10)
run.font.color.rgb = RGBColor(0xFF, 0xFF, 0xFF)
run.font.name = "Arial"
# data rows
for ri, row in enumerate(rows_data):
bg = row_bg if ri % 2 == 0 else alt_bg
for ci, val in enumerate(row):
c = tbl.rows[ri + 1].cells[ci]
set_cell_background(c, bg)
p = c.paragraphs[0]
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = p.add_run(str(val))
run.font.size = Pt(9.5)
run.font.name = "Arial"
return tbl
# ──────────────────────────────────────────────
# Document setup
# ──────────────────────────────────────────────
doc = Document()
# Page margins
section = doc.sections[0]
section.page_width = Inches(8.27)
section.page_height = Inches(11.69)
section.top_margin = Inches(0.75)
section.bottom_margin = Inches(0.75)
section.left_margin = Inches(0.9)
section.right_margin = Inches(0.9)
# Global styles
normal = doc.styles["Normal"]
normal.font.name = "Arial"
normal.font.size = Pt(11)
h1 = doc.styles["Heading 1"]
h1.font.name = "Arial"
h1.font.size = Pt(16)
h1.font.bold = True
h1.font.color.rgb = RGBColor(0x1F, 0x4E, 0x79)
h2 = doc.styles["Heading 2"]
h2.font.name = "Arial"
h2.font.size = Pt(13)
h2.font.bold = True
h2.font.color.rgb = RGBColor(0x2E, 0x75, 0xB6)
# Cover heading
title_p = doc.add_heading("Diabetic and Anaesthesia Concerns", level=1)
title_p.alignment = WD_ALIGN_PARAGRAPH.CENTER
sub = doc.add_paragraph("Clinical Flowcharts – Perioperative Management")
sub.alignment = WD_ALIGN_PARAGRAPH.CENTER
sub.runs[0].font.size = Pt(11)
sub.runs[0].font.italic = True
sub.runs[0].font.color.rgb = RGBColor(0x40, 0x40, 0x40)
doc.add_paragraph("")
# ══════════════════════════════════════════════════════════════
# FLOWCHART 1 – PERIOPERATIVE MANAGEMENT
# ══════════════════════════════════════════════════════════════
section_title(doc, "FLOWCHART 1: Perioperative Management of the Diabetic Patient")
spacer(doc)
# --- PREOPERATIVE ---
box(doc, "DIABETIC PATIENT SCHEDULED FOR SURGERY", bg="1F4E79", size=11)
arrow(doc)
box(doc, "PREOPERATIVE ASSESSMENT", bg="2E75B6", size=11)
arrow(doc)
# Preop details table
multi_row_table(doc,
["Assessment Domain", "Key Points"],
[
("Type & Duration", "Type 1 / Type 2 / Gestational / Other cause"),
("Glycaemic Control", "HbA1c (target <7–8%), FBS, PPBS — reflect 60-90 day control"),
("End-Organ Damage", "Cardiovascular, Renal (KFT, urine albumin), Retinal (fundus), Neuro"),
("Autonomic Neuropathy", "Gastroparesis, orthostatic hypotension, bladder atony — screen with DAN tests"),
("Airway Assessment", "Stiff Joint Syndrome: Prayer sign + Palm print test; Cervical X-ray if indicated"),
("Investigations", "ECG, Echo, CXR, ABG, Electrolytes, Ketones, Cervical spine X-ray"),
("Cardiovascular Screen", "Mandatory if: elderly, smoker, hypertensive, hyperlipidaemic, asymptomatic"),
],
header_bg="1F4E79", row_bg="DEEAF1", alt_bg="BDD7EE"
)
arrow(doc)
box(doc, "ORAL HYPOGLYCAEMIC DRUG MANAGEMENT", bg="2E75B6", size=11)
arrow(doc)
multi_row_table(doc,
["Drug Class", "Action Before Surgery"],
[
("Sulfonylureas – Long acting (e.g. Glibenclamide)", "STOP 48–72 hours before surgery"),
("Sulfonylureas – Short acting (e.g. Glipizide)", "Omit evening/morning dose before surgery"),
("Metformin", "Stop 24 h before surgery; restart ≥48 h after major surgery"),
("Thiazolidinediones", "Omit morning dose on day of surgery"),
("Alpha-glucosidase inhibitors", "No effect on fasting glucose; may omit"),
],
header_bg="375623", row_bg="E2EFDA", alt_bg="C6E0B4"
)
arrow(doc)
# --- INTRAOPERATIVE ---
box(doc, "INTRAOPERATIVE PHASE", bg="1F4E79", size=11)
arrow(doc)
box(doc, "TARGET BLOOD GLUCOSE: 120–180 mg/dL", bg="C00000", fg="FFFFFF", size=11)
arrow(doc)
box(doc, "Minor Surgery (Day Care)\n Monitor glucose hourly | Resume oral meds post-op",
bg="375623", size=10)
arrow(doc)
box(doc, "Major Surgery (Overnight Admission)\n Insulin infusion protocol | IV glucose | Electrolyte monitoring",
bg="7B2C2C", size=10)
arrow(doc)
# --- POSTOPERATIVE ---
box(doc, "POSTOPERATIVE PHASE", bg="2E75B6", size=11)
arrow(doc)
multi_row_table(doc,
["Concern", "Management"],
[
("Glucose monitoring", "Hourly until stable, then 2–4 hourly"),
("Insulin transition", "Convert to SC insulin when eating; wean infusion"),
("Metformin restart", "Only after ≥48 h and confirmed normal renal function"),
("Oral agents restart", "Resume when tolerating oral intake"),
("Autonomic instability", "Watch for aspiration risk (gastroparesis), postural hypotension"),
("Wound healing", "Monitor for delayed healing and infection (hyperglycaemia risk)"),
],
header_bg="1F4E79", row_bg="DEEAF1", alt_bg="BDD7EE"
)
spacer(doc, 2)
# ══════════════════════════════════════════════════════════════
# FLOWCHART 2 – INSULIN INFUSION PROTOCOL
# ══════════════════════════════════════════════════════════════
doc.add_page_break()
section_title(doc, "FLOWCHART 2: Insulin Infusion Protocol (Intraoperative / ICU)")
spacer(doc)
box(doc, "INDICATION: Major surgery, ICU, or glucose consistently >180 mg/dL", bg="1F4E79", size=11)
arrow(doc)
box(doc, "PREPARATION\n100 U Regular Insulin in 100 mL Normal Saline = 1 U / mL", bg="2E75B6", size=11)
arrow(doc)
box(doc, "STARTING RATE\nTotal Daily Dose ÷ 24 ≈ 0.02 U/kg/hour\n(Typical range: 1–2 U/hour)", bg="375623", size=11)
arrow(doc)
box(doc, "CHECK BLOOD GLUCOSE HOURLY", bg="C00000", size=11)
arrow(doc)
# Glucose algorithm table
multi_row_table(doc,
["Blood Glucose (mg/dL)", "Action"],
[
("< 70", "STOP infusion | Give 25 mL 50% Dextrose IV | Recheck in 15 min"),
("71 – 100", "Reduce infusion by 50% | Recheck in 30 min | Consider dextrose supplement"),
("101 – 150", "Reduce infusion rate by 25%"),
("151 – 200 (TARGET ZONE)", "Continue current rate — No change"),
("201 – 250", "Increase infusion rate by 1 U/hour"),
("251 – 300", "Increase infusion rate by 2 U/hour | Check for ketones"),
("> 300", "Increase infusion rate by 2–3 U/hour | Urgent review | Check ketones & electrolytes"),
],
header_bg="7B2C2C", row_bg="FCE4D6", alt_bg="F4B8A0"
)
arrow(doc)
box(doc, "POTASSIUM MONITORING\nSupplement potassium if K⁺ < 3.5 mEq/L\n(Insulin drives K⁺ intracellularly)", bg="7B2C2C", size=10)
arrow(doc)
box(doc, "Note: 1 Unit of insulin lowers blood glucose by approximately 25–30 mg/dL",
bg="BDD7EE", fg="000000", size=10, bold=False)
arrow(doc)
box(doc, "TRANSITION TO SUBCUTANEOUS INSULIN\nWhen: patient eating + haemodynamically stable\nOverlap IV and SC for 1–2 hours before stopping infusion",
bg="1F4E79", size=10)
spacer(doc, 2)
# ══════════════════════════════════════════════════════════════
# FLOWCHART 3 – ANAESTHESIA CHOICE: REGIONAL vs GA
# ══════════════════════════════════════════════════════════════
doc.add_page_break()
section_title(doc, "FLOWCHART 3: Anaesthesia Choice – Regional vs General Anaesthesia")
spacer(doc)
box(doc, "DIABETIC PATIENT — ANAESTHESIA DECISION", bg="1F4E79", size=12)
arrow(doc)
diamond(doc, "Is the surgical site amenable to regional anaesthesia?", bg="C00000", size=10)
arrow(doc)
two_col_box(doc,
"YES → Consider Regional Anaesthesia",
"NO → Proceed to General Anaesthesia",
left_bg="375623", right_bg="7B2C2C"
)
spacer(doc)
arrow(doc)
spacer(doc)
# Side-by-side comparison table
tbl = doc.add_table(rows=1, cols=2)
tbl.style = "Table Grid"
tbl.alignment = WD_TABLE_ALIGNMENT.CENTER
# Column widths
for i in range(2):
tbl.rows[0].cells[i].width = Inches(2.9)
# Headers
headers = ["REGIONAL ANAESTHESIA", "GENERAL ANAESTHESIA"]
header_bgs = ["375623", "7B2C2C"]
for i, (hdr, bg) in enumerate(zip(headers, header_bgs)):
c = tbl.rows[0].cells[i]
set_cell_background(c, bg)
p = c.paragraphs[0]
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
run = p.add_run(hdr)
run.font.bold = True
run.font.size = Pt(11)
run.font.color.rgb = RGBColor(0xFF, 0xFF, 0xFF)
run.font.name = "Arial"
# Content rows
ra_advantages = [
("Advantages", [
"Epidural suppresses stress hormone response",
"Less glucose derangement intraoperatively",
"Reduced hyperglycaemia",
"Better postoperative pain control",
"Faster recovery",
"Preferred if gastroparesis (reduces aspiration risk)",
"No need for airway instrumentation",
]),
("Disadvantages", [
"Risk of hypotension (autonomic neuropathy amplifies this)",
"Pre-existing peripheral neuropathy complicates documentation",
"Infection risk in poorly controlled diabetics",
"Technical difficulty if stiff joint syndrome",
"Inadequate block possible",
]),
]
ga_content = [
("Drug effects on glucose", [
"Halothane / Enflurane / Isoflurane: reduce insulin secretion (dose-dependent, reversible)",
"Etomidate: ↓ cortisol → ↓ hyperglycaemia",
"Benzodiazepines: ↓ ACTH & cortisol",
"High-dose opioids: block sympathetic response, abolish hyperglycaemia",
]),
("Key concerns", [
"GA causes elevated stress hormones → hyperglycaemia",
"Increased glucose derangement vs regional",
"Gastroparesis → full stomach risk → RSI",
"Stiff Joint Syndrome → difficult airway anticipated",
"Autonomic neuropathy → haemodynamic instability under GA",
"Sensitive to respiratory depressants",
"Reduced FEV1, FVC, diffusion capacity",
]),
]
def add_comparison_rows(tbl, left_sections, right_sections):
max_items = max(
sum(len(items) + 1 for _, items in left_sections),
sum(len(items) + 1 for _, items in right_sections)
)
# Flatten
left_flat = []
for title, items in left_sections:
left_flat.append(("heading", title))
for item in items:
left_flat.append(("item", item))
right_flat = []
for title, items in right_sections:
right_flat.append(("heading", title))
for item in items:
right_flat.append(("item", item))
n = max(len(left_flat), len(right_flat))
for ri in range(n):
row = tbl.add_row()
for ci, flat in enumerate([left_flat, right_flat]):
cell = row.cells[ci]
cell.width = Inches(2.9)
if ri < len(flat):
kind, text = flat[ri]
if kind == "heading":
bg_col = "C6E0B4" if ci == 0 else "FCE4D6"
set_cell_background(cell, bg_col)
p = cell.paragraphs[0]
run = p.add_run(text)
run.font.bold = True
run.font.size = Pt(9.5)
run.font.name = "Arial"
run.font.color.rgb = RGBColor(0x1F, 0x4E, 0x79) if ci == 0 else RGBColor(0x7B, 0x2C, 0x2C)
else:
bg_col = "E2EFDA" if ci == 0 else "FFF2CC"
set_cell_background(cell, bg_col)
p = cell.paragraphs[0]
run = p.add_run("• " + text)
run.font.size = Pt(9)
run.font.name = "Arial"
else:
set_cell_background(cell, "F2F2F2")
add_comparison_rows(tbl, ra_advantages, ga_content)
spacer(doc)
arrow(doc)
spacer(doc)
box(doc, "DECISION SUMMARY", bg="1F4E79", size=11)
arrow(doc)
multi_row_table(doc,
["Situation", "Preferred Anaesthesia", "Rationale"],
[
("Lower limb / perineal surgery", "Regional (spinal/epidural)", "Less stress response, avoids airway"),
("Gastroparesis present", "Regional preferred if possible", "Reduces aspiration risk"),
("Stiff Joint Syndrome", "Awake fibre-optic intubation if GA needed", "Difficult airway anticipated"),
("Autonomic neuropathy", "Epidural with caution", "Monitor BP closely; have vasopressors ready"),
("Upper abdominal / thoracic surgery", "GA ± epidural", "Regional alone insufficient"),
("Emergency surgery", "GA + RSI", "No time for full regional; control airway"),
("Peripheral neuropathy (pre-existing)", "Document deficits before block", "Medico-legal protection"),
],
header_bg="1F4E79", row_bg="DEEAF1", alt_bg="BDD7EE"
)
# ──────────────────────────────────────────────
# Save
# ──────────────────────────────────────────────
out_path = "/tmp/workspace/diabetic-anaesthesia/Diabetic_Anaesthesia_Flowcharts.docx"
doc.save(out_path)
print(f"Saved: {out_path}")
cd /tmp/workspace/diabetic-anaesthesia && python3 build_flowcharts.py 2>&1
python3 -c " from docx import Document doc = Document('/tmp/workspace/diabetic-anaesthesia/Diabetic_Anaesthesia_Flowcharts.docx') headings = [p.text for p in doc.paragraphs if p.style.name.startswith('Heading')] print('Headings found:', headings) print('Total paragraphs:', len(doc.paragraphs)) print('Total tables:', len(doc.tables)) "
Diabetic Anaesthesia Flowcharts
Word Document · DOCX
From the above ppt i want to summarise the important fields to flow charts and graphs and concise accordingly
python3 -c " from pptx import Presentation prs = Presentation('/tmp/workspace/attachments/5cd1516e-ab0a-4e80-b0b8-608dbaf25a1a/Diabetic and anesthesia concerns.pptx') for i, slide in enumerate(prs.slides, 1): texts = [] for shape in slide.shapes: if shape.has_text_frame: t = shape.text_frame.text.strip() if t: texts.append(t) if texts: print(f'=== SLIDE {i} ===') for t in texts: print(t) print() " 2>&1 | head -400
~/diabetic-anaesthesia/build_full_summary.py
"""
Diabetic and Anaesthesia Concerns – Complete PPT Summary as Flowcharts & Concise Tables
Covers ALL major sections from the uploaded PPT.
"""
from docx import Document
from docx.shared import Pt, Inches, RGBColor
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.enum.table import WD_TABLE_ALIGNMENT, WD_ALIGN_VERTICAL
from docx.oxml.ns import qn
from docx.oxml import OxmlElement
# ─────────────────────────── HELPERS ───────────────────────────
def shd(cell, hex_color):
tc = cell._tc
tcPr = tc.get_or_add_tcPr()
s = OxmlElement("w:shd")
s.set(qn("w:val"), "clear")
s.set(qn("w:color"), "auto")
s.set(qn("w:fill"), hex_color)
tcPr.append(s)
def no_border_cell(cell):
tc = cell._tc
tcPr = tc.get_or_add_tcPr()
b = OxmlElement("w:tcBorders")
for side in ["top","bottom","left","right","insideH","insideV"]:
el = OxmlElement(f"w:{side}")
el.set(qn("w:val"),"nil")
b.append(el)
tcPr.append(b)
def cell_para(cell, text, bold=False, size=10, color="000000",
align=WD_ALIGN_PARAGRAPH.CENTER, italic=False):
p = cell.paragraphs[0]
p.alignment = align
pPr = p._p.get_or_add_pPr()
sp = OxmlElement("w:spacing")
sp.set(qn("w:before"), "40"); sp.set(qn("w:after"), "40")
pPr.append(sp)
run = p.add_run(text)
run.font.bold = bold
run.font.italic = italic
run.font.size = Pt(size)
run.font.name = "Arial"
run.font.color.rgb = RGBColor(*bytes.fromhex(color))
def arrow_para(doc, char="▼", color="1F4E79"):
p = doc.add_paragraph(char)
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
r = p.runs[0]
r.font.size = Pt(13); r.font.bold = True
r.font.name = "Arial"
r.font.color.rgb = RGBColor(*bytes.fromhex(color))
pPr = p._p.get_or_add_pPr()
sp = OxmlElement("w:spacing")
sp.set(qn("w:before"),"0"); sp.set(qn("w:after"),"0")
pPr.append(sp)
def spacer(doc, before=40, after=40):
p = doc.add_paragraph("")
pPr = p._p.get_or_add_pPr()
sp = OxmlElement("w:spacing")
sp.set(qn("w:before"), str(before))
sp.set(qn("w:after"), str(after))
pPr.append(sp)
def flow_box(doc, text, bg="1F4E79", fg="FFFFFF", size=10.5, bold=True, width=5.5,
align=WD_ALIGN_PARAGRAPH.CENTER):
t = doc.add_table(rows=1, cols=1)
t.alignment = WD_TABLE_ALIGNMENT.CENTER
t.style = "Table Grid"
c = t.rows[0].cells[0]
c.width = Inches(width)
shd(c, bg)
cell_para(c, text, bold=bold, size=size, color=fg, align=align)
return t
def section_heading(doc, text, level=1, color="1F4E79"):
p = doc.add_heading(text, level=level)
p.alignment = WD_ALIGN_PARAGRAPH.CENTER
for run in p.runs:
run.font.name = "Arial"
run.font.color.rgb = RGBColor(*bytes.fromhex(color))
def hr(doc):
"""Thin horizontal rule via a 1-row table with bottom border only."""
t = doc.add_table(rows=1, cols=1)
t.alignment = WD_TABLE_ALIGNMENT.CENTER
c = t.rows[0].cells[0]
c.width = Inches(6.5)
shd(c, "D0D0D0")
cell_para(c, "", size=2)
def make_table(doc, headers, rows, hdr_bg="1F4E79", row_bgs=("DEEAF1","BDD7EE"),
col_widths=None):
n = len(headers)
t = doc.add_table(rows=1+len(rows), cols=n)
t.style = "Table Grid"
t.alignment = WD_TABLE_ALIGNMENT.CENTER
if col_widths:
for ci, w in enumerate(col_widths):
for row in t.rows:
row.cells[ci].width = Inches(w)
# header row
for ci, h in enumerate(headers):
c = t.rows[0].cells[ci]
shd(c, hdr_bg)
cell_para(c, h, bold=True, size=10, color="FFFFFF")
# data rows
for ri, row in enumerate(rows):
for ci, val in enumerate(row):
c = t.rows[ri+1].cells[ci]
shd(c, row_bgs[ri % len(row_bgs)])
cell_para(c, str(val), size=9.5)
return t
def decision_box(doc, text, bg="C00000", fg="FFFFFF", width=5.5):
"""Red rhombus-like decision node using a box with ◆ indicator."""
return flow_box(doc, "◆ " + text, bg=bg, fg=fg, size=10, width=width)
def branch_table(doc, left_label, right_label, left_bg="375623", right_bg="7B2C2C",
fg="FFFFFF", size=10):
t = doc.add_table(rows=1, cols=3)
t.alignment = WD_TABLE_ALIGNMENT.CENTER
t.style = "Table Grid"
# left
cl = t.rows[0].cells[0]; cl.width = Inches(2.6)
shd(cl, left_bg)
cell_para(cl, left_label, bold=True, size=size, color=fg)
# spacer
cm = t.rows[0].cells[1]; cm.width = Inches(0.3)
shd(cm, "FFFFFF"); no_border_cell(cm)
cell_para(cm, "")
# right
cr = t.rows[0].cells[2]; cr.width = Inches(2.6)
shd(cr, right_bg)
cell_para(cr, right_label, bold=True, size=size, color=fg)
return t
# ─────────────────────────── DOCUMENT ───────────────────────────
doc = Document()
sec = doc.sections[0]
sec.page_width = Inches(8.27); sec.page_height = Inches(11.69)
sec.top_margin = Inches(0.7); sec.bottom_margin = Inches(0.7)
sec.left_margin = Inches(0.85); sec.right_margin = Inches(0.85)
normal = doc.styles["Normal"]
normal.font.name = "Arial"; normal.font.size = Pt(10.5)
for lvl, sz, col in [(1,16,"1F4E79"),(2,13,"2E75B6"),(3,11,"375623")]:
s = doc.styles[f"Heading {lvl}"]
s.font.name = "Arial"; s.font.size = Pt(sz); s.font.bold = True
s.font.color.rgb = RGBColor(*bytes.fromhex(col))
# ══════════════════ TITLE PAGE ══════════════════
title = doc.add_heading("DIABETIC AND ANAESTHESIA CONCERNS", level=1)
title.alignment = WD_ALIGN_PARAGRAPH.CENTER
sub = doc.add_paragraph("Complete PPT Summary — Flowcharts & Concise Reference")
sub.alignment = WD_ALIGN_PARAGRAPH.CENTER
sub.runs[0].font.italic = True; sub.runs[0].font.size = Pt(11)
sub.runs[0].font.color.rgb = RGBColor(0x55,0x55,0x55)
doc.add_paragraph("")
# ══════════════════ FC 1: DEFINITION & CLASSIFICATION ══════════════════
section_heading(doc, "1. DEFINITION & CLASSIFICATION (ADA)", level=2)
spacer(doc)
flow_box(doc, "DIABETES MELLITUS", bg="1F4E79", size=12)
arrow_para(doc)
flow_box(doc,
"Group of metabolic disorders → chronic HYPERGLYCAEMIA\n"
"Defects in: insulin secretion | insulin action | BOTH\n"
"Long-term damage: Eyes · Kidneys · Nerves · Heart · Blood Vessels",
bg="2E75B6", size=10)
arrow_para(doc)
flow_box(doc, "ADA CLASSIFICATION — 4 Categories", bg="375623", size=11)
# 4-branch classification table
t = doc.add_table(rows=2, cols=4)
t.style = "Table Grid"
t.alignment = WD_TABLE_ALIGNMENT.CENTER
headers_cls = ["TYPE 1 DM", "TYPE 2 DM", "GESTATIONAL DM", "SPECIFIC TYPES"]
bgs_cls = ["1F4E79","2E75B6","375623","7B2C2C"]
desc_cls = [
"Autoimmune β-cell destruction\n→ Absolute insulin deficiency",
"Progressive β-cell secretion loss\n+ Insulin resistance",
"Diagnosed in 2nd/3rd trimester\n(not pre-existing)",
"MODY, Neonatal DM\nPancreatic disease\nDrug-induced (glucocorticoids)"
]
for ci in range(4):
c = t.rows[0].cells[ci]; c.width = Inches(1.5)
shd(c, bgs_cls[ci])
cell_para(c, headers_cls[ci], bold=True, size=9.5, color="FFFFFF")
c2 = t.rows[1].cells[ci]; c2.width = Inches(1.5)
shd(c2, "DEEAF1")
cell_para(c2, desc_cls[ci], size=9, align=WD_ALIGN_PARAGRAPH.LEFT)
spacer(doc)
doc.add_page_break()
# ══════════════════ FC 2: DIAGNOSTIC CRITERIA ══════════════════
section_heading(doc, "2. DIAGNOSTIC CRITERIA (ADA)", level=2)
spacer(doc)
flow_box(doc, "DIAGNOSIS OF DIABETES MELLITUS", bg="1F4E79", size=11)
arrow_para(doc)
make_table(doc,
["Criterion", "Threshold", "Note"],
[
("Fasting Plasma Glucose (FPG)", "≥ 126 mg/dL (7.0 mmol/L)", "No caloric intake ≥ 8 h"),
("2-hr Plasma Glucose (OGTT)", "≥ 200 mg/dL (11.1 mmol/L)", "75 g oral glucose load"),
("HbA1c", "≥ 6.5%", "Standardised NGSP/DCCT assay"),
("Random Plasma Glucose + Symptoms", "≥ 200 mg/dL (11.1 mmol/L)", "Classic symptoms of hyperglycaemia"),
("Pre-diabetes: Impaired FPG", "100–125 mg/dL", "Repeat test to confirm"),
("Pre-diabetes: HbA1c", "5.7–6.4%", "High risk; lifestyle intervention"),
("Normal FPG", "< 100 mg/dL", ""),
],
hdr_bg="1F4E79",
col_widths=[2.5, 2.0, 2.0]
)
spacer(doc)
# HbA1c box
flow_box(doc,
"HbA1c — KEY FACTS\n"
"Non-enzymatic glycosylation of haemoglobin\n"
"Reflects blood glucose over preceding 60–90 days\n"
"Normal: 4–6% | Target perioperative: < 7–8%",
bg="2E75B6", size=10)
spacer(doc)
# Glycaemic control summary
section_heading(doc, "Glycaemic Control Assessment", level=3)
make_table(doc,
["Method", "Information Provided"],
[
("Fasting Blood Sugar (FBS)", "Baseline glucose; short-term control"),
("Postprandial Blood Sugar (PPBS)", "Post-meal glucose excursion"),
("Glucose Tolerance Test (GTT)", "Confirms pre-diabetes / DM diagnosis"),
("HbA1c", "Long-term control (60–90 days); guides perioperative risk"),
("History: hypo/hyperglycaemic episodes", "Frequency & severity of swings"),
("Medication compliance history", "Adherence to OHA / insulin regimen"),
],
hdr_bg="375623", col_widths=[2.8, 3.7]
)
doc.add_page_break()
# ══════════════════ FC 3: FACTORS AFFECTING ANAESTHETIC MANAGEMENT ══════════════════
section_heading(doc, "3. FACTORS AFFECTING ANAESTHETIC MANAGEMENT", level=2)
spacer(doc)
flow_box(doc, "DIABETIC PATIENT UNDERGOING SURGERY", bg="1F4E79", size=11)
arrow_para(doc)
# Spider/hub layout using a 3-col × 3-row table
t = doc.add_table(rows=3, cols=3)
t.style = "Table Grid"
t.alignment = WD_TABLE_ALIGNMENT.CENTER
boxes_data = [
("Type of DM","1F4E79"), ("Duration of DM","2E75B6"), ("OHA / Insulin used","375623"),
("Glycaemic Control","7B2C2C"), ("END-ORGAN\nDAMAGE","C00000"), ("Autonomic\nDysfunction","1F4E79"),
("Minor Surgery\n(Day Care)","375623"), ("Major Surgery\n(Overnight)","7B2C2C"), ("Comorbidities","2E75B6"),
]
for idx, (label, bg) in enumerate(boxes_data):
ri, ci = divmod(idx, 3)
c = t.rows[ri].cells[ci]; c.width = Inches(1.8)
shd(c, bg)
cell_para(c, label, bold=True, size=9.5, color="FFFFFF")
spacer(doc)
doc.add_page_break()
# ══════════════════ FC 4: OHA DRUG MANAGEMENT ══════════════════
section_heading(doc, "4. ORAL HYPOGLYCAEMIC AGENTS — PERIOPERATIVE MANAGEMENT", level=2)
spacer(doc)
flow_box(doc, "PREOPERATIVE OHA DRUG ADJUSTMENTS", bg="1F4E79", size=11)
arrow_para(doc)
make_table(doc,
["Drug Class", "Examples", "Action Required", "Reason"],
[
("Sulfonylureas\n(Long-acting)",
"Glibenclamide,\nGlimepiride",
"STOP 48–72 h\nbefore surgery",
"Risk of prolonged hypoglycaemia under fasting/NPO"),
("Sulfonylureas\n(Short-acting)",
"Glipizide,\nGliclazide",
"Omit evening dose\nor morning dose",
"Shorter action; hold only day of surgery"),
("Biguanides",
"Metformin",
"STOP 24 h pre-op\nRestart ≥ 48 h post-op (major)",
"Risk of lactic acidosis if renal hypoperfusion intraop"),
("Thiazolidinediones",
"Pioglitazone,\nRosiglitazone",
"Omit morning dose",
"Fluid retention; minimal acute glucose effect"),
("Alpha-glucosidase\nInhibitors",
"Acarbose, Miglitol",
"No adjustment needed",
"No effect on fasting blood glucose"),
("SGLT2 Inhibitors",
"Dapagliflozin,\nEmpagliflozin",
"STOP 3–4 days\nbefore surgery",
"Risk of euglycaemic DKA perioperatively"),
("GLP-1 Agonists",
"Semaglutide,\nLiraglutide",
"Discuss with team;\n hold day of surgery",
"Delayed gastric emptying → aspiration risk"),
],
hdr_bg="375623",
col_widths=[1.5, 1.4, 1.7, 2.0]
)
doc.add_page_break()
# ══════════════════ FC 5: END-ORGAN DAMAGE ══════════════════
section_heading(doc, "5. END-ORGAN DAMAGE & ANAESTHETIC IMPLICATIONS", level=2)
spacer(doc)
flow_box(doc, "CHRONIC HYPERGLYCAEMIA → MULTI-ORGAN DAMAGE", bg="C00000", size=11)
arrow_para(doc)
# Organ damage table
make_table(doc,
["System", "Pathological Changes", "Anaesthetic Implications"],
[
("Cardiovascular",
"Atherosclerosis, silent IHD, LVH\nCardiomyopathy, hypertension",
"Pre-op ECG/Echo; risk of MI\nHaemodynamic instability under GA"),
("Respiratory",
"↓ FEV1, ↓ FVC, ↓ diffusion capacity\n↓ ventilatory response to PaCO₂/PaO₂\n↓ 2,3-DPG → altered O₂ transport",
"↑ sensitivity to respiratory depressants\n↑ respiratory infection risk\nCareful ventilator settings"),
("Renal",
"Diabetic nephropathy\nProteinuria → CKD",
"KFT + urine albumin pre-op\nDrug dosing adjustments\nAvoid nephrotoxic drugs"),
("Neurological",
"Sorbitol accumulation in vasa nervorum\nAGE (advanced glycation end-products)\n→ Peripheral + autonomic neuropathy",
"Document baseline deficits before blocks\nRisk of difficult airway (stiff joints)\nHaemodynamic instability"),
("Ophthalmic",
"Diabetic retinopathy\nCataracts, glaucoma",
"Fundus examination pre-op\nAvoid sudden IOP changes"),
("Gastrointestinal",
"Gastroparesis\nDelayed gastric emptying",
"Aspiration risk → RSI\nProkinetics pre-op (metoclopramide)"),
("Musculoskeletal",
"Stiff Joint Syndrome (SJS)\nGlycosylation of periarticular tissues",
"Prayer sign + Palm print test\nAnticipate difficult airway\nCervical spine X-ray"),
],
hdr_bg="C00000",
col_widths=[1.4, 2.3, 2.9]
)
doc.add_page_break()
# ══════════════════ FC 6: AUTONOMIC NEUROPATHY ══════════════════
section_heading(doc, "6. DIABETIC AUTONOMIC NEUROPATHY (DAN)", level=2)
spacer(doc)
flow_box(doc, "DIABETIC AUTONOMIC NEUROPATHY (DAN)", bg="7B2C2C", size=11)
arrow_para(doc)
# Symptoms table
section_heading(doc, "Clinical Features by System", level=3)
make_table(doc,
["System", "Symptoms / Signs"],
[
("Gastrointestinal", "Early satiety · Gastroparesis · Nausea · Vomiting · Bloating · Reflux\nNocturnal diarrhoea · Constipation · Abdominal distension"),
("Cardiovascular", "Resting tachycardia (>100 bpm) · Orthostatic hypotension\nPalpitations · Irregular pulse · Painless myocardial ischaemia"),
("Genitourinary", "Bladder atony · Urinary retention · Erectile dysfunction · Retrograde ejaculation"),
("Thermoregulatory", "Reduced / absent sweating · Temperature dysregulation"),
("Sensory", "Discomfort / paraesthesia of lower limbs · Hypoglycaemia unawareness"),
],
hdr_bg="7B2C2C",
col_widths=[1.8, 4.7]
)
spacer(doc)
section_heading(doc, "DAN Testing Protocol", level=3)
# DAN tests side by side
t = doc.add_table(rows=1, cols=2)
t.style = "Table Grid"
t.alignment = WD_TABLE_ALIGNMENT.CENTER
# Sympathetic col
cs = t.rows[0].cells[0]; cs.width = Inches(3.0)
shd(cs, "1F4E79")
cell_para(cs, "SYMPATHETIC TESTS", bold=True, size=10, color="FFFFFF")
# Parasympathetic col
cp = t.rows[0].cells[1]; cp.width = Inches(3.0)
shd(cp, "375623")
cell_para(cp, "PARASYMPATHETIC TESTS", bold=True, size=10, color="FFFFFF")
symp_rows = [
("SBP response to standing", "BP(lying) − BP(standing) > 30 mmHg = Abnormal\nNormal: < 10 mmHg"),
("DBP handgrip test", "Hold 30% max grip × 5 min; Normal rise > 16 mmHg"),
("Valsalva BP response", "Reduced / obtunded response = Abnormal"),
]
para_rows = [
("Resting tachycardia", "> 100 bpm at rest = Abnormal"),
("Beat-to-beat HR variability", "Reduced with deep breathing = Abnormal"),
("HR response to standing", "Reduced HR increase on standing"),
("Valsalva HR response", "Reduced HR ratio = Abnormal"),
]
for sr, pr in zip(symp_rows + [("","")], para_rows):
row = t.add_row()
cl = row.cells[0]; cl.width = Inches(3.0)
shd(cl, "DEEAF1" if sr[0] else "F2F2F2")
cell_para(cl, f"{sr[0]}\n{sr[1]}" if sr[0] else "", size=9, align=WD_ALIGN_PARAGRAPH.LEFT)
cr = row.cells[1]; cr.width = Inches(3.0)
shd(cr, "E2EFDA")
cell_para(cr, f"{pr[0]}\n{pr[1]}", size=9, align=WD_ALIGN_PARAGRAPH.LEFT)
spacer(doc)
doc.add_page_break()
# ══════════════════ FC 7: STIFF JOINT SYNDROME ══════════════════
section_heading(doc, "7. STIFF JOINT SYNDROME & AIRWAY ASSESSMENT", level=2)
spacer(doc)
flow_box(doc, "STIFF JOINT SYNDROME (SJS) — Diabetic Cheiroarthropathy", bg="7B2C2C", size=11)
arrow_para(doc)
make_table(doc,
["Assessment Tool", "Method", "Positive Finding / Implication"],
[
("Prayer Sign",
"Patient presses palms together (prayer position)",
"Inability to approximate palmar surfaces of phalangeal joints\n→ Anticipate difficult intubation"),
("Palm Print Test",
"Ink impression of dominant hand on paper",
"Grade 0 (normal) to Grade 3 (severe);\nGrade ≥ 2 → significant cervical involvement"),
("Stature / Skin",
"Clinical inspection",
"Non-familial short stature + tight waxy skin"),
("Cervical Spine X-ray",
"Lateral X-ray of cervical spine",
"Delineate limited atlanto-axial extension\n→ Plan awake fibre-optic if severe"),
],
hdr_bg="7B2C2C",
col_widths=[1.7, 2.0, 2.9]
)
arrow_para(doc)
flow_box(doc, "If Stiff Joint Syndrome Confirmed:\nAnticipate Difficult Airway → Plan Awake Fibre-optic Intubation", bg="C00000", size=10)
spacer(doc)
doc.add_page_break()
# ══════════════════ FC 8: PREOPERATIVE EVALUATION ══════════════════
section_heading(doc, "8. PREOPERATIVE EVALUATION FLOWCHART", level=2)
spacer(doc)
flow_box(doc, "DIABETIC PATIENT SCHEDULED FOR SURGERY", bg="1F4E79", size=11)
arrow_para(doc)
flow_box(doc, "OBJECTIVES OF PREOPERATIVE EVALUATION", bg="2E75B6", size=10.5)
arrow_para(doc)
make_table(doc,
["Objective", "Action"],
[
("Determine type & duration of DM", "Type 1 / 2 / GDM / Other — affects insulin sensitivity & response"),
("Assess end-organ damage", "5-fold increase in perioperative mortality if undetected"),
("Optimise glycaemic control", "Convert to short-acting agents if needed; target HbA1c < 7–8%"),
("Cardiovascular screening", "Elderly, smokers, hypertensives, hyperlipidaemics, asymptomatic DM"),
("Reduce mortality & morbidity", "Optimise prior to elective surgery"),
("Minimise hospital stay", "Good preoperative control = shorter admission"),
],
hdr_bg="2E75B6", col_widths=[2.8, 3.7]
)
arrow_para(doc)
section_heading(doc, "Investigations Checklist", level=3)
make_table(doc,
["Category", "Investigation", "What It Assesses"],
[
("Glycaemia", "FBS + PPBS + HbA1c", "Current & long-term glucose control"),
("Cardiovascular", "ECG + ECHO", "Silent ischaemia, LVH, cardiomyopathy"),
("Renal", "KFT + Urine Albumin", "Nephropathy, drug dosing"),
("Ophthalmic", "Fundus Examination", "Retinopathy grading"),
("Respiratory", "CXR + ABG", "Lung disease, acid-base status"),
("Metabolic", "Sr. Electrolytes + Ketones", "Hypokalaemia, DKA screening"),
("Airway / Skeletal", "Cervical Spine X-ray (lateral)", "Atlanto-axial mobility — SJS"),
],
hdr_bg="1F4E79",
col_widths=[1.5, 2.0, 3.0]
)
doc.add_page_break()
# ══════════════════ FC 9: ANAESTHETIC DRUG EFFECTS ══════════════════
section_heading(doc, "9. EFFECT OF ANAESTHETIC DRUGS ON GLUCOSE METABOLISM", level=2)
spacer(doc)
flow_box(doc, "ANAESTHETIC DRUG EFFECTS ON GLUCOSE HOMEOSTASIS", bg="1F4E79", size=11)
arrow_para(doc)
make_table(doc,
["Drug / Class", "Mechanism", "Net Effect on Glucose"],
[
("Etomidate",
"Blocks adrenal steroidogenesis\n→ ↓ cortisol synthesis",
"↓ Hyperglycaemic response\n(~ −1 mmol/L reduction)"),
("Benzodiazepines\n(high dose)",
"↓ ACTH secretion → ↓ cortisol\n↓ Sympathetic stimulation",
"↓ Glycaemic response to surgery"),
("High-dose Opioids",
"Block SNS + hypothalamic-pituitary axis\nAbolish catecholamine surge",
"Abolish stress-induced hyperglycaemia"),
("Halothane / Enflurane /\nIsoflurane",
"Inhibit insulin secretion\n(dose-dependent, reversible)",
"↑ Blood glucose intraoperatively\n(Isoflurane > Halothane)"),
("Epidural Anaesthesia",
"Blocks neurohormonal stress response\n(↓ epinephrine + cortisol release)",
"Much less glucose derangement\nvs General Anaesthesia"),
("General Anaesthesia",
"↑ Stress hormones (epinephrine,\ncortisol, glucagon, GH)",
"↑ Blood glucose; greatest disruption\nof glucose metabolism"),
],
hdr_bg="375623",
col_widths=[1.8, 2.5, 2.3]
)
doc.add_page_break()
# ══════════════════ FC 10: INSULIN INFUSION PROTOCOL ══════════════════
section_heading(doc, "10. INSULIN INFUSION PROTOCOL (Intraoperative / ICU)", level=2)
spacer(doc)
flow_box(doc, "INDICATION: Major surgery OR blood glucose persistently > 180 mg/dL", bg="C00000", size=10.5)
arrow_para(doc)
flow_box(doc,
"PREPARATION\n100 U Regular Insulin + 100 mL Normal Saline → 1 U / mL concentration",
bg="1F4E79", size=10.5)
arrow_para(doc)
flow_box(doc,
"STARTING RATE\nTotal Daily Dose ÷ 24 ≈ 0.02 U/kg/hr (typically 1–2 U/hr)\n"
"1 Unit of insulin lowers BG by ~25–30 mg/dL",
bg="375623", size=10.5)
arrow_para(doc)
flow_box(doc, "CHECK BLOOD GLUCOSE HOURLY", bg="7B2C2C", size=11, bold=True)
arrow_para(doc)
# Dose adjustment algorithm
make_table(doc,
["Blood Glucose (mg/dL)", "Insulin Infusion Action", "Additional Notes"],
[
("< 70 [HYPOGLYCAEMIA]",
"STOP infusion immediately\nGive 25 mL 50% Dextrose IV",
"Recheck in 15 min; do NOT restart until BG > 100"),
("71 – 100",
"Reduce rate by 50%\nConsider 5% dextrose supplement",
"Recheck in 30 min"),
("101 – 150",
"Reduce rate by 25%",
"Recheck in 60 min"),
("151 – 200 ✓ TARGET",
"Maintain current rate",
"No change needed"),
("201 – 250",
"Increase rate by 1 U/hr",
"Recheck in 60 min"),
("251 – 300",
"Increase rate by 2 U/hr",
"Check urine/serum ketones"),
("> 300 [SEVERE]",
"Increase rate by 2–3 U/hr\nUrgent senior review",
"Check ketones + electrolytes\nConsider DKA protocol"),
],
hdr_bg="7B2C2C",
row_bgs=("FCE4D6","F4B8A0"),
col_widths=[1.9, 2.5, 2.2]
)
arrow_para(doc)
flow_box(doc,
"POTASSIUM MONITORING\n"
"Measure K⁺ during major surgery\n"
"Insulin drives K⁺ intracellularly → Supplement if K⁺ < 3.5 mEq/L",
bg="1F4E79", size=10)
arrow_para(doc)
flow_box(doc,
"TRANSITION TO S/C INSULIN\n"
"When: patient eating + haemodynamically stable\n"
"Overlap IV and SC for 1–2 hours before stopping infusion",
bg="375623", size=10)
spacer(doc)
doc.add_page_break()
# ══════════════════ FC 11: REGIONAL vs GA ══════════════════
section_heading(doc, "11. ANAESTHESIA CHOICE — REGIONAL vs GENERAL ANAESTHESIA", level=2)
spacer(doc)
flow_box(doc, "DIABETIC PATIENT — SELECT ANAESTHETIC TECHNIQUE", bg="1F4E79", size=11)
arrow_para(doc)
decision_box(doc, "Is the surgical site amenable to regional anaesthesia?")
arrow_para(doc)
branch_table(doc, "YES → REGIONAL ANAESTHESIA", "NO → GENERAL ANAESTHESIA")
arrow_para(doc)
# Comparison table
t = doc.add_table(rows=1, cols=2)
t.style = "Table Grid"
t.alignment = WD_TABLE_ALIGNMENT.CENTER
for ci, (label, bg) in enumerate([("REGIONAL ANAESTHESIA","375623"),("GENERAL ANAESTHESIA","7B2C2C")]):
c = t.rows[0].cells[ci]; c.width = Inches(3.0)
shd(c, bg)
cell_para(c, label, bold=True, size=11, color="FFFFFF")
content = [
# (RA heading, RA items, GA heading, GA items)
("ADVANTAGES",
["Epidural suppresses stress hormone response",
"Less intraoperative glucose derangement",
"Better postoperative analgesia",
"Faster recovery; reduced PONV",
"Avoids airway instrumentation",
"Preferred with gastroparesis (reduces aspiration risk)"],
"KEY CONCERNS",
["GA → ↑ stress hormones → hyperglycaemia",
"Greatest glucose disruption of all techniques",
"Gastroparesis → full stomach → RSI mandatory",
"Stiff Joint Syndrome → difficult airway",
"Autonomic neuropathy → haemodynamic instability",
"↑ sensitivity to respiratory depressants",
"↓ FEV1, ↓ FVC, ↓ diffusion capacity"]),
("DISADVANTAGES",
["Orthostatic hypotension worsened by autonomic neuropathy",
"Pre-existing neuropathy complicates consent/documentation",
"Infection risk with poor glucose control",
"Technically difficult if stiff joint syndrome",
"Risk of incomplete block"],
"DRUG EFFECTS ON GLUCOSE",
["Halothane/Enflurane/Isoflurane: ↓ insulin secretion (reversible)",
"Etomidate: ↓ cortisol → ↓ hyperglycaemia",
"Benzodiazepines (high dose): ↓ ACTH + cortisol",
"High-dose opioids: abolish hyperglycaemia"]),
]
ra_bgs = ["C6E0B4","E2EFDA"]
ga_bgs = ["FCE4D6","FFF2CC"]
for section_data in content:
ra_hdg, ra_items, ga_hdg, ga_items = section_data
# heading rows
row = t.add_row()
cl = row.cells[0]; cl.width = Inches(3.0)
shd(cl, ra_bgs[0])
cell_para(cl, ra_hdg, bold=True, size=9.5, color="375623")
cr = row.cells[1]; cr.width = Inches(3.0)
shd(cr, ga_bgs[0])
cell_para(cr, ga_hdg, bold=True, size=9.5, color="7B2C2C")
# item rows
n = max(len(ra_items), len(ga_items))
for i in range(n):
row = t.add_row()
cl = row.cells[0]; cl.width = Inches(3.0)
shd(cl, ra_bgs[1])
cell_para(cl, ("• " + ra_items[i]) if i < len(ra_items) else "",
size=9, align=WD_ALIGN_PARAGRAPH.LEFT)
cr = row.cells[1]; cr.width = Inches(3.0)
shd(cr, ga_bgs[1])
cell_para(cr, ("• " + ga_items[i]) if i < len(ga_items) else "",
size=9, align=WD_ALIGN_PARAGRAPH.LEFT)
spacer(doc)
arrow_para(doc)
section_heading(doc, "Clinical Decision Summary", level=3)
make_table(doc,
["Clinical Scenario", "Preferred Technique", "Key Reason"],
[
("Lower limb / perineal surgery", "Spinal / Epidural", "Less stress response; avoids airway"),
("Gastroparesis present", "Regional preferred (if feasible)", "Eliminates aspiration risk"),
("Stiff Joint Syndrome", "Awake Fibre-optic Intubation (if GA)", "Anticipated difficult airway"),
("Autonomic neuropathy", "Epidural with vasopressor standby", "Expect hypotension; BP support ready"),
("Upper abdominal / thoracic", "GA ± Epidural (combined)", "Regional alone insufficient"),
("Emergency surgery", "GA + RSI", "Airway control priority; no time for regional"),
("Pre-existing peripheral neuropathy", "Document deficits BEFORE block", "Medico-legal protection"),
("Type 1 DM, labile glycaemia", "Regional preferred + IV insulin infusion", "Minimise glucose disruption"),
],
hdr_bg="1F4E79",
col_widths=[2.2, 1.9, 2.5]
)
doc.add_page_break()
# ══════════════════ FC 12: AIMS OF PERIOPERATIVE GLUCOSE MANAGEMENT ══════════════════
section_heading(doc, "12. AIMS OF PERIOPERATIVE GLUCOSE MANAGEMENT", level=2)
spacer(doc)
flow_box(doc, "PERIOPERATIVE GLUCOSE MANAGEMENT — GOALS", bg="1F4E79", size=11)
arrow_para(doc)
t = doc.add_table(rows=2, cols=3)
t.style = "Table Grid"
t.alignment = WD_TABLE_ALIGNMENT.CENTER
goals = [
("AVOID\nHYPOGLYCAEMIA","< 70 mg/dL is dangerous\nImpairs cerebral function","C00000"),
("AVOID\nHYPERGLYCAEMIA","Impaired wound healing\nInfection, osmotic diuresis","7B2C2C"),
("TARGET RANGE\n120–180 mg/dL","Insulin infusion 1–2 U/hr\nHourly monitoring","375623"),
]
for i, (title, detail, bg) in enumerate(goals):
c1 = t.rows[0].cells[i]; c1.width = Inches(2.0)
shd(c1, bg)
cell_para(c1, title, bold=True, size=10, color="FFFFFF")
c2 = t.rows[1].cells[i]; c2.width = Inches(2.0)
shd(c2, "DEEAF1")
cell_para(c2, detail, size=9)
arrow_para(doc)
make_table(doc,
["Phase", "Monitoring", "Target", "Action if Out of Range"],
[
("Preoperative", "FBS + HbA1c", "FBS < 180 mg/dL\nHbA1c < 8%", "Optimise with insulin; postpone elective if HbA1c > 9%"),
("Intraoperative", "Hourly glucometry", "120–180 mg/dL", "IV insulin infusion per protocol; D5% if hypoglycaemic"),
("Postoperative ICU", "Hourly → 2-hourly", "140–180 mg/dL", "Continue IV infusion until eating; then convert to SC"),
("Ward / Step-down", "Pre-meal + bedtime", "< 180 mg/dL pre-meal", "Resume oral agents when tolerating oral intake"),
],
hdr_bg="1F4E79",
col_widths=[1.3, 1.6, 1.6, 2.1]
)
spacer(doc)
# ══════════════════ QUICK REFERENCE CARD ══════════════════
section_heading(doc, "QUICK REFERENCE — KEY NUMBERS AT A GLANCE", level=2)
spacer(doc)
make_table(doc,
["Parameter", "Value / Threshold"],
[
("HbA1c — Normal", "4–6%"),
("HbA1c — Perioperative target", "< 7–8% (postpone elective if > 9%)"),
("Intraoperative glucose target", "120–180 mg/dL"),
("Insulin infusion concentration", "100 U Regular Insulin in 100 mL NS = 1 U/mL"),
("Starting insulin infusion rate", "~0.02 U/kg/hr ≈ 1.4 U/hr (70 kg patient)"),
("1 unit insulin lowers BG by", "~25–30 mg/dL"),
("Potassium supplement threshold", "K⁺ < 3.5 mEq/L during insulin infusion"),
("Metformin — stop before surgery", "≥ 24 h pre-op"),
("Metformin — restart after major surgery", "≥ 48 h post-op (confirm normal renal function)"),
("Long-acting sulfonylurea — stop", "48–72 h before surgery"),
("SBP drop (DAN test) — abnormal", "> 30 mmHg drop on standing"),
("DBP handgrip rise (DAN) — normal", "> 16 mmHg"),
("Resting tachycardia (DAN)", "> 100 bpm at rest"),
],
hdr_bg="1F4E79",
col_widths=[4.0, 2.6]
)
# ─── Save ───
out_path = "/tmp/workspace/diabetic-anaesthesia/Diabetic_Anaesthesia_Complete_Summary.docx"
doc.save(out_path)
print(f"Saved: {out_path}")
cd /tmp/workspace/diabetic-anaesthesia && python3 build_full_summary.py 2>&1
python3 -c " from docx import Document doc = Document('/tmp/workspace/diabetic-anaesthesia/Diabetic_Anaesthesia_Complete_Summary.docx') headings = [p.text for p in doc.paragraphs if p.style.name.startswith('Heading')] print('Sections:', headings) print('Total tables:', len(doc.tables)) print('Total paragraphs:', len(doc.paragraphs)) import os size = os.path.getsize('/tmp/workspace/diabetic-anaesthesia/Diabetic_Anaesthesia_Complete_Summary.docx') print(f'File size: {size/1024:.1f} KB') "
Diabetic Anaesthesia Complete Summary
Word Document · DOCX
| # | Section | Format |
|---|---|---|
| 1 | Definition & ADA Classification | Flow box → 4-column type table |
| 2 | Diagnostic Criteria + HbA1c + Glycaemic Control | Flow box → criteria table + HbA1c summary box |
| 3 | Factors Affecting Anaesthetic Management | 3×3 hub grid (9 factors colour-coded) |
| 4 | OHA Drug Management (7 drug classes) | Colour table with stop/omit timing + reason |
| 5 | End-Organ Damage (6 systems) | System → pathology → anaesthetic implication table |
| 6 | Diabetic Autonomic Neuropathy | Symptoms by system + side-by-side sympathetic vs parasympathetic tests |
| 7 | Stiff Joint Syndrome & Airway | Assessment tool table → difficult airway alert box |
| 8 | Preoperative Evaluation | Objectives flow → investigations checklist |
| 9 | Anaesthetic Drug Effects on Glucose | Drug-by-drug mechanism and glucose effect table |
| 10 | Insulin Infusion Protocol | Step-by-step flow + 7-level glucose adjustment algorithm (red-coded) |
| 11 | Regional vs General Anaesthesia | Decision diamond → side-by-side advantages/disadvantages → clinical scenario table |
| 12 | Perioperative Glucose Goals + Quick Reference Card | 3-goal visual block → phase-by-phase targets → all key numbers in one place |