Make notes for diabetic foot which I can download and read for
mkdir -p /tmp/workspace/diabetic-foot-notes && ls /tmp/workspace/
~/diabetic-foot-notes/generate_notes.py
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import mm, cm
from reportlab.platypus import (
SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
HRFlowable, KeepTogether
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus import PageBreak
OUTPUT = "/tmp/workspace/diabetic-foot-notes/Diabetic_Foot_Notes.pdf"
doc = SimpleDocTemplate(
OUTPUT,
pagesize=A4,
rightMargin=2*cm,
leftMargin=2*cm,
topMargin=2*cm,
bottomMargin=2*cm,
title="Diabetic Foot - Clinical Notes",
author="Orris Medical Notes"
)
W = A4[0] - 4*cm # usable width
styles = getSampleStyleSheet()
# --- Custom Styles ---
title_style = ParagraphStyle(
"TitleStyle",
parent=styles["Title"],
fontSize=22,
textColor=colors.HexColor("#1a3a5c"),
spaceAfter=4,
alignment=TA_CENTER,
fontName="Helvetica-Bold"
)
subtitle_style = ParagraphStyle(
"SubTitle",
parent=styles["Normal"],
fontSize=11,
textColor=colors.HexColor("#4a6fa5"),
spaceAfter=16,
alignment=TA_CENTER,
fontName="Helvetica"
)
h1_style = ParagraphStyle(
"H1",
parent=styles["Heading1"],
fontSize=14,
textColor=colors.white,
backColor=colors.HexColor("#1a3a5c"),
spaceBefore=14,
spaceAfter=6,
leftIndent=-4,
rightIndent=-4,
borderPad=4,
fontName="Helvetica-Bold"
)
h2_style = ParagraphStyle(
"H2",
parent=styles["Heading2"],
fontSize=12,
textColor=colors.HexColor("#1a3a5c"),
spaceBefore=10,
spaceAfter=4,
fontName="Helvetica-Bold",
borderPadding=(0,0,2,0),
)
h3_style = ParagraphStyle(
"H3",
parent=styles["Heading3"],
fontSize=10.5,
textColor=colors.HexColor("#2e5f99"),
spaceBefore=8,
spaceAfter=3,
fontName="Helvetica-BoldOblique"
)
body_style = ParagraphStyle(
"Body",
parent=styles["Normal"],
fontSize=9.5,
leading=14,
spaceAfter=4,
alignment=TA_JUSTIFY,
fontName="Helvetica"
)
bullet_style = ParagraphStyle(
"Bullet",
parent=styles["Normal"],
fontSize=9.5,
leading=13,
leftIndent=14,
spaceAfter=2,
bulletIndent=4,
fontName="Helvetica"
)
key_style = ParagraphStyle(
"Key",
parent=styles["Normal"],
fontSize=9.5,
leading=13,
backColor=colors.HexColor("#fff3cd"),
borderColor=colors.HexColor("#ffc107"),
borderWidth=1,
borderPad=5,
spaceAfter=6,
fontName="Helvetica"
)
warn_style = ParagraphStyle(
"Warn",
parent=styles["Normal"],
fontSize=9.5,
leading=13,
backColor=colors.HexColor("#f8d7da"),
borderColor=colors.HexColor("#dc3545"),
borderWidth=1,
borderPad=5,
spaceAfter=6,
fontName="Helvetica"
)
tip_style = ParagraphStyle(
"Tip",
parent=styles["Normal"],
fontSize=9.5,
leading=13,
backColor=colors.HexColor("#d4edda"),
borderColor=colors.HexColor("#28a745"),
borderWidth=1,
borderPad=5,
spaceAfter=6,
fontName="Helvetica"
)
footer_style = ParagraphStyle(
"Footer",
parent=styles["Normal"],
fontSize=8,
textColor=colors.grey,
alignment=TA_CENTER
)
def H1(text):
return Paragraph(f" {text}", h1_style)
def H2(text):
return Paragraph(text, h2_style)
def H3(text):
return Paragraph(text, h3_style)
def B(text):
return Paragraph(text, body_style)
def BU(text):
return Paragraph(f"• {text}", bullet_style)
def KEY(text):
return Paragraph(f"<b>🔑 KEY POINT:</b> {text}", key_style)
def WARN(text):
return Paragraph(f"<b>⚠ ALERT:</b> {text}", warn_style)
def TIP(text):
return Paragraph(f"<b>✔ CLINICAL TIP:</b> {text}", tip_style)
def HR():
return HRFlowable(width="100%", thickness=0.5, color=colors.HexColor("#cccccc"), spaceAfter=4)
def SP(h=6):
return Spacer(1, h)
# === BUILD DOCUMENT ===
story = []
# ---- TITLE PAGE ----
story.append(SP(20))
story.append(Paragraph("DIABETIC FOOT", title_style))
story.append(Paragraph("Comprehensive Clinical Notes", subtitle_style))
story.append(HR())
story.append(SP(4))
story.append(Paragraph(
"Sources: Bailey & Love's Short Practice of Surgery (28th Ed) • Campbell's Operative Orthopaedics (15th Ed 2026) • Fischer's Mastery of Surgery (8th Ed)",
footer_style
))
story.append(SP(8))
# ===== 1. EPIDEMIOLOGY =====
story.append(H1("1. EPIDEMIOLOGY"))
story.append(B("Diabetes is the 7th leading cause of death in the United States. In 2019, 37.4 million Americans (11.3%) had diabetes, with 96 million in a prediabetes state."))
story.append(SP(4))
epi_data = [
["Parameter", "Value"],
["Lifetime risk of diabetic foot ulcer (DFU)", "15%"],
["Annual incidence of DFU", "2%"],
["Annual incidence of foot complications", "1–2% per year"],
["Risk of amputation from foot ulcer", "Up to 20%"],
["DFU with infection → risk of some amputation", "40–55%"],
["Infected + ischemic ulcer → amputation risk", "90× higher vs. clean ulcer"],
["Diabetics vs. non-diabetics: PAD risk", "2× more likely"],
["Diabetics with PAD: foot ulcer risk", "9× more likely"],
]
t = Table(epi_data, colWidths=[W*0.65, W*0.35])
t.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), colors.HexColor("#1a3a5c")),
("TEXTCOLOR", (0,0), (-1,0), colors.white),
("FONTNAME", (0,0), (-1,0), "Helvetica-Bold"),
("FONTSIZE", (0,0), (-1,-1), 9),
("ROWBACKGROUNDS", (0,1), (-1,-1), [colors.HexColor("#f5f8ff"), colors.white]),
("GRID", (0,0), (-1,-1), 0.3, colors.HexColor("#aaaaaa")),
("VALIGN", (0,0), (-1,-1), "MIDDLE"),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 6),
]))
story.append(t)
story.append(SP(6))
# ===== 2. PATHOPHYSIOLOGY =====
story.append(H1("2. PATHOPHYSIOLOGY"))
story.append(B("The diabetic foot results from an interplay of <b>neuropathy, vascular disease, and impaired immunity</b>."))
story.append(SP(4))
story.append(H2("2.1 Peripheral Neuropathy"))
story.append(B("Chronic hyperglycemia drives multiple mechanisms of nerve injury:"))
story.append(BU("<b>Polyol pathway:</b> Excess glucose → sorbitol/fructose accumulation → impairs ATPase pumps → structural breakdown and impaired axonal transport."))
story.append(BU("<b>Advanced glycation end-products (AGEs):</b> Glycosylation of vasa nervorum basement membranes → thickening → chronic ischemia of nerves."))
story.append(BU("<b>Oxidative stress:</b> Excess glucose → mitochondrial free radical production → neuronal damage."))
story.append(BU("<b>Progression:</b> Starts with smallest unmyelinated fibers → patients first lose temperature and light touch sensation → progresses to glove-and-stocking distribution."))
story.append(SP(2))
story.append(B("<b>Three types of neuropathy and their effects:</b>"))
neuro_data = [
["Neuropathy Type", "Effect on Foot"],
["Sensory", "Loss of protective sensation; painless injury; delayed presentation"],
["Autonomic", "Decreased sweating/skin lubrication → dry, cracked skin prone to fissuring; reduced blood distribution to skin"],
["Motor", "Intrinsic muscle wasting → claw toes, hammer toes, distal fat pad migration; abnormal plantar pressure points; gastrocnemius tightness increases forefoot loading"],
]
t2 = Table(neuro_data, colWidths=[W*0.3, W*0.7])
t2.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), colors.HexColor("#2e5f99")),
("TEXTCOLOR", (0,0), (-1,0), colors.white),
("FONTNAME", (0,0), (-1,0), "Helvetica-Bold"),
("FONTSIZE", (0,0), (-1,-1), 9),
("ROWBACKGROUNDS", (0,1), (-1,-1), [colors.HexColor("#f5f8ff"), colors.white]),
("GRID", (0,0), (-1,-1), 0.3, colors.HexColor("#aaaaaa")),
("VALIGN", (0,0), (-1,-1), "TOP"),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 6),
("WORDWRAP", (0,0), (-1,-1), True),
]))
story.append(t2)
story.append(SP(4))
story.append(H2("2.2 Macrovascular Disease"))
story.append(BU("Glycosylation of arterial endothelium → arteriosclerosis → poor perfusion."))
story.append(BU("Atherosclerosis primarily affects the <b>tibial distribution</b> or <b>femoral-popliteal distribution</b> in diabetics."))
story.append(BU("Calcinosis of arterial walls → noncompressible vessels (may give falsely elevated ABI)."))
story.append(BU("Poor oxygen diffusion to tissues + hyperlipidemia → further ischemia."))
story.append(SP(4))
story.append(H2("2.3 Impaired Wound Healing"))
story.append(BU("Normal wound healing: <b>Hemostasis → Inflammation → Proliferation → Remodeling</b>."))
story.append(BU("Hyperglycemia impairs neutrophils, macrophages, and fibroblasts."))
story.append(BU("Macrophage epigenetic modifications cause a <b>persistent proinflammatory state</b> → wound cannot progress to proliferation/remodeling."))
story.append(BU("Bacterial colonization and biofilm formation further inhibit healing."))
story.append(BU("Wounds are typically <b>polymicrobial</b>: Gram-positive aerobes (Staphylococci) + Gram-negative bacilli + anaerobes."))
story.append(SP(4))
story.append(KEY("Loss of protective sensation is the pivotal event — it blunts the patient's awareness of injury and delays care because pain is absent."))
# ===== 3. CLINICAL PRESENTATION =====
story.append(H1("3. CLINICAL PRESENTATION & DIAGNOSIS"))
story.append(H2("3.1 Common Ulcer Locations"))
story.append(BU("<b>Neuropathic ulcers:</b> Plantar surface — metatarsal heads of 1st and 5th toes (high-pressure points)."))
story.append(BU("<b>Ischemic ulcers (PAD):</b> Tips of toes."))
story.append(BU("<b>Venous stasis ulcers:</b> Medial malleolus (over venous perforators)."))
story.append(BU("Calcaneum and forefoot bones: common sites for osteomyelitis."))
story.append(SP(4))
story.append(H2("3.2 History Taking"))
story.append(BU("Prior episodes of ulceration, previous amputations, known Charcot arthropathy."))
story.append(BU("Impaired vision (retinopathy → difficulty inspecting feet)."))
story.append(BU("Renal history, paresthesias/numbness, claudication symptoms."))
story.append(BU("Current footwear, wound care being used."))
story.append(BU("<b>Note:</b> Due to sensory neuropathy, patients often cannot recall the inciting trauma."))
story.append(SP(4))
story.append(H2("3.3 Physical Examination"))
story.append(B("<b>Skin inspection:</b>"))
story.append(BU("Shiny, taut, hairless skin → peripheral arterial disease."))
story.append(BU("Dry, scaly skin → autonomic dysfunction."))
story.append(BU("Erythema, warmth, swelling → infection or Charcot neuroarthropathy."))
story.append(BU("Corns/calluses → increased pressure; precursor to ulcers."))
story.append(SP(2))
story.append(B("<b>Vascular exam:</b>"))
story.append(BU("Palpate dorsalis pedis and posterior tibial pulses. Absent/diminished → Doppler examination."))
story.append(BU("Assess skin temperature bilaterally for asymmetry."))
story.append(SP(2))
story.append(B("<b>Neurologic exam:</b>"))
story.append(BU("<b>Semmes–Weinstein 5.07 monofilament (10-g force):</b> inability to feel = high-risk for foot morbidity."))
story.append(BU("Standard: test 10 sites on foot OR 4.5-g monofilament under both first metatarsal heads."))
story.append(SP(2))
story.append(B("<b>Ulcer assessment:</b>"))
story.append(BU("Measure longest and widest dimension (area = L × W)."))
story.append(BU("<b>Probe-to-bone test:</b> 57% PPV for osteomyelitis; negative predictive value 96%."))
story.append(BU("Describe wound bed: granulation vs. fibrous vs. necrotic tissue."))
story.append(SP(2))
story.append(B("<b>Musculoskeletal exam:</b>"))
story.append(BU("Arch of foot, hindfoot alignment (abnormalities → altered plantar pressure)."))
story.append(BU("<b>Silfverskiöld test:</b> ankle dorsiflexion with knee flexed vs. extended → identifies gastrocnemius vs. Achilles contracture."))
story.append(SP(4))
story.append(H2("3.4 Signs of Infection / Pedal Sepsis"))
story.append(BU("Local: wound with purulence, foul odor, surrounding erythema, warmth, swelling."))
story.append(BU("Cellulitis spreading proximally up the leg, lymphangitis."))
story.append(BU("<b>Systemic (admit immediately):</b> fevers, chills, tachycardia, leukocytosis, hypotension, altered mental status, acidosis, severe hyperglycemia."))
story.append(BU("Gas in soft tissues on imaging → urgent surgical emergency."))
story.append(SP(2))
story.append(WARN("Pedal sepsis = surgical emergency. Do NOT wait for imaging if clinical picture is clear. Rapid surgical consultation for source control."))
# ===== 4. INVESTIGATIONS =====
story.append(H1("4. INVESTIGATIONS"))
story.append(H2("4.1 Laboratory"))
inv_data = [
["Test", "Purpose / Note"],
["CBC", "Establish baseline; leukocytosis suggests systemic infection"],
["ESR / CRP", "Elevated supports osteomyelitis (nonspecific); baseline for monitoring"],
["HbA1c", "Every 3 months; higher levels = independent risk factor for DFU"],
["Blood glucose", "Optimize glycemic control"],
["Renal function", "Diabetes is leading cause of ESRD; impacts antibiotic dosing"],
]
t3 = Table(inv_data, colWidths=[W*0.35, W*0.65])
t3.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), colors.HexColor("#1a3a5c")),
("TEXTCOLOR", (0,0), (-1,0), colors.white),
("FONTNAME", (0,0), (-1,0), "Helvetica-Bold"),
("FONTSIZE", (0,0), (-1,-1), 9),
("ROWBACKGROUNDS", (0,1), (-1,-1), [colors.HexColor("#f5f8ff"), colors.white]),
("GRID", (0,0), (-1,-1), 0.3, colors.HexColor("#aaaaaa")),
("VALIGN", (0,0), (-1,-1), "TOP"),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 6),
]))
story.append(t3)
story.append(SP(6))
story.append(H2("4.2 Vascular Assessment — Ankle-Brachial Index (ABI)"))
abi_data = [
["ABI Value", "Interpretation"],
["0.9 – 1.2", "Normal"],
["> 1.3", "Noncompressible vessels (calcification) → use Toe Brachial Index instead"],
["< 0.9", "Peripheral arterial disease"],
["< 0.5", "Ulcer unlikely to heal without vascular intervention"],
["< 0.15 difference between limbs", "Significant finding → investigate further"],
]
t4 = Table(abi_data, colWidths=[W*0.4, W*0.6])
t4.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), colors.HexColor("#2e5f99")),
("TEXTCOLOR", (0,0), (-1,0), colors.white),
("FONTNAME", (0,0), (-1,0), "Helvetica-Bold"),
("FONTSIZE", (0,0), (-1,-1), 9),
("ROWBACKGROUNDS", (0,1), (-1,-1), [colors.HexColor("#f5f8ff"), colors.white]),
("GRID", (0,0), (-1,-1), 0.3, colors.HexColor("#aaaaaa")),
("VALIGN", (0,0), (-1,-1), "TOP"),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 6),
]))
story.append(t4)
story.append(SP(4))
story.append(B("<b>Toe Brachial Index (TBI):</b> Used when ABI is invalid (noncompressible vessels). TBI >0.4 or absolute toe pressure >40 mmHg = adequate perfusion for healing. Absolute toe pressure should be >70 mmHg (Campbell's: >70 mmHg cited)."))
story.append(SP(4))
story.append(H2("4.3 Imaging"))
img_data = [
["Modality", "Use / Limitation"],
["Plain X-ray", "First-line; can show osteomyelitis, gas in tissues, fractures. Low sensitivity/specificity for early osteomyelitis — may be normal initially."],
["MRI", "Most sensitive and specific for osteomyelitis and deep tissue involvement. Gold standard imaging. Logistical/cost challenges."],
["CT scan", "Shows gas, edema, foreign bodies. Useful when MRI not available."],
["Bone scan (Tc-99m)", "Useful when MRI unavailable; sensitive but not specific."],
["Tagged WBC scan", "Better specificity than bone scan; helps confirm osteomyelitis."],
]
t5 = Table(img_data, colWidths=[W*0.25, W*0.75])
t5.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), colors.HexColor("#1a3a5c")),
("TEXTCOLOR", (0,0), (-1,0), colors.white),
("FONTNAME", (0,0), (-1,0), "Helvetica-Bold"),
("FONTSIZE", (0,0), (-1,-1), 9),
("ROWBACKGROUNDS", (0,1), (-1,-1), [colors.HexColor("#f5f8ff"), colors.white]),
("GRID", (0,0), (-1,-1), 0.3, colors.HexColor("#aaaaaa")),
("VALIGN", (0,0), (-1,-1), "TOP"),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 6),
("WORDWRAP", (0,0), (-1,-1), True),
]))
story.append(t5)
story.append(SP(4))
story.append(TIP("Diagnosis of osteomyelitis: combination of probe-to-bone test + elevated inflammatory markers + plain X-ray changes. Gold standard = bone biopsy with culture. Superficial swabs are unreliable."))
# ===== 5. CLASSIFICATION =====
story.append(PageBreak())
story.append(H1("5. ULCER CLASSIFICATION SYSTEMS"))
story.append(H2("5.1 Wagner Classification (Most Widely Used)"))
wagner_data = [
["Grade", "Description", "Management Implication"],
["0", "At-risk foot; no ulceration; healed ulcer", "Preventive care, education, footwear"],
["I", "Superficial ulcer; partial or full thickness; no subcutaneous tissue", "Debridement, off-loading, wound care"],
["II", "Ulcer extending to tendon, capsule, or bone; no abscess/osteomyelitis", "More aggressive debridement; IV antibiotics"],
["III", "Deep ulcer with abscess or osteomyelitis", "Hospital admission; surgical drainage; IV antibiotics"],
["IV", "Partial foot gangrene (forefoot/heel)", "Vascular surgery; partial amputation"],
["V", "Gangrene of entire foot", "Major amputation likely required"],
]
t6 = Table(wagner_data, colWidths=[W*0.1, W*0.4, W*0.5])
t6.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), colors.HexColor("#1a3a5c")),
("TEXTCOLOR", (0,0), (-1,0), colors.white),
("FONTNAME", (0,0), (-1,0), "Helvetica-Bold"),
("FONTSIZE", (0,0), (-1,-1), 9),
("ROWBACKGROUNDS", (0,1), (-1,-1), [colors.HexColor("#f5f8ff"), colors.white]),
("GRID", (0,0), (-1,-1), 0.3, colors.HexColor("#aaaaaa")),
("VALIGN", (0,0), (-1,-1), "TOP"),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 6),
("WORDWRAP", (0,0), (-1,-1), True),
]))
story.append(t6)
story.append(SP(6))
story.append(H2("5.2 Brodsky Depth-Ischemia Classification"))
brodsky_data = [
["Depth", "Description"],
["0", "At-risk foot; no ulceration"],
["1", "Superficial ulcer, not involving subcutaneous tissue"],
["2", "Ulcer through to tendon, capsule, or bone"],
["3", "Extensive ulcer with exposed bone or joint; cavitary lesion; osteomyelitis"],
["Ischemia A", "Not ischemic"],
["Ischemia B", "Ischemia; not gangrenous"],
["Ischemia C", "Partial (forefoot) gangrene"],
["Ischemia D", "Complete foot gangrene"],
]
t7 = Table(brodsky_data, colWidths=[W*0.25, W*0.75])
t7.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), colors.HexColor("#2e5f99")),
("TEXTCOLOR", (0,0), (-1,0), colors.white),
("FONTNAME", (0,0), (-1,0), "Helvetica-Bold"),
("FONTSIZE", (0,0), (-1,-1), 9),
("ROWBACKGROUNDS", (0,1), (-1,-1), [colors.HexColor("#f5f8ff"), colors.white]),
("GRID", (0,0), (-1,-1), 0.3, colors.HexColor("#aaaaaa")),
("VALIGN", (0,0), (-1,-1), "TOP"),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 6),
]))
story.append(t7)
story.append(SP(4))
story.append(KEY("Ulcers that are both infected AND ischemic are 90× more likely to result in amputation. Infected ulcer alone = 40–55% risk of amputation."))
story.append(SP(4))
story.append(H2("5.3 IDSA / IWGDF Infection Classification"))
idsa_data = [
["Clinical Manifestation", "IDSA Severity", "IWGDF PEDIS"],
["No purulence or inflammation", "Uninfected", "Grade 1"],
["Purulence or ≥2 signs of inflammation; extension ≤2 cm; no systemic illness", "Mild", "Grade 2"],
["Systemically well but: cellulitis >2 cm, lymphangitis, spread beneath fascia, deep abscess, gangrene, or involvement of muscle/tendon/joint/bone", "Moderate", "Grade 3"],
["Systemic toxicity (fever, leukocytosis) OR metabolic instability (tachycardia, hypotension, confusion, acidosis, severe hyperglycemia, azotemia)", "Severe", "Grade 4"],
]
t8 = Table(idsa_data, colWidths=[W*0.5, W*0.25, W*0.25])
t8.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), colors.HexColor("#1a3a5c")),
("TEXTCOLOR", (0,0), (-1,0), colors.white),
("FONTNAME", (0,0), (-1,0), "Helvetica-Bold"),
("FONTSIZE", (0,0), (-1,-1), 9),
("ROWBACKGROUNDS", (0,1), (-1,-1), [colors.HexColor("#f5f8ff"), colors.white]),
("GRID", (0,0), (-1,-1), 0.3, colors.HexColor("#aaaaaa")),
("VALIGN", (0,0), (-1,-1), "TOP"),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 6),
("WORDWRAP", (0,0), (-1,-1), True),
]))
story.append(t8)
story.append(SP(6))
# ===== 6. MICROBIOLOGY =====
story.append(H1("6. MICROBIOLOGY OF DIABETIC FOOT INFECTION"))
story.append(B("Diabetic foot infections are <b>polymicrobial</b>. Aetiological agents are similar to non-diabetic osteomyelitis but with some key differences:"))
story.append(SP(4))
micro_data = [
["Organism", "Relevance"],
["Staphylococcus aureus (incl. MRSA)", "Most prevalent; target of empirical therapy in mild infection"],
["β-haemolytic Streptococci", "Common; covered by penicillins/cephalosporins"],
["Aerobic Gram-negative bacilli", "Common in diabetics; may require broader spectrum cover"],
["Pseudomonas aeruginosa", "Over-represented in diabetics; severe infections must cover this organism"],
["Anaerobes", "Present especially with abscess/devitalized tissue; add metronidazole"],
]
t9 = Table(micro_data, colWidths=[W*0.4, W*0.6])
t9.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), colors.HexColor("#1a3a5c")),
("TEXTCOLOR", (0,0), (-1,0), colors.white),
("FONTNAME", (0,0), (-1,0), "Helvetica-Bold"),
("FONTSIZE", (0,0), (-1,-1), 9),
("ROWBACKGROUNDS", (0,1), (-1,-1), [colors.HexColor("#f5f8ff"), colors.white]),
("GRID", (0,0), (-1,-1), 0.3, colors.HexColor("#aaaaaa")),
("VALIGN", (0,0), (-1,-1), "TOP"),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 6),
]))
story.append(t9)
story.append(SP(4))
story.append(WARN("Superficial swabs and sinus tract cultures are UNRELIABLE for identifying deep infection organisms. Culture requirement: deep tissue biopsy or bone biopsy. Bone biopsy = gold standard for osteomyelitis culture."))
# ===== 7. MANAGEMENT =====
story.append(PageBreak())
story.append(H1("7. MANAGEMENT"))
story.append(H2("7.1 General Principles"))
story.append(BU("Prevention is the mainstay of treatment — regular foot inspection, proper footwear, education."))
story.append(BU("Multidisciplinary approach: surgeon, diabetologist, vascular surgeon, podiatrist, wound nurse."))
story.append(BU("<b>Optimize glycemic control</b> — critical for wound healing and immunity."))
story.append(BU("Full vascular assessment is mandatory before any surgical intervention."))
story.append(BU("Aggressive debridement should NOT be undertaken until adequate perfusion is confirmed (unless severe infection present)."))
story.append(SP(4))
story.append(H2("7.2 Off-Loading"))
story.append(B("Redistribution of plantar pressure is fundamental to healing neuropathic ulcers."))
story.append(BU("<b>Total contact cast (TCC):</b> Gold standard for off-loading neuropathic plantar ulcers."))
story.append(BU("Removable walking braces, half-shoes, therapeutic footwear."))
story.append(BU("<b>Surgical off-loading:</b> Metatarsal head resection; Achilles tendon lengthening (reduces forefoot pressure); liquid silicone injections."))
story.append(BU("Silfverskiöld test guides tendon lengthening selection (gastrocnemius vs. Achilles)."))
story.append(SP(4))
story.append(H2("7.3 Wound Care"))
story.append(B("Goal: moist wound environment while controlling exudate; prevent maceration."))
story.append(BU("<b>Simple:</b> Saline or Vaseline-impregnated gauze (change daily or twice daily). Low cost."))
story.append(BU("<b>Silver-impregnated dressings:</b> Provide cushioning and infection prevention."))
story.append(BU("<b>Wet-to-dry dressings:</b> Classic non-surgical debridement; can be painful in sensate patients."))
story.append(BU("<b>Topical enzymatic debridement:</b> Aids complex ulcers with proteinaceous eschar."))
story.append(BU("<b>Negative pressure wound therapy (NPWT/VAC):</b> Changed 2-3×/week; debrides superficial tissue; promotes angiogenesis and granulation; decreases healing time. <b>Infusion VAC</b> can instill antibiotics/saline."))
story.append(BU("<b>Medical maggot therapy:</b> Selectively debrides nonviable tissue; effective but limited by patient/provider preference; does not accelerate healing vs. traditional methods."))
story.append(SP(4))
story.append(H2("7.4 Antibiotics"))
story.append(B("Treatment guided by IDSA/IWGDF severity classification:"))
story.append(BU("<b>Mild infection:</b> Oral antibiotic active against Gram-positive cocci (S. aureus including MRSA, Streptococci) — e.g., TMP-SMX, doxycycline, clindamycin (MRSA coverage)."))
story.append(BU("<b>Moderate infection:</b> Broader spectrum; consider IV route; cover Gram-negatives."))
story.append(BU("<b>Severe infection:</b> IV antibiotics covering MRSA, Gram-negatives, Pseudomonas, and anaerobes; add metronidazole for abscesses/devitalized tissue."))
story.append(BU("Tailor therapy to culture results when available. Superficial swabs → avoid; use deep tissue/bone culture."))
story.append(SP(4))
story.append(H2("7.5 Vascular Interventions"))
story.append(BU("Full vascular assessment mandatory for poor peripheral pulses."))
story.append(BU("Options: proximal angioplasty or bypass surgery to improve distal vascularity."))
story.append(BU("Vascular surgery prior to or concurrent with foot infection surgery improves outcomes."))
story.append(SP(4))
story.append(H2("7.6 Adjunctive Therapies"))
story.append(BU("<b>Hyperbaric oxygen therapy (HBO):</b> Increases tissue oxygenation via oxygen-rich plasma; promotes angiogenesis. Best for patients with good perfusion (palpable pulses, normal TBI). Multiple weeks of treatment required."))
story.append(BU("<b>Platelet-derived growth factor (PDGF) / becaplermin:</b> Topical; for persistent chronic wounds; promotes platelet-mediated proliferative phase."))
story.append(SP(4))
story.append(H2("7.7 Surgical Management"))
story.append(B("<b>Indications for surgery:</b>"))
story.append(BU("Collections (abscess) → incision and drainage."))
story.append(BU("Necrotic tissue → surgical debridement."))
story.append(BU("Osteomyelitis with bone involvement of cortex → resection of affected bone."))
story.append(BU("Extensive infection/gangrene → amputation."))
story.append(SP(2))
story.append(B("<b>Principles of surgical debridement:</b>"))
story.append(BU("Distinguish superficial osteitis (soft-tissue cover loss ± vascular compromise) from true osteomyelitis — different management."))
story.append(BU("Remove all infected material; excess bone resection for tension-free skin closure."))
story.append(BU("Wounds generally left open to drain and heal by secondary intent."))
story.append(SP(2))
story.append(B("<b>Amputation:</b>"))
story.append(BU("Not a simple option — wound healing post-amputation is unreliable in diabetics."))
story.append(BU("Excision must remove all infected material."))
story.append(BU("With extensive peripheral neuropathy, below-knee amputation in area with better sensation may be more appropriate."))
story.append(SP(4))
story.append(TIP("Ulcer size at 4 weeks predicts outcome: ≥50% reduction in size after 4 weeks = significantly higher healing rates at 12 weeks. Ulcers <1 cm² have 96% heal rate without amputation; ulcers >3 cm² only 72%."))
# ===== 8. CHARCOT NEUROARTHROPATHY =====
story.append(H1("8. CHARCOT NEUROARTHROPATHY"))
story.append(B("A destructive arthropathy occurring in the setting of peripheral neuropathy, characterized by progressive bone and joint destruction. Affects the <b>midfoot</b> most commonly."))
story.append(SP(4))
story.append(H2("8.1 Diagnosis"))
story.append(BU("Presents with <b>warm, swollen, erythematous foot</b> without pain (or minimal pain due to neuropathy)."))
story.append(BU("Can mimic infection — distinguish by: <b>elevating the extremity</b> (Charcot erythema subsides with elevation; infection does not)."))
story.append(BU("X-ray: fragmentation, subluxation, dislocation, new bone formation ('rocker-bottom' deformity)."))
story.append(BU("MRI: confirms early bone marrow edema before radiographic changes."))
story.append(SP(4))
story.append(H2("8.2 Management"))
story.append(BU("<b>Acute phase:</b> Immobilization with total contact casting, non-weight bearing; continue until temperatures equalize between feet."))
story.append(BU("<b>Chronic phase:</b> Custom accommodative footwear; surgical reconstruction for severe deformity."))
story.append(BU("Surgical reconstruction: corrective triple fusion of hindfoot, excision of infected/collapsed tissue."))
story.append(SP(4))
# ===== 9. PREVENTION =====
story.append(H1("9. PREVENTION"))
story.append(BU("Daily foot inspection (or by caregiver if vision impaired)."))
story.append(BU("Appropriate footwear — cushioned, well-fitting shoes; inspect shoes for foreign objects."))
story.append(BU("Monofilament testing at every visit to detect loss of protective sensation."))
story.append(BU("HbA1c monitoring every 3 months; maintain tight glycemic control."))
story.append(BU("Patient education: foot hygiene, nail care, moisturizing dry skin, avoiding barefoot walking."))
story.append(BU("Regular podiatry review; callus debridement."))
story.append(BU("Smoking cessation — worsens peripheral vascular disease."))
story.append(BU("Prompt treatment of any foot wound, regardless of pain."))
story.append(SP(4))
story.append(KEY("Risk factors for DFU: higher HbA1c, impaired vision, monofilament insensitivity, history of prior ulcer, PAD."))
# ===== 10. QUICK REFERENCE / MEMORY AIDS =====
story.append(PageBreak())
story.append(H1("10. QUICK REFERENCE"))
story.append(H2("The Diabetic Foot Triad"))
triad_data = [
["NEUROPATHY", "ISCHEMIA", "INFECTION"],
["Sensory: painless injury\nMotor: deformity, abnormal pressure\nAutonomic: dry skin, no sweating",
"PAD (tibial/fem-pop)\nNoncompressible vessels\nPoor wound healing",
"Polymicrobial\nS. aureus/MRSA\nPseudomonas\nAnaerobes"]
]
t10 = Table(triad_data, colWidths=[W/3, W/3, W/3])
t10.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), colors.HexColor("#1a3a5c")),
("TEXTCOLOR", (0,0), (-1,0), colors.white),
("FONTNAME", (0,0), (-1,0), "Helvetica-Bold"),
("FONTSIZE", (0,0), (-1,-1), 9),
("ALIGN", (0,0), (-1,-1), "CENTER"),
("VALIGN", (0,0), (-1,-1), "MIDDLE"),
("ROWBACKGROUNDS", (0,1), (-1,-1), [colors.HexColor("#dce8f5")]),
("GRID", (0,0), (-1,-1), 0.3, colors.HexColor("#aaaaaa")),
("TOPPADDING", (0,0), (-1,-1), 6),
("BOTTOMPADDING", (0,0), (-1,-1), 6),
("LEFTPADDING", (0,0), (-1,-1), 6),
("WORDWRAP", (0,0), (-1,-1), True),
]))
story.append(t10)
story.append(SP(8))
story.append(H2("Key Numbers to Remember"))
numbers_data = [
["Fact", "Value"],
["Lifetime risk of DFU in diabetics", "15%"],
["Annual incidence of DFU", "2%"],
["DFU → amputation risk", "Up to 20%"],
["Infected DFU → some amputation", "40–55%"],
["Infected + ischemic ulcer → amputation", "90× higher risk"],
["Probe-to-bone (+) → PPV for osteomyelitis", "57%"],
["Probe-to-bone (-) → NPV for osteomyelitis", "96%"],
["Ulcer <1 cm² → heals without amputation", "96%"],
["Ulcer >3 cm² → heals without amputation", "72%"],
["ABI normal range", "0.9 – 1.2"],
["ABI → vascular intervention needed", "< 0.5"],
["TBI → adequate perfusion", "> 0.4 (or absolute toe pressure >40 mmHg)"],
["Monofilament test threshold (high-risk)", "Cannot feel 10-g (5.07 Semmes-Weinstein)"],
["HbA1c monitoring frequency", "Every 3 months"],
]
t11 = Table(numbers_data, colWidths=[W*0.65, W*0.35])
t11.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), colors.HexColor("#2e5f99")),
("TEXTCOLOR", (0,0), (-1,0), colors.white),
("FONTNAME", (0,0), (-1,0), "Helvetica-Bold"),
("FONTSIZE", (0,0), (-1,-1), 9),
("ROWBACKGROUNDS", (0,1), (-1,-1), [colors.HexColor("#f5f8ff"), colors.white]),
("GRID", (0,0), (-1,-1), 0.3, colors.HexColor("#aaaaaa")),
("VALIGN", (0,0), (-1,-1), "MIDDLE"),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 6),
]))
story.append(t11)
story.append(SP(8))
story.append(H2("Antibiotics Quick Guide"))
abx_data = [
["Severity", "Route", "Covers", "Notes"],
["Mild", "Oral", "MSSA, MRSA, Streptococci", "TMP-SMX, doxycycline, or clindamycin for MRSA"],
["Moderate", "PO or IV", "Gram-positive + Gram-negative", "Broad spectrum; culture guidance preferred"],
["Severe", "IV", "MRSA + GNB + Pseudomonas + Anaerobes", "Add metronidazole for abscess/devitalized tissue; cover Pseudomonas"],
]
t12 = Table(abx_data, colWidths=[W*0.15, W*0.12, W*0.35, W*0.38])
t12.setStyle(TableStyle([
("BACKGROUND", (0,0), (-1,0), colors.HexColor("#1a3a5c")),
("TEXTCOLOR", (0,0), (-1,0), colors.white),
("FONTNAME", (0,0), (-1,0), "Helvetica-Bold"),
("FONTSIZE", (0,0), (-1,-1), 9),
("ROWBACKGROUNDS", (0,1), (-1,-1), [colors.HexColor("#f5f8ff"), colors.white]),
("GRID", (0,0), (-1,-1), 0.3, colors.HexColor("#aaaaaa")),
("VALIGN", (0,0), (-1,-1), "TOP"),
("TOPPADDING", (0,0), (-1,-1), 4),
("BOTTOMPADDING", (0,0), (-1,-1), 4),
("LEFTPADDING", (0,0), (-1,-1), 6),
("WORDWRAP", (0,0), (-1,-1), True),
]))
story.append(t12)
story.append(SP(8))
# Footer
story.append(HR())
story.append(Paragraph(
"Sources: Bailey & Love's Short Practice of Surgery 28th Ed • Campbell's Operative Orthopaedics 15th Ed 2026 • Fischer's Mastery of Surgery 8th Ed | Generated by Orris – July 2026",
footer_style
))
doc.build(story)
print(f"PDF saved to: {OUTPUT}")
cd /tmp/workspace/diabetic-foot-notes && python generate_notes.py
ls -lh /tmp/workspace/diabetic-foot-notes/Diabetic_Foot_Notes.pdf
Diabetic Foot Notes
PDF Document · PDF