Diabetes mellitus
"diabetes mellitus" AND management
| Type | Mechanism |
|---|---|
| Type 1 DM (T1DM) | Autoimmune beta cell destruction → absolute insulin deficiency |
| Type 2 DM (T2DM) | Progressive loss of beta cell secretion + insulin resistance (~90% of all cases) |
| Gestational DM (GDM) | Diabetes first recognized during pregnancy (not clearly overt prior to gestation) |
| Other specific types | Monogenic (MODY, neonatal), exocrine pancreas disease (cystic fibrosis), drug/chemical-induced (glucocorticoids, HIV therapy, post-transplant) |
| Criterion | Threshold |
|---|---|
| Fasting plasma glucose (FPG) | ≥126 mg/dL (7.0 mmol/L) |
| 2-hour plasma glucose (75 g OGTT) | ≥200 mg/dL (11.1 mmol/L) |
| HbA1c | ≥6.5% |
| Random plasma glucose + classic symptoms | ≥200 mg/dL (11.1 mmol/L) |
| Complication | Description |
|---|---|
| Diabetic Retinopathy | Leading cause of blindness in working-age adults; annual eye exams essential |
| Diabetic Nephropathy | Leading cause of end-stage renal disease; earliest sign is microalbuminuria |
| Diabetic Neuropathy | Peripheral (distal symmetric polyneuropathy) + autonomic; loss of protective sensation in feet |
| Type | Onset | Peak | Duration |
|---|---|---|---|
| Rapid-acting (Aspart, Glulisine, Lispro) | <15 min | 0.5-1.5 h | 3-5 h |
| Short-acting Regular | 0.5-1 h | 2-3 h | 4-8 h |
| Inhaled human insulin | <15 min | 1-2 h | 3 h |
| Intermediate (NPH) | 2-4 h | 4-10 h | 10-16 h |
| Long-acting (Glargine, Detemir, Degludec) | 1-9 h | Flat | 20-42 h |

