attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment

I have send you my marrow notes and textbook notes of DKA tell me what to add in my marrow notes to complete my answer

analyse_media
analyse_media
analyse_media
analyse_media
analyse_media
Now I have a clear picture of both your Marrow notes and your textbook (Essential Pediatrics). Here is a detailed gap analysis - everything present in the textbook that is missing from your Marrow notes:

What to Add to Your Marrow Notes on DKA

1. EPIDEMIOLOGY / INTRODUCTION (missing entirely)

Add a brief intro box:
  • DKA = most severe acute complication of DM
  • Previously T1D only - now also seen in T2D and MODY
  • 30-40% of newly diagnosed T1D children present with DKA
  • India: incidence higher than developed countries

2. PATHOPHYSIOLOGY - Gaps to fill

What you haveWhat's missing
Insulinopenia + counter-regulatory hormonesAdd catecholamines explicitly alongside GH, glucagon, cortisol
Hyperglycemia + lipolysisAdd: osmotic diuresis → urinary water loss → dehydration (your notes show intracellular dehydration but miss the osmotic diuresis/polyuria pathway)
Ketone bodies listedAdd that β-hydroxybutyrate is measured clinically (β-HB ≥ 5.3 mmol/L)
Pseudohyponatremia notedAdd: acidosis shifts K⁺ and PO₄³⁻ from ICF → ECF (the potassium/phosphate shift is missing)
Add: serum K⁺ is initially HIGH → becomes hypokalemic with insulin therapy (this is a high-yield point completely absent from your notes)

3. DIFFERENTIAL DIAGNOSIS - "When to Suspect" (missing entirely)

Add a small box:
PresentationDDx
EncephalopathyCNS infections, severe malaria, poisoning
Acute abdomenPancreatitis, appendicitis
DehydrationGastroenteritis
TachypneaBronchial asthma, pneumonia
Hyperglycemia with acidosis, no ketonesRenal failure, septicemia
Ketoacidosis without hyperglycemiaStarvation, salicylate poisoning, organic acidemia

4. INVESTIGATIONS - Major section missing from Marrow notes

Add a "Workup" box:
  • Serum Na⁺: True deficit = 4-6 mEq/kg. Use corrected sodium (falsely low in hyperglycemia). Rapid drop in Na⁺ = risk for cerebral edema
  • Serum K⁺: True deficit = 3-6 mEq/kg, but levels are normal/high at presentation (ICF→ECF shift). Risk of life-threatening hypokalemia once insulin started
  • Serum phosphate: Significant deficit. Treat if PO₄ < 1 mg/dL
  • WBC: Transient leukocytosis is common and doesn't indicate infection. Infection suspected only with persistent leukocytosis + fever
  • Blood urea: High BUN = severe DKA
  • ECG: Screen for hypo/hyperkalemia

5. MANAGEMENT - Significant gaps

A. ICU criteria (missing):
  • Age < 2 years OR
  • Severe DKA → ICU admission
B. Initial stabilization details (partial in your notes):
  • Insert nasogastric tube + urinary catheter if unconscious
  • Intubation should be deferred (worsens CNS acidosis) - this is a high-yield negative point
C. Fluid therapy - specific numbers missing:
  • Fluid deficit in most children = 5-10%
  • Fluid requirement = 3-3.5 L/m²/day
  • Do NOT exceed 4-5 L/m²/day (risk of cerebral edema)
  • Correct deficit over 48 hours (72 hours if high plasma osmolality)
  • IV fluid choice: Normal saline (154 mEq/L) for first 6 hours, then sodium content between 77-154 mEq/L
  • Account for fluids already given at referring center
D. Insulin therapy details (partially in your notes, but add):
  • Give insulin only after initial hydration (1 hour after starting fluids)
  • No initial bolus (risk cerebral edema) - already in your notes ✓
  • Flush IV tubing with insulin before starting infusion (insulin binds plastic)
  • Standard dose: 0.05-0.1 u/kg/hr IV ✓
  • Increase by 0.02 u/kg/hr if glucose not falling > 50 mg/dL/hr or acidosis not resolving
  • Do NOT decrease insulin rate when glucose falls - instead add dextrose (to avoid prolonging acidosis)
  • If no IV insulin available: IM regular insulin - 0.3 u/kg loading, then 0.1 u/kg/hr
  • Subcutaneous insulin NOT recommended (poor absorption due to poor perfusion)
E. Potassium replacement protocol (missing - very high yield):
  • K⁺ < 3.5 mEq/L → give K before starting insulin
  • K⁺ 3.5-6 mEq/L → add KCl 40 mEq/L to fluids at time of starting insulin
  • K⁺ > 6 mEq/L OR anuric OR ECG shows hyperkalemia changes → do NOT give K⁺
F. Dextrose rule (clarify in notes):
  • Add 5% dextrose when blood glucose < 270-300 mg/dL (your notes say < 300 ✓ but add the "270" threshold from the textbook)
G. Acid-base/Bicarbonate (clarify in notes):
  • Bicarbonate is contraindicated ✓ (in your notes)
  • Add the exceptions: Only use bicarbonate if pH < 6.9 WITH hemodynamic compromise, OR severe hyperkalemia (K⁺ > 6.5 mEq/L with ECG changes)

6. CEREBRAL EDEMA - Most critical complication (partially missing)

Your notes mention "slow deficit correction" for cerebral edema but you need to add:
  • Most serious complication, most common cause of death in DKA
  • Risk factors: Age < 5 years, severe acidosis, insulin bolus, excessive hydration, pCO₂ < 10 mmol/L, alkali treatment
  • Timing: Usually 4-12 hours after starting treatment (but can be present at diagnosis)
  • Early signs: Headache, vomiting, drowsiness, irritability, hypertension + bradycardia (Cushing's triad)
  • Late/severe signs: Unconsciousness, focal neurological deficits, papilledema, fixed dilated pupils, sixth nerve palsy
  • Treatment: IV mannitol 5 mL/kg + fluid restriction + head elevation

7. MONITORING (missing entirely)

Add a box:
  • Hourly: neurological status, HR, BP, fluid I/O, blood glucose
  • Every 4 hours: blood ketone, pH, bicarbonate, electrolytes
Response to Treatment table (Table 18.36 from textbook - very high yield):
ParameterExpectedConcernAction
Blood glucoseDecrease 50-100 mg/dL/hrDecline > 100 mg/dL/hrAdd dextrose
Decline < 50 mg/dL/hrPrepare fresh insulin, flush tubing
Blood pHResolution by 12 hrPersistent at 12 hrExclude infection, shock, lactic acidosis
Serum Na⁺IncreaseIncrease < 2 mmol/L/hrIncrease sodium in IV fluid
Serum K⁺Gradual decreaseHypokalemiaIncrease K⁺ in IV fluid
Anion gapResolution by 12 hrElevated at 12 hrExclude lactic acidosis/infection
Plasma osmolalityStableDecrease > 2 mOsm/kg/hrIncrease Na, decrease fluid rate
Blood ureaDecreasePersistently elevatedExclude renal failure

8. DISCONTINUATION OF TREATMENT (missing)

  • Switch to subcutaneous insulin once: patient is conscious, tolerating oral feeds, and acidosis resolved
  • Give regular/rapid-acting insulin 0.25 u/kg 30 minutes before the first meal
  • Stop IV insulin 30 minutes after the SC dose (to provide overlap)

9. INFECTIONS as a complication (missing)

  • Bacterial and fungal infections are common post-DKA
  • Red flags: persistent fever, leukocytosis, black nasal discharge (rhinocerebral mucormycosis), hemoptysis (pulmonary aspergillosis)

Summary of highest-yield additions:
  1. K⁺ dynamics (initial hyperkalemia → insulin-induced hypokalemia) and K⁺ replacement protocol
  2. Cerebral edema - full risk factors, signs, and treatment (mannitol)
  3. "When to suspect" differential diagnosis box
  4. Investigations workup box
  5. Monitoring table (Table 18.36)
  6. Bicarbonate exception criteria (pH < 6.9 + hemodynamic compromise)
  7. Discontinuation criteria for IV insulin

Give that is required for university final year theory examination

Based on my analysis of both your notes, here is exactly what to add to your Marrow notes for a university final year theory exam - focused on what examiners ask, structured for written answers.

ADD THESE TO YOUR MARROW NOTES


1. ONE-LINE INTRO (add at top)

"Most severe acute complication of DM; seen in T1D, increasingly in T2D and MODY"

2. PATHOPHYSIOLOGY - Add these 2 missing points

In your flowchart, after "Hyperglycemia + lipolysis", add:
Missing branch:
Acidosis → shifts K⁺ and PO₄³⁻ from ICF → ECF → Serum K⁺ initially HIGH → becomes LOW once insulin started
This is asked directly: "Explain potassium changes in DKA"

3. CRITERIA - Small correction

Your notes say serum bicarbonate < 18 mmol/L - the textbook says < 15 mEq/L. Note both: < 18 (ISPAD) / < 15 (some guidelines) - safe to write < 15 mEq/L in theory exam.

4. DIFFERENTIAL DIAGNOSIS BOX (examiners ask "when to suspect DKA")

PresentationThink DKA when ruling out
EncephalopathyCNS infection, malaria, poisoning
Acute abdomenPancreatitis, appendicitis
DehydrationGastroenteritis
TachypneaAsthma, pneumonia
Acidosis without ketonesRenal failure, septicemia
Ketosis without hyperglycemiaStarvation, salicylate poisoning

5. INVESTIGATIONS BOX (completely missing - frequently asked as short note)

InvestigationFindingSignificance
Serum Na⁺Low (false - pseudohyponatremia)Use corrected Na⁺. Rapid fall = risk of cerebral edema
Serum K⁺Normal/High (despite total body deficit 3-6 mEq/kg)Becomes dangerously low with insulin
Serum phosphateLowTreat if < 1 mg/dL
WBCTransient leukocytosisNormal in DKA. Persistent = suspect infection
Blood ureaHighIndicates severe DKA
ECGScreens for hypo/hyperkalemia
Blood gaspH < 7.3, HCO₃ < 15Confirms acidosis

6. MANAGEMENT - Key additions only

A. ICU criteria (add near top of management):
  • Age < 2 years OR Severe DKA → ICU
B. Initial stabilization (add 2 points):
  • Insert NG tube + urinary catheter if unconscious
  • Defer intubation - worsens CNS acidosis
C. Fluid therapy numbers (add to your fluid table):
  • Deficit = 5-10% body weight
  • Rate = 3-3.5 L/m²/day, never exceed 4 L/m²/day (cerebral edema risk)
  • Duration = correct over 48 hours (72 hr if high osmolality)
  • NS for first 6 hours, then sodium 77-154 mEq/L
  • Add 5% dextrose when glucose < 270 mg/dL
D. Insulin - add these points:
  • Flush IV tubing with insulin before use (insulin binds to plastic)
  • Increase dose by 0.02 u/kg/hr if glucose not falling ≥ 50 mg/dL/hr
  • Do NOT reduce insulin when glucose falls - add dextrose instead (stopping insulin prolongs acidosis)
  • If no IV: IM regular insulin 0.3 u/kg load → 0.1 u/kg/hr
  • SC insulin not used (poor perfusion = poor absorption)
E. Potassium protocol (high-yield - add as a separate box):
K⁺ < 3.5 mEq/L  → Give K⁺ BEFORE insulin
K⁺ 3.5-6 mEq/L  → Add 40 mEq/L KCl when starting insulin
K⁺ > 6 mEq/L    → Do NOT give K⁺ (also if anuric / ECG changes)
F. Bicarbonate - add the exception:
Avoided routinely. Give only if pH < 6.9 + hemodynamic compromise OR K⁺ > 6.5 mEq/L with ECG changes

7. CEREBRAL EDEMA - Full box (most common cause of death - always asked)

Add this entire section:
  • Most serious complication, most common cause of death
  • Timing: 4-12 hours after starting treatment (rarely at diagnosis)
Risk factors (mnemonic - ASHI-C):
Age < 5 yr | Severe acidosis | Hydration excess | Insulin bolus | CO₂ < 10 mmol/L + alkali
Early signs: Headache, vomiting, drowsiness, irritability, hypertension + bradycardia
Late signs: Unconsciousness, focal deficits, papilledema, fixed dilated pupils, 6th nerve palsy
Treatment:
  • IV Mannitol 5 mL/kg stat
  • Fluid restriction
  • Head elevation
  • Suspected clinically - do not wait for imaging

8. MONITORING TABLE (asked in long answers - add at end)

ParameterFrequencyConcern if...
Neuro status, HR, BP, I/OHourlyAny deterioration
Blood glucoseHourlyFall > 100 mg/dL/hr → add dextrose; Fall < 50 → change insulin
pH, HCO₃, electrolytes, ketones4-hourlypH not resolving by 12 hr → exclude infection
Serum Na⁺4-hourlyNot rising → increase Na in fluid

9. STOPPING TREATMENT / TRANSITION (add at end)

Once patient is:
  • Conscious + tolerating oral feeds + acidosis resolved
→ Give SC regular insulin 0.25 u/kg 30 min before first meal → Stop IV insulin 30 min after SC dose (overlap to avoid rebound hyperglycemia)

10. INFECTIONS POST-DKA (add under complications)

  • Fungal infections common
  • Watch for: black nasal discharge = mucormycosis | hemoptysis = pulmonary aspergillosis

WHAT YOU ALREADY HAVE (don't repeat)

  • Pathophysiology flowchart ✓
  • Ketone body types ✓
  • Severity table ✓
  • 3 pillars of management ✓
  • Initial management table ✓
  • KCl 40 mEq/L mentioned ✓
  • Insulin bolus C/I ✓
  • Bicarbonate C/I ✓
  • 5% dextrose when glucose < 300 ✓
The biggest gaps for theory exam are: Cerebral edema full answer, K⁺ protocol, Investigations box, and Monitoring table - these four alone can fetch you 6-8 marks in a 10-mark question.

Make pdf for differential diagnosis investigation management in short marrow textbook mix notes complications monitoring

Reading File
Running Command

mkdir -p /tmp/workspace/dka-notes && ls /tmp/workspace/dka-notes/

Writing File

~/dka-notes/make_dka_pdf.py

from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import cm, mm
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/dka-notes/DKA_Notes.pdf"

doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=A4,
    rightMargin=1.8*cm,
    leftMargin=1.8*cm,
    topMargin=2*cm,
    bottomMargin=2*cm,
)

# ── Colour palette ──────────────────────────────────────────────
C_NAVY    = colors.HexColor("#1A3A5C")
C_TEAL    = colors.HexColor("#0B6E6E")
C_ORANGE  = colors.HexColor("#D45A00")
C_RED     = colors.HexColor("#B82020")
C_YELLOW  = colors.HexColor("#FFF3B0")
C_LTBLUE  = colors.HexColor("#E8F4FD")
C_LTGREEN = colors.HexColor("#E8F8F0")
C_LTRED   = colors.HexColor("#FDF0F0")
C_LTORANGE= colors.HexColor("#FFF5E6")
C_GREY    = colors.HexColor("#F4F4F4")
C_WHITE   = colors.white
C_BLACK   = colors.HexColor("#1A1A1A")

styles = getSampleStyleSheet()

def sty(name, **kwargs):
    return ParagraphStyle(name, **kwargs)

TITLE_STYLE = sty("Title",
    fontSize=22, fontName="Helvetica-Bold",
    textColor=C_WHITE, alignment=TA_CENTER,
    spaceAfter=4, spaceBefore=4)

SUBTITLE_STYLE = sty("Subtitle",
    fontSize=11, fontName="Helvetica",
    textColor=C_WHITE, alignment=TA_CENTER,
    spaceAfter=2)

H1 = sty("H1",
    fontSize=13, fontName="Helvetica-Bold",
    textColor=C_WHITE, alignment=TA_LEFT,
    spaceBefore=10, spaceAfter=2,
    leftIndent=4)

H2 = sty("H2",
    fontSize=11, fontName="Helvetica-Bold",
    textColor=C_NAVY,
    spaceBefore=8, spaceAfter=3)

BODY = sty("Body",
    fontSize=9.5, fontName="Helvetica",
    textColor=C_BLACK,
    spaceBefore=2, spaceAfter=2,
    leading=14)

BODY_BOLD = sty("BodyBold",
    fontSize=9.5, fontName="Helvetica-Bold",
    textColor=C_NAVY,
    spaceBefore=2, spaceAfter=2,
    leading=14)

SMALL = sty("Small",
    fontSize=8.5, fontName="Helvetica",
    textColor=C_BLACK, leading=12,
    spaceBefore=1, spaceAfter=1)

SMALL_BOLD = sty("SmallBold",
    fontSize=8.5, fontName="Helvetica-Bold",
    textColor=C_NAVY, leading=12)

WARN = sty("Warn",
    fontSize=9, fontName="Helvetica-Bold",
    textColor=C_RED, leading=13)

NOTE = sty("Note",
    fontSize=8.5, fontName="Helvetica-Oblique",
    textColor=C_TEAL, leading=12)

TABLE_HEADER = sty("TH",
    fontSize=9, fontName="Helvetica-Bold",
    textColor=C_WHITE, alignment=TA_CENTER, leading=12)

TABLE_CELL = sty("TC",
    fontSize=8.5, fontName="Helvetica",
    textColor=C_BLACK, alignment=TA_LEFT, leading=12)

TABLE_CELL_C = sty("TCC",
    fontSize=8.5, fontName="Helvetica",
    textColor=C_BLACK, alignment=TA_CENTER, leading=12)

TABLE_CELL_BOLD = sty("TCB",
    fontSize=8.5, fontName="Helvetica-Bold",
    textColor=C_NAVY, alignment=TA_LEFT, leading=12)

# ── Helper builders ─────────────────────────────────────────────

def section_header(text, bg=C_NAVY):
    t = Table([[Paragraph(text, H1)]], colWidths=[doc.width])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), bg),
        ("ROWPADDING", (0,0), (-1,-1), 6),
        ("ROUNDEDCORNERS", [4,4,4,4]),
    ]))
    return t

def hr():
    return HRFlowable(width="100%", thickness=1, color=C_TEAL, spaceAfter=4, spaceBefore=4)

def sp(h=6):
    return Spacer(1, h)

def p(text, style=BODY):
    return Paragraph(text, style)

def bullet(items, style=BODY):
    out = []
    for item in items:
        out.append(Paragraph(f"<bullet>\u2022</bullet> {item}", style))
    return out

def key_val_table(rows, col1=6.5*cm, col2=None):
    if col2 is None:
        col2 = doc.width - col1
    data = []
    for k, v in rows:
        data.append([
            Paragraph(k, TABLE_CELL_BOLD),
            Paragraph(v, TABLE_CELL)
        ])
    t = Table(data, colWidths=[col1, col2])
    t.setStyle(TableStyle([
        ("VALIGN", (0,0), (-1,-1), "TOP"),
        ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#CCCCCC")),
        ("ROWBACKGROUNDS", (0,0), (-1,-1), [C_WHITE, C_GREY]),
        ("LEFTPADDING", (0,0), (-1,-1), 6),
        ("RIGHTPADDING", (0,0), (-1,-1), 6),
        ("TOPPADDING", (0,0), (-1,-1), 4),
        ("BOTTOMPADDING", (0,0), (-1,-1), 4),
    ]))
    return t

def generic_table(headers, rows, col_widths, row_colors=None, header_bg=C_NAVY):
    data = [[Paragraph(h, TABLE_HEADER) for h in headers]]
    for i, row in enumerate(rows):
        data.append([Paragraph(str(c), TABLE_CELL) for c in row])
    t = Table(data, colWidths=col_widths)
    style_cmds = [
        ("BACKGROUND", (0,0), (-1,0), header_bg),
        ("VALIGN", (0,0), (-1,-1), "TOP"),
        ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#AAAAAA")),
        ("TOPPADDING", (0,0), (-1,-1), 4),
        ("BOTTOMPADDING", (0,0), (-1,-1), 4),
        ("LEFTPADDING", (0,0), (-1,-1), 5),
        ("RIGHTPADDING", (0,0), (-1,-1), 5),
    ]
    if row_colors:
        for i, bg in enumerate(row_colors):
            style_cmds.append(("BACKGROUND", (0, i+1), (-1, i+1), bg))
    else:
        for i in range(len(rows)):
            bg = C_WHITE if i % 2 == 0 else C_GREY
            style_cmds.append(("BACKGROUND", (0, i+1), (-1, i+1), bg))
    t.setStyle(TableStyle(style_cmds))
    return t

def info_box(text, bg=C_LTBLUE, border=C_TEAL):
    t = Table([[Paragraph(text, BODY)]], colWidths=[doc.width])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), bg),
        ("LEFTPADDING", (0,0), (-1,-1), 10),
        ("RIGHTPADDING", (0,0), (-1,-1), 10),
        ("TOPPADDING", (0,0), (-1,-1), 6),
        ("BOTTOMPADDING", (0,0), (-1,-1), 6),
        ("BOX", (0,0), (-1,-1), 1.5, border),
        ("ROUNDEDCORNERS", [4,4,4,4]),
    ]))
    return t

def warn_box(text):
    return info_box(text, bg=C_LTRED, border=C_RED)

def tip_box(text):
    return info_box(text, bg=C_LTORANGE, border=C_ORANGE)

# ═══════════════════════════════════════════════════════════════
# BUILD CONTENT
# ═══════════════════════════════════════════════════════════════
story = []

# ── TITLE BANNER ────────────────────────────────────────────────
title_data = [[
    Paragraph("DIABETIC KETOACIDOSIS", TITLE_STYLE),
    Paragraph("DKA", sty("TL", fontSize=28, fontName="Helvetica-Bold",
                          textColor=colors.HexColor("#FFFFFF66"),
                          alignment=TA_CENTER))
]]
title_table = Table(title_data, colWidths=[doc.width - 3*cm, 3*cm])
title_table.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), C_NAVY),
    ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
    ("TOPPADDING", (0,0), (-1,-1), 12),
    ("BOTTOMPADDING", (0,0), (-1,-1), 12),
    ("LEFTPADDING", (0,0), (-1,-1), 12),
    ("ROUNDEDCORNERS", [6,6,6,6]),
]))
story.append(title_table)

sub_data = [[
    Paragraph("Marrow + Textbook Notes  |  Final Year Theory Exam  |  ISPAD Guidelines", SUBTITLE_STYLE)
]]
sub_table = Table(sub_data, colWidths=[doc.width])
sub_table.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), C_TEAL),
    ("TOPPADDING", (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
]))
story.append(sub_table)
story.append(sp(10))

# ═══════════════════════════════════════════════════════
# SECTION 1: DIFFERENTIAL DIAGNOSIS
# ═══════════════════════════════════════════════════════
story.append(section_header("1.  DIFFERENTIAL DIAGNOSIS  —  WHEN TO SUSPECT DKA"))
story.append(sp(6))

story.append(p("DKA must be considered in the differential diagnosis of the following presentations:", BODY))
story.append(sp(4))

dd_data = [
    [Paragraph("PRESENTATION", TABLE_HEADER),
     Paragraph("CONDITIONS TO RULE OUT", TABLE_HEADER),
     Paragraph("DKA CLUE", TABLE_HEADER)],
    [Paragraph("Encephalopathy / altered sensorium", TABLE_CELL_BOLD),
     Paragraph("CNS infections, severe malaria, poisoning", TABLE_CELL),
     Paragraph("Hyperglycemia + ketones", TABLE_CELL)],
    [Paragraph("Acute abdomen", TABLE_CELL_BOLD),
     Paragraph("Pancreatitis, appendicitis", TABLE_CELL),
     Paragraph("Abdominal pain d/t acidosis", TABLE_CELL)],
    [Paragraph("Dehydration", TABLE_CELL_BOLD),
     Paragraph("Gastroenteritis", TABLE_CELL),
     Paragraph("No diarrhoea; osmotic diuresis", TABLE_CELL)],
    [Paragraph("Tachypnea / respiratory distress", TABLE_CELL_BOLD),
     Paragraph("Bronchial asthma, pneumonia", TABLE_CELL),
     Paragraph("Kussmaul breathing (deep, not wheeze)", TABLE_CELL)],
    [Paragraph("Hyperglycemia + acidosis, NO ketones", TABLE_CELL_BOLD),
     Paragraph("Renal failure, septicemia", TABLE_CELL),
     Paragraph("Ketonuria absent; BUN very high", TABLE_CELL)],
    [Paragraph("Ketoacidosis, NO hyperglycemia", TABLE_CELL_BOLD),
     Paragraph("Starvation, salicylate poisoning, organic acidemia", TABLE_CELL),
     Paragraph("Glucose normal / low", TABLE_CELL)],
]
dd_table = Table(dd_data, colWidths=[4.5*cm, 6.5*cm, doc.width-11*cm])
dd_table.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), C_NAVY),
    ("VALIGN", (0,0), (-1,-1), "TOP"),
    ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#AAAAAA")),
    ("TOPPADDING", (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING", (0,0), (-1,-1), 5),
    ("RIGHTPADDING", (0,0), (-1,-1), 5),
    *[("BACKGROUND", (0,i), (-1,i), C_WHITE if i%2==1 else C_GREY) for i in range(1,8)],
]))
story.append(dd_table)
story.append(sp(8))

# ═══════════════════════════════════════════════════════
# SECTION 2: INVESTIGATIONS
# ═══════════════════════════════════════════════════════
story.append(section_header("2.  INVESTIGATIONS", bg=C_TEAL))
story.append(sp(6))

inv_data = [
    [Paragraph("INVESTIGATION", TABLE_HEADER),
     Paragraph("FINDING IN DKA", TABLE_HEADER),
     Paragraph("SIGNIFICANCE / ACTION", TABLE_HEADER)],
    [Paragraph("Serum Na⁺", TABLE_CELL_BOLD),
     Paragraph("LOW (falsely - pseudohyponatremia)\nTrue deficit: 4-6 mEq/kg", TABLE_CELL),
     Paragraph("Use corrected Na⁺. Rapid fall in Na⁺ = risk for cerebral edema", TABLE_CELL)],
    [Paragraph("Serum K⁺", TABLE_CELL_BOLD),
     Paragraph("NORMAL or HIGH at presentation\nTrue deficit: 3-6 mEq/kg (ICF depleted)", TABLE_CELL),
     Paragraph("Becomes dangerously LOW once insulin started. Monitor carefully.", TABLE_CELL)],
    [Paragraph("Serum Phosphate", TABLE_CELL_BOLD),
     Paragraph("LOW (significant deficit)", TABLE_CELL),
     Paragraph("Treat if phosphate < 1 mg/dL", TABLE_CELL)],
    [Paragraph("Blood glucose", TABLE_CELL_BOLD),
     Paragraph("> 200 mg/dL", TABLE_CELL),
     Paragraph("Confirm diagnosis; monitor hourly", TABLE_CELL)],
    [Paragraph("Blood gas (VBG)", TABLE_CELL_BOLD),
     Paragraph("pH < 7.3, HCO₃ < 15 mEq/L", TABLE_CELL),
     Paragraph("Confirms acidosis; severity assessment", TABLE_CELL)],
    [Paragraph("Urine/blood ketones", TABLE_CELL_BOLD),
     Paragraph("Ketonuria ≥ 2+ on dipstick\nor β-HB ≥ 5.3 mmol/L", TABLE_CELL),
     Paragraph("Confirms ketosis", TABLE_CELL)],
    [Paragraph("WBC count", TABLE_CELL_BOLD),
     Paragraph("Transient leukocytosis = NORMAL in DKA", TABLE_CELL),
     Paragraph("PERSISTENT leukocytosis + fever = suspect infection", TABLE_CELL)],
    [Paragraph("Blood urea / BUN", TABLE_CELL_BOLD),
     Paragraph("High BUN", TABLE_CELL),
     Paragraph("Indicator of SEVERE DKA", TABLE_CELL)],
    [Paragraph("ECG", TABLE_CELL_BOLD),
     Paragraph("May show hypo/hyperkalemia changes", TABLE_CELL),
     Paragraph("Peaked T = hyperkalemia; Flat T, U wave = hypokalemia", TABLE_CELL)],
    [Paragraph("Serum osmolality", TABLE_CELL_BOLD),
     Paragraph("High (due to hyperglycemia)", TABLE_CELL),
     Paragraph("If very high: extend fluid correction to 72 hr", TABLE_CELL)],
    [Paragraph("Anion gap", TABLE_CELL_BOLD),
     Paragraph("Elevated (> 12 mEq/L)", TABLE_CELL),
     Paragraph("Should resolve by 12 hr of treatment", TABLE_CELL)],
]

inv_table = Table(inv_data, colWidths=[3.8*cm, 5.8*cm, doc.width-9.6*cm])
inv_table.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), C_TEAL),
    ("VALIGN", (0,0), (-1,-1), "TOP"),
    ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#AAAAAA")),
    ("TOPPADDING", (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING", (0,0), (-1,-1), 5),
    ("RIGHTPADDING", (0,0), (-1,-1), 5),
    *[("BACKGROUND", (0,i), (-1,i), C_WHITE if i%2==1 else C_LTBLUE) for i in range(1,13)],
]))
story.append(inv_table)
story.append(sp(6))
story.append(tip_box(
    "<b>KEY POINT (High Yield):</b> Serum K⁺ is normal/HIGH at presentation despite total body K⁺ depletion "
    "because acidosis drives K⁺ out of cells (ICF → ECF). Once insulin corrects acidosis, "
    "K⁺ shifts back into cells → life-threatening HYPOKALEMIA."
))
story.append(sp(10))

# ═══════════════════════════════════════════════════════
# SECTION 3: MANAGEMENT
# ═══════════════════════════════════════════════════════
story.append(section_header("3.  MANAGEMENT", bg=C_ORANGE))
story.append(sp(6))

story.append(p("<b>3 Pillars of Management:</b>", BODY_BOLD))
pillars_data = [[
    Paragraph("1\nCorrect the Pathology\n(Insulin for hyperglycemia)", sty("P1",
        fontSize=9, fontName="Helvetica-Bold", textColor=C_WHITE,
        alignment=TA_CENTER, leading=13)),
    Paragraph("2\nCorrect Dehydration\n(Fluid restoration)", sty("P2",
        fontSize=9, fontName="Helvetica-Bold", textColor=C_WHITE,
        alignment=TA_CENTER, leading=13)),
    Paragraph("3\nIdentify & Treat\nPrecipitating Event", sty("P3",
        fontSize=9, fontName="Helvetica-Bold", textColor=C_WHITE,
        alignment=TA_CENTER, leading=13)),
]]
pillars_table = Table(pillars_data, colWidths=[doc.width/3]*3)
pillars_table.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (0,0), C_NAVY),
    ("BACKGROUND", (1,0), (1,0), C_TEAL),
    ("BACKGROUND", (2,0), (2,0), C_ORANGE),
    ("TOPPADDING", (0,0), (-1,-1), 10),
    ("BOTTOMPADDING", (0,0), (-1,-1), 10),
    ("ALIGN", (0,0), (-1,-1), "CENTER"),
    ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
    ("INNERGRID", (0,0), (-1,-1), 2, C_WHITE),
    ("ROUNDEDCORNERS", [4,4,4,4]),
]))
story.append(pillars_table)
story.append(sp(8))

# ICU criteria
story.append(warn_box(
    "<b>ICU ADMISSION CRITERIA:</b>  Age &lt; 2 years  |  Severe DKA (pH &lt; 7.1)  "
    "|  Altered consciousness"
))
story.append(sp(6))

# ── 3A. Initial Stabilization
story.append(p("<b>A. INITIAL STABILIZATION</b>", H2))
init_items = [
    "Assess Airway, Breathing, Circulation (ABC)",
    "Oxygen and respiratory support if needed",
    "IV access; send blood for investigations",
    "Insert NG tube + urinary catheter if <b>unconscious</b>",
    "<b>Defer intubation</b> - worsens CNS acidosis (IMPORTANT)",
    "Nil by mouth",
    "Neurological evaluation: pupils, cranial nerves (6th nerve palsy = cerebral edema), DTR",
]
for item in init_items:
    story.append(Paragraph(f"<bullet>\u2022</bullet> {item}", BODY))
story.append(sp(6))

# ── 3B. Fluid Therapy
story.append(p("<b>B. FLUID THERAPY  (Mainstay of treatment)</b>", H2))

fluid_data = [
    [Paragraph("CONDITION", TABLE_HEADER),
     Paragraph("FEATURES", TABLE_HEADER),
     Paragraph("FLUID REGIME", TABLE_HEADER)],
    [Paragraph("Minimal dehydration (Mild DKA)", TABLE_CELL_BOLD),
     Paragraph("Tolerates oral fluids", TABLE_CELL),
     Paragraph("Oral fluids; S/C insulin", TABLE_CELL)],
    [Paragraph("Moderate/Severe dehydration (not in shock)", TABLE_CELL_BOLD),
     Paragraph("Vomiting, intolerant to oral, dehydrated", TABLE_CELL),
     Paragraph("10-20 mL/kg IV NS (0.9%) over 20-30 min", TABLE_CELL)],
    [Paragraph("Shock", TABLE_CELL_BOLD),
     Paragraph("Thready pulse, altered consciousness/coma", TABLE_CELL),
     Paragraph("Secure ABC; IV bolus 20 mL/kg 0.9% NS", TABLE_CELL)],
]
fluid_table = Table(fluid_data, colWidths=[4.5*cm, 5*cm, doc.width-9.5*cm])
fluid_table.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), C_ORANGE),
    ("VALIGN", (0,0), (-1,-1), "TOP"),
    ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#AAAAAA")),
    ("TOPPADDING", (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING", (0,0), (-1,-1), 5),
    *[("BACKGROUND", (0,i), (-1,i), C_WHITE if i%2==1 else C_LTORANGE) for i in range(1,4)],
]))
story.append(fluid_table)
story.append(sp(5))

fluid_details = [
    ("Deficit", "5-10% body weight in most children"),
    ("Rate", "3-3.5 L/m²/day. <b>Never exceed 4 L/m²/day</b> (cerebral edema risk)"),
    ("Duration", "Correct over <b>48 hours</b> (72 hr if high plasma osmolality)"),
    ("IV fluid choice", "<b>Normal saline (NS) for first 6 hours</b>, then Na content 77-154 mEq/L"),
    ("Add dextrose when", "Blood glucose &lt; <b>270 mg/dL</b> — add 5% dextrose to IV fluid"),
    ("Important note", "Count fluids already given at referring centre in total calculation"),
]
story.append(key_val_table(fluid_details, col1=5*cm))
story.append(sp(5))
story.append(warn_box(
    "<b>WARNING:</b> Rapid and excessive fluid = risk for CEREBRAL EDEMA. "
    "Slow rise in serum Na with rapid fall in glucose = cerebral edema risk."
))
story.append(sp(8))

# ── 3C. Insulin Therapy
story.append(p("<b>C. INSULIN THERAPY</b>", H2))
story.append(info_box(
    "<b>RULE:</b> Start insulin <b>1 hour AFTER</b> starting fluids. "
    "Early insulin = drastic fall in osmolality + hypokalemia + cerebral edema risk."
))
story.append(sp(5))

insulin_details = [
    ("Route", "<b>IV continuous infusion</b> (preferred). Flush tubing with insulin first — insulin binds to plastic."),
    ("Standard dose", "<b>0.05-0.1 u/kg/hr</b> IV infusion"),
    ("Infants / mild DKA", "0.05 u/kg/hr"),
    ("Increase dose if", "Glucose not falling ≥ 50 mg/dL/hr OR acidosis not resolving → increase by <b>0.02 u/kg/hr</b>"),
    ("NEVER reduce insulin", "When glucose falls — <b>ADD dextrose instead</b> (reducing insulin prolongs acidosis)"),
    ("No bolus", "<b>NO initial insulin bolus</b> — C/I due to cerebral edema risk"),
    ("If no IV available", "IM regular insulin: <b>0.3 u/kg loading</b>, then <b>0.1 u/kg/hr</b>"),
    ("SC insulin", "<b>NOT recommended</b> in moderate/severe DKA — poor perfusion = poor absorption"),
]
story.append(key_val_table(insulin_details, col1=4.5*cm))
story.append(sp(8))

# ── 3D. Potassium Protocol
story.append(p("<b>D. POTASSIUM REPLACEMENT PROTOCOL  (High Yield)</b>", H2))

k_data = [
    [Paragraph("SERUM K⁺ LEVEL", TABLE_HEADER),
     Paragraph("ACTION", TABLE_HEADER),
     Paragraph("REASON", TABLE_HEADER)],
    [Paragraph("< 3.5 mEq/L", sty("kl", fontSize=9.5, fontName="Helvetica-Bold",
                                     textColor=C_RED, leading=12)),
     Paragraph("<b>Give K⁺ BEFORE starting insulin</b>", TABLE_CELL),
     Paragraph("Insulin will drop K⁺ further - dangerous", TABLE_CELL)],
    [Paragraph("3.5 - 6.0 mEq/L", TABLE_CELL_BOLD),
     Paragraph("Add <b>40 mEq/L KCl</b> to IV fluid at time of starting insulin", TABLE_CELL),
     Paragraph("Standard protocol", TABLE_CELL)],
    [Paragraph("> 6.0 mEq/L\nOR anuric\nOR ECG hyperkalemia changes", sty("kh", fontSize=9.5,
                fontName="Helvetica-Bold", textColor=C_RED, leading=12)),
     Paragraph("<b>DO NOT give K⁺</b>", TABLE_CELL),
     Paragraph("Risk of fatal hyperkalemia", TABLE_CELL)],
]
k_table = Table(k_data, colWidths=[3.8*cm, 7*cm, doc.width-10.8*cm])
k_table.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), C_NAVY),
    ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
    ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#AAAAAA")),
    ("TOPPADDING", (0,0), (-1,-1), 6),
    ("BOTTOMPADDING", (0,0), (-1,-1), 6),
    ("LEFTPADDING", (0,0), (-1,-1), 6),
    ("BACKGROUND", (0,1), (-1,1), C_LTRED),
    ("BACKGROUND", (0,2), (-1,2), C_LTGREEN),
    ("BACKGROUND", (0,3), (-1,3), C_LTRED),
]))
story.append(k_table)
story.append(sp(8))

# ── 3E. Acid-base / Bicarbonate
story.append(p("<b>E. BICARBONATE THERAPY</b>", H2))
story.append(warn_box(
    "<b>AVOID bicarbonate routinely</b> — risks: cerebral edema, lactic acidosis, hypokalemia, worsens CNS acidosis."
))
story.append(sp(4))
story.append(info_box(
    "<b>EXCEPTION — Give bicarbonate ONLY IF:</b><br/>"
    "1. pH &lt; 6.9 WITH hemodynamic compromise, OR<br/>"
    "2. Severe hyperkalemia: K⁺ &gt; 6.5 mEq/L with ECG changes"
))
story.append(sp(8))

# ── 3F. Dextrose rule
story.append(p("<b>F. DEXTROSE RULE</b>", H2))
story.append(info_box(
    "Add <b>5% dextrose</b> to IV fluids once blood glucose &lt; <b>270-300 mg/dL</b>.<br/>"
    "Hyperglycemia resolves BEFORE acidosis — so do NOT stop insulin; add dextrose to maintain infusion."
))
story.append(sp(8))

# ── 3G. Transition / Stopping treatment
story.append(p("<b>G. DISCONTINUATION OF ACUTE TREATMENT</b>", H2))
transition_items = [
    "Switch to S/C insulin when: <b>conscious + tolerating oral feeds + acidosis resolved</b>",
    "Give <b>regular/rapid-acting insulin 0.25 u/kg</b> S/C 30 minutes BEFORE first meal",
    "Stop IV insulin infusion <b>30 minutes AFTER</b> S/C dose (overlap prevents rebound hyperglycemia)",
    "Start basal-bolus or mix-split SC insulin regime",
]
for item in transition_items:
    story.append(Paragraph(f"<bullet>\u2022</bullet> {item}", BODY))
story.append(sp(10))

# ═══════════════════════════════════════════════════════
# SECTION 4: COMPLICATIONS
# ═══════════════════════════════════════════════════════
story.append(section_header("4.  COMPLICATIONS OF DKA", bg=C_RED))
story.append(sp(6))

# Cerebral edema box
ce_header = Table([[Paragraph(
    "CEREBRAL EDEMA  —  Most common cause of death in DKA",
    sty("CEH", fontSize=11, fontName="Helvetica-Bold", textColor=C_WHITE, alignment=TA_CENTER)
)]], colWidths=[doc.width])
ce_header.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), C_RED),
    ("TOPPADDING", (0,0), (-1,-1), 6),
    ("BOTTOMPADDING", (0,0), (-1,-1), 6),
]))
story.append(ce_header)
story.append(sp(4))

ce_left = [
    [Paragraph("TIMING", TABLE_CELL_BOLD)],
    [Paragraph("Usually <b>4-12 hours</b> after starting treatment (rarely at diagnosis)", TABLE_CELL)],
    [Paragraph("", TABLE_CELL)],
    [Paragraph("RISK FACTORS  (mnemonic: ASHIC)", TABLE_CELL_BOLD)],
    [Paragraph("<b>A</b>ge &lt; 5 years", TABLE_CELL)],
    [Paragraph("<b>S</b>evere acidosis", TABLE_CELL)],
    [Paragraph("<b>H</b>ydration excessive (rapid/excess IV fluids)", TABLE_CELL)],
    [Paragraph("<b>I</b>nsulin bolus given", TABLE_CELL)],
    [Paragraph("<b>C</b>O₂ &lt; 10 mmol/L; alkali treatment", TABLE_CELL)],
    [Paragraph("Rapid fall in serum Na⁺ or osmolality", TABLE_CELL)],
]

ce_right = [
    [Paragraph("EARLY SIGNS", TABLE_CELL_BOLD)],
    [Paragraph("Headache, vomiting, drowsiness, irritability", TABLE_CELL)],
    [Paragraph("<b>Hypertension + Bradycardia</b> (Cushing's triad)", TABLE_CELL)],
    [Paragraph("", TABLE_CELL)],
    [Paragraph("LATE/SEVERE SIGNS", TABLE_CELL_BOLD)],
    [Paragraph("Unconsciousness", TABLE_CELL)],
    [Paragraph("Focal neurological deficits", TABLE_CELL)],
    [Paragraph("<b>Papilledema</b>, fixed dilated pupils", TABLE_CELL)],
    [Paragraph("<b>6th nerve palsy</b> (early sign)", TABLE_CELL)],
    [Paragraph("Brisk DTR (raised ICP)", TABLE_CELL)],
]

ce_cols_left  = Table(ce_left,  colWidths=[doc.width/2 - 0.5*cm])
ce_cols_right = Table(ce_right, colWidths=[doc.width/2 - 0.5*cm])
ce_cols_left.setStyle(TableStyle([
    ("VALIGN", (0,0), (-1,-1), "TOP"),
    ("LEFTPADDING", (0,0), (-1,-1), 4),
    ("TOPPADDING", (0,0), (-1,-1), 3),
    ("BOTTOMPADDING", (0,0), (-1,-1), 3),
]))
ce_cols_right.setStyle(TableStyle([
    ("VALIGN", (0,0), (-1,-1), "TOP"),
    ("LEFTPADDING", (0,0), (-1,-1), 4),
    ("TOPPADDING", (0,0), (-1,-1), 3),
    ("BOTTOMPADDING", (0,0), (-1,-1), 3),
]))
ce_two_col = Table([[ce_cols_left, ce_cols_right]], colWidths=[doc.width/2, doc.width/2])
ce_two_col.setStyle(TableStyle([
    ("VALIGN", (0,0), (-1,-1), "TOP"),
    ("BOX", (0,0), (-1,-1), 1, C_RED),
    ("INNERGRID", (0,0), (-1,-1), 0.5, colors.HexColor("#FFCCCC")),
    ("BACKGROUND", (0,0), (-1,-1), C_LTRED),
    ("LEFTPADDING", (0,0), (-1,-1), 4),
    ("TOPPADDING", (0,0), (-1,-1), 6),
    ("BOTTOMPADDING", (0,0), (-1,-1), 6),
]))
story.append(ce_two_col)
story.append(sp(5))

story.append(info_box(
    "<b>TREATMENT OF CEREBRAL EDEMA:</b><br/>"
    "1. IV <b>Mannitol 5 mL/kg</b> stat (osmotic agent)<br/>"
    "2. <b>Fluid restriction</b><br/>"
    "3. <b>Head elevation</b><br/>"
    "4. Diagnosis is CLINICAL — do not wait for imaging<br/>"
    "5. Hypertonic saline (3%) 2.5-5 mL/kg may be used as alternative to mannitol",
    bg=C_LTRED, border=C_RED
))
story.append(sp(8))

# Other complications
story.append(p("<b>OTHER COMPLICATIONS</b>", H2))
other_comp = [
    ("Hypokalemia", "Life-threatening; occurs after insulin starts; prevent with K⁺ protocol"),
    ("Hypoglycemia", "Add dextrose when glucose < 270 mg/dL"),
    ("Hypernatremia", "From excessive NS; monitor corrected Na⁺"),
    ("Infection (bacterial/fungal)", "Persistent fever + leukocytosis. Watch for:<br/>- <b>Black nasal discharge</b> = Rhinocerebral mucormycosis<br/>- <b>Hemoptysis</b> = Pulmonary aspergillosis"),
    ("Cerebral thrombosis", "Rare; due to dehydration and hyperviscosity"),
    ("Aspiration pneumonia", "From vomiting; hence NG tube if unconscious"),
    ("Acute renal failure", "From severe dehydration; high BUN indicates severity"),
]
story.append(key_val_table(other_comp, col1=4.5*cm))
story.append(sp(10))

# ═══════════════════════════════════════════════════════
# SECTION 5: MONITORING
# ═══════════════════════════════════════════════════════
story.append(section_header("5.  MONITORING", bg=C_TEAL))
story.append(sp(6))

story.append(p("<b>Clinical Monitoring (Hourly):</b>", BODY_BOLD))
clin_items = [
    "Neurological status (GCS, pupils, cranial nerves)",
    "Heart rate, blood pressure",
    "Fluid input/output",
    "Signs of cerebral edema: headache, vomiting, drowsiness, bradycardia",
]
for item in clin_items:
    story.append(Paragraph(f"<bullet>\u2022</bullet> {item}", BODY))
story.append(sp(5))

story.append(p("<b>Laboratory Monitoring:</b>", BODY_BOLD))
lab_freq = [
    [Paragraph("PARAMETER", TABLE_HEADER),
     Paragraph("FREQUENCY", TABLE_HEADER)],
    [Paragraph("Blood glucose", TABLE_CELL),
     Paragraph("Every 1 hour", TABLE_CELL)],
    [Paragraph("Blood ketones", TABLE_CELL),
     Paragraph("Every 4 hours", TABLE_CELL)],
    [Paragraph("pH, bicarbonate, electrolytes", TABLE_CELL),
     Paragraph("Every 4 hours", TABLE_CELL)],
    [Paragraph("Serum sodium (corrected)", TABLE_CELL),
     Paragraph("Every 4 hours", TABLE_CELL)],
]
lab_table = Table(lab_freq, colWidths=[doc.width*0.55, doc.width*0.45])
lab_table.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), C_TEAL),
    ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#AAAAAA")),
    ("ROWBACKGROUNDS", (0,1), (-1,-1), [C_WHITE, C_LTBLUE]),
    ("TOPPADDING", (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING", (0,0), (-1,-1), 6),
    ("VALIGN", (0,0), (-1,-1), "MIDDLE"),
]))
story.append(lab_table)
story.append(sp(8))

# Response to treatment table (high yield)
story.append(p("<b>RESPONSE TO TREATMENT TABLE  (Table 18.36 - High Yield for Exams)</b>", BODY_BOLD))
story.append(sp(4))

rtt_data = [
    [Paragraph("PARAMETER", TABLE_HEADER),
     Paragraph("EXPECTED RESPONSE", TABLE_HEADER),
     Paragraph("CONCERN", TABLE_HEADER),
     Paragraph("ACTION", TABLE_HEADER)],
    [Paragraph("Blood glucose", TABLE_CELL_BOLD),
     Paragraph("Decrease 50-100 mg/dL/hr", TABLE_CELL),
     Paragraph("Fall > 100 mg/dL/hr\nFall < 50 mg/dL/hr", TABLE_CELL),
     Paragraph("Add dextrose to IV fluid\nPrepare fresh insulin; flush tubing", TABLE_CELL)],
    [Paragraph("Blood pH", TABLE_CELL_BOLD),
     Paragraph("Resolution by 12 hours", TABLE_CELL),
     Paragraph("Persistent at 12 hours", TABLE_CELL),
     Paragraph("Exclude infection, shock, lactic acidosis", TABLE_CELL)],
    [Paragraph("Serum Na⁺", TABLE_CELL_BOLD),
     Paragraph("Should increase", TABLE_CELL),
     Paragraph("Rise < 2 mmol/L/hr", TABLE_CELL),
     Paragraph("Increase Na concentration in IV fluid", TABLE_CELL)],
    [Paragraph("Serum K⁺", TABLE_CELL_BOLD),
     Paragraph("Gradual decrease", TABLE_CELL),
     Paragraph("Hypokalemia", TABLE_CELL),
     Paragraph("Increase K⁺ in IV fluid", TABLE_CELL)],
    [Paragraph("Anion gap", TABLE_CELL_BOLD),
     Paragraph("Resolution by 12 hours", TABLE_CELL),
     Paragraph("Elevated at 12 hours", TABLE_CELL),
     Paragraph("Exclude lactic acidosis, consider infection", TABLE_CELL)],
    [Paragraph("Plasma osmolality", TABLE_CELL_BOLD),
     Paragraph("Stable", TABLE_CELL),
     Paragraph("Decrease > 2 mOsm/kg/hr", TABLE_CELL),
     Paragraph("Increase Na concentration; decrease fluid rate", TABLE_CELL)],
    [Paragraph("Blood urea", TABLE_CELL_BOLD),
     Paragraph("Should decrease", TABLE_CELL),
     Paragraph("Persistently elevated", TABLE_CELL),
     Paragraph("Exclude renal failure", TABLE_CELL)],
]

rtt_col = [3.2*cm, 4*cm, 4*cm, doc.width-11.2*cm]
rtt_table = Table(rtt_data, colWidths=rtt_col)
rtt_table.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,0), C_TEAL),
    ("VALIGN", (0,0), (-1,-1), "TOP"),
    ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#AAAAAA")),
    ("TOPPADDING", (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING", (0,0), (-1,-1), 5),
    ("RIGHTPADDING", (0,0), (-1,-1), 5),
    *[("BACKGROUND", (0,i), (-1,i), C_WHITE if i%2==1 else C_LTBLUE) for i in range(1,9)],
]))
story.append(rtt_table)
story.append(sp(10))

# ── FOOTER
footer_data = [[
    Paragraph(
        "DKA Notes  |  Marrow + Essential Pediatrics  |  ISPAD Guidelines  |  Final Year Theory Exam",
        sty("FT", fontSize=8, fontName="Helvetica", textColor=C_WHITE, alignment=TA_CENTER)
    )
]]
footer = Table(footer_data, colWidths=[doc.width])
footer.setStyle(TableStyle([
    ("BACKGROUND", (0,0), (-1,-1), C_NAVY),
    ("TOPPADDING", (0,0), (-1,-1), 6),
    ("BOTTOMPADDING", (0,0), (-1,-1), 6),
]))
story.append(footer)

# BUILD
doc.build(story)
print(f"PDF created: {OUTPUT}")
Running Command

cd /tmp/workspace/dka-notes && python make_dka_pdf.py 2>&1

Your PDF is ready! Download it here:

DKA Notes

PDF Document · PDF


What's inside the PDF (5 colour-coded sections):
SectionColourContent
1. Differential DiagnosisNavyWhen to suspect DKA table with DDx + clues
2. InvestigationsTealAll 12 investigations with findings + significance
3. ManagementOrange3 pillars, initial stabilization, fluid therapy, insulin, K⁺ protocol, bicarbonate exceptions, dextrose rule, transition criteria
4. ComplicationsRedFull cerebral edema box (risk factors - ASHIC mnemonic, signs, treatment), other complications
5. MonitoringTealClinical + lab monitoring frequency + full Response to Treatment table (Table 18.36)

Tell me points that I must add in my marrow notes

Based on my full analysis of both your Marrow notes and the textbook, here are the must-add points only - nothing you already have:

PATHOPHYSIOLOGY PAGE (pg 212)

Add one missing branch to your flowchart:
Acidosis → K⁺ + PO₄³⁻ shift ICF → ECF → Serum K⁺ initially HIGH → becomes LOW after insulin starts

CRITERIA PAGE (pg 212)

Correct one value:
Your notes say HCO₃ < 18 mmol/L → textbook says < 15 mEq/L (Write both: < 18 ISPAD / < 15 textbook)

ADD NEW SECTION — DIFFERENTIAL DIAGNOSIS

(Examiners ask "when to suspect DKA")
PresentationDDx
EncephalopathyCNS infection, malaria, poisoning
Acute abdomenPancreatitis, appendicitis
DehydrationGastroenteritis
TachypneaAsthma, pneumonia
Acidosis + NO ketonesRenal failure, septicemia
Ketosis + NO hyperglycemiaStarvation, salicylate poisoning

ADD NEW SECTION — INVESTIGATIONS

InvestigationKey Point
Serum K⁺Normal/HIGH despite deficit (3-6 mEq/kg). Falls dangerously after insulin
Serum Na⁺Falsely low. Use corrected Na⁺. Rapid fall = cerebral edema risk
Serum phosphateTreat if < 1 mg/dL
WBCTransient leukocytosis = normal. Persistent = infection
Blood ureaHigh BUN = severe DKA
ECGScreen for hypo/hyperkalemia

MANAGEMENT PAGE (pg 213) — Add these points

Initial stabilization — add 2 lines:
  • NG tube + urinary catheter if unconscious
  • Defer intubation — worsens CNS acidosis
ICU criteria — add box:
Age < 2 years OR Severe DKA → ICU
Fluid therapy — add numbers:
  • NS for first 6 hours → then Na 77-154 mEq/L
  • Never exceed 4 L/m²/day
  • Correct over 48 hours (72 hr if high osmolality)
  • Add 5% dextrose when glucose < 270 mg/dL (your notes say 300 — add 270)
Insulin — add 3 lines:
  • Flush IV tubing with insulin before use (binds to plastic)
  • Increase by 0.02 u/kg/hr if glucose not falling ≥ 50 mg/dL/hr
  • Never reduce insulin rate — add dextrose instead
K⁺ Protocol — add as separate box (HIGH YIELD):
K⁺ < 3.5     → Give K⁺ BEFORE insulin
K⁺ 3.5-6.0  → 40 mEq/L KCl with insulin (already in notes ✓)
K⁺ > 6.0     → DO NOT give K⁺
Anuric / ECG hyperkalemia → DO NOT give K⁺
Bicarbonate — add exception to your C/I:
Give ONLY IF: pH < 6.9 + hemodynamic compromise OR K⁺ > 6.5 mEq/L with ECG changes

ADD NEW SECTION — CEREBRAL EDEMA (Most marks)

Risk factors (ASHIC):
  • Age < 5 yr
  • Severe acidosis
  • Hydration excessive / rapid
  • Insulin bolus
  • CO₂ < 10 mmol/L + alkali treatment
Signs:
  • Early: Headache, vomiting, drowsiness, hypertension + bradycardia
  • Late: Unconscious, focal deficits, papilledema, fixed dilated pupils, 6th nerve palsy
Treatment:
  • IV Mannitol 5 mL/kg stat
  • Fluid restriction + head elevation

ADD NEW SECTION — MONITORING

Clinical (hourly): Neuro status, HR, BP, I/O
Lab:
  • Hourly: Blood glucose
  • 4-hourly: Ketones, pH, HCO₃, electrolytes

ADD — STOPPING TREATMENT

Once conscious + oral feeds tolerated + acidosis resolved:
  • SC insulin 0.25 u/kg 30 min before first meal
  • Stop IV insulin 30 min after SC dose

That's everything. The 3 highest-yield additions are:
  1. K⁺ protocol box
  2. Cerebral edema full section
  3. Investigations table
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment

Hypothyroidism in children clinical feature investigation management Congenital hypothyroidism Criticism What points to add in my notes from textbook

analyse_media
analyse_media
analyse_media
analyse_media
analyse_media
I now have a complete picture of both your Marrow notes (all 4 pages) and the textbook (pages 537-540). Here is the precise gap analysis:

POINTS TO ADD TO YOUR MARROW NOTES


PAGE 200 — CONGENITAL HYPOTHYROIDISM (Classification & Etiology)

Add prevalence:
Prevalence = 1 in 2,000 newborns (India: much higher)
Add to Etiology — Primary causes (textbook Table 18.5 — missing from your notes):
  • Autoimmune thyroiditis (primary cause in older children)
  • Thyroid injury: Surgery, radiation, infection
  • Goitrogens: Thiocyanates, thionamides, lithium, amiodarone
  • Iodine excess (maternal)
Add to Central/Secondary causes:
Secondary/Tertiary (<5% of cases):
  • Septo-optic dysplasia, holoprosencephaly
  • CNS insults: trauma, surgery, radiation, infection
  • CNS tumors: Craniopharyngioma, germinoma
Add clue for central vs primary hypothyroidism:
Hypoglycemia + micropenis + midline facial defects = hypothalamic-pituitary etiology
Add to Thyroid dyshormonogenesis:
Pendred syndrome = pendrin gene defect → iodine transport defect + deafness

PAGE 200 — FEATURES (Clinical features box to add)

Add these missing features from Table 18.6:
  • Facial puffiness (lethargy)
  • Mottling of skin
  • Hypotonia (your notes don't mention it)
  • Protuberant abdomen
  • Sallow edematous facies
  • Unexplained hypothermia
  • Delayed neurodevelopment
Add "Evaluation" clue:
Always ask: maternal thyroid disease history? Maternal antithyroid drug use? Family history?
Add textbook Table 18.6 comparison — Congenital vs Acquired:
Congenital ONLYAcquired ONLYBoth
Open posterior fontanelMyopathy + pseudohypertrophy of limb musclesGrowth retardation
Umbilical herniaEnlarged sellaSallow edematous facies
Delayed neurodevelopmentPseudotumor cerebriDelayed skeletal maturation
Large tongueRough dry skin, hypothermia
Delayed puberty, constipation, hypotonia

PAGE 201 — INVESTIGATIONS (Add these missing points)

Add to Screening protocol (very high yield):
  • DBS collected at postnatal age 2-4 days
  • Cord blood used if postnatal DBS not feasible
  • TSH cut-offs:
    • > 40 mU/L in first week → treat
    • > 20 mU/L between 7-21 days → treat
    • > 10 mU/L beyond 21 days → treat
  • Screening done after 48 hours of birth (TSH peaks at 24 hr, must wait)
  • TSH-first approach misses central hypothyroidism (important criticism)
Add TFT interpretation box (completely missing — HIGH YIELD):
PatternInterpretation
Low FT4 + High TSHPrimary hypothyroidism
Low FT4 + Low/Normal TSHCentral hypothyroidism
Normal FT4 + High TSHSubclinical hypothyroidism
High FT3/FT4 + Undetectable TSHHyperthyroid state
TSH = most sensitive indicator of primary hypothyroidism Free T4 > Total T4 (TBG variability makes total unreliable)
Add confirmatory investigations when TSH > 40:
  • Radionuclide scan: if thyroid undetectable on scan but normal on USG → iodine transport defect or TSH receptor abnormality
  • Low TSH + Low FT4 → work up for pituitary-hypothalamic defects

PAGE 201 — TREATMENT (Add these missing details)

Add to Congenital Hypothyroidism treatment:
  • Start after sending confirmatory venous sample for FT4 and TSH
  • FT4 should normalize in 1 week, TSH in 1 month after starting treatment
  • FT4 monitored every 2 months in first year
  • In suspected transient CH: stop at age 3 years and retest (if thyroid functions normal → treatment not required)
  • Before stopping insulin in adrenal insufficiency → cortisol replacement precedes thyroxine (thyroid replacement may precipitate adrenal crisis)
Add outcome:
Early diagnosis + treatment = normal intellectual outcome Diagnosed beyond early infancy = neurocognitive disability + short stature (irreversible)

PAGE 202 — ENDEMIC CRETINISM (Expand this section)

Your notes only say "endemic to countries with severe iodine deficiency." Add:
Two types (HIGH YIELD for exams):
Neurological typeMyxedematous type
SeverityMost severeLess severe
IntellectVery low IQLess severe intellectual impairment
StatureNormalSevere short stature
GoiterPresentAbsent
FeaturesDeaf-mutism, squint, proximal spasticity, rigidityCoarse facial features, myxedema
Prevention:
  • Iodized salt OR iodized oil — highly efficacious
  • Treatment may eliminate hypothyroid signs but neuromotor and intellectual deficiency are IRREVERSIBLE
  • National Goiter Control Programme of India: started 1962, salt iodination plants, only iodized salt used
Daily iodine requirements:
  • Children up to 10 years: 40-120 µg/day
  • Older children + adults: 150 µg/day
  • Pregnancy/lactation: +25 µg and +50 µg additional

PAGE 202 — ACQUIRED HYPOTHYROIDISM (Add these missing points)

Add to etiology:
AIT may be associated with other autoimmune conditions:
  • Adrenal insufficiency, Type 1 DM, hypoparathyroidism (Schmidt syndrome/polyglandular)
Add screening indication:
These children should be periodically screened even without symptoms:
  • Down syndrome
  • Turner syndrome
  • Celiac disease
  • Type 1 diabetes
Add to clinical features:
  • Cold intolerance
  • Lethargy, poor school performance
  • Delayed dentition
  • Uncontrolled long-standing hypothyroidism → ovarian cysts in girls → peripheral sexual precocity (Van Wyk Grumbach syndrome)
Add to management — treatment details (your notes are incomplete here):
  • Thyroxine dose for acquired: 100 µg/m²/day
  • Give on empty stomach, 30 minutes before breakfast
  • At least 6 hours before iron or calcium supplements (absorption reduced)
  • Gradual build-up over 3-4 weeks (25-50% dose increase)
  • Follow-up: every 3 months for first 2 years, then 6-monthly
  • Doses adjusted to maintain FT4 + TSH in normal range

ADD NEW SECTION — SUBCLINICAL HYPOTHYROIDISM

Mild TSH elevation (< 10 mU/L) with normal FT4 Usually reverses in 3-6 months Treat if: thyromegaly + anti-TPO antibodies present + family history

ADD NEW SECTION — GOITER (Examiners ask this as short note)

Etiology (Table 18.7):
  • Diffuse: Autoimmune (Hashimoto's, Graves'), iodine deficiency, dyshormonogenesis, Pendred syndrome
  • Nodular: Multinodular (long-standing goiter), solitary nodule (toxic/cold)
Solitary thyroid nodule — malignancy pointers:
  • Firm nodule with limited mobility
  • Associated lymph node enlargement
  • → Do USG + fine needle aspiration cytology (FNAC)
Management of goiter:
  • Treat the cause
  • Surgery: only if causing respiratory embarrassment
  • Suppressive thyroxine for euthyroid goiter = limited benefit, best avoided

SUMMARY — TOP MUST-ADDS

PriorityAdd
⭐⭐⭐TFT interpretation table (primary vs central vs subclinical)
⭐⭐⭐TSH screening cut-offs (40/20/10 mU/L) + 48-hour rule
⭐⭐⭐Endemic cretinism — 2 types table
⭐⭐⭐Acquired hypothyroidism screening indications (Down, Turner, T1DM)
⭐⭐Congenital vs Acquired clinical features table
⭐⭐Thyroxine dosing details + timing (empty stomach, iron/Ca separation)
⭐⭐Transient CH protocol (stop at 3 years, retest)
⭐⭐Subclinical hypothyroidism
Pendred syndrome
Cortisol precedes thyroxine in adrenal insufficiency
This is a shared conversation. Sign in to Orris to start your own chat.