make a ppt on diabetis mellitus type1 for internal medicine post graduate level
"Type 1 Diabetes Mellitus"[MeSH Terms]
ADA Standards of Care 2026 type 1 diabetes adults insulin management technology
type 1 diabetes autoimmune beta cell destruction pancreas diagram insulin therapy continuous glucose monitor
https://diabetesjournals.org/care/article/49/Supplement_1/S1…
~/
~/t1dm-pg-deck/src/create_t1dm_deck.py
from pptx import Presentation
from pptx.util import Inches, Pt
from pptx.enum.shapes import MSO_SHAPE
from pptx.enum.text import PP_ALIGN, MSO_ANCHOR
from pptx.dml.color import RGBColor
from pptx.enum.dml import MSO_THEME_COLOR
from pptx.enum.shapes import MSO_CONNECTOR
from pptx.enum.text import MSO_AUTO_SIZE
OUT='/tmp/workspace/t1dm-pg-deck/output/Type_1_Diabetes_Mellitus_PG_Internal_Medicine.pptx'
prs=Presentation(); prs.slide_width=Inches(13.333); prs.slide_height=Inches(7.5)
blank=prs.slide_layouts[6]
NAVY=RGBColor(12,38,64); BLUE=RGBColor(24,102,156); TEAL=RGBColor(0,143,153); CYAN=RGBColor(225,246,249); LIGHT=RGBColor(244,248,251); GREY=RGBColor(78,91,104); RED=RGBColor(190,50,60); AMBER=RGBColor(237,155,42); WHITE=RGBColor(255,255,255); GREEN=RGBColor(39,132,91)
def rect(s,x,y,w,h,fill, radius=False, line=None):
sh=s.shapes.add_shape(MSO_SHAPE.ROUNDED_RECTANGLE if radius else MSO_SHAPE.RECTANGLE, Inches(x), Inches(y), Inches(w), Inches(h)); sh.fill.solid(); sh.fill.fore_color.rgb=fill; sh.line.color.rgb=line or fill; return sh
def txt(s,text,x,y,w,h,size=20,color=NAVY,bold=False,align=PP_ALIGN.LEFT, font='Aptos', valign=MSO_ANCHOR.TOP,margin=.08):
tb=s.shapes.add_textbox(Inches(x), Inches(y), Inches(w), Inches(h)); tf=tb.text_frame; tf.clear(); tf.word_wrap=True; tf.margin_left=tf.margin_right=Inches(margin); tf.margin_top=tf.margin_bottom=Inches(margin); tf.vertical_anchor=valign
for i,line in enumerate(text.split('\n')):
p=tf.paragraphs[0] if i==0 else tf.add_paragraph(); p.text=line; p.alignment=align; p.space_after=Pt(3)
for r in p.runs: r.font.name=font; r.font.size=Pt(size); r.font.bold=bold; r.font.color.rgb=color
return tb
def rich(s, lines, x,y,w,h, size=17):
tb=s.shapes.add_textbox(Inches(x), Inches(y), Inches(w), Inches(h)); tf=tb.text_frame; tf.clear(); tf.word_wrap=True; tf.margin_left=tf.margin_right=Inches(.12); tf.margin_top=Inches(.08); tf.margin_bottom=Inches(.04)
for i,(text,col,bold) in enumerate(lines):
p=tf.paragraphs[0] if i==0 else tf.add_paragraph(); p.text=text; p.space_after=Pt(7); p.level=0
for r in p.runs: r.font.name='Aptos'; r.font.size=Pt(size); r.font.color.rgb=col; r.font.bold=bold
return tb
def base(title,kicker='TYPE 1 DIABETES MELLITUS | INTERNAL MEDICINE'):
s=prs.slides.add_slide(blank); rect(s,0,0,13.333,7.5,WHITE); rect(s,0,0,13.333,.18,TEAL); txt(s,kicker,.55,.3,8.5,.25,10,TEAL,True); txt(s,title,.55,.62,12.1,.55,27,NAVY,True); rect(s,.55,1.33,12.2,.02,RGBColor(211,222,230)); return s
def footer(s,n):
txt(s,f'{n:02d}',12.1,7.05,.45,.2,9,TEAL,True,PP_ALIGN.RIGHT); txt(s,'PG teaching deck | October 2026',.55,7.05,3,.2,8,GREY)
def bullets(s,items,x,y,w,h,size=17):
lines=[]
for head,body in items:
lines += [(head,BLUE,True),(body,GREY,False)]
return rich(s,lines,x,y,w,h,size)
def note(s,text):
try: s.notes_slide.notes_text_frame.text=text
except Exception: pass
# 1 title
s=prs.slides.add_slide(blank); rect(s,0,0,13.333,7.5,NAVY); rect(s,0,0,13.333,.18,TEAL); rect(s,8.55,.9,3.7,5.35,RGBColor(18,57,85),True)
txt(s,'TYPE 1\nDIABETES\nMELLITUS',.7,1.08,7.4,2.7,35,WHITE,True); txt(s,'Internal Medicine Postgraduate Level',.75,4.1,6.2,.35,18,RGBColor(186,224,230)); txt(s,'Diagnosis • insulin physiology • acute care • technology • complications',.75,4.65,6.6,.65,15,WHITE)
# visual beta-cell
for i in range(7):
import math
x=10.4+1.15*math.cos(i*2*math.pi/7); y=3.35+1.15*math.sin(i*2*math.pi/7)
sh=s.shapes.add_shape(MSO_SHAPE.OVAL,Inches(x-.22),Inches(y-.22),Inches(.44),Inches(.44)); sh.fill.solid(); sh.fill.fore_color.rgb=CYAN; sh.line.color.rgb=CYAN
rect(s,9.8,2.75,1.2,1.2,TEAL,True); txt(s,'β',10.12,2.95,.55,.4,27,WHITE,True,PP_ALIGN.CENTER); txt(s,'AUTOIMMUNE\nβ-CELL FAILURE',9.15,5.35,2.6,.5,12,WHITE,True,PP_ALIGN.CENTER)
txt(s,'Prepared for postgraduate academic teaching | Not a substitute for local protocols',.75,6.65,7.5,.25,9,RGBColor(176,197,211)); footer(s,1)
# 2 objectives
s=base('Learning objectives');
items=[('1. Classify accurately','Recognize immune-mediated and idiopathic T1D; distinguish adult-onset T1D/LADA and ketosis-prone diabetes.'),('2. Diagnose with intent','Use glucose/HbA1c criteria, ketones, C-peptide and islet antibodies in the correct clinical context.'),('3. Prescribe insulin safely','Build a physiologic basal-bolus or pump regimen, quantify correction and carbohydrate dosing, prevent hypoglycemia.'),('4. Manage risk longitudinally','Apply sick-day rules, DKA principles, screening for complications and associated autoimmune disease.')]
bullets(s,items,.8,1.7,11.7,4.9,19); footer(s,2)
# 3 definition
s=base('What is Type 1 diabetes?','CORE CONCEPT')
rect(s,.7,1.65,4.0,4.7,LIGHT,True); txt(s,'Disease model',1.0,1.95,3.3,.35,19,NAVY,True)
bullets(s,[('Immune-mediated β-cell destruction','Usually T-cell mediated, with islet autoantibodies as markers; progressive insulin deficiency.'),('Clinical endpoint','Near-absolute endogenous insulin deficiency, propensity to ketosis and lifelong exogenous insulin requirement.'),('Not an age diagnosis','May present in childhood, adolescence or adulthood; phenotype can overlap with type 2 diabetes.')],1.0,2.45,3.35,3.4,15)
rect(s,5.1,1.65,7.4,1.1,CYAN,True); txt(s,'AUTOIMMUNITY → β-cell loss → insulinopenia → hyperglycemia + ketogenesis',5.35,1.98,6.9,.4,18,NAVY,True,PP_ALIGN.CENTER)
for i,(h,b,c) in enumerate([('5-10%','of diabetes cases',TEAL),('85-90%','autoantibody positive at diagnosis',BLUE),('DKA','if untreated',RED)]):
x=5.2+i*2.45; rect(s,x,3.25,2.1,1.65,WHITE,True,RGBColor(211,222,230)); txt(s,h,x,3.52,2.1,.35,22,c,True,PP_ALIGN.CENTER); txt(s,b,x+.1,4.03,1.9,.38,11,GREY,False,PP_ALIGN.CENTER)
txt(s,'Clinical implication: basal insulin must never be omitted, even when fasting or unwell.',5.3,5.65,6.9,.45,16,RED,True); footer(s,3); note(s,'Source: Henry’s Clinical Diagnosis and Management by Laboratory Methods, TYPE 1 DIABETES, lines 786-788.')
# 4 pathogenesis
s=base('Pathogenesis and disease staging')
steps=[('Genetic susceptibility','HLA class II DR/DQ and non-HLA loci'),('Environmental/immune trigger','Initiation and propagation of islet-directed autoimmunity'),('Stage 1','≥2 islet autoantibodies\nNormoglycemia\nAsymptomatic'),('Stage 2','≥2 antibodies + dysglycemia\nAsymptomatic'),('Stage 3','Clinical diabetes\nSymptoms and/or DKA')]
for i,(h,b) in enumerate(steps):
x=.65+i*2.5; rect(s,x,2.15,2.15,1.85, LIGHT if i<2 else CYAN, True); txt(s,h,x+.12,2.43,1.9,.32,15,NAVY,True,PP_ALIGN.CENTER); txt(s,b,x+.12,2.9,1.9,.75,11,GREY,False,PP_ALIGN.CENTER)
if i<4: txt(s,'›',x+2.15,2.68,.3,.4,28,TEAL,True,PP_ALIGN.CENTER)
rect(s,.85,4.65,11.55,1.05,RGBColor(255,246,232),True); txt(s,'Autoantibodies: IAA, GAD65, IA-2, ZnT8, ICA. Multiple antibodies confer substantially higher risk of progression than a single antibody.',1.15,4.95,10.9,.42,16,NAVY,False,PP_ALIGN.CENTER)
txt(s,'Disease-modifying therapy is evolving. Refer at-risk individuals to dedicated staging/prevention programs where available.',.9,6.05,11.4,.3,14,GREY,False,PP_ALIGN.CENTER); footer(s,4)
# 5 presentation
s=base('Clinical presentation: do not miss insulin deficiency')
rect(s,.75,1.68,3.8,4.75,LIGHT,True); txt(s,'Typical presentation',1.05,1.98,3.1,.32,19,NAVY,True); bullets(s,[('Osmotic symptoms','Polyuria, polydipsia, nocturia, weight loss, fatigue, blurred vision.'),('Catabolic phenotype','Weight loss, dehydration, recurrent infections; but overweight phenotype does not exclude T1D.'),('Acute presentation','DKA may be first presentation, especially in delayed diagnosis.')],1.05,2.5,3.1,3.3,15)
rect(s,4.85,1.68,3.8,4.75,RGBColor(255,246,232),True); txt(s,'Adult-onset clues',5.15,1.98,3.1,.32,19,NAVY,True); bullets(s,[('Consider autoimmune diabetes','Rapid progression to insulin, personal/family autoimmunity, low/normal BMI, ketosis.'),('But avoid stereotypes','Obesity, metabolic syndrome and older age can coexist with T1D.'),('LADA','Slower β-cell decline, often initially non-insulin-requiring; antibody-positive adult diabetes.')],5.15,2.5,3.1,3.3,15)
rect(s,8.95,1.68,3.65,4.75,RGBColor(255,238,239),True); txt(s,'Red flags for DKA',9.25,1.98,3,.32,19,RED,True); bullets(s,[('Symptoms','Vomiting, abdominal pain, Kussmaul respirations, confusion.'),('Immediate tests','Capillary glucose + blood β-hydroxybutyrate + venous blood gas + electrolytes.'),('Action','Treat as DKA until proven otherwise; do not defer insulin assessment.')],9.25,2.5,2.95,3.3,15); footer(s,5)
# 6 diagnosis
s=base('Diagnosis: establish diabetes, then establish type')
rect(s,.75,1.7,5.8,4.85,LIGHT,True); txt(s,'1 | Confirm diabetes',1.05,1.98,3.2,.3,19,NAVY,True)
txt(s,'• Classic symptoms or hyperglycemic crisis + random plasma glucose ≥200 mg/dL (11.1 mmol/L)\n• OR fasting plasma glucose ≥126 mg/dL (7.0 mmol/L)\n• OR 2-h plasma glucose ≥200 mg/dL on 75-g OGTT\n• OR HbA1c ≥6.5%\n\nAbsent unequivocal hyperglycemia, confirm on a separate day.',1.1,2.45,4.95,2.45,16,GREY)
txt(s,'Always interpret HbA1c cautiously in altered RBC turnover, hemoglobinopathies, advanced CKD or recent transfusion.',1.1,5.47,4.95,.45,13,RED,True)
rect(s,6.8,1.7,5.8,4.85,CYAN,True); txt(s,'2 | Determine phenotype and etiology',7.1,1.98,4.5,.3,19,NAVY,True)
bullets(s,[('Islet antibodies','GAD65 first-line in many adult pathways; add IA-2 and ZnT8; IAA only before exogenous insulin or early after diagnosis.'),('C-peptide','Interpret with concurrent glucose and renal function. Low C-peptide supports severe insulin deficiency; avoid testing during acute metabolic decompensation.'),('Alternative diagnoses','Type 2 DM, monogenic diabetes, pancreatic diabetes, drug-induced diabetes, ketosis-prone diabetes.')],7.1,2.45,4.95,3.25,15); footer(s,6)
# 7 differential
s=base('Differential diagnosis in the insulin-treated adult')
headers=['Feature','Classic T1D','LADA','Type 2 DM','Monogenic DM']
rows=[['Typical onset','Any age; often abrupt','>30 y; slower','Usually adult; variable','Young, familial'],['Autoantibodies','Often multiple +','Usually GAD +','Negative','Negative'],['C-peptide','Low/declining','Initially preserved','Normal/high early','Usually preserved'],['Ketosis','Common if untreated','Can occur late','Less common','Uncommon'],['Therapy','Insulin from diagnosis','Progresses to insulin','Non-insulin ± insulin','Gene-specific']]
x=[.6,2.45,4.65,6.85,9.05]; widths=[1.8,2.05,2.05,2.05,3.65]
for j,h in enumerate(headers): rect(s,x[j],1.72,widths[j],.62,NAVY,True); txt(s,h,x[j]+.03,1.91,widths[j]-.06,.2,12,WHITE,True,PP_ALIGN.CENTER)
for i,row in enumerate(rows):
y=2.36+i*.72
for j,cell in enumerate(row): rect(s,x[j],y,widths[j],.68, CYAN if i%2==0 else LIGHT); txt(s,cell,x[j]+.06,y+.16,widths[j]-.12,.3,12,NAVY if j==0 else GREY,j==0,PP_ALIGN.CENTER)
txt(s,'Use biomarkers to resolve ambiguity. Clinical phenotype alone can misclassify adult autoimmune diabetes.',.8,6.35,11.6,.32,16,RED,True,PP_ALIGN.CENTER); footer(s,7)
# 8 insulin
s=base('Insulin replacement: mimic physiology, individualize delivery')
rect(s,.7,1.7,3.8,4.8,LIGHT,True); txt(s,'Basal insulin',1.0,2.0,3.1,.3,20,TEAL,True); txt(s,'Suppresses hepatic glucose output and ketogenesis between meals and overnight.\n\nLong-acting analog\n• glargine U100/U300\n• degludec\n• detemir (often BID)\n\nNPH is an alternative but has a peak and higher nocturnal hypoglycemia risk.',1.0,2.55,3.1,2.8,16,GREY)
rect(s,4.75,1.7,3.8,4.8,CYAN,True); txt(s,'Prandial insulin',5.05,2.0,3.1,.3,20,BLUE,True); txt(s,'Covers carbohydrate intake and corrects pre-meal hyperglycemia.\n\nRapid analog\n• lispro, aspart, glulisine\n• faster aspart / ultra-rapid lispro\n\nDose timing must match meal, gastric emptying, exercise and glucose trend.',5.05,2.55,3.1,2.8,16,GREY)
rect(s,8.8,1.7,3.8,4.8,RGBColor(235,249,242),True); txt(s,'Delivery options',9.1,2.0,3.1,.3,20,GREEN,True); txt(s,'MDI\nBasal + meal bolus + correction\n\nCSII / pump\nContinuous rapid-acting insulin only\n\nAID\nCGM-informed automated basal modulation and, in some systems, automated correction boluses.',9.1,2.55,3.1,2.8,16,GREY); footer(s,8)
# 9 dosing
s=base('Practical basal-bolus prescribing')
rect(s,.75,1.65,4.0,4.95,LIGHT,True); txt(s,'Starting framework',1.05,1.95,3.2,.35,20,NAVY,True); txt(s,'For new, stable adults:\n\nTotal daily dose (TDD) often 0.3-0.6 U/kg/day.\n\nStart around 40-50% basal and 50-60% prandial, then titrate from CGM/SMBG patterns.\n\nLower starting doses in honeymoon phase, frailty, renal impairment or high hypoglycemia risk.',1.08,2.5,3.25,3.2,16,GREY)
rect(s,5.05,1.65,3.55,4.95,CYAN,True); txt(s,'Meal dose',5.35,1.95,2.95,.35,20,BLUE,True); txt(s,'Meal bolus =\n\nCarbohydrate grams ÷ insulin-to-carb ratio (ICR)\n\n+ (Current glucose - target) ÷ insulin sensitivity factor (ISF)\n\n- active insulin adjustment (pump/AID).',5.35,2.65,2.95,2.8,17,NAVY,False,PP_ALIGN.CENTER)
rect(s,8.9,1.65,3.65,4.95,RGBColor(255,246,232),True); txt(s,'Rules of thumb',9.2,1.95,3,.35,20,AMBER,True); txt(s,'Initial estimates only:\n\nICR ≈ 500 ÷ TDD\nISF ≈ 1800 ÷ TDD (mg/dL)\n\nValidate with glucose data. Avoid repeated correction doses before insulin action is complete.',9.2,2.55,3,2.9,16,GREY); footer(s,9)
# 10 monitoring
s=base('Glycemic assessment and CGM-informed targets')
rect(s,.75,1.7,4.0,4.75,LIGHT,True); txt(s,'Core metrics',1.05,2.0,3.1,.3,19,NAVY,True); bullets(s,[('HbA1c','Usually every 3 months when therapy is changing or goals unmet; individualize target.'),('CGM','Time in range, time below range, glucose management indicator, coefficient of variation and ambulatory glucose profile.'),('Context','Assess hypoglycemia, glycemic variability, burden, access, pregnancy, comorbidity and patient goals.')],1.05,2.5,3.1,3.25,15)
for i,(num,label,col) in enumerate([('>70%','TIR 70-180 mg/dL',GREEN),('<4%','<70 mg/dL',AMBER),('<1%','<54 mg/dL',RED)]):
x=5.2+i*2.4; rect(s,x,2.0,2.1,1.72,WHITE,True,RGBColor(211,222,230)); txt(s,num,x,2.35,2.1,.3,23,col,True,PP_ALIGN.CENTER); txt(s,label,x+.08,2.86,1.94,.35,11,GREY,False,PP_ALIGN.CENTER)
rect(s,5.15,4.35,7.25,1.42,CYAN,True); txt(s,'Common nonpregnant adult target: HbA1c <7% if achievable without significant hypoglycemia. Individualize more or less stringent goals.',5.45,4.7,6.65,.6,17,NAVY,True,PP_ALIGN.CENTER); footer(s,10)
# 11 hypoglycemia
s=base('Hypoglycemia: prevention, recognition, rescue')
rect(s,.75,1.7,3.7,4.85,RGBColor(255,238,239),True); txt(s,'Classify',1.05,2.0,3.1,.3,20,RED,True); txt(s,'Level 1: glucose <70 and ≥54 mg/dL\n\nLevel 2: glucose <54 mg/dL\n\nLevel 3: severe event with altered mental/physical status requiring assistance',1.05,2.55,3.05,2.5,17,NAVY)
rect(s,4.78,1.7,3.7,4.85,LIGHT,True); txt(s,'Treat',5.08,2.0,3.1,.3,20,TEAL,True); txt(s,'Awake and able to swallow:\n15-20 g rapid carbohydrate\nRecheck in 15 minutes; repeat if needed.\n\nIf meal is not imminent, take longer-acting carbohydrate after recovery.',5.08,2.55,3.05,2.5,16,GREY)
rect(s,8.8,1.7,3.7,4.85,CYAN,True); txt(s,'Rescue and prevention',9.1,2.0,3.1,.3,20,BLUE,True); txt(s,'Severe hypoglycemia:\nGlucagon (nasal or ready-to-use injectable preferred) and urgent assistance.\n\nReview: basal excess, ICR/ISF, missed meals, alcohol, exercise, renal function, impaired awareness. Prescribe glucagon and educate close contacts.',9.1,2.55,3.05,2.9,15,GREY); footer(s,11)
# 12 sick day
s=base('Sick-day management: a safety-critical conversation')
rect(s,.75,1.7,11.85,.7,NAVY,True); txt(s,'Never stop basal insulin. Check glucose frequently, check ketones early, hydrate, give supplemental rapid insulin when indicated.',1.0,1.93,11.35,.25,16,WHITE,True,PP_ALIGN.CENTER)
cols=[('Monitor','Glucose every 2-4 h; blood β-hydroxybutyrate or urine ketones if unwell, vomiting or hyperglycemic.'),('Hydrate','Use carbohydrate-containing fluids if unable to eat and glucose is low/normal; sugar-free fluids if hyperglycemic.'),('Escalate','Urgent evaluation for persistent vomiting, inability to maintain fluids, rising ketones, acidosis symptoms or altered mental state.'),('Plan before discharge','Written sick-day plan, ketone supplies, CGM/pump backup, contact pathway and glucagon.')]
for i,(h,b) in enumerate(cols):
x=.78+i*2.95; rect(s,x,2.85,2.65,2.72,LIGHT if i%2==0 else CYAN,True); txt(s,h,x+.15,3.18,2.35,.3,18,TEAL,True,PP_ALIGN.CENTER); txt(s,b,x+.18,3.75,2.28,1.35,13,GREY,False,PP_ALIGN.CENTER)
txt(s,'For pump users: unexplained hyperglycemia can represent infusion-set failure. Give correction by injection if ketones are present and change the set.',.9,6.2,11.5,.35,14,RED,True,PP_ALIGN.CENTER); footer(s,12)
# 13 DKA
s=base('Diabetic ketoacidosis: first-hour priorities')
rect(s,.75,1.65,3.65,4.95,RGBColor(255,238,239),True); txt(s,'Recognize',1.05,1.96,3,.3,20,RED,True); txt(s,'Diabetes or hyperglycemia\n+ ketosis (β-hydroxybutyrate preferred)\n+ metabolic acidosis\n\nAssess severity, precipitant, mental status and hemodynamics.',1.05,2.52,3,2.4,16,NAVY)
rect(s,4.82,1.65,3.65,4.95,LIGHT,True); txt(s,'Resuscitate and correct',5.12,1.96,3,.3,20,TEAL,True); txt(s,'1. Isotonic crystalloid\n2. Potassium-guided replacement\n3. Fixed-rate IV insulin after verifying K+ is safe\n4. Add dextrose as glucose falls while continuing insulin until ketosis resolves',5.12,2.52,3,2.9,16,GREY)
rect(s,8.9,1.65,3.65,4.95,CYAN,True); txt(s,'Avoid errors',9.2,1.96,3,.3,20,BLUE,True); txt(s,'• Do not start insulin if K+ is severely low\n• Do not stop insulin merely because glucose normalizes\n• Search for infection, infarction, stroke, missed insulin, pump failure, drugs\n• Overlap SC basal insulin before stopping IV insulin',9.2,2.52,3,2.9,15,GREY); footer(s,13)
#14 technology
s=base('Diabetes technology: CGM, pumps and automated insulin delivery')
rect(s,.75,1.7,3.65,4.8,LIGHT,True); txt(s,'CGM',1.05,2.0,3,.3,20,TEAL,True); txt(s,'Real-time or intermittently scanned CGM improves pattern recognition, supports insulin adjustment and can reduce hypoglycemia.\n\nReview AGP systematically: TIR → hypoglycemia → variability → hyperglycemia pattern.',1.05,2.55,3,2.7,16,GREY)
rect(s,4.83,1.7,3.65,4.8,CYAN,True); txt(s,'Pump / CSII',5.13,2.0,3,.3,20,BLUE,True); txt(s,'Permits programmable basal rates, temporary basal changes, bolus calculator and extended bolus.\n\nRisk: interruption of rapid-acting insulin delivery can precipitate ketosis rapidly.',5.13,2.55,3,2.7,16,GREY)
rect(s,8.9,1.7,3.65,4.8,RGBColor(235,249,242),True); txt(s,'AID',9.2,2.0,3,.3,20,GREEN,True); txt(s,'CGM-driven algorithm adjusts insulin delivery. Current ADA 2026: AID is the preferred insulin delivery system in people with T1D.\n\nSuccess depends on training, meal bolusing, device troubleshooting, access and backup plans.',9.2,2.55,3,2.7,15,GREY); footer(s,14)
# 15 complications
s=base('Complications and associated autoimmune disease')
for i,(h,b,c) in enumerate([('Microvascular','Retinopathy\nAlbuminuria/eGFR decline\nPeripheral/autonomic neuropathy',TEAL),('Macrovascular','Blood pressure, lipids, smoking, kidney disease, obesity, exercise and diet modify risk.',BLUE),('Autoimmune','Thyroid disease, celiac disease, pernicious anemia/autoimmune gastritis, Addison disease.',AMBER)]):
x=.75+i*4.05; rect(s,x,1.85,3.65,3.5,LIGHT if i!=1 else CYAN,True); txt(s,h,x+.2,2.18,3.25,.3,21,c,True,PP_ALIGN.CENTER); txt(s,b,x+.28,2.9,3.1,1.55,16,GREY,False,PP_ALIGN.CENTER)
rect(s,.85,5.85,11.55,.6,NAVY,True); txt(s,'Annual review should integrate diabetes distress, depression, eating disorder risk, social determinants, pregnancy planning and vaccination.',1.1,6.04,11.05,.22,14,WHITE,True,PP_ALIGN.CENTER); footer(s,15)
# 16 screening
s=base('Longitudinal surveillance: a pragmatic annual-review checklist')
items=[('Eyes','Dilated retinal photography/exam based on duration and prior findings.'),('Kidneys','UACR + eGFR; blood pressure and renoprotective therapy when indicated.'),('Feet / nerves','Foot inspection, pulses, monofilament, neuropathic symptoms, autonomic symptoms.'),('Cardiometabolic','BP, lipids, smoking, weight, physical activity, nutrition and statin indication.'),('Autoimmunity','TSH ± thyroid antibodies by context; celiac and B12/autoimmune gastritis assessment when indicated.'),('Psychosocial','Diabetes distress, depression, fear of hypoglycemia, access, education, device burden.')]
for i,(h,b) in enumerate(items):
col=i%2; row=i//2; x=.85+col*6.05; y=1.7+row*1.48; rect(s,x,y,5.6,1.18,LIGHT if col==0 else CYAN,True); txt(s,h,x+.18,y+.18,1.55,.28,17,TEAL if col==0 else BLUE,True); txt(s,b,x+1.65,y+.14,3.72,.55,13,GREY)
footer(s,16)
#17 inpatient
s=base('Hospital and peri-procedural care')
rect(s,.75,1.7,5.6,4.85,LIGHT,True); txt(s,'Non-negotiable principles',1.05,2.0,4.9,.3,20,NAVY,True); bullets(s,[('Basal insulin continues','T1D requires basal insulin even if NPO to prevent ketosis. Adjust dose only with clinical judgment and monitoring.'),('Monitor frequently','Capillary glucose; ketones/acid-base status if unexplained hyperglycemia or clinical deterioration.'),('Use IV insulin when appropriate','Critical illness, DKA, prolonged surgery/NPO or unstable perfusion may require infusion protocols.')],1.05,2.52,4.85,3.2,15)
rect(s,6.7,1.7,5.85,4.85,CYAN,True); txt(s,'Perioperative planning',7.0,2.0,5.1,.3,20,BLUE,True); txt(s,'• Early scheduling limits fasting\n• Continue basal insulin, monitor closely\n• Dextrose infusion can prevent hypoglycemia during fasting\n• Pump/AID continuation requires institutional policy, competence and contingency plan\n• Transition from IV to SC requires basal overlap\n\nCommunicate: insulin type, device settings, last dose, CGM status, sick-day history.',7.0,2.55,4.95,3.15,16,GREY); footer(s,17); note(s,'Source: The Washington Manual of Medical Therapeutics, Type 1 diabetes, lines 1010-1018: basal insulin required to prevent ketosis; perioperative guidance.')
#18 case
s=base('Case-based application')
rect(s,.75,1.65,4.3,4.95,LIGHT,True); txt(s,'Case',1.05,1.95,3.5,.3,20,NAVY,True); txt(s,'28-year-old with 2 weeks of polyuria, 7-kg weight loss and vomiting.\n\nGlucose 420 mg/dL\nβ-hydroxybutyrate 5.8 mmol/L\npH 7.18, HCO₃⁻ 11 mmol/L\nK+ 4.8 mmol/L',1.05,2.5,3.45,2.75,17,GREY)
rect(s,5.35,1.65,3.35,4.95,CYAN,True); txt(s,'Interpretation',5.65,1.95,2.75,.3,20,BLUE,True); txt(s,'This is DKA.\n\nImmediate care is not delayed for antibody results.\n\nObtain A1c, precipitant evaluation and diabetes classification tests after stabilization.',5.65,2.5,2.75,2.75,16,GREY)
rect(s,9.0,1.65,3.55,4.95,RGBColor(255,246,232),True); txt(s,'Questions for the team',9.3,1.95,2.95,.3,20,AMBER,True); txt(s,'1. What is the first-hour protocol?\n\n2. When is it safe to start insulin?\n\n3. What prevents recurrent ketosis after transition?\n\n4. What education is required before discharge?',9.3,2.5,2.95,2.75,16,NAVY); footer(s,18)
#19 take home
s=base('Take-home messages')
messages=[('1','Think insulin deficiency','T1D can occur at any age and body size. Test ketones early when clinically unwell.'),('2','Basal insulin is essential','Do not omit basal insulin in fasting, illness or hospital admission.'),('3','Biomarkers clarify type','Antibodies and carefully interpreted C-peptide reduce adult misclassification.'),('4','Technology works with education','CGM/AID improve care when matched to training, access, troubleshooting and backup plans.'),('5','Prevent acute and chronic harm','Structured hypoglycemia, sick-day, DKA, complication and psychosocial care are integral.')]
for i,(num,h,b) in enumerate(messages):
y=1.55+i*1.02; rect(s,.8,y,1.05,.72,TEAL,True); txt(s,num,.8,y+.18,1.05,.25,20,WHITE,True,PP_ALIGN.CENTER); txt(s,h,2.05,y+.1,3.45,.25,17,NAVY,True); txt(s,b,5.4,y+.1,6.75,.38,14,GREY)
footer(s,19)
#20 refs
s=base('Selected references and guidance')
refs=['American Diabetes Association. Standards of Care in Diabetes - 2026. Diabetes Care. 2026;49(Suppl 1). Sections 2, 6, 7, 9, 15 and 16.','The Washington Manual of Medical Therapeutics. Diabetes mellitus, perioperative Type 1 diabetes section.','Henry’s Clinical Diagnosis and Management by Laboratory Methods. Type 1 diabetes and islet autoantibody sections.','Tietz Textbook of Laboratory Medicine, 7th ed. Diabetes classification, C-peptide and autoantibody testing sections.','International consensus report on hyperglycemic crises in adults with diabetes (DKA/HHS). Diabetes Care. 2024.','Battelino T, et al. Clinical targets for continuous glucose monitoring data interpretation. Diabetes Care. 2019;42:1593-1603.']
rect(s,.75,1.65,11.85,4.9,LIGHT,True); txt(s,'Primary sources used for this deck',1.05,1.95,6,.3,20,NAVY,True)
for i,r in enumerate(refs): txt(s,f'{i+1}. {r}',1.1,2.55+i*.57,10.95,.4,14,GREY)
txt(s,'Current practice should follow local formulary, device availability, institutional DKA pathways and region-specific guidance.',1.0,6.72,11.1,.25,11,RED,True,PP_ALIGN.CENTER); footer(s,20)
prs.core_properties.title='Type 1 Diabetes Mellitus - Internal Medicine Postgraduate Level'; prs.core_properties.subject='Postgraduate internal medicine teaching'; prs.core_properties.author='Orris'
prs.save(OUT)
print(OUT)
mkdir -p "/tmp/workspace/t1dm-pg-deck/output" && python "/tmp/workspace/t1dm-pg-deck/src/create_t1dm_deck.py" && python - <<'PY' from pptx import Presentation p='/tmp/workspace/t1dm-pg-deck/output/Type_1_Diabetes_Mellitus_PG_Internal_Medicine.pptx' prs=Presentation(p) print('slides',len(prs.slides)) for i,s in enumerate(prs.slides,1): text=' '.join(sh.text for sh in s.shapes if hasattr(sh,'text_frame')) print(i, len(text), text[:75].replace('\n',' | ')) PY
python - <<'PY' from pptx import Presentation from pptx.util import Inches p='/tmp/workspace/t1dm-pg-deck/output/Type_1_Diabetes_Mellitus_PG_Internal_Medicine.pptx' prs=Presentation(p) W,H=prs.slide_width,prs.slide_height issues=[] for i,slide in enumerate(prs.slides,1): for j,sh in enumerate(slide.shapes,1): if sh.left < 0 or sh.top < 0 or sh.left+sh.width>W or sh.top+sh.height>H: issues.append((i,j,'out-of-bounds')) if getattr(sh,'has_text_frame',False): for p in sh.text_frame.paragraphs: for r in p.runs: if r.font.size and r.font.size.pt < 8: issues.append((i,j,'small-font')) print('slides=',len(prs.slides),'issues=',issues) PY ls -lh "/tmp/workspace/t1dm-pg-deck/output/Type_1_Diabetes_Mellitus_PG_Internal_Medicine.pptx"
Type 1 Diabetes Mellitus PG Internal Medicine
Presentation · PPTX