| Class | Mechanism | Key Agents |
|---|---|---|
| Biguanides | Reduces hepatic gluconeogenesis, improves insulin sensitivity | Metformin |
| Sulfonylureas | Stimulates insulin secretion from beta cells | Glimepiride, glipizide |
| TZDs | PPAR-γ agonist, improves insulin sensitivity | Pioglitazone |
| DPP-4 inhibitors | Inhibits incretin degradation, glucose-dependent insulin release | Sitagliptin |
| GLP-1 RAs | Mimics GLP-1: glucose-dependent insulin secretion, slows gastric emptying, weight loss, CV benefit | Semaglutide, liraglutide |
| SGLT-2 inhibitors | Blocks renal glucose reabsorption → glucosuria; CV and renal protection | Empagliflozin, dapagliflozin |
| Insulin | Replaces/supplements deficient insulin | Multiple preparations |
| Trial | Finding |
|---|---|
| DCCT | Intensive glycemic control in T1DM reduces microvascular complications (retinopathy, nephropathy, neuropathy) but increases hypoglycemia risk |
| UKPDS 35 | Glycemia correlates directly with macro- and microvascular complications in T2DM |
| CARDS | Atorvastatin reduces cardiovascular events in T2DM |
| GRADE | Liraglutide/basal insulin superior to glimepiride/sitagliptin as add-ons to metformin for glycemic control |
Create a quick reference guide PDF on diabetes diagnosis, monitoring, and management
ls /home/daytona/workspace/ 2>/dev/null && echo "exists" || mkdir -p /home/dayto…
mkdir -p /home/daytona/workspace/diabetes-pdf && python3 -c "from reportlab.lib …
~/diabetes-pdf/generate_pdf.py
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import cm, mm
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_LEFT, TA_CENTER, TA_JUSTIFY
from reportlab.platypus import (
SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
HRFlowable, KeepTogether
)
from reportlab.lib.colors import HexColor
import os
# ── Colour palette ──────────────────────────────────────────────────────────
NAVY = HexColor("#1B3A6B")
STEEL_BLUE = HexColor("#2E6DA4")
LIGHT_BLUE = HexColor("#D6E8F7")
TEAL = HexColor("#1B7A78")
LIGHT_TEAL = HexColor("#D4EFEE")
AMBER = HexColor("#E07B00")
AMBER_LIGHT= HexColor("#FFF3D6")
RED = HexColor("#C0392B")
RED_LIGHT = HexColor("#FDECEA")
GREEN = HexColor("#1E7E34")
GREEN_LIGHT= HexColor("#E4F5E9")
GREY_DARK = HexColor("#3D3D3D")
GREY_MID = HexColor("#6B6B6B")
GREY_LIGHT = HexColor("#F4F6F8")
WHITE = colors.white
OUTPUT = "/home/daytona/workspace/diabetes-pdf/Diabetes_Quick_Reference.pdf"
# ── Document ─────────────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
OUTPUT, pagesize=A4,
leftMargin=1.5*cm, rightMargin=1.5*cm,
topMargin=1.8*cm, bottomMargin=1.8*cm,
title="Diabetes Mellitus – Quick Reference Guide",
author="Orris Medical"
)
W = A4[0] - 3*cm # usable width
styles = getSampleStyleSheet()
# Custom paragraph styles
def PS(name, **kw):
return ParagraphStyle(name, **kw)
title_style = PS("DocTitle",
fontName="Helvetica-Bold", fontSize=22, textColor=WHITE,
alignment=TA_CENTER, leading=26, spaceAfter=2)
subtitle_style = PS("DocSubtitle",
fontName="Helvetica", fontSize=11, textColor=HexColor("#C8DDEF"),
alignment=TA_CENTER, leading=14, spaceAfter=4)
section_header = PS("SectionHeader",
fontName="Helvetica-Bold", fontSize=11, textColor=WHITE,
leading=14, spaceAfter=2, spaceBefore=2,
leftIndent=4, rightIndent=4)
body = PS("Body",
fontName="Helvetica", fontSize=8.5, textColor=GREY_DARK,
leading=12, spaceAfter=3, spaceBefore=2)
body_small = PS("BodySmall",
fontName="Helvetica", fontSize=7.8, textColor=GREY_DARK,
leading=11, spaceAfter=2)
bold_body = PS("BoldBody",
fontName="Helvetica-Bold", fontSize=8.5, textColor=GREY_DARK,
leading=12, spaceAfter=2)
bullet_style = PS("Bullet",
fontName="Helvetica", fontSize=8.5, textColor=GREY_DARK,
leading=12, leftIndent=10, firstLineIndent=-7,
spaceAfter=2)
caption_style = PS("Caption",
fontName="Helvetica-Oblique", fontSize=7.5, textColor=GREY_MID,
alignment=TA_CENTER, leading=10)
note_style = PS("Note",
fontName="Helvetica-Oblique", fontSize=7.5, textColor=GREY_MID,
leading=10, spaceAfter=2)
# ── Helper functions ─────────────────────────────────────────────────────────
def section_box(title, bg=STEEL_BLUE):
"""Coloured section header bar."""
t = Table([[Paragraph(title, section_header)]], colWidths=[W])
t.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), bg),
("TOPPADDING", (0,0), (-1,-1), 5),
("BOTTOMPADDING", (0,0), (-1,-1), 5),
("LEFTPADDING", (0,0), (-1,-1), 8),
("RIGHTPADDING", (0,0), (-1,-1), 8),
("ROUNDEDCORNERS", [4]),
]))
return t
def note_box(text, bg=AMBER_LIGHT, border=AMBER):
"""Callout box."""
t = Table([[Paragraph(text, body_small)]], colWidths=[W])
t.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), bg),
("BOX", (0,0), (-1,-1), 1, border),
("TOPPADDING", (0,0), (-1,-1), 6),
("BOTTOMPADDING", (0,0), (-1,-1), 6),
("LEFTPADDING", (0,0), (-1,-1), 8),
("RIGHTPADDING", (0,0), (-1,-1), 8),
]))
return t
def header_table(col_data, col_widths, header_bg=NAVY):
"""Table with a bold coloured header row."""
header_style = PS("TH", fontName="Helvetica-Bold", fontSize=8,
textColor=WHITE, leading=10, alignment=TA_LEFT)
cell_style = PS("TD", fontName="Helvetica", fontSize=8,
textColor=GREY_DARK, leading=11, alignment=TA_LEFT)
rows = []
for i, row in enumerate(col_data):
if i == 0:
rows.append([Paragraph(str(c), header_style) for c in row])
else:
rows.append([Paragraph(str(c), cell_style) for c in row])
t = Table(rows, colWidths=col_widths, repeatRows=1)
ts = TableStyle([
("BACKGROUND", (0,0), (-1,0), header_bg),
("ROWBACKGROUNDS",(0,1), (-1,-1), [WHITE, GREY_LIGHT]),
("GRID", (0,0), (-1,-1), 0.4, HexColor("#BFCCD6")),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 6),
("RIGHTPADDING", (0,0), (-1,-1), 6),
("VALIGN", (0,0), (-1,-1), "TOP"),
])
t.setStyle(ts)
return t
def bullet(txt):
return Paragraph(f"<bullet>\u2022</bullet> {txt}", bullet_style)
# ── Title Banner ──────────────────────────────────────────────────────────────
def make_title_banner():
banner = Table(
[[Paragraph("DIABETES MELLITUS", title_style)],
[Paragraph("Quick Reference Guide — Diagnosis · Monitoring · Management", subtitle_style)],
[Paragraph("Based on ADA Standards of Care | Harrison's 22e | Goodman & Gilman's | Guyton & Hall", caption_style)]],
colWidths=[W]
)
banner.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,-1), NAVY),
("TOPPADDING", (0,0), (-1,-1), 12),
("BOTTOMPADDING", (0,0), (-1,-1), 10),
("LEFTPADDING", (0,0), (-1,-1), 12),
("RIGHTPADDING", (0,0), (-1,-1), 12),
("ROUNDEDCORNERS", [6]),
]))
return banner
# ─────────────────────────────────────────────────────────────────────────────
# BUILD CONTENT
# ─────────────────────────────────────────────────────────────────────────────
story = []
# ── TITLE ────────────────────────────────────────────────────────────────────
story.append(make_title_banner())
story.append(Spacer(1, 8))
# ═══════════════════════════════════════════════════════════════════════
# 1. CLASSIFICATION
# ═══════════════════════════════════════════════════════════════════════
story.append(section_box("1. CLASSIFICATION OF DIABETES MELLITUS", NAVY))
story.append(Spacer(1, 4))
class_data = [
["Type", "Mechanism / Aetiology", "Key Features"],
["Type 1 DM\n(T1DM)",
"Autoimmune beta-cell destruction → absolute insulin deficiency",
"5–10% of DM; abrupt onset; islet autoantibodies (GAD65, IA-2, IAA); ~30% present with DKA; peak incidence childhood/adolescence"],
["Type 2 DM\n(T2DM)",
"Progressive beta-cell secretory failure on background of insulin resistance",
"~90% of DM; insidious onset; linked to obesity, sedentary lifestyle, aging; many have complications at diagnosis"],
["Gestational DM\n(GDM)",
"Diabetes first recognised in pregnancy (not clearly pre-existing overt DM)",
"Screen all pregnant women 24–28 weeks; increased maternal/fetal risks; resolves post-partum (but ↑ future T2DM risk)"],
["Other Specific\nTypes",
"Monogenic (MODY, neonatal DM); exocrine pancreas disease (cystic fibrosis, pancreatitis); drug-induced (glucocorticoids, anti-retroviral therapy, post-transplant)",
"Consider in young, lean patients with family history or unusual clinical features; genetic testing may confirm"],
]
story.append(header_table(class_data, [2.5*cm, 6.5*cm, 8.5*cm]))
story.append(Spacer(1, 6))
# ═══════════════════════════════════════════════════════════════════════
# 2. DIAGNOSIS
# ═══════════════════════════════════════════════════════════════════════
story.append(section_box("2. DIAGNOSTIC CRITERIA (ADA)", STEEL_BLUE))
story.append(Spacer(1, 4))
# Diagnosis table – 2 column side by side
diag_data = [
["DIABETES (any ONE criterion, confirmed on 2 separate occasions unless classic symptoms present)",
"PREDIABETES (any ONE criterion)"],
["• Fasting Plasma Glucose (FPG) ≥ 126 mg/dL (7.0 mmol/L)\n"
" [fasting = no caloric intake ≥ 8 h]\n\n"
"• 2-hr Plasma Glucose (75 g OGTT) ≥ 200 mg/dL (11.1 mmol/L)\n\n"
"• HbA1c ≥ 6.5% (48 mmol/mol)\n\n"
"• Random Plasma Glucose ≥ 200 mg/dL WITH classic hyperglycaemic symptoms\n"
" (polyuria, polydipsia, unexplained weight loss)",
"• Impaired Fasting Glucose (IFG):\n FPG 100–125 mg/dL (5.6–6.9 mmol/L)\n\n"
"• Impaired Glucose Tolerance (IGT):\n 2-hr OGTT 140–199 mg/dL (7.8–11.0 mmol/L)\n\n"
"• HbA1c 5.7–6.4% (39–47 mmol/mol)\n\n"
" → Lifestyle intervention reduces progression\n"
" to T2DM by ~58% (DPP trial)\n"
" → Metformin may be offered (high-risk patients)"],
]
diag_ps = PS("DiagCell", fontName="Helvetica", fontSize=8, textColor=GREY_DARK, leading=12)
diag_hdr = PS("DiagHdr", fontName="Helvetica-Bold", fontSize=8, textColor=WHITE, leading=11, alignment=TA_CENTER)
diag_rows = [
[Paragraph(diag_data[0][0], diag_hdr), Paragraph(diag_data[0][1], diag_hdr)],
[Paragraph(diag_data[1][0], diag_ps), Paragraph(diag_data[1][1], diag_ps)],
]
diag_t = Table(diag_rows, colWidths=[W/2 - 2, W/2 - 2])
diag_t.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), STEEL_BLUE),
("BACKGROUND", (0,1), (0,1), LIGHT_BLUE),
("BACKGROUND", (1,1), (1,1), AMBER_LIGHT),
("BOX", (0,0), (-1,-1), 0.5, STEEL_BLUE),
("INNERGRID", (0,0), (-1,-1), 0.4, HexColor("#BFCCD6")),
("TOPPADDING", (0,0), (-1,-1), 6),
("BOTTOMPADDING", (0,0), (-1,-1), 6),
("LEFTPADDING", (0,0), (-1,-1), 7),
("RIGHTPADDING", (0,0), (-1,-1), 7),
("VALIGN", (0,0), (-1,-1), "TOP"),
]))
story.append(diag_t)
story.append(Spacer(1, 4))
story.append(note_box(
"⚠ Renal glucose threshold ~200 mg/dL — glycosuria indicates established hyperglycaemia. "
"HbA1c is unreliable in haemolytic anaemia, haemoglobinopathies, recent blood transfusion, and pregnancy (use FPG/OGTT instead).",
bg=AMBER_LIGHT, border=AMBER))
story.append(Spacer(1, 6))
# ═══════════════════════════════════════════════════════════════════════
# 3. MONITORING
# ═══════════════════════════════════════════════════════════════════════
story.append(section_box("3. MONITORING", TEAL))
story.append(Spacer(1, 4))
mon_data = [
["Parameter", "Target / Frequency", "Notes"],
["HbA1c",
"< 7.0% (most adults)\n< 6.5% pre-conception\n> 8.0% in elderly/frail (relaxed)\nCheck every 3 months until at goal, then every 6 months",
"Reflects avg glycaemia over ~3 months; 1% reduction in HbA1c ≈ 14 mg/dL reduction in mean glucose"],
["Fasting Blood Glucose",
"80–130 mg/dL (4.4–7.2 mmol/L)\nSelf-monitor: frequency per clinical need",
"Key for basal insulin titration; morning fasting level reflects overnight hepatic glucose output"],
["Post-prandial Glucose",
"< 180 mg/dL (10.0 mmol/L)\n1–2 h after meal start",
"Target for post-meal bolus insulin dosing and GLP-1 RA assessment"],
["Continuous Glucose\nMonitoring (CGM)",
"Time-In-Range (TIR) > 70%\n(70–180 mg/dL)\nTime Below Range < 4%\n(< 70 mg/dL)",
"Preferred for T1DM; increasingly used in T2DM on insulin; reduces HbA1c and hypoglycaemia"],
["Urine Albumin/\nCreatinine Ratio (UACR)",
"Normal: < 30 mg/g\nMicro: 30–300 mg/g\nMacro: > 300 mg/g\nAnnually from diagnosis (T2DM); after 5 yrs (T1DM)",
"Earliest marker of diabetic nephropathy; ACEi/ARB indicated if UACR ≥ 30 mg/g"],
["eGFR",
"At diagnosis then annually;\nReduce SGLT-2i if eGFR < 45 mL/min;\nAvoid metformin if eGFR < 30 mL/min",
"Stage CKD and adjust drug therapy accordingly"],
["Blood Pressure",
"Target: < 130/80 mmHg\nEvery visit",
"BP control as important as glycaemia for CV/renal outcomes; ACEi/ARB first-line if DM + HTN"],
["Lipids",
"LDL-C < 100 mg/dL (high risk)\nLDL-C < 70 mg/dL (ASCVD present)\nAnnually",
"Statin therapy for all DM patients > 40 yrs or with CV risk factors (CARDS trial)"],
["Dilated Retinal Exam",
"At diagnosis (T2DM)\n5 years after diagnosis (T1DM)\nThen annually if normal; more frequently if retinopathy present",
"Diabetic retinopathy is leading cause of blindness in working-age adults"],
["Comprehensive Foot Exam",
"Annually\n(visual inspection each visit for high-risk feet)",
"Assess: pedal pulses, 10-g monofilament, 128-Hz tuning fork (great toe), ankle reflexes, nail care, deformities"],
["Dental Exam",
"Every 6 months",
"Periodontal disease more frequent in DM; bidirectional relationship with glycaemic control"],
["Weight / BMI",
"Every visit",
"5–10% weight loss improves insulin sensitivity significantly; weight loss drugs/surgery if BMI ≥ 30 kg/m²"],
]
story.append(header_table(mon_data, [3.5*cm, 5.5*cm, 8.5*cm], TEAL))
story.append(Spacer(1, 6))
# ═══════════════════════════════════════════════════════════════════════
# 4. MANAGEMENT — LIFESTYLE
# ═══════════════════════════════════════════════════════════════════════
story.append(section_box("4a. MANAGEMENT — LIFESTYLE MODIFICATIONS", STEEL_BLUE))
story.append(Spacer(1, 4))
life_data = [
["Domain", "Recommendation"],
["Medical Nutrition\nTherapy (MNT)",
"No single 'DM diet'; individualised with registered dietitian. Reduce refined carbohydrates, added sugars, saturated fats. "
"Mediterranean, DASH, or low-carb patterns all acceptable. Consistent carbohydrate intake helps insulin timing. "
"Caloric restriction (500–750 kcal/day deficit) for overweight/obese patients."],
["Physical Activity",
"≥ 150 min/week moderate aerobic exercise (e.g. brisk walking) OR ≥ 75 min/week vigorous activity. "
"Resistance training ≥ 2 days/week. Break prolonged sitting every 30 minutes. "
"Exercise improves insulin sensitivity, lowers HbA1c by ~0.6–0.7%, and reduces CV risk."],
["Weight Management",
"5–10% weight loss significantly improves glycaemia, BP, and lipids. "
"> 15% weight loss may induce T2DM remission (DiRECT trial). "
"GLP-1 RAs (semaglutide) and SGLT-2 inhibitors provide additional weight reduction. "
"Bariatric surgery for BMI ≥ 35 kg/m² with inadequate glycaemic control."],
["Smoking Cessation",
"Smoking doubles CV risk in DM. Cessation is one of the highest-yield interventions. "
"Offer pharmacotherapy + behavioural support."],
["Alcohol",
"Moderate intake only (≤ 1 drink/day women, ≤ 2 drinks/day men). "
"Alcohol can cause delayed hypoglycaemia (inhibits gluconeogenesis) — consume with food; avoid on empty stomach."],
["Sleep",
"Poor sleep impairs insulin sensitivity and glucose regulation. "
"Screen for obstructive sleep apnoea (OSA) — prevalence > 50% in T2DM. "
"CPAP treatment may improve glycaemic control."],
]
story.append(header_table(life_data, [3.5*cm, 14*cm], STEEL_BLUE))
story.append(Spacer(1, 6))
# ═══════════════════════════════════════════════════════════════════════
# 5. PHARMACOTHERAPY — T2DM
# ═══════════════════════════════════════════════════════════════════════
story.append(section_box("4b. PHARMACOTHERAPY — TYPE 2 DM", NAVY))
story.append(Spacer(1, 4))
# Treatment algorithm as styled table
alg_header_ps = PS("AlgHdr", fontName="Helvetica-Bold", fontSize=8.5, textColor=WHITE, leading=12, alignment=TA_CENTER)
alg_cell_ps = PS("AlgCell", fontName="Helvetica", fontSize=8, textColor=GREY_DARK, leading=11)
alg_note_ps = PS("AlgNote", fontName="Helvetica-Oblique", fontSize=7.5, textColor=GREY_MID, leading=10, alignment=TA_CENTER)
alg_data = [
["STEP 1", "STEP 2", "STEP 3"],
["Lifestyle + Metformin\n(start at diagnosis)\n\nReassess HbA1c in 2–3 months",
"Add 2nd agent if HbA1c target not met:\n• Sulfonylurea\n• TZD (pioglitazone)\n• DPP-4 inhibitor\n• GLP-1 RA ★\n• SGLT-2 inhibitor ★\n• Basal insulin",
"Metformin + 2 other agents\nOR\nMetformin + insulin\n\nReassess HbA1c every 3 months"],
["",
"★ For ASCVD: add GLP-1 RA or SGLT-2i early\n★ For HF/nephropathy: SGLT-2 inhibitor preferred",
""],
]
alg_rows = [
[Paragraph(c, alg_header_ps) for c in alg_data[0]],
[Paragraph(c, alg_cell_ps) for c in alg_data[1]],
[Paragraph(c, alg_note_ps) for c in alg_data[2]],
]
alg_t = Table(alg_rows, colWidths=[W/3 - 1, W/3 + 2, W/3 - 1])
alg_t.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), NAVY),
("BACKGROUND", (0,1), (0,1), LIGHT_BLUE),
("BACKGROUND", (1,1), (1,1), LIGHT_TEAL),
("BACKGROUND", (2,1), (2,1), LIGHT_BLUE),
("BACKGROUND", (0,2), (-1,2), GREY_LIGHT),
("BOX", (0,0), (-1,-1), 0.6, NAVY),
("INNERGRID", (0,0), (-1,-1), 0.4, HexColor("#BFCCD6")),
("TOPPADDING", (0,0), (-1,-1), 7),
("BOTTOMPADDING", (0,0), (-1,-1), 7),
("LEFTPADDING", (0,0), (-1,-1), 7),
("RIGHTPADDING", (0,0), (-1,-1), 7),
("VALIGN", (0,0), (-1,-1), "TOP"),
("ALIGN", (0,0), (-1,0), "CENTER"),
]))
story.append(alg_t)
story.append(Spacer(1, 5))
# Drug class table
drug_data = [
["Drug Class", "Key Agents", "Mechanism", "HbA1c ↓", "Advantages", "Cautions / Side Effects"],
["Biguanides\n(First-line)", "Metformin", "↓ Hepatic gluconeogenesis;\n↑ insulin sensitivity", "1–2%",
"Weight neutral; cheap;\ncardioprotective; reduces\nprogression from prediabetes",
"GI upset (start low, titrate);\nhold for contrast/surgery;\navoid if eGFR < 30; B12 deficiency"],
["Sulfonylureas", "Glimepiride\nGlipizide\nGliclazide", "Stimulates beta-cell\ninsulin secretion\n(closes K-ATP channels)", "1–2%",
"Effective; oral; cheap",
"Hypoglycaemia; weight gain;\navoiding in elderly and\nrenal impairment"],
["TZDs\n(PPAR-γ agonists)", "Pioglitazone", "↑ Insulin sensitivity\nin muscle, fat, liver", "0.5–1.4%",
"↓ TG, ↑ HDL; cardioprotective\nin some data (PROactive)",
"Weight gain; fluid retention;\ncontraindicated in HF;\n↑ fracture risk; bladder cancer risk"],
["DPP-4 Inhibitors\n(Gliptins)", "Sitagliptin\nSaxagliptin\nAlogliptin", "Inhibits DPP-4 →\n↑ active GLP-1 and GIP\n→ glucose-dependent\ninsulin secretion", "0.5–0.8%",
"Weight neutral;\nlow hypoglycaemia risk;\nrenal-dose adjustment available",
"Nasopharyngitis; do NOT\ncombine with GLP-1 RA;\nHF signal with saxagliptin"],
["GLP-1 Receptor\nAgonists", "Semaglutide\nLiraglutide\nDulaglutide\nExenatide", "Mimics GLP-1: ↑ glucose-\ndependent insulin secretion;\n↓ glucagon; slows gastric\nemptying; central satiety", "0.8–2.0%",
"↓ Weight (2–15 kg);\nCVOT benefit (LEADER,\nSUSTAIN-6);\nnephroprotective;\nnow available orally",
"GI: nausea, vomiting, diarrhoea\n(common, often transient);\ninjection (most); avoid in\npersonal/family hx MTC;\n↑ HR (liraglutide)"],
["SGLT-2 Inhibitors\n(Gliflozins)", "Empagliflozin\nDapagliflozin\nCanagliflozin", "Blocks SGLT-2 in PCT →\n↓ renal glucose reabsorption\n→ glucosuria (~70 g/day)", "0.6–1.2%",
"↓ Weight; ↓ BP;\nCVOT benefit (EMPA-REG);\n↓ HF hospitalisation;\nrenoprotective (CREDENCE)",
"Genital mycotic infections;\nDKA (rare, even in T2DM);\ndo NOT use if eGFR < 45;\nFourier's gangrene (rare)"],
["Insulin\n(all types)", "See insulin table\nbelow", "Replaces/supplements\ndeficient endogenous insulin", "1.5–3.5%\n(no ceiling)",
"Most effective at lowering\nglucose; no contraindication\nbased on renal/hepatic\nfunction; essential in T1DM",
"Hypoglycaemia; weight gain;\ninjection; requires monitoring;\ncost issues"],
]
story.append(Spacer(1, 4))
story.append(header_table(drug_data, [2.8*cm, 2.5*cm, 3.8*cm, 1.4*cm, 3.8*cm, 3.2*cm], NAVY))
story.append(Spacer(1, 6))
# ═══════════════════════════════════════════════════════════════════════
# 6. INSULIN
# ═══════════════════════════════════════════════════════════════════════
story.append(section_box("4c. INSULIN PREPARATIONS", TEAL))
story.append(Spacer(1, 4))
ins_data = [
["Type", "Examples", "Onset", "Peak", "Duration", "Clinical Use"],
["Rapid-acting\n(injected)", "Aspart, Lispro,\nGlulisine", "< 15 min", "0.5–1.5 h", "3–5 h", "Mealtime bolus; given just before meals"],
["Rapid-acting\n(inhaled)", "Afrezza\n(inhaled human)", "< 15 min", "1–2 h", "~3 h", "Pre-meal; not for smokers, lung disease"],
["Short-acting", "Regular\n(Humulin R, Actrapid)", "0.5–1 h", "2–3 h", "4–8 h", "IV drip (DKA); pre-meal if 30 min before"],
["Intermediate-acting", "NPH\n(Humulin N, Insulatard)", "2–4 h", "4–10 h", "10–16 h", "Twice-daily basal; less preferred (variable)"],
["Long-acting\nBasal", "Glargine U100\nDetemir", "2–4 h", "Minimal\npeak", "20–24 h", "Once-daily basal; T2DM basal therapy"],
["Ultra-long-acting\nBasal", "Degludec\nGlargine U300", "1–9 h", "Flat / no\npeak", "42 h (Degludec)\n> 24 h (U300)", "Once-daily; flexible timing; ↓ nocturnal hypo risk"],
["Pre-mixed", "70/30 NPH/Reg\nBiAspart 70/30", "Varies", "Dual", "Varies", "Twice-daily convenience; less flexible"],
]
story.append(header_table(ins_data, [2.5*cm, 3.5*cm, 1.8*cm, 2.2*cm, 2.5*cm, 5*cm], TEAL))
story.append(Spacer(1, 4))
story.append(note_box(
"Basal-Bolus Regimen: Long-acting insulin once daily (basal) + rapid-acting with each meal (bolus) — best mimics physiological insulin secretion. "
"Automated Insulin Delivery (AID / closed-loop systems): pump + CGM + algorithm — significantly improves TIR and reduces hypoglycaemia in T1DM.",
bg=LIGHT_TEAL, border=TEAL))
story.append(Spacer(1, 6))
# ═══════════════════════════════════════════════════════════════════════
# 7. ACUTE COMPLICATIONS
# ═══════════════════════════════════════════════════════════════════════
story.append(section_box("5. ACUTE COMPLICATIONS", RED))
story.append(Spacer(1, 4))
acute_data = [
["Complication", "Typical Patient", "Key Features", "Management Principles"],
["Diabetic Ketoacidosis\n(DKA)",
"T1DM (also T2DM\nunder physiological stress\nor SGLT-2i use)",
"Glucose > 250 mg/dL; pH < 7.3; bicarb < 18; ketones +++ "
"in blood/urine; Kussmaul breathing; fruity breath; "
"dehydration; altered consciousness in severe cases",
"IV fluids (0.9% NaCl); insulin infusion (0.1 U/kg/h); "
"K⁺ replacement (hold insulin if K⁺ < 3.5); "
"bicarbonate only if pH < 6.9; identify & treat precipitant"],
["Hyperosmolar Hyperglycaemic\nState (HHS)",
"Elderly T2DM;\noften dehydrated,\ninfected",
"Glucose > 600 mg/dL; plasma osmolality > 320 mOsm/kg; "
"minimal ketosis; pH normal; profound dehydration; "
"neurological signs (seizures, coma) common",
"Gradual fluid replacement (avoid too-rapid correction); "
"low-dose insulin; anticoagulation (DVT risk); "
"treat precipitant; correct Na⁺ carefully"],
["Hypoglycaemia",
"T1DM/T2DM on\ninsulin or sulfonylurea",
"< 70 mg/dL (mild-moderate); < 54 mg/dL (clinically significant); "
"symptoms: tremor, sweating, palpitations, confusion, seizure; "
"autonomic unawareness with recurrent episodes",
"Conscious: 15 g fast-acting carbohydrate (rule of 15); "
"unconscious: IM glucagon 1 mg or IV dextrose 50%; "
"review insulin/medication dose; consider CGM"],
]
story.append(header_table(acute_data, [3.5*cm, 3.5*cm, 5.5*cm, 5*cm], RED))
story.append(Spacer(1, 6))
# ═══════════════════════════════════════════════════════════════════════
# 8. CHRONIC COMPLICATIONS
# ═══════════════════════════════════════════════════════════════════════
story.append(section_box("6. CHRONIC COMPLICATIONS", NAVY))
story.append(Spacer(1, 4))
# Micro / Macro two-column
micro_hdr = PS("MicroHdr", fontName="Helvetica-Bold", fontSize=8.5, textColor=WHITE, leading=12, alignment=TA_CENTER)
micro_cell = PS("MicroCell", fontName="Helvetica", fontSize=8, textColor=GREY_DARK, leading=11)
comp_rows = [
[Paragraph("MICROVASCULAR COMPLICATIONS", micro_hdr), Paragraph("MACROVASCULAR COMPLICATIONS", micro_hdr)],
[
Paragraph(
"<b>Diabetic Retinopathy</b><br/>"
"• Leading cause of blindness in working-age adults<br/>"
"• Background → pre-proliferative → proliferative (neovascularisation)<br/>"
"• Also: diabetic macular oedema (DMO)<br/>"
"• Prevention: tight glycaemia + BP control<br/>"
"• Treatment: laser photocoagulation, intravitreal anti-VEGF<br/><br/>"
"<b>Diabetic Nephropathy (DKD)</b><br/>"
"• Leading cause of ESRD in developed countries<br/>"
"• Progression: microalbuminuria → macroalbuminuria → ↓ GFR → ESRD<br/>"
"• Prevention: HbA1c control, BP control (ACEi/ARB), SGLT-2i<br/>"
"• Screen UACR + eGFR annually<br/><br/>"
"<b>Diabetic Neuropathy</b><br/>"
"• Distal symmetric polyneuropathy (most common): numbness, tingling, burning feet; "
"loss of protective sensation (LOPS)<br/>"
"• Autonomic neuropathy: gastroparesis, erectile dysfunction, postural hypotension, "
"neurogenic bladder, abnormal cardiac reflexes<br/>"
"• Treatment: glycaemic control; duloxetine/pregabalin for pain; foot care",
micro_cell),
Paragraph(
"<b>Cardiovascular Disease (CVD)</b><br/>"
"• DM doubles CV risk; T2DM patients have equivalent MI risk to non-diabetics with prior MI<br/>"
"• Atherosclerosis: CAD, stroke, peripheral arterial disease (PAD)<br/>"
"• Management: statins, ACEi/ARB, antiplatelet (if indicated), GLP-1 RA / SGLT-2i<br/><br/>"
"<b>Diabetic Foot</b><br/>"
"• Triad: neuropathy + ischaemia + infection<br/>"
"• Annual foot exam: monofilament, tuning fork, pedal pulses, ankle reflexes<br/>"
"• Deformities: hammer toes, Charcot foot, callus formation<br/>"
"• Ulceration may lead to osteomyelitis and amputation<br/>"
"• Multidisciplinary foot team essential<br/><br/>"
"<b>Other</b><br/>"
"• Periodontal disease (bidirectional relationship with glycaemia)<br/>"
"• Dermatological: diabetic dermopathy ('shin spots'), necrobiosis lipoidica, "
"acanthosis nigricans<br/>"
"• Sexual dysfunction; urinary tract infections; non-alcoholic fatty liver disease (NAFLD)<br/>"
"• Cognitive impairment / dementia (↑ risk)",
micro_cell)
]
]
comp_t = Table(comp_rows, colWidths=[W/2 - 2, W/2 - 2])
comp_t.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), NAVY),
("BACKGROUND", (0,1), (0,1), LIGHT_BLUE),
("BACKGROUND", (1,1), (1,1), RED_LIGHT),
("BOX", (0,0), (-1,-1), 0.5, NAVY),
("INNERGRID", (0,0), (-1,-1), 0.5, HexColor("#BFCCD6")),
("TOPPADDING", (0,0), (-1,-1), 7),
("BOTTOMPADDING", (0,0), (-1,-1), 7),
("LEFTPADDING", (0,0), (-1,-1), 7),
("RIGHTPADDING", (0,0), (-1,-1), 7),
("VALIGN", (0,0), (-1,-1), "TOP"),
]))
story.append(comp_t)
story.append(Spacer(1, 4))
story.append(note_box(
"DCCT (T1DM): Intensive glycaemic control reduces retinopathy, nephropathy, and neuropathy risk significantly. "
"UKPDS 35 (T2DM): Each 1% reduction in HbA1c → 37% ↓ microvascular complications, 21% ↓ DM-related deaths. "
"EMPA-REG OUTCOME: Empagliflozin ↓ CV death by 38% and ↓ HF hospitalisation by 35% in T2DM with established CVD.",
bg=GREEN_LIGHT, border=GREEN))
story.append(Spacer(1, 6))
# ═══════════════════════════════════════════════════════════════════════
# 9. SPECIAL SITUATIONS
# ═══════════════════════════════════════════════════════════════════════
story.append(section_box("7. SPECIAL CLINICAL SITUATIONS", STEEL_BLUE))
story.append(Spacer(1, 4))
spec_data = [
["Situation", "Key Considerations"],
["Pregnancy (Pre-existing DM)",
"Target HbA1c < 6.5% (ideally < 6%) before conception. Tight control throughout; "
"insulin is the only approved agent; metformin/glyburide used in some guidelines for GDM but not preferred. "
"Risks: congenital anomalies, macrosomia, pre-eclampsia, perinatal mortality. "
"Close obstetric + diabetic team collaboration essential."],
["Gestational DM (GDM)",
"Screen all women 24–28 weeks (75 g OGTT). First-line: MNT + exercise. "
"If targets not met (FPG ≥ 95 / 1-hr ≥ 140 / 2-hr ≥ 120 mg/dL): insulin. "
"Postpartum: re-test at 6–12 weeks; lifetime screening for T2DM every 1–3 years."],
["Elderly Patients",
"Relax HbA1c target to 7.5–8.0% (or even 8.5% in frail/limited life expectancy). "
"Hypoglycaemia is particularly dangerous (falls, cognitive impairment, cardiac events). "
"Avoid complex regimens; prefer agents with low hypo risk (DPP-4i, SGLT-2i if tolerated). "
"Screen for cognitive impairment and depression annually."],
["Chronic Kidney Disease\n(CKD)",
"Metformin: avoid if eGFR < 30; reduce dose if eGFR 30–45. "
"SGLT-2 inhibitors: renoprotective (CREDENCE, DAPA-CKD); stop if eGFR < 20–25. "
"GLP-1 RAs: mostly safe (dose reduce exenatide if CKD stage ≥ 3). "
"Insulin dose reduction needed as eGFR falls (reduced insulin clearance)."],
["Heart Failure (HF)",
"SGLT-2 inhibitors are first-choice add-on (reduce HF hospitalisations regardless of EF). "
"Avoid TZDs (fluid retention, worsens HF). Avoid saxagliptin (↑ HF hospitalisation in SAVOR-TIMI). "
"Metformin: use with caution in decompensated HF; acceptable in stable HF."],
["Perioperative",
"Hold metformin on day of surgery (especially if contrast or major procedure). "
"Hold SGLT-2i at least 3–4 days pre-operatively (DKA risk). "
"Continue basal insulin at 75–80% of usual dose; hold rapid-acting while NBM. "
"Target glucose 140–180 mg/dL intra-operatively (tighter in cardiac surgery: 110–140)."],
["Sick Day Rules",
"Never stop insulin in T1DM even when not eating. "
"Monitor glucose every 2–4 h; check ketones if glucose > 250 mg/dL. "
"Maintain hydration with fluids containing carbohydrate if glucose < 200 mg/dL. "
"Seek medical attention if vomiting, ketones ++, glucose > 300, or altered consciousness."],
]
story.append(header_table(spec_data, [3.5*cm, 14*cm], STEEL_BLUE))
story.append(Spacer(1, 6))
# ═══════════════════════════════════════════════════════════════════════
# 10. GLYCAEMIC TARGETS SUMMARY BOX
# ═══════════════════════════════════════════════════════════════════════
story.append(section_box("8. GLYCAEMIC TARGETS AT A GLANCE", TEAL))
story.append(Spacer(1, 4))
tgt_data = [
["Measure", "General Adult", "Pre-Conception / Pregnancy", "Elderly / Frail", "Paediatric (T1DM)"],
["HbA1c", "< 7.0%", "< 6.5% (ideally < 6%)", "> 7.5–8.5%", "< 7.0%"],
["Fasting BG", "80–130\nmg/dL", "60–99 mg/dL", "90–150 mg/dL","90–130 mg/dL"],
["Post-prandial\n(1–2 hr)", "< 180 mg/dL", "< 120–140 mg/dL", "< 200 mg/dL", "< 180 mg/dL"],
["Time-In-Range\n(CGM, 70–180)", "> 70%", "> 70% (63% in preg.)", "> 50%", "> 70%"],
["Time Below Range\n(< 70 mg/dL)", "< 4%", "< 4%", "< 1%", "< 4%"],
["BP", "< 130/80 mmHg", "< 135/85 mmHg", "< 140/90 mmHg", "< 95th percentile"],
["LDL-C", "< 100 mg/dL\n(< 70 if ASCVD)", "Statins contraindicated in\npregnancy", "Individualise", "< 100 mg/dL\n(if risk factors)"],
]
story.append(header_table(tgt_data, [3.5*cm, 3.2*cm, 4.2*cm, 3.2*cm, 3.4*cm], TEAL))
story.append(Spacer(1, 6))
# ═══════════════════════════════════════════════════════════════════════
# 11. KEY LANDMARK TRIALS
# ═══════════════════════════════════════════════════════════════════════
story.append(section_box("9. KEY LANDMARK TRIALS", NAVY))
story.append(Spacer(1, 4))
trial_data = [
["Trial", "Year", "Population", "Key Finding"],
["DCCT", "1993", "T1DM", "Intensive glycaemic control ↓ retinopathy 76%, nephropathy 50%, neuropathy 60%; ↑ hypoglycaemia 3×"],
["UKPDS 33", "1998", "T2DM (new diagnosis)", "Intensive control ↓ microvascular complications by 25%; no significant ↓ in CV events"],
["UKPDS 35", "2000", "T2DM", "Each 1% ↓ in HbA1c → 37% ↓ microvascular complications, 21% ↓ DM-related deaths, 14% ↓ MI"],
["ACCORD", "2008", "T2DM + high CV risk", "Targeting HbA1c < 6% ↑ all-cause mortality — intensive arm stopped early; avoid over-treatment"],
["EMPA-REG OUTCOME", "2015", "T2DM + established CVD", "Empagliflozin ↓ CV death 38%, ↓ HF hospitalisation 35%, ↓ progression of nephropathy"],
["LEADER", "2016", "T2DM + high CV risk", "Liraglutide ↓ MACE 13%, ↓ CV death 22%, ↓ nephropathy progression"],
["CREDENCE", "2019", "T2DM + CKD (eGFR 30–90)", "Canagliflozin ↓ renal failure/CV death composite by 30%; stopped early due to benefit"],
["SUSTAIN-6", "2016", "T2DM + high CV risk", "Semaglutide ↓ MACE 26% vs placebo; ↑ diabetic retinopathy (rapid HbA1c ↓)"],
["DAPA-HF", "2019", "HFrEF (with/without DM)", "Dapagliflozin ↓ CV death/worsening HF by 26%; benefit in patients without DM too"],
["GRADE", "2022", "T2DM on metformin", "Liraglutide or basal insulin → slightly better glycaemic control vs glimepiride or sitagliptin as add-on"],
]
story.append(header_table(trial_data, [3.5*cm, 1.3*cm, 3.7*cm, 9*cm], NAVY))
story.append(Spacer(1, 6))
# ═══════════════════════════════════════════════════════════════════════
# FOOTER NOTE
# ═══════════════════════════════════════════════════════════════════════
story.append(HRFlowable(width=W, thickness=0.5, color=GREY_MID))
story.append(Spacer(1, 4))
story.append(Paragraph(
"<b>Sources:</b> Harrison's Principles of Internal Medicine 22e (2025) | Goodman & Gilman's Pharmacological Basis of Therapeutics | "
"Guyton & Hall Textbook of Medical Physiology | Tietz Textbook of Laboratory Medicine 7e | "
"Lippincott Illustrated Reviews: Pharmacology | Creasy & Resnik's Maternal-Fetal Medicine | Rosen's Emergency Medicine | "
"Robbins & Cotran Pathologic Basis of Disease | ADA Standards of Medical Care in Diabetes",
note_style))
story.append(Spacer(1, 2))
story.append(Paragraph(
"This document is a clinical quick-reference summary. Always verify drug doses and guidelines against current local formularies and institutional protocols. "
"Not a substitute for professional clinical judgement.",
note_style))
# ─────────────────────────────────────────────────────────────────────────────
# Build PDF
doc.build(story)
print(f"PDF created: {OUTPUT}")
cd /home/daytona/workspace/diabetes-pdf && python3 generate_pdf.py 2>&1
ls -lh /home/daytona/workspace/diabetes-pdf/Diabetes_Quick_Reference.pdf
Diabetes Quick Reference
PDF Document · PDF
| Section | Contents |
|---|---|
| 1. Classification | T1DM, T2DM, GDM, other specific types with mechanisms and key features |
| 2. Diagnosis | ADA diagnostic criteria table (FPG, OGTT, HbA1c, random glucose) + prediabetes thresholds with caveats |
| 3. Monitoring | 10 parameters — HbA1c, CGM targets (TIR), UACR/eGFR, retinal exam, foot exam, BP, lipids, weight, with frequencies and targets |
| 4a. Lifestyle | Nutrition, exercise, weight management, smoking, alcohol, sleep — each with specific recommendations |
| 4b. Pharmacotherapy (T2DM) | Step 1-2-3 treatment algorithm + full drug class table (7 classes: mechanism, HbA1c reduction, advantages, cautions) |
| 4c. Insulin | All preparations with onset/peak/duration/clinical use; note on basal-bolus and AID systems |
| 5. Acute Complications | DKA, HHS, hypoglycaemia — features and management principles side by side |
| 6. Chronic Complications | Micro (retinopathy, nephropathy, neuropathy) vs macro (CVD, diabetic foot) in a two-column layout; key trial callout box |
| 7. Special Situations | Pregnancy, GDM, elderly, CKD, heart failure, perioperative, sick day rules |
| 8. Targets at a Glance | HbA1c, fasting BG, post-prandial, TIR, BP, LDL-C - across four patient groups |
| 9. Landmark Trials | 10 key trials (DCCT, UKPDS, EMPA-REG, LEADER, CREDENCE, GRADE, etc.) with year, population, and findings |