From the above ppt i want to summarise the important fields to flow charts and graphs and concise accordingly
python3 << 'EOF' from pptx import Presentation prs = Presentation("/tmp/workspace/attachments/29531651-9c55-484b-8127-f9606ee412b2/Diabetic and anesthesia concerns.pptx") for i, slide in enumerate(prs.slides, 1): print(f"\n===== SLIDE {i} =====") for shape in slide.shapes: if shape.has_text_frame and shape.text_frame.text.strip(): print(f"[{shape.shape_type}] {shape.text_frame.text}") EOF
python3 << 'EOF' from pptx import Presentation from pptx.util import Inches import pptx.oxml.ns as ns prs = Presentation("/tmp/workspace/attachments/29531651-9c55-484b-8127-f9606ee412b2/Diabetic and anesthesia concerns.pptx") for i, slide in enumerate(prs.slides, 1): has_content = False for shape in slide.shapes: if shape.has_text_frame and shape.text_frame.text.strip(): has_content = True if shape.has_table: has_content = True if not has_content: continue print(f"\n===== SLIDE {i} =====") for shape in slide.shapes: if shape.has_text_frame and shape.text_frame.text.strip(): print(f" TEXT: {shape.text_frame.text[:500]}") if shape.has_table: print(" TABLE:") for row in shape.table.rows: row_text = " | ".join(cell.text_frame.text.strip() for cell in row.cells) if row_text.strip(): print(f" {row_text}") EOF
python3 << 'EOF' from pptx import Presentation from pptx.enum.shapes import MSO_SHAPE_TYPE prs = Presentation("/tmp/workspace/attachments/29531651-9c55-484b-8127-f9606ee412b2/Diabetic and anesthesia concerns.pptx") # Find image-only slides and list image details image_slides = [5,6,7,12,13,19,22,23,25,26,30,34,35,36,37,38,39,40,41,43,46,47,48,49,50,51,52,53,54,55,56,57] for i, slide in enumerate(prs.slides, 1): if i not in image_slides: continue shapes_info = [] for shape in slide.shapes: shapes_info.append(f" shape_type={shape.shape_type}, name={shape.name}") if shape.has_text_frame and shape.text_frame.text.strip(): shapes_info.append(f" TEXT: {shape.text_frame.text[:200]}") if shapes_info: print(f"\nSlide {i}:") for s in shapes_info: print(s) EOF
mkdir -p /tmp/workspace/diabetic-anesthesia && ls /tmp/workspace/diabetic-anesthesia/
python3 << 'PYEOF' import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import matplotlib.patches as mpatches from matplotlib.patches import FancyBboxPatch, FancyArrowPatch import numpy as np import os OUT = "/tmp/workspace/diabetic-anesthesia/" # ── helper colours ── C_BLUE = "#1565C0" C_LBLUE = "#42A5F5" C_TEAL = "#00796B" C_GREEN = "#2E7D32" C_LGREEN = "#A5D6A7" C_AMBER = "#F57F17" C_RED = "#C62828" C_LRED = "#EF9A9A" C_GREY = "#546E7A" C_LGREY = "#ECEFF1" C_WHITE = "#FFFFFF" C_DARK = "#212121" def save(fig, name): fig.savefig(os.path.join(OUT, name), dpi=150, bbox_inches='tight', facecolor=fig.get_facecolor()) plt.close(fig) # ═══════════════════════════════════════════════════════ # 1. FLOWCHART – ADA Classification of Diabetes # ═══════════════════════════════════════════════════════ fig, ax = plt.subplots(figsize=(12, 8)) fig.patch.set_facecolor(C_LGREY) ax.set_xlim(0, 12); ax.set_ylim(0, 8); ax.axis('off') def box(ax, x, y, w, h, text, fc, tc=C_WHITE, fs=10, bold=False): r = FancyBboxPatch((x-w/2, y-h/2), w, h, boxstyle="round,pad=0.08", linewidth=1.5, edgecolor=C_DARK, facecolor=fc) ax.add_patch(r) ax.text(x, y, text, ha='center', va='center', fontsize=fs, color=tc, fontweight='bold' if bold else 'normal', wrap=True, multialignment='center') def arrow(ax, x1, y1, x2, y2): ax.annotate("", xy=(x2,y2), xytext=(x1,y1), arrowprops=dict(arrowstyle="-|>", color=C_GREY, lw=1.5)) # Root box(ax, 6, 7.2, 3.8, 0.7, "DIABETES MELLITUS\n(ADA Classification)", C_BLUE, fs=12, bold=True) # 4 branches types = [ (2, 5.2, "Type 1 DM", C_RED, "Autoimmune β-cell\ndestruction\n→ Absolute insulin\ndeficiency"), (5, 5.2, "Type 2 DM", C_TEAL, "Progressive β-cell\nfailure + insulin\nresistance"), (8, 5.2, "GDM", C_AMBER, "Onset in 2nd/3rd\ntrimester of\npregnancy"), (11, 5.2, "Other Specific\nTypes", C_GREY,"Monogenic / Exocrine\npancreas disease /\nDrug-induced"), ] for (bx, by, title, col, detail) in types: arrow(ax, 6, 6.85, bx, by+0.45) box(ax, bx, by, 2.5, 0.9, title, col, fs=10, bold=True) box(ax, bx, by-1.5, 2.5, 2.0, detail, col, fs=9) arrow(ax, bx, by-0.45, bx, by-0.5) ax.set_title("ADA Classification of Diabetes Mellitus", fontsize=14, fontweight='bold', color=C_DARK, pad=8) save(fig, "fig1_dm_classification.png") print("fig1 done") PYEOF
python3 << 'PYEOF' import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import matplotlib.patches as mpatches from matplotlib.patches import FancyBboxPatch import numpy as np import os OUT = "/tmp/workspace/diabetic-anesthesia/" C_BLUE="#1565C0"; C_LBLUE="#42A5F5"; C_TEAL="#00796B"; C_GREEN="#2E7D32" C_LGREEN="#A5D6A7"; C_AMBER="#F57F17"; C_RED="#C62828"; C_LRED="#EF9A9A" C_GREY="#546E7A"; C_LGREY="#ECEFF1"; C_WHITE="#FFFFFF"; C_DARK="#212121" C_PURPLE="#6A1B9A" def save(fig, name): fig.savefig(os.path.join(OUT, name), dpi=150, bbox_inches='tight', facecolor=fig.get_facecolor()) plt.close(fig) def box(ax, x, y, w, h, text, fc, tc=C_WHITE, fs=9.5, bold=False): r = FancyBboxPatch((x-w/2, y-h/2), w, h, boxstyle="round,pad=0.07", linewidth=1.4, edgecolor=C_DARK, facecolor=fc) ax.add_patch(r) ax.text(x, y, text, ha='center', va='center', fontsize=fs, color=tc, fontweight='bold' if bold else 'normal', multialignment='center') def arrow(ax, x1, y1, x2, y2): ax.annotate("", xy=(x2,y2), xytext=(x1,y1), arrowprops=dict(arrowstyle="-|>", color=C_GREY, lw=1.5)) # ═══════════════════════════════════════════════════════ # 2. FLOWCHART – Perioperative Anesthesia Assessment Flow # ═══════════════════════════════════════════════════════ fig, ax = plt.subplots(figsize=(14, 10)) fig.patch.set_facecolor(C_LGREY) ax.set_xlim(0,14); ax.set_ylim(0,10); ax.axis('off') # Top node box(ax, 7, 9.4, 4, 0.7, "DIABETIC PATIENT\nFor Surgery", C_BLUE, fs=12, bold=True) arrow(ax, 7, 9.05, 7, 8.45) # Pre-op assess box(ax, 7, 8.1, 5, 0.65, "PRE-OPERATIVE ASSESSMENT", C_TEAL, fs=11, bold=True) # 6 assessment branches branches = [ (1.3, 6.2, "Type &\nDuration\nof DM", C_RED), (3.5, 6.2, "Glycemic\nControl\n(FBS/HbA1c)", C_AMBER), (5.8, 6.2, "Medications\nOHA / Insulin", C_PURPLE), (8.2, 6.2, "End-Organ\nDamage", C_TEAL), (10.5, 6.2, "Autonomic\nNeuropathy\n(DAN)", C_GREEN), (12.7, 6.2, "Nature of\nSurgery\nMajor/Minor", C_GREY), ] for bx,by,lbl,col in branches: arrow(ax, 7, 7.78, bx, by+0.45) box(ax, bx, by, 2.0, 0.9, lbl, col, fs=9) # End-organ sub-items eox, eoy = 8.2, 6.2 sub = ["Cardiac","Renal","Retinal","Stiff Joint"] for j,s in enumerate(sub): sx = 7.0 + j*0.7 sy = 4.9 ax.text(sx, sy, s, ha='center', va='center', fontsize=7.5, color=C_WHITE, bbox=dict(boxstyle="round,pad=0.2", fc=C_TEAL, ec=C_DARK)) arrow(ax, eox, eoy-0.45, sx, sy+0.18) # Investigations box box(ax, 7, 3.6, 9, 0.65, "INVESTIGATIONS: ECG | FBS/PPBS/HbA1c | KFT/Urine Albumin | CXR/ECHO | Fundus | Cervical X-ray | ABG/Electrolytes", C_BLUE, fs=8.5) arrow(ax, 7, 4.55, 7, 3.93) # Decision box(ax, 7, 2.65, 4, 0.65, "Glycemic Control Optimised?", C_AMBER, tc=C_DARK, fs=10, bold=True) arrow(ax, 7, 3.27, 7, 2.97) ax.annotate("YES", xy=(9,2.65), xytext=(7,2.65), fontsize=10, color=C_GREEN, fontweight='bold', ha='left') ax.annotate("NO →\nSwitch to\nshort-acting\ndrugs", xy=(4.5,1.6), xytext=(7,2.32), fontsize=8.5, color=C_RED, fontweight='bold', ha='center', arrowprops=dict(arrowstyle="-|>", color=C_RED, lw=1.2)) # Final arrow(ax, 9.2, 2.65, 11, 1.7) box(ax, 11, 1.3, 3.2, 0.7, "PROCEED TO\nANAESTHESIA", C_GREEN, fs=11, bold=True) ax.set_title("Perioperative Anesthetic Assessment – Diabetic Patient", fontsize=13, fontweight='bold', color=C_DARK, pad=8) save(fig, "fig2_preop_flow.png") print("fig2 done") PYEOF
python3 << 'PYEOF' import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from matplotlib.patches import FancyBboxPatch import numpy as np import os OUT = "/tmp/workspace/diabetic-anesthesia/" C_BLUE="#1565C0"; C_TEAL="#00796B"; C_GREEN="#2E7D32"; C_AMBER="#F57F17" C_RED="#C62828"; C_GREY="#546E7A"; C_LGREY="#ECEFF1"; C_WHITE="#FFFFFF" C_DARK="#212121"; C_PURPLE="#6A1B9A"; C_ORANGE="#E65100" def save(fig, name): fig.savefig(os.path.join(OUT, name), dpi=150, bbox_inches='tight', facecolor=fig.get_facecolor()) plt.close(fig) def box(ax, x, y, w, h, text, fc, tc=C_WHITE, fs=9, bold=False): r = FancyBboxPatch((x-w/2, y-h/2), w, h, boxstyle="round,pad=0.07", linewidth=1.4, edgecolor=C_DARK, facecolor=fc) ax.add_patch(r) ax.text(x, y, text, ha='center', va='center', fontsize=fs, color=tc, fontweight='bold' if bold else 'normal', multialignment='center') def arrow(ax, x1, y1, x2, y2, col=C_GREY): ax.annotate("", xy=(x2,y2), xytext=(x1,y1), arrowprops=dict(arrowstyle="-|>", color=col, lw=1.5)) # ═══════════════════════════════════════════════════════ # 3. OHA MANAGEMENT TABLE + TIMELINE VISUAL # ═══════════════════════════════════════════════════════ fig, ax = plt.subplots(figsize=(13, 5)) fig.patch.set_facecolor(C_LGREY) ax.set_xlim(0,13); ax.set_ylim(0,5); ax.axis('off') ax.set_title("Oral Hypoglycemic Agents – Pre-Surgical Management", fontsize=13, fontweight='bold', color=C_DARK, pad=8) cols = [C_RED, C_ORANGE, C_TEAL, C_GREY] headers = ["SULFONYLUREAS\n(Long-acting)", "BIGUANIDES\n(Metformin)", "THIAZOLIDINEDIONES\n(Rosi/Pioglitazone)", "α-GLUCOSIDASE\nINHIBITORS"] details = [ "Long-acting: Stop\n48–72 hrs before surgery\n\nShort-acting: Withhold\nnight before / morning of", "Discontinue ≥24 hrs\nbefore surgery\nWithhold 48 hrs after\nmajor surgery", "Omit on the\nmorning of surgery", "No effect on fasting\nblood glucose\n(low periop risk)" ] xs = [1.5, 4.5, 8.0, 11.3] for i,(hdr,det,col,x) in enumerate(zip(headers,details,cols,xs)): box(ax, x, 3.8, 2.6, 0.85, hdr, col, fs=9.5, bold=True) box(ax, x, 2.25, 2.6, 2.2, det, col, fs=9) # Timeline bar ax.text(6.5, 0.75, "Timeline before surgery (hours)", ha='center', va='center', fontsize=10, color=C_DARK, fontweight='bold') tline_y = 0.35 ax.plot([0.5,12.5],[tline_y,tline_y], color=C_DARK, lw=2) ticks = [(0.5,"Surgery"), (2.5,"12h"), (4.5,"24h"), (6.5,"48h"), (9.5,"72h")] for tx,lbl in ticks: ax.plot([tx,tx],[tline_y-0.08, tline_y+0.08], color=C_DARK, lw=1.5) ax.text(tx, tline_y-0.2, lbl, ha='center', va='top', fontsize=8, color=C_DARK) # bands ax.barh(tline_y, 2.0, left=0.5, height=0.2, color=C_TEAL, alpha=0.4) # TZD ax.barh(tline_y, 4.0, left=0.5, height=0.2, color=C_ORANGE, alpha=0.4) # metformin ax.barh(tline_y, 6.0, left=0.5, height=0.2, color=C_RED, alpha=0.4) # long SU save(fig, "fig3_oha_management.png") print("fig3 done") # ═══════════════════════════════════════════════════════ # 4. INTRAOPERATIVE GLUCOSE MANAGEMENT – BAR CHART # ═══════════════════════════════════════════════════════ fig, ax = plt.subplots(figsize=(11, 6)) fig.patch.set_facecolor(C_LGREY) glucose_ranges = ["< 70", "71–100", "101–150", "151–200", "201–250", "251–300", "> 300"] insulin_dose = [0, 0, 1, 2, 3, 4, "Variable"] colors = [C_RED, C_ORANGE, "#FDD835", C_TEAL, C_BLUE, C_PURPLE, C_DARK] insulin_num = [0, 0, 1, 2, 3, 4, 5] bars = ax.bar(glucose_ranges, insulin_num, color=colors, edgecolor=C_DARK, linewidth=1.2, width=0.6) ax.set_xlabel("Blood Glucose (mg/dL)", fontsize=12, fontweight='bold', color=C_DARK) ax.set_ylabel("Insulin Dose (U/h) – Relative", fontsize=12, fontweight='bold', color=C_DARK) ax.set_title("Intraoperative Blood Glucose → Insulin Dose Protocol", fontsize=13, fontweight='bold', color=C_DARK, pad=8) actions = [ "STOP insulin\nRapid D5W 100mL", "Stop insulin\nD5W 100mL/h", "1U insulin\n+D5W 100mL/h", "2U insulin\n+D5W 100mL/h", "3U insulin\n+D5W 100mL/h", "4U insulin\n+D5W 100mL/h", "1U/50mg↑ above\n100 +NS 100mL/h", ] for i,(bar,act) in enumerate(zip(bars,actions)): h = bar.get_height() ax.text(bar.get_x()+bar.get_width()/2, h+0.05, act, ha='center', va='bottom', fontsize=7.5, color=C_DARK, multialignment='center') # Target range band ax.axhspan(0.8, 2.2, alpha=0.1, color=C_GREEN, label="Target: 120–180 mg/dL range") ax.legend(fontsize=10) ax.set_facecolor(C_LGREY) fig.patch.set_facecolor(C_LGREY) ax.spines[['top','right']].set_visible(False) ax.set_yticks([]) save(fig, "fig4_intraop_glucose.png") print("fig4 done") PYEOF
python3 << 'PYEOF' import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from matplotlib.patches import FancyBboxPatch import numpy as np, os OUT = "/tmp/workspace/diabetic-anesthesia/" C_BLUE="#1565C0"; C_TEAL="#00796B"; C_GREEN="#2E7D32"; C_AMBER="#F57F17" C_RED="#C62828"; C_GREY="#546E7A"; C_LGREY="#ECEFF1"; C_WHITE="#FFFFFF" C_DARK="#212121"; C_PURPLE="#6A1B9A"; C_ORANGE="#E65100" def save(fig, name): fig.savefig(os.path.join(OUT, name), dpi=150, bbox_inches='tight', facecolor=fig.get_facecolor()) plt.close(fig) def box(ax, x, y, w, h, text, fc, tc=C_WHITE, fs=9, bold=False): r = FancyBboxPatch((x-w/2, y-h/2), w, h, boxstyle="round,pad=0.07", lw=1.4, ec=C_DARK, fc=fc) ax.add_patch(r) ax.text(x, y, text, ha='center', va='center', fontsize=fs, color=tc, fontweight='bold' if bold else 'normal', multialignment='center') def arrow(ax, x1, y1, x2, y2, col=C_GREY): ax.annotate("", xy=(x2,y2), xytext=(x1,y1), arrowprops=dict(arrowstyle="-|>", color=col, lw=1.5)) # ═══════════════════════════════════════════════════════ # 5. DAN (Autonomic Neuropathy) Assessment Spider/Cluster # ═══════════════════════════════════════════════════════ fig, ax = plt.subplots(figsize=(13, 8)) fig.patch.set_facecolor(C_LGREY); ax.set_xlim(0,13); ax.set_ylim(0,8); ax.axis('off') ax.set_title("Diabetic Autonomic Neuropathy (DAN) – Assessment Overview", fontsize=13, fontweight='bold', color=C_DARK, pad=8) box(ax, 6.5, 7.2, 4.5, 0.7, "DIABETIC AUTONOMIC NEUROPATHY (DAN)", C_BLUE, fs=12, bold=True) # Sympathetic box(ax, 2.5, 5.8, 3.8, 0.7, "SYMPATHETIC TESTS\n(BP Response)", C_RED, fs=10, bold=True) arrow(ax, 6.5, 6.85, 2.5, 6.15) symp = [ "SBP drop >30mmHg on standing\n(Normal: <10mmHg)", "DBP: handgrip test\nnormal increase >16mmHg", "Valsalva BP response\nis reduced" ] for j,s in enumerate(symp): box(ax, 2.5, 4.7-j*1.2, 3.8, 0.9, s, C_RED, fs=8.5) arrow(ax, 2.5, 5.45 if j==0 else 4.7-j*1.2+0.45+0.45, 2.5, 4.7-j*1.2+0.45) # Parasympathetic box(ax, 10.5, 5.8, 3.8, 0.7, "PARASYMPATHETIC TESTS\n(HRV Response)", C_TEAL, fs=10, bold=True) arrow(ax, 6.5, 6.85, 10.5, 6.15) para = [ "Resting tachycardia >100 BPM", "↓ Beat-to-beat variation\nwith deep breathing", "↓ HR response to standing", "↓ HR Valsalva response" ] for j,p in enumerate(para): box(ax, 10.5, 4.8-j*1.1, 3.8, 0.82, p, C_TEAL, fs=8.5) # Symptoms box(ax, 6.5, 5.8, 3.8, 0.7, "SYMPTOMS of DAN", C_PURPLE, fs=10, bold=True) arrow(ax, 6.5, 6.85, 6.5, 6.15) symptoms = ["Gastroparesis\n(Nausea/Vomiting/Bloating)", "Orthostatic hypotension\n(postural syncope)", "Bladder atony\nUrinary retention", "Hypoglycemia unawareness\nLack of sweating"] for j,s in enumerate(symptoms): box(ax, 6.5, 4.7-j*1.2, 3.8, 0.9, s, C_PURPLE, fs=8) save(fig, "fig5_dan_assessment.png") print("fig5 done") # ═══════════════════════════════════════════════════════ # 6. SYSTEM-WISE END ORGAN DAMAGE – Radar/Bubble chart # ═══════════════════════════════════════════════════════ fig, axes = plt.subplots(1, 2, figsize=(14, 6)) fig.patch.set_facecolor(C_LGREY) fig.suptitle("DM End-Organ Effects & Anesthetic Implications", fontsize=13, fontweight='bold', color=C_DARK, y=1.01) # Left: system-wise horizontal bar summary ax1 = axes[0] ax1.set_facecolor(C_LGREY) systems = ["Respiratory", "Neurological", "Autonomic\n(DAN)", "Cardiovascular", "Renal", "Joints\n(Stiff)"] impacts = [4, 3.5, 5, 4.5, 3, 2.5] # relative clinical concern 1-5 cols = [C_BLUE, C_TEAL, C_RED, C_ORANGE, C_PURPLE, C_GREY] bars = ax1.barh(systems, impacts, color=cols, edgecolor=C_DARK, linewidth=1.1, height=0.55) ax1.set_xlim(0, 6) ax1.set_xlabel("Clinical Concern Level", fontsize=10, fontweight='bold', color=C_DARK) ax1.set_title("Organ System Involvement", fontsize=11, fontweight='bold', color=C_DARK) for bar, val in zip(bars, impacts): ax1.text(val+0.05, bar.get_y()+bar.get_height()/2, f"{val:.0f}/5", va='center', fontsize=9, color=C_DARK, fontweight='bold') ax1.spines[['top','right']].set_visible(False) # Right: pie of periop concerns ax2 = axes[1] ax2.set_facecolor(C_LGREY) labels = ["Glycemic\nControl", "Autonomic\nNeuropathy", "Cardiac\nRisk", "Medication\nManagement", "Airway\n(Stiff Joint)", "Other"] sizes = [30, 22, 20, 15, 8, 5] explode= (0.05,0.05,0.05,0.02,0.02,0) pie_cols = [C_AMBER, C_RED, C_ORANGE, C_TEAL, C_BLUE, C_GREY] wedges, texts, autotexts = ax2.pie(sizes, labels=labels, colors=pie_cols, autopct='%1.0f%%', startangle=120, explode=explode, pctdistance=0.75, textprops={'fontsize':8.5}) ax2.set_title("Perioperative Concern Distribution", fontsize=11, fontweight='bold', color=C_DARK) plt.tight_layout() save(fig, "fig6_organ_damage.png") print("fig6 done") PYEOF
python3 << 'PYEOF' import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from matplotlib.patches import FancyBboxPatch import os OUT = "/tmp/workspace/diabetic-anesthesia/" C_BLUE="#1565C0"; C_TEAL="#00796B"; C_GREEN="#2E7D32"; C_AMBER="#F57F17" C_RED="#C62828"; C_GREY="#546E7A"; C_LGREY="#ECEFF1"; C_WHITE="#FFFFFF" C_DARK="#212121"; C_PURPLE="#6A1B9A"; C_ORANGE="#E65100" def save(fig, name): fig.savefig(os.path.join(OUT, name), dpi=150, bbox_inches='tight', facecolor=fig.get_facecolor()) plt.close(fig) def box(ax, x, y, w, h, text, fc, tc=C_WHITE, fs=9, bold=False): r = FancyBboxPatch((x-w/2, y-h/2), w, h, boxstyle="round,pad=0.07", lw=1.4, ec=C_DARK, fc=fc) ax.add_patch(r) ax.text(x, y, text, ha='center', va='center', fontsize=fs, color=tc, fontweight='bold' if bold else 'normal', multialignment='center') def arrow(ax, x1, y1, x2, y2, col=C_GREY, label=""): ax.annotate("", xy=(x2,y2), xytext=(x1,y1), arrowprops=dict(arrowstyle="-|>", color=col, lw=1.5)) if label: mx, my = (x1+x2)/2, (y1+y2)/2 ax.text(mx+0.05, my, label, fontsize=8, color=col, fontweight='bold') # ═══════════════════════════════════════════════════════ # 7. ANAESTHETIC AGENTS & GLYCEMIC EFFECT # ═══════════════════════════════════════════════════════ fig, ax = plt.subplots(figsize=(13,7)) fig.patch.set_facecolor(C_LGREY); ax.set_xlim(0,13); ax.set_ylim(0,7); ax.axis('off') ax.set_title("Anaesthetic Agents – Effects on Glucose Homeostasis", fontsize=13, fontweight='bold', color=C_DARK, pad=8) box(ax, 6.5, 6.4, 5, 0.7, "ANAESTHETIC AGENTS & GLUCOSE EFFECTS", C_BLUE, fs=12, bold=True) agents = [ (1.5, 4.8, "EPIDURAL\nANAESTHESIA", C_GREEN, "Blocks periop ↑ in\nepinephrine & cortisol\n→ Less glucose disruption\nvs General Anaesthesia"), (4.5, 4.8, "ETOMIDATE", C_TEAL, "↓ Adrenal steroidogenesis\n→ ↓ Cortisol\n→ ↓ Hyperglycemia\nby ~1 mmol/L"), (7.5, 4.8, "BENZO-\nDIAZEPINES", C_PURPLE, "High dose:\n↓ ACTH → ↓ Cortisol\n↓ Sympathetic stimulation\n→ ↓ Glycemic response"), (10.5, 4.8, "HIGH-DOSE\nOPIOIDS", C_RED, "Block SNS &\nHypothalamic-pituitary axis\n→ Abolish\nhyperglycemia"), ] for bx,by,title,col,det in agents: arrow(ax, 6.5, 6.05, bx, by+0.5) box(ax, bx, by, 2.6, 1.0, title, col, fs=10, bold=True) box(ax, bx, by-1.65, 2.6, 2.1, det, col, fs=8.5) # Warning box box(ax, 6.5, 0.6, 9.5, 0.65, "Halothane / Enflurane / Isoflurane – Inhibit insulin response to glucose (reversible, dose-dependent)", C_AMBER, tc=C_DARK, fs=9.5) save(fig, "fig7_anaesthetic_agents.png") print("fig7 done") # ═══════════════════════════════════════════════════════ # 8. RA vs GA COMPARISON TABLE VISUAL # ═══════════════════════════════════════════════════════ fig, ax = plt.subplots(figsize=(13, 7)) fig.patch.set_facecolor(C_LGREY); ax.set_xlim(0,13); ax.set_ylim(0,7); ax.axis('off') ax.set_title("Regional Anaesthesia vs General Anaesthesia in Diabetics", fontsize=13, fontweight='bold', color=C_DARK, pad=8) box(ax, 3.25, 6.3, 5.8, 0.65, "REGIONAL ANAESTHESIA (RA)", C_GREEN, fs=12, bold=True) box(ax, 9.75, 6.3, 5.8, 0.65, "GENERAL ANAESTHESIA (GA)", C_RED, fs=12, bold=True) ax.plot([6.5,6.5],[0,6.7], color=C_GREY, lw=1.5, linestyle='--') ra_adv = ["Lower stress hormone response","Better glycemic stability","Awake patient – easier\nhypoglycemia detection","Avoid aspiration risk\n(gastroparesis)","Less postop respiratory\ncomplications"] ra_dis = ["Autonomic neuropathy →\nunpredictable block spread","Increased sensitivity\nto LA drugs","Peripheral neuropathy –\nassessment difficult","Risk of epidural\nhematoma (coagulopathy)"] ga_pts = ["Rapid Sequence Induction\n(gastroparesis risk)","Volatile agents inhibit insulin","SNS stimulation ↑ glucose","Mask hypoglycemia symptoms","Preferred for uncooperative\nor long major surgeries","Monitor glucose hourly"] y = 5.5 ax.text(3.25, y, "ADVANTAGES", ha='center', fontsize=10, color=C_GREEN, fontweight='bold') ax.text(9.75, y, "KEY POINTS", ha='center', fontsize=10, color=C_RED, fontweight='bold') for i,txt in enumerate(ra_adv): ax.text(0.3, 5.0-i*0.62, f"✓ {txt}", va='center', fontsize=8.5, color=C_GREEN) ax.text(3.25, 1.8, "DISADVANTAGES", ha='center', fontsize=10, color=C_ORANGE, fontweight='bold') for i,txt in enumerate(ra_dis): ax.text(0.3, 1.4-i*0.55, f"✗ {txt}", va='center', fontsize=8.5, color=C_ORANGE) for i,txt in enumerate(ga_pts): ax.text(6.8, 5.0-i*0.72, f"▸ {txt}", va='center', fontsize=8.5, color=C_RED) save(fig, "fig8_ra_vs_ga.png") print("fig8 done") PYEOF
python3 << 'PYEOF' import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from matplotlib.patches import FancyBboxPatch import os OUT = "/tmp/workspace/diabetic-anesthesia/" C_BLUE="#1565C0"; C_TEAL="#00796B"; C_GREEN="#2E7D32"; C_AMBER="#F57F17" C_RED="#C62828"; C_GREY="#546E7A"; C_LGREY="#ECEFF1"; C_WHITE="#FFFFFF" C_DARK="#212121"; C_PURPLE="#6A1B9A" def save(fig, name): fig.savefig(os.path.join(OUT, name), dpi=150, bbox_inches='tight', facecolor=fig.get_facecolor()) plt.close(fig) def box(ax, x, y, w, h, text, fc, tc=C_WHITE, fs=9, bold=False): r = FancyBboxPatch((x-w/2, y-h/2), w, h, boxstyle="round,pad=0.07", lw=1.4, ec=C_DARK, fc=fc) ax.add_patch(r) ax.text(x, y, text, ha='center', va='center', fontsize=fs, color=tc, fontweight='bold' if bold else 'normal', multialignment='center') def arrow(ax, x1, y1, x2, y2, col=C_GREY): ax.annotate("", xy=(x2,y2), xytext=(x1,y1), arrowprops=dict(arrowstyle="-|>", color=col, lw=1.5)) # ═══════════════════════════════════════════════════════ # 9. HbA1c GLYCEMIC CONTROL GAUGE BAR # ═══════════════════════════════════════════════════════ fig, ax = plt.subplots(figsize=(11, 4)) fig.patch.set_facecolor(C_LGREY) ax.set_facecolor(C_LGREY) ax.set_xlim(0,11); ax.set_ylim(0,4); ax.axis('off') ax.set_title("HbA1c – Glycemic Control Interpretation", fontsize=13, fontweight='bold', color=C_DARK, pad=8) # Colour bands bands = [ (0, 2.2, "#A5D6A7", "Normal\n4–6%"), (2.2, 4.4, "#FFF9C4", "Good Control\n6–7%"), (4.4, 6.6, "#FFE082", "Acceptable\n7–8%"), (6.6, 8.8, "#FFAB40", "Poor Control\n8–10%"), (8.8, 11, "#EF9A9A", "Very Poor\n>10%"), ] for x1,x2,col,lbl in bands: r = FancyBboxPatch((x1,1.6), x2-x1, 1.2, boxstyle="square,pad=0", lw=1.2, ec=C_DARK, fc=col) ax.add_patch(r) ax.text((x1+x2)/2, 2.2, lbl, ha='center', va='center', fontsize=9, color=C_DARK, fontweight='bold', multialignment='center') # HbA1c axis for hb,lbl in [(0,"4%"),(2.2,"6%"),(4.4,"7%"),(6.6,"8%"),(8.8,"10%"),(11,">10%")]: ax.text(hb, 1.35, lbl, ha='center', va='top', fontsize=9, color=C_DARK) ax.plot([hb,hb],[1.6,1.5], color=C_DARK, lw=1) # Target marker ax.annotate("SURGICAL TARGET\n≤ 8% (ideally ≤7%)", xy=(4.4, 2.8), xytext=(5.5,3.6), fontsize=9, color=C_GREEN, fontweight='bold', arrowprops=dict(arrowstyle="-|>", color=C_GREEN, lw=1.5), ha='center') save(fig, "fig9_hba1c.png") print("fig9 done") # ═══════════════════════════════════════════════════════ # 10. STIFF JOINT SYNDROME + AIRWAY CONCERN # ═══════════════════════════════════════════════════════ fig, ax = plt.subplots(figsize=(12, 6)) fig.patch.set_facecolor(C_LGREY); ax.set_xlim(0,12); ax.set_ylim(0,6); ax.axis('off') ax.set_title("Stiff Joint Syndrome – Airway Assessment in Diabetics", fontsize=13, fontweight='bold', color=C_DARK, pad=8) box(ax, 6, 5.4, 6, 0.65, "STIFF JOINT SYNDROME (Cheiroarthropathy)", C_BLUE, fs=12, bold=True) tests = [ (2, 3.8, "Prayer Sign", C_TEAL, "Unable to approximate\npalmar surfaces of\nphalangeal joints"), (5.5, 3.8, "Palm Print Test", C_PURPLE, "Ink impression of palm\nScores interphalangeal\njoint involvement"), (9, 3.8, "Cervical Spine\nX-Ray", C_RED, "Assess limited\natlanto-axial extension\n→ Difficult intubation risk"), ] for bx,by,title,col,det in tests: arrow(ax, 6, 5.1, bx, by+0.45) box(ax, bx, by, 3.0, 0.9, title, col, fs=10, bold=True) box(ax, bx, by-1.3, 3.0, 1.6, det, col, fs=9) # Warning box(ax, 6, 0.55, 10, 0.65, "Clinical Features: Non-familial short stature | Tight waxy skin\n→ Anticipate DIFFICULT AIRWAY – have video laryngoscope ready", C_RED, fs=9.5) save(fig, "fig10_stiff_joint.png") print("fig10 done") PYEOF
python3 << 'PYEOF' from pptx import Presentation from pptx.util import Inches, Pt, Emu from pptx.dml.color import RGBColor from pptx.enum.text import PP_ALIGN import os OUT = "/tmp/workspace/diabetic-anesthesia/" IMGS = OUT prs = Presentation() prs.slide_width = Inches(13.33) prs.slide_height = Inches(7.5) blank_layout = prs.slide_layouts[6] # completely blank C_BLUE = RGBColor(0x15, 0x65, 0xC0) C_DARK = RGBColor(0x21, 0x21, 0x21) C_WHITE = RGBColor(0xFF, 0xFF, 0xFF) C_LGREY = RGBColor(0xEC, 0xF0, 0xF1) C_RED = RGBColor(0xC6, 0x28, 0x28) C_GREEN = RGBColor(0x2E, 0x7D, 0x32) def add_title_slide(prs, title, subtitle=""): slide = prs.slides.add_slide(blank_layout) # Background bg = slide.shapes.add_shape(1, Inches(0), Inches(0), Inches(13.33), Inches(7.5)) bg.fill.solid(); bg.fill.fore_color.rgb = C_BLUE bg.line.fill.background() # Title tf = slide.shapes.add_textbox(Inches(0.5), Inches(2.5), Inches(12.33), Inches(1.8)) p = tf.text_frame.add_paragraph() p.text = title; p.alignment = PP_ALIGN.CENTER r = p.runs[0]; r.font.size = Pt(40); r.font.bold = True r.font.color.rgb = C_WHITE # Subtitle if subtitle: tf2 = slide.shapes.add_textbox(Inches(0.5), Inches(4.4), Inches(12.33), Inches(1.0)) p2 = tf2.text_frame.add_paragraph() p2.text = subtitle; p2.alignment = PP_ALIGN.CENTER r2 = p2.runs[0]; r2.font.size = Pt(20); r2.font.color.rgb = C_LGREY return slide def add_image_slide(prs, img_path, slide_title=""): slide = prs.slides.add_slide(blank_layout) # Light bg bg = slide.shapes.add_shape(1, Inches(0), Inches(0), Inches(13.33), Inches(7.5)) bg.fill.solid(); bg.fill.fore_color.rgb = C_LGREY; bg.line.fill.background() # Optional title bar if slide_title: bar = slide.shapes.add_shape(1, Inches(0), Inches(0), Inches(13.33), Inches(0.55)) bar.fill.solid(); bar.fill.fore_color.rgb = C_BLUE; bar.line.fill.background() tf = slide.shapes.add_textbox(Inches(0.2), Inches(0.05), Inches(12.9), Inches(0.45)) p = tf.text_frame.add_paragraph() p.text = slide_title; r = p.runs[0] r.font.size = Pt(16); r.font.bold = True; r.font.color.rgb = C_WHITE img_top = Inches(0.6) else: img_top = Inches(0.1) # Image img_h = Inches(7.5) - img_top - Inches(0.1) pic = slide.shapes.add_picture(img_path, Inches(0.15), img_top, width=Inches(13.0), height=img_h) return slide # ── TITLE SLIDE ── add_title_slide(prs, "Diabetes & Anaesthesia", "Visual Summary | Flowcharts & Key Concepts") # ── SLIDE 1: DM Classification flowchart ── add_image_slide(prs, IMGS+"fig1_dm_classification.png", "1. ADA Classification of Diabetes Mellitus") # ── SLIDE 2: Preoperative assessment flowchart ── add_image_slide(prs, IMGS+"fig2_preop_flow.png", "2. Perioperative Anaesthetic Assessment Flow") # ── SLIDE 3: OHA Management ── add_image_slide(prs, IMGS+"fig3_oha_management.png", "3. Oral Hypoglycaemic Agents – Pre-surgical Management") # ── SLIDE 4: HbA1c gauge ── add_image_slide(prs, IMGS+"fig9_hba1c.png", "4. HbA1c – Glycaemic Control Levels") # ── SLIDE 5: DAN assessment ── add_image_slide(prs, IMGS+"fig5_dan_assessment.png", "5. Diabetic Autonomic Neuropathy (DAN) – Assessment") # ── SLIDE 6: End-organ damage ── add_image_slide(prs, IMGS+"fig6_organ_damage.png", "6. End-Organ Damage & Perioperative Concern Distribution") # ── SLIDE 7: Stiff joint ── add_image_slide(prs, IMGS+"fig10_stiff_joint.png", "7. Stiff Joint Syndrome – Airway Implications") # ── SLIDE 8: Anaesthetic agents ── add_image_slide(prs, IMGS+"fig7_anaesthetic_agents.png", "8. Anaesthetic Agents & Glycaemic Effects") # ── SLIDE 9: RA vs GA ── add_image_slide(prs, IMGS+"fig8_ra_vs_ga.png", "9. Regional vs General Anaesthesia in Diabetics") # ── SLIDE 10: Intraop glucose protocol ── add_image_slide(prs, IMGS+"fig4_intraop_glucose.png", "10. Intraoperative Glucose Management Protocol") # ── SLIDE 11: Key takeaways text slide ── slide = prs.slides.add_slide(blank_layout) bg = slide.shapes.add_shape(1, Inches(0), Inches(0), Inches(13.33), Inches(7.5)) bg.fill.solid(); bg.fill.fore_color.rgb = C_BLUE; bg.line.fill.background() bar = slide.shapes.add_shape(1, Inches(0), Inches(0), Inches(13.33), Inches(1.0)) bar.fill.solid(); bar.fill.fore_color.rgb = RGBColor(0x0D, 0x47, 0xA1); bar.line.fill.background() tft = slide.shapes.add_textbox(Inches(0.3), Inches(0.15), Inches(12.7), Inches(0.7)) p = tft.text_frame.add_paragraph() p.text = "Key Clinical Takeaways"; r = p.runs[0] r.font.size = Pt(26); r.font.bold = True; r.font.color.rgb = C_WHITE points = [ "Target intraoperative glucose: 120–180 mg/dL; 1 U insulin ≈ lowers BG by 25–30 mg/dL", "HbA1c >8% is a significant perioperative risk marker – optimise before elective surgery", "Stop metformin ≥24h pre-op; long-acting sulfonylureas 48–72h pre-op", "DAN (autonomic neuropathy) is the most critical system to assess – leads to haemodynamic instability", "Epidural anaesthesia provides better glycaemic stability than GA by blocking stress hormone surge", "Stiff joint syndrome → anticipate difficult airway → Cervical X-ray & video laryngoscopy", "Cardiac risk assessment mandatory in asymptomatic diabetics with age/smoking/HT/hyperlipidaemia", "Perioperative mortality is 5× higher with DM end-organ damage – thorough pre-op workup is essential", ] tfb = slide.shapes.add_textbox(Inches(0.5), Inches(1.1), Inches(12.3), Inches(6.0)) tf = tfb.text_frame; tf.word_wrap = True for i,pt in enumerate(points): p2 = tf.add_paragraph() if i > 0 else tf.paragraphs[0] p2.text = f"• {pt}" r2 = p2.runs[0]; r2.font.size = Pt(14.5); r2.font.color.rgb = C_WHITE p2.space_after = Pt(4) out_path = OUT + "Diabetes_Anaesthesia_Summary.pptx" prs.save(out_path) print(f"Saved: {out_path}") PYEOF
ls -lh /tmp/workspace/diabetic-anesthesia/
Diabetes Anaesthesia Summary
Presentation · PPTX
| Slide | Content | Type |
|---|---|---|
| 1 | Title | Cover |
| 2 | ADA Classification of DM (Type 1, 2, GDM, Other) | Flowchart |
| 3 | Perioperative Anaesthetic Assessment Flow | Flowchart |
| 4 | Oral Hypoglycaemic Agents - Pre-surgical timing | Visual table + timeline bar |
| 5 | HbA1c Glycaemic Control gauge | Colour-coded bar |
| 6 | Diabetic Autonomic Neuropathy (DAN) - Tests & Symptoms | Cluster diagram |
| 7 | End-Organ Damage severity + perioperative concern distribution | Horizontal bar + pie chart |
| 8 | Stiff Joint Syndrome & Airway implications | Flowchart |
| 9 | Anaesthetic Agents & Glycaemic Effects | Branch diagram |
| 10 | Regional vs General Anaesthesia in Diabetics | Comparison visual |
| 11 | Intraoperative Blood Glucose - Insulin Dose Protocol | Bar chart with actions |
| 12 | Key Clinical Takeaways | Summary slide |