Give laboratory investigations for jaundice with findings and values in pdf format
mkdir -p /home/daytona/workspace/jaundice-pdf && ls /home/daytona/workspace/jaundice-pdf/
~/jaundice-pdf/generate_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 inch, cm
from reportlab.platypus import (
SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
HRFlowable, KeepTogether
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
OUTPUT = "/home/daytona/workspace/jaundice-pdf/Jaundice_Laboratory_Investigations.pdf"
doc = SimpleDocTemplate(
OUTPUT,
pagesize=A4,
rightMargin=2*cm,
leftMargin=2*cm,
topMargin=2*cm,
bottomMargin=2*cm,
title="Laboratory Investigations for Jaundice",
author="Orris Medical Reference"
)
styles = getSampleStyleSheet()
# Custom styles
title_style = ParagraphStyle(
'CustomTitle',
parent=styles['Title'],
fontSize=22,
textColor=colors.HexColor('#1a3a5c'),
spaceAfter=6,
alignment=TA_CENTER,
fontName='Helvetica-Bold'
)
subtitle_style = ParagraphStyle(
'Subtitle',
parent=styles['Normal'],
fontSize=11,
textColor=colors.HexColor('#4a4a4a'),
spaceAfter=12,
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,
fontName='Helvetica-Bold',
leftIndent=-8,
rightIndent=-8,
leading=20,
borderPad=5
)
h2_style = ParagraphStyle(
'H2',
parent=styles['Heading2'],
fontSize=12,
textColor=colors.HexColor('#1a3a5c'),
spaceBefore=10,
spaceAfter=4,
fontName='Helvetica-Bold',
borderWidth=0,
borderPadding=0
)
body_style = ParagraphStyle(
'Body',
parent=styles['Normal'],
fontSize=9.5,
textColor=colors.HexColor('#222222'),
spaceAfter=4,
leading=14,
alignment=TA_JUSTIFY
)
note_style = ParagraphStyle(
'Note',
parent=styles['Normal'],
fontSize=8.5,
textColor=colors.HexColor('#555555'),
spaceAfter=4,
leading=12,
leftIndent=10,
italicName='Helvetica-Oblique'
)
footer_style = ParagraphStyle(
'Footer',
parent=styles['Normal'],
fontSize=8,
textColor=colors.HexColor('#777777'),
alignment=TA_CENTER
)
# Table header style
def make_table_header():
return 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,0), 9),
('ALIGN', (0,0), (-1,0), 'CENTER'),
('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
('FONTNAME', (0,1), (-1,-1), 'Helvetica'),
('FONTSIZE', (0,1), (-1,-1), 8.5),
('ROWBACKGROUNDS', (0,1), (-1,-1), [colors.HexColor('#f0f4fa'), colors.white]),
('GRID', (0,0), (-1,-1), 0.5, colors.HexColor('#c0cce0')),
('TOPPADDING', (0,0), (-1,-1), 5),
('BOTTOMPADDING', (0,0), (-1,-1), 5),
('LEFTPADDING', (0,0), (-1,-1), 6),
('RIGHTPADDING', (0,0), (-1,-1), 6),
('WORDWRAP', (0,0), (-1,-1), True),
])
def h1(text):
# Use a table cell for colored header background spanning full width
data = [[Paragraph(f'<font color="white"><b>{text}</b></font>', ParagraphStyle(
'H1Inner', parent=styles['Normal'], fontSize=13,
textColor=colors.white, fontName='Helvetica-Bold', leading=18
))]]
t = Table(data, colWidths=[17*cm])
t.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,-1), colors.HexColor('#1a3a5c')),
('TOPPADDING', (0,0), (-1,-1), 7),
('BOTTOMPADDING', (0,0), (-1,-1), 7),
('LEFTPADDING', (0,0), (-1,-1), 10),
]))
return t
content = []
# ── TITLE PAGE ──────────────────────────────────────────────────────────────
content.append(Spacer(1, 0.5*inch))
content.append(Paragraph("Laboratory Investigations for Jaundice", title_style))
content.append(Paragraph("Findings, Reference Values & Diagnostic Interpretation", subtitle_style))
content.append(HRFlowable(width="100%", thickness=2, color=colors.HexColor('#1a3a5c'), spaceAfter=8))
content.append(Paragraph(
"Based on: Harrison's Principles of Internal Medicine 22E, Guyton & Hall Medical Physiology, "
"Harper's Illustrated Biochemistry 32nd Ed, Tietz Textbook of Laboratory Medicine 7th Ed",
note_style
))
content.append(Spacer(1, 0.2*inch))
# ── SECTION 1: OVERVIEW ─────────────────────────────────────────────────────
content.append(h1("1. Overview of Jaundice"))
content.append(Spacer(1, 6))
content.append(Paragraph(
"<b>Jaundice (icterus)</b> is yellow discoloration of skin, mucous membranes, and sclera caused by bilirubin "
"deposition. It is clinically apparent when plasma bilirubin reaches <b>2–3 mg/dL</b> (34–51 µmol/L). "
"Normal total serum bilirubin is <b>0.3–1.0 mg/dL</b> (5–17 µmol/L).",
body_style
))
content.append(Paragraph(
"The initial diagnostic step is to determine whether hyperbilirubinemia is predominantly "
"<b>unconjugated (indirect)</b> or <b>conjugated (direct)</b>, and whether other liver test "
"abnormalities are present. This guides the differential diagnosis into three categories:",
body_style
))
cat_data = [
["Type", "Bilirubin Fraction", "Key Mechanism", "Examples"],
["Prehepatic\n(Hemolytic)", "Unconjugated ↑↑", "Overproduction of bilirubin exceeds hepatic conjugation capacity",
"Haemolytic anaemia, sickle cell, thalassaemia, G6PD deficiency"],
["Hepatic\n(Hepatocellular)", "Both ↑ (conjugated predominant)", "Impaired uptake, conjugation, or excretion by hepatocytes",
"Viral hepatitis, alcoholic hepatitis, cirrhosis, drug toxicity, Wilson's, autoimmune"],
["Posthepatic\n(Cholestatic/Obstructive)", "Conjugated ↑↑", "Obstruction to bile flow - intra- or extrahepatic",
"Choledocholithiasis, pancreatic cancer, cholangiocarcinoma, PSC, PBC"],
]
cat_table = Table(cat_data, colWidths=[2.8*cm, 3.2*cm, 5.5*cm, 5.5*cm])
cat_table.setStyle(make_table_header())
content.append(cat_table)
content.append(Spacer(1, 6))
# ── SECTION 2: BILIRUBIN ────────────────────────────────────────────────────
content.append(h1("2. Serum Bilirubin"))
content.append(Spacer(1, 6))
content.append(Paragraph(
"Measured by the <b>van den Bergh reaction</b>. Direct (conjugated) bilirubin reacts directly; "
"total bilirubin reacts after addition of methanol. Indirect = Total − Direct.",
body_style
))
bili_data = [
["Test", "Normal Value", "Prehepatic Jaundice", "Hepatocellular Jaundice", "Obstructive Jaundice"],
["Total Serum Bilirubin", "0.3–1.0 mg/dL\n(5–17 µmol/L)", "↑↑ (rarely >5 mg/dL)", "↑↑↑ (variable)", "↑↑↑ (can be very high)"],
["Direct (Conjugated)\nBilirubin", "<0.25 mg/dL\n(<4.3 µmol/L)", "Normal / minimal ↑", "↑↑", "↑↑↑"],
["Indirect (Unconjugated)\nBilirubin", "0.2–0.7 mg/dL\n(3.4–12 µmol/L)", "↑↑↑ (predominant)", "↑", "Normal / slight ↑"],
["Direct Bilirubin\n% of Total", "<30%", "<20% (indirect predominates)", "30–60%", ">50% (direct predominates)"],
]
bili_table = Table(bili_data, colWidths=[3.0*cm, 3.0*cm, 3.0*cm, 3.5*cm, 3.5*cm])
bili_table.setStyle(make_table_header())
content.append(bili_table)
content.append(Paragraph(
"<i>Note: In hemolysis, serum bilirubin rarely exceeds 5 mg/dL (86 µmol/L) unless coexistent renal/hepatocellular dysfunction. "
"Crigler-Najjar type I: bilirubin >20 mg/dL; Gilbert's syndrome: mild unconjugated elevation (typically 1–3 mg/dL).</i>",
note_style
))
content.append(Spacer(1, 6))
# ── SECTION 3: URINE TESTS ──────────────────────────────────────────────────
content.append(h1("3. Urine Bilirubin and Urobilinogen"))
content.append(Spacer(1, 6))
content.append(Paragraph(
"Only conjugated (water-soluble) bilirubin is filtered by the kidneys and appears in urine. "
"Unconjugated bilirubin is albumin-bound and cannot be excreted in urine. Urobilinogen is "
"produced in the gut from conjugated bilirubin by bacteria; a portion is reabsorbed and excreted in urine.",
body_style
))
urine_data = [
["Test", "Normal", "Prehepatic\n(Haemolytic)", "Hepatocellular", "Obstructive\n(Cholestatic)"],
["Urine Bilirubin", "Absent / Negative", "Absent\n(unconjugated - not filtered)", "Present +++\n(bilirubinuria)", "Present +++\n(bilirubinuria)"],
["Urine Urobilinogen", "0.1–1.0 mg/dL\n(<17 µmol/L); or 1–4 mg/24h", "↑↑↑ Markedly elevated\n(increased gut production)", "↑ Elevated\n(reduced hepatic reuptake)", "Absent / Trace\n(no bilirubin reaches gut)"],
["Urine Colour", "Normal pale yellow", "Normal or dark\n(urobilinogen excess)", "Dark (tea-coloured)\nbilirubinuria", "Dark (tea-coloured)\nbilirubinuria"],
["Stool Colour", "Normal brown", "Normal / darker\n(excess stercobilin)", "Pale / normal", "Pale clay-coloured\n(acholic stools)\n- absent stercobilin"],
["Foam Test (shake urine)", "White foam", "White foam", "Yellow foam", "Yellow foam\n(conjugated bilirubin)"],
]
urine_table = Table(urine_data, colWidths=[3.0*cm, 2.8*cm, 3.2*cm, 3.2*cm, 3.8*cm])
urine_table.setStyle(make_table_header())
content.append(urine_table)
content.append(Paragraph(
"<i>Key rule: Bilirubinuria (positive urine bilirubin) with absent urobilinogen = complete biliary obstruction. "
"Absent urine bilirubin with increased urobilinogen = haemolytic jaundice.</i>",
note_style
))
content.append(Spacer(1, 6))
# ── SECTION 4: LIVER ENZYMES ────────────────────────────────────────────────
content.append(h1("4. Liver Function Tests (LFTs) / Enzyme Panel"))
content.append(Spacer(1, 6))
content.append(Paragraph(
"Enzyme tests are critical for distinguishing <b>hepatocellular</b> from <b>cholestatic</b> disease. "
"Hepatocellular disease: aminotransferases (ALT/AST) rise disproportionately to ALP. "
"Cholestatic disease: ALP rises disproportionately to aminotransferases.",
body_style
))
enzyme_data = [
["Test", "Normal Range", "Prehepatic", "Hepatocellular", "Cholestatic/Obstructive", "Clinical Significance"],
["ALT\n(Alanine Aminotransferase)\nSGPT", "7–56 U/L\n(Males slightly higher)", "Normal", "↑↑↑↑\n>500 U/L in acute viral hepatitis;\n>1000 U/L in drug toxicity/ischaemia",
"Normal or mild ↑\n(<3× ULN)", "Hepatocyte injury marker; more specific for liver than AST"],
["AST\n(Aspartate Aminotransferase)\nSGOT", "10–40 U/L", "Normal", "↑↑↑\nAST:ALT ratio <1 (viral);\n>2:1 suggests alcoholic hepatitis",
"Normal or mild ↑", "Less specific (also from heart, muscle, RBCs); AST:ALT >2 = alcoholic hepatitis"],
["ALP\n(Alkaline Phosphatase)", "44–147 U/L\n(adult)", "Normal", "↑ (1–3× ULN)", "↑↑↑↑\n>4× ULN; may reach 1000+ U/L",
"Elevated in bone disease too; confirm with GGT to establish liver origin"],
["GGT\n(Gamma-Glutamyl\nTransferase)", "9–48 U/L", "Normal", "↑", "↑↑↑\n(mirrors ALP; confirms liver source)",
"Sensitive marker of cholestasis; elevated with alcohol use; not elevated in bone disease"],
["5'-Nucleotidase", "2–15 U/L", "Normal", "Mild ↑", "↑↑↑\n(parallels ALP from liver)", "Confirms hepatic origin of ALP elevation; not affected by bone"],
["LDH\n(Lactate Dehydrogenase)", "140–280 U/L", "↑↑ (haemolysis)", "↑↑ (hepatocellular damage)", "Normal / mild ↑",
"Non-specific; markedly elevated in haemolysis and ischaemic hepatitis"],
]
enzyme_table = Table(enzyme_data, colWidths=[2.7*cm, 2.5*cm, 2.0*cm, 3.8*cm, 3.0*cm, 3.0*cm])
enzyme_table.setStyle(make_table_header())
content.append(enzyme_table)
content.append(Spacer(1, 6))
# ── SECTION 5: SYNTHETIC FUNCTION ───────────────────────────────────────────
content.append(h1("5. Tests of Hepatic Synthetic Function"))
content.append(Spacer(1, 6))
synth_data = [
["Test", "Normal Range", "Finding in Hepatic Jaundice", "Clinical Significance"],
["Serum Albumin", "3.5–5.0 g/dL\n(35–50 g/L)", "↓ in chronic disease\n(cirrhosis, cancer)\nNormal in acute hepatitis", "Low albumin = chronic/severe disease (t½ ~20 days). Normal = acute process (viral hepatitis, choledocholithiasis)."],
["Prothrombin Time (PT)\n/ INR", "PT: 11–13 sec\nINR: 0.8–1.2", "↑ PT / ↑ INR in hepatocellular damage or prolonged cholestasis (fat-soluble vit. K malabsorption)",
"Failure to correct PT with parenteral Vitamin K = severe hepatocellular injury. Correction = obstructive aetiology with Vit. K deficiency."],
["aPTT", "25–35 sec", "↑ in severe hepatic failure", "Reflects clotting factor deficiency from liver dysfunction"],
["Total Protein", "6.0–8.3 g/dL", "May be low in cirrhosis; elevated globulins in autoimmune/chronic disease", "Globulin fraction ↑ in autoimmune hepatitis and cirrhosis"],
["Serum Ammonia", "15–45 µg/dL\n(11–32 µmol/L)", "↑ in severe hepatocellular failure", "Marker of hepatic encephalopathy risk; not routinely used for jaundice work-up"],
]
synth_table = Table(synth_data, colWidths=[3.2*cm, 3.2*cm, 4.2*cm, 6.4*cm])
synth_table.setStyle(make_table_header())
content.append(synth_table)
content.append(Spacer(1, 6))
# ── SECTION 6: HAEMATOLOGY ──────────────────────────────────────────────────
content.append(h1("6. Haematological Investigations"))
content.append(Spacer(1, 6))
content.append(Paragraph(
"Particularly important to identify <b>prehepatic (haemolytic)</b> jaundice.",
body_style
))
haem_data = [
["Test", "Normal Range", "Prehepatic\n(Haemolytic)", "Hepatocellular", "Cholestatic"],
["Haemoglobin (Hb)", "M: 13.5–17.5 g/dL\nF: 12.0–15.5 g/dL", "↓ (anaemia)\noften normocytic/\nmacrocytic", "Normal (unless end-stage cirrhosis)", "Normal"],
["Reticulocyte Count", "0.5–1.5% (of RBCs)\nor 25,000–75,000/µL", "↑↑ (>2–3%)\nbonemarrow compensation", "Normal", "Normal"],
["Peripheral Blood Film", "Normal morphology", "Spherocytes (hereditary spherocytosis), sickle cells, target cells, fragmented RBCs (microangiopathy)",
"May show target cells, burr cells (uraemia) in cirrhosis", "Normal"],
["Serum Haptoglobin", "30–200 mg/dL", "↓↓ or absent\n(consumed by free Hb)", "May be low in cirrhosis", "Normal"],
["Serum Free Haemoglobin", "<5 mg/dL", "↑ (in intravascular haemolysis)", "Normal", "Normal"],
["Coombs Test\n(Direct Antiglobulin)", "Negative", "Positive in immune\nhaemolytic anaemia;\nNegative in non-immune", "Negative", "Negative"],
["WBC Count", "4,000–11,000/µL", "Normal or ↑ (if infection)", "↑ in viral hepatitis (lymphocytosis); ↑ in bacterial cholangitis", "↑ in cholangitis"],
["Platelet Count", "150,000–400,000/µL", "Normal / ↓ (hypersplenism)", "↓ in cirrhosis\n(hypersplenism, thrombopoietin ↓)", "Usually normal"],
["ESR / CRP", "ESR: M <15, F <20 mm/h\nCRP: <5 mg/L", "↑ in haemolysis/underlying condition", "↑ in acute hepatitis", "↑ in cholangitis/malignancy"],
]
haem_table = Table(haem_data, colWidths=[3.0*cm, 3.0*cm, 3.5*cm, 3.5*cm, 3.0*cm])
haem_table.setStyle(make_table_header())
content.append(haem_table)
content.append(Spacer(1, 6))
# ── SECTION 7: SPECIFIC MARKERS ─────────────────────────────────────────────
content.append(h1("7. Specific / Additional Investigations"))
content.append(Spacer(1, 6))
spec_data = [
["Test", "Normal / Reference", "Finding & Significance"],
["Hepatitis Serology\n(HBsAg, Anti-HBc, Anti-HAV IgM,\nHCV Ab, HEV IgM)", "Negative / Non-reactive",
"Positive serology identifies viral aetiology. HBsAg +ve = active HBV. Anti-HAV IgM = acute HAV. Anti-HCV +ve = HCV exposure (confirm with HCV RNA)."],
["HCV RNA / HBV DNA\n(Viral Load)", "Undetectable (PCR negative)",
"Quantifies viral replication; used for treatment monitoring; HBV DNA >20,000 IU/mL = high replication."],
["EBV / CMV Serology &\nMonospot Test", "Negative",
"EBV (Epstein-Barr) and CMV are uncommon causes of viral hepatitis with jaundice; monospot positive in infectious mononucleosis."],
["Antinuclear Antibody (ANA)\nSmooth Muscle Ab (SMA)\nAnti-LKM-1", "Negative (<1:40 titre)",
"Autoimmune hepatitis: ANA and/or SMA positive (type 1); Anti-LKM-1 positive (type 2). Titres >1:80 significant."],
["Antimitochondrial Ab (AMA)", "Negative",
"Positive (titre >1:40) in >95% of Primary Biliary Cholangitis (PBC) cases. Highly specific."],
["Serum Ceruloplasmin", "20–60 mg/dL", "↓ (<20 mg/dL) in Wilson's disease. Normal or elevated in other conditions (acute-phase reactant)."],
["Serum Copper\n24-hr Urine Copper", "Serum: 70–140 µg/dL\nUrine: <40 µg/24h",
"Wilson's disease: serum copper ↑, urine copper >100 µg/24h (>250 µg/24h diagnostic). Liver copper >250 µg/g dry weight on biopsy."],
["Serum Ferritin\nTransferrin Saturation", "Ferritin: M 12–300 ng/mL;\nF 12–150 ng/mL\nSaturation: 20–45%",
"Hereditary haemochromatosis: ferritin markedly elevated (often >1000 ng/mL); transferrin saturation >45–50%. Also elevated in alcoholic liver disease."],
["Alpha-1 Antitrypsin (A1AT)", "80–200 mg/dL", "↓ in A1AT deficiency - causes neonatal cholestasis and adult liver disease."],
["AFP (Alpha-Feto Protein)", "<10 ng/mL", "↑↑↑ in Hepatocellular Carcinoma (HCC). Also mildly elevated in viral hepatitis (regeneration). Levels >400 ng/mL highly suggestive of HCC."],
["CA 19-9", "<37 U/mL", "↑↑ in cholangiocarcinoma and pancreatic cancer - obstructive jaundice with malignancy."],
["Serum Lipase / Amylase", "Lipase: 0–60 U/L\nAmylase: 30–110 U/L",
"↑ in pancreatitis - a cause of obstructive jaundice (oedema of pancreatic head compressing common bile duct)."],
["Blood Culture", "No growth",
"Positive in ascending cholangitis (Charcot's triad: fever, jaundice, RUQ pain). Common organisms: E. coli, Klebsiella, Enterococcus."],
["Serum Glucose", "Fasting: 70–100 mg/dL\n(3.9–5.6 mmol/L)", "↓ Hypoglycaemia in fulminant hepatic failure (impaired gluconeogenesis/glycogenolysis)."],
["Serum Electrolytes\n(Na, K, Cr, Urea)", "Na: 136–145 mEq/L\nK: 3.5–5.0 mEq/L\nCr: 0.6–1.2 mg/dL",
"Hyponatraemia in advanced cirrhosis/ascites. Elevated creatinine in hepatorenal syndrome complicating severe liver disease."],
]
spec_table = Table(spec_data, colWidths=[4.0*cm, 3.8*cm, 9.2*cm])
spec_table.setStyle(make_table_header())
content.append(spec_table)
content.append(Spacer(1, 6))
# ── SECTION 8: SUMMARY COMPARISON TABLE ─────────────────────────────────────
content.append(h1("8. Summary: Differential Laboratory Profile of Jaundice"))
content.append(Spacer(1, 6))
summary_data = [
["Investigation", "Prehepatic\n(Haemolytic)", "Hepatocellular\n(Hepatic)", "Posthepatic\n(Obstructive/Cholestatic)"],
["Total Bilirubin", "↑↑ (rarely >5 mg/dL)", "↑↑↑ (variable)", "↑↑↑ (often very high)"],
["Direct (Conjugated) Bilirubin", "Normal / minimal ↑", "↑↑", "↑↑↑ (predominant)"],
["Indirect (Unconjugated) Bilirubin", "↑↑↑ (predominant)", "↑", "Normal / mild ↑"],
["ALT / AST", "Normal", "↑↑↑↑ (>10× ULN in acute hepatitis)", "Normal or mild ↑ (<3× ULN)"],
["Alkaline Phosphatase (ALP)", "Normal", "↑ (1–3× ULN)", "↑↑↑↑ (>4× ULN)"],
["GGT", "Normal", "↑ (especially alcohol)", "↑↑↑↑"],
["Serum Albumin", "Normal", "↓ in chronic disease", "May be ↓ in prolonged obstruction"],
["Prothrombin Time", "Normal", "↑ (severe hepatocellular damage;\ndoes NOT correct with Vit K)", "↑ if prolonged (corrects with Vit K injection)"],
["Urine Bilirubin", "Absent", "Present +++", "Present +++"],
["Urine Urobilinogen", "↑↑↑", "↑ or normal", "Absent / trace"],
["Stool Colour", "Normal / dark", "Normal or pale", "Pale / clay-coloured (acholic)"],
["Haemoglobin", "↓ (anaemia)", "Normal (may ↓ in cirrhosis)", "Normal"],
["Reticulocyte Count", "↑↑ (>2%)", "Normal", "Normal"],
["Haptoglobin", "↓↓ or absent", "Normal or ↓ in cirrhosis", "Normal"],
["LDH", "↑↑ (haemolysis)", "↑", "Normal / mild ↑"],
["Blood Film", "Abnormal RBC morphology\n(spherocytes, sickle cells, etc.)", "Normal / target cells in cirrhosis", "Normal"],
]
summary_table = Table(summary_data, colWidths=[4.0*cm, 4.0*cm, 4.5*cm, 4.5*cm])
summary_table.setStyle(make_table_header())
content.append(summary_table)
content.append(Spacer(1, 6))
# ── SECTION 9: ADDITIONAL WORKUP ────────────────────────────────────────────
content.append(h1("9. Further Investigations Based on Clinical Diagnosis"))
content.append(Spacer(1, 6))
further_data = [
["Suspected Diagnosis", "Key Laboratory Tests", "Imaging / Procedures"],
["Viral Hepatitis A", "Anti-HAV IgM positive; total bilirubin ↑; ALT/AST ↑↑↑", "Ultrasound abdomen (hepatomegaly)"],
["Viral Hepatitis B", "HBsAg +, HBeAg, HBV DNA quantitative, Anti-HBc IgM (acute)", "Ultrasound liver; fibroscan if chronic"],
["Viral Hepatitis C", "Anti-HCV Ab; HCV RNA (PCR); genotyping for treatment", "Liver biopsy / fibroscan for fibrosis staging"],
["Alcoholic Hepatitis", "AST:ALT ratio >2:1; GGT ↑↑; MCV ↑ (macrocytosis); CDT ↑; Maddrey discriminant function", "Ultrasound; liver biopsy in selected cases"],
["Primary Biliary Cholangitis", "AMA +ve (>95%); ALP ↑↑↑; GGT ↑; IgM ↑", "Liver biopsy (granulomatous cholangitis)"],
["Autoimmune Hepatitis", "ANA, SMA, Anti-LKM-1 +ve; IgG ↑↑; ALT/AST ↑↑", "Liver biopsy (interface hepatitis)"],
["Wilson's Disease", "Ceruloplasmin ↓; serum copper ↑; 24h urine copper ↑; Kayser-Fleischer rings on slit lamp", "MRI brain; liver biopsy"],
["Haemochromatosis", "Ferritin ↑↑↑; transferrin saturation >45%; HFE gene mutation", "MRI liver (iron quantification); liver biopsy"],
["Choledocholithiasis", "Conjugated bilirubin ↑; ALP ↑↑; GGT ↑↑; amylase/lipase if pancreatitis", "MRCP (first line); ERCP (therapeutic)"],
["Pancreatic Cancer", "CA 19-9 ↑↑; ALP ↑↑↑; conjugated bilirubin ↑↑↑; albumin ↓ (weight loss)", "CT abdomen/chest; ERCP/EUS; tissue biopsy"],
["Cholangiocarcinoma", "CA 19-9 ↑; CEA ↑ (occasionally); ALP ↑↑↑", "MRCP; PET-CT; bile duct brush cytology"],
["Haemolytic Anaemia", "Unconjugated bilirubin ↑↑; Hb ↓; reticulocytes ↑↑; Coombs test; haptoglobin ↓; blood film", "Peripheral blood smear; bone marrow if needed"],
["Primary Sclerosing Cholangitis", "ALP ↑↑↑; GGT ↑↑↑; pANCA +ve in ~80%; IgG4 (to exclude IgG4-SC)", "MRCP (beaded bile ducts); colonoscopy (associated IBD)"],
["Hepatocellular Carcinoma", "AFP ↑↑↑ (>400 ng/mL suggestive); ALP ↑; LFTs deranged", "Triphasic CT or MRI; CEUS; liver biopsy"],
]
further_table = Table(further_data, colWidths=[3.5*cm, 6.8*cm, 6.7*cm])
further_table.setStyle(make_table_header())
content.append(further_table)
content.append(Spacer(1, 6))
# ── SECTION 10: NOTES ON VALUES ─────────────────────────────────────────────
content.append(h1("10. Key Diagnostic Thresholds & Notes"))
content.append(Spacer(1, 6))
notes = [
"<b>Jaundice becomes clinically visible</b> at serum bilirubin ≥2–3 mg/dL (34–51 µmol/L).",
"<b>Isolated unconjugated hyperbilirubinemia</b> with no other liver test abnormality strongly suggests haemolysis or Gilbert's syndrome.",
"<b>AST:ALT ratio >2:1</b> (especially >3:1) strongly suggests alcoholic liver disease.",
"<b>ALP >4× ULN</b> with proportionally lesser aminotransferase elevation = cholestatic pattern.",
"<b>Prothrombin time correction with Vitamin K</b>: corrects in obstructive jaundice (Vit K malabsorption); does NOT correct in hepatocellular failure (synthetic dysfunction).",
"<b>Low albumin</b> suggests chronic liver disease (albumin t½ ~20 days); normal albumin in acute processes.",
"<b>Positive urine bilirubin + absent urobilinogen</b> = complete biliary obstruction.",
"<b>Increased urine urobilinogen + absent urine bilirubin</b> = haemolytic jaundice.",
"<b>AMA positivity (>1:40)</b> is >95% specific for Primary Biliary Cholangitis.",
"<b>Crigler-Najjar type I</b>: bilirubin often >20 mg/dL, life-threatening kernicterus in neonates.",
"<b>Gilbert's syndrome</b>: mild unconjugated elevation typically 1–3 mg/dL; incidence 3–7% of population; benign.",
"<b>Hypoglycaemia</b> in jaundiced patient = ominous sign of fulminant hepatic failure.",
]
for note in notes:
content.append(Paragraph(f"• {note}", body_style))
content.append(Spacer(1, 8))
# ── REFERENCES ───────────────────────────────────────────────────────────────
content.append(HRFlowable(width="100%", thickness=1, color=colors.HexColor('#c0cce0'), spaceBefore=6, spaceAfter=6))
content.append(Paragraph("<b>References</b>", h2_style))
refs = [
"1. Friedman LS. Jaundice. In: <i>Harrison's Principles of Internal Medicine, 22nd Ed.</i> McGraw Hill; 2025. Ch. 52.",
"2. Guyton AC, Hall JE. <i>Guyton and Hall Textbook of Medical Physiology, 14th Ed.</i> Elsevier; 2020.",
"3. Murray RK, et al. <i>Harper's Illustrated Biochemistry, 32nd Ed.</i> McGraw Hill; 2023.",
"4. McPherson RA, Pincus MR. <i>Henry's Clinical Diagnosis and Management by Laboratory Methods, 23rd Ed.</i> Elsevier; 2017.",
"5. Rifai N, et al. <i>Tietz Textbook of Laboratory Medicine, 7th Ed.</i> Elsevier; 2023.",
]
for ref in refs:
content.append(Paragraph(ref, note_style))
content.append(Spacer(1, 6))
content.append(Paragraph(
"Generated by Orris Medical Reference • July 2026 • For educational use only. Always correlate with clinical findings.",
footer_style
))
# Build
doc.build(content)
print(f"PDF created: {OUTPUT}")
cd /home/daytona/workspace/jaundice-pdf && python generate_pdf.py
ls -lh /home/daytona/workspace/jaundice-pdf/Jaundice_Laboratory_Investigations.pdf
Jaundice Laboratory Investigations
PDF Document · PDF
Laboratory investigations for diabetes with values in pdf form
~/jaundice-pdf/generate_diabetes_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 inch, cm
from reportlab.platypus import (
SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
HRFlowable, KeepTogether, PageBreak
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
OUTPUT = "/home/daytona/workspace/jaundice-pdf/Diabetes_Laboratory_Investigations.pdf"
doc = SimpleDocTemplate(
OUTPUT,
pagesize=A4,
rightMargin=1.8*cm,
leftMargin=1.8*cm,
topMargin=2*cm,
bottomMargin=2*cm,
title="Laboratory Investigations for Diabetes Mellitus",
author="Orris Medical Reference"
)
styles = getSampleStyleSheet()
W = 17.4*cm # usable width
# ── Styles ───────────────────────────────────────────────────────────────────
title_style = ParagraphStyle('CT', parent=styles['Title'],
fontSize=22, textColor=colors.HexColor('#0d3b6e'), spaceAfter=4,
alignment=TA_CENTER, fontName='Helvetica-Bold')
subtitle_style = ParagraphStyle('CS', parent=styles['Normal'],
fontSize=10.5, textColor=colors.HexColor('#444444'), spaceAfter=10,
alignment=TA_CENTER, fontName='Helvetica')
h2_style = ParagraphStyle('H2', parent=styles['Normal'],
fontSize=11, textColor=colors.HexColor('#0d3b6e'), spaceBefore=8,
spaceAfter=3, fontName='Helvetica-Bold')
body_style = ParagraphStyle('Body', parent=styles['Normal'],
fontSize=9, textColor=colors.HexColor('#222222'), spaceAfter=4,
leading=13, alignment=TA_JUSTIFY)
note_style = ParagraphStyle('Note', parent=styles['Normal'],
fontSize=8, textColor=colors.HexColor('#555555'), spaceAfter=3,
leading=11, leftIndent=8, fontName='Helvetica-Oblique')
footer_style = ParagraphStyle('Footer', parent=styles['Normal'],
fontSize=7.5, textColor=colors.HexColor('#888888'), alignment=TA_CENTER)
bullet_style = ParagraphStyle('Bullet', parent=styles['Normal'],
fontSize=9, textColor=colors.HexColor('#222222'), spaceAfter=3,
leading=13, leftIndent=12)
NAVY = colors.HexColor('#0d3b6e')
LTBLUE = colors.HexColor('#ddeeff')
STRIPE1 = colors.HexColor('#eef4fb')
STRIPE2 = colors.white
GRIDCLR = colors.HexColor('#b0c8e8')
def h1(text):
inner = ParagraphStyle('H1i', parent=styles['Normal'],
fontSize=12, textColor=colors.white, fontName='Helvetica-Bold', leading=17)
t = Table([[Paragraph(text, inner)]], colWidths=[W])
t.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,-1), NAVY),
('TOPPADDING', (0,0), (-1,-1), 7),
('BOTTOMPADDING', (0,0), (-1,-1), 7),
('LEFTPADDING', (0,0), (-1,-1), 10),
]))
return t
def tbl(data, widths, row_heights=None):
t = Table(data, colWidths=widths, rowHeights=row_heights)
t.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,0), NAVY),
('TEXTCOLOR', (0,0), (-1,0), colors.white),
('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
('FONTSIZE', (0,0), (-1,0), 8.5),
('ALIGN', (0,0), (-1,0), 'CENTER'),
('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
('FONTNAME', (0,1), (-1,-1), 'Helvetica'),
('FONTSIZE', (0,1), (-1,-1), 8),
('ROWBACKGROUNDS', (0,1), (-1,-1), [STRIPE1, STRIPE2]),
('GRID', (0,0), (-1,-1), 0.4, GRIDCLR),
('TOPPADDING', (0,0), (-1,-1), 4),
('BOTTOMPADDING', (0,0), (-1,-1), 4),
('LEFTPADDING', (0,0), (-1,-1), 5),
('RIGHTPADDING', (0,0), (-1,-1), 5),
('WORDWRAP', (0,0), (-1,-1), True),
]))
return t
content = []
# ── TITLE ────────────────────────────────────────────────────────────────────
content.append(Spacer(1, 0.4*inch))
content.append(Paragraph("Laboratory Investigations for Diabetes Mellitus", title_style))
content.append(Paragraph("Diagnostic Criteria, Monitoring Tests, Complication Markers & Reference Values", subtitle_style))
content.append(HRFlowable(width="100%", thickness=2, color=NAVY, spaceAfter=6))
content.append(Paragraph(
"Sources: Harrison's Principles of Internal Medicine 22E • Henry's Clinical Diagnosis & "
"Management by Laboratory Methods 23E • Tietz Textbook of Laboratory Medicine 7E • "
"ADA Standards of Medical Care in Diabetes 2024 • Katzung's Basic & Clinical Pharmacology 16E",
note_style))
content.append(Spacer(1, 0.15*inch))
# ── SECTION 1: CLASSIFICATION ────────────────────────────────────────────────
content.append(h1("1. Classification of Diabetes Mellitus"))
content.append(Spacer(1, 5))
cls_data = [
["Type", "Key Features", "Pathophysiology"],
["Type 1 DM\n(T1DM)", "Usually onset <30 yrs; lean; absolute insulin deficiency; prone to DKA; autoimmune markers +ve",
"Autoimmune destruction of pancreatic β-cells; HLA-DR3/DR4 association; GAD65, IA-2, ZnT8, IAA autoantibodies"],
["Type 2 DM\n(T2DM)", "Most common (>90%); onset usually >40 yrs (earlier in obesity); insulin resistance + relative insulin deficiency; rarely DKA",
"Progressive insulin secretory failure on background of insulin resistance; strong genetic + lifestyle component"],
["Gestational DM\n(GDM)", "Diagnosed during pregnancy (24–28 weeks); resolves postpartum in most; ↑ risk of future T2DM",
"Hormonal insulin resistance of pregnancy; placental hormones (hPL, progesterone, cortisol)"],
["Other Specific\nTypes", "MODY, drug-induced (steroids, antipsychotics), pancreatic disease, endocrinopathies (Cushing's, acromegaly)",
"Monogenic defects in β-cell function; exocrine pancreatic disease; drug/chemical-induced; endocrine disorders"],
["LADA\n(Latent Autoimmune\nDiabetes in Adults)", "Adult onset; initially resembles T2DM; slowly progressive β-cell destruction",
"GAD65 antibodies positive; 5–10% of adults clinically diagnosed as T2DM; ultimately requires insulin"],
]
content.append(tbl(cls_data, [2.5*cm, 7.2*cm, 7.7*cm]))
content.append(Spacer(1, 6))
# ── SECTION 2: DIAGNOSTIC CRITERIA ──────────────────────────────────────────
content.append(h1("2. Diagnostic Criteria (ADA 2024)"))
content.append(Spacer(1, 5))
content.append(Paragraph(
"Any <b>ONE</b> of the following criteria is sufficient. In the absence of unequivocal hyperglycemia, "
"diagnosis requires <b>two abnormal test results</b> from the same sample or two separate test samples.",
body_style))
diag_data = [
["Test", "Diabetes\n(Diagnostic)", "Prediabetes\n(At-Risk)", "Normal", "Notes"],
["Fasting Plasma\nGlucose (FPG)", "≥126 mg/dL\n(≥7.0 mmol/L)", "100–125 mg/dL\n(IFG)\n(5.6–6.9 mmol/L)",
"<100 mg/dL\n(<5.6 mmol/L)", "Fast ≥8 hours; no caloric intake. Large biological variation - repeat if near threshold."],
["2-Hour Plasma\nGlucose (75 g OGTT)", "≥200 mg/dL\n(≥11.1 mmol/L)", "140–199 mg/dL\n(IGT)\n(7.8–11.0 mmol/L)",
"<140 mg/dL\n(<7.8 mmol/L)", "75 g anhydrous glucose in water. Patient seated; no smoking. Perform 7–9 AM after 10–16h fast."],
["HbA1c\n(Glycated Haemoglobin)", "≥6.5%\n(≥48 mmol/mol)", "5.7–6.4%\n(39–47 mmol/mol)",
"<5.7%\n(<39 mmol/mol)", "NGSP-certified, DCCT-standardised lab method. NOT valid in haemoglobinopathies, haemolysis, recent transfusion."],
["Random Plasma\nGlucose", "≥200 mg/dL\n(≥11.1 mmol/L)\n+ classic symptoms", "N/A", "N/A",
"Symptoms: polyuria, polydipsia, unexplained weight loss. This criterion alone is sufficient IF classic symptoms present."],
]
content.append(tbl(diag_data, [2.8*cm, 2.8*cm, 3.0*cm, 2.8*cm, 6.0*cm]))
content.append(Paragraph(
"<i>IFG = Impaired Fasting Glucose; IGT = Impaired Glucose Tolerance; OGTT = Oral Glucose Tolerance Test</i>",
note_style))
content.append(Spacer(1, 6))
# ── SECTION 3: GESTATIONAL DM ────────────────────────────────────────────────
content.append(h1("3. Gestational Diabetes (GDM) Screening & Diagnostic Values"))
content.append(Spacer(1, 5))
content.append(Paragraph(
"Screen all women at 24–28 weeks gestation. Women with risk factors for pre-existing T2DM "
"should be screened at first prenatal visit. Two approaches are accepted:",
body_style))
gdm_data = [
["Approach", "Test", "Time Point", "Threshold for GDM Diagnosis"],
["One-Step IADPSG\n(recommended internationally)\n75 g OGTT",
"Plasma glucose\n(any ONE value met\nor exceeded = GDM)",
"Fasting\n1 hour\n2 hour",
"≥92 mg/dL (5.1 mmol/L)\n≥180 mg/dL (10.0 mmol/L)\n≥153 mg/dL (8.5 mmol/L)"],
["Two-Step NIH/ACOG\n(used in USA)\nStep 1: 50 g GCT (non-fasting)",
"Plasma glucose at 1h\n(if positive, proceed\nto Step 2)",
"1 hour",
"≥130 mg/dL (7.2) or\n≥135 mg/dL (7.5) or\n≥140 mg/dL (7.8 mmol/L)\n[threshold varies by institution]"],
["Step 2: 100 g OGTT\n(fasting)\n≥2 values met = GDM",
"Carpenter/Coustan\nNDDG",
"Fasting / 1h / 2h / 3h\nFasting / 1h / 2h / 3h",
"95 / 180 / 155 / 140 mg/dL\n105 / 190 / 165 / 145 mg/dL"],
]
content.append(tbl(gdm_data, [3.5*cm, 3.5*cm, 2.5*cm, 7.9*cm]))
content.append(Spacer(1, 6))
# ── SECTION 4: GLYCAEMIC MONITORING ─────────────────────────────────────────
content.append(h1("4. Glycaemic Monitoring Tests"))
content.append(Spacer(1, 5))
gly_data = [
["Test", "Reference / Target Values", "Frequency / Use", "Notes"],
["HbA1c\n(Glycated Haemoglobin)", "Target: <7.0% (53 mmol/mol) for most adults\n<6.5% for selected patients\n<8.0% for elderly/frail\nNormal (non-diabetic): <5.7%",
"Every 3 months if not at target;\nEvery 6 months if stable at goal",
"Reflects average BG over ~3 months (erythrocyte lifespan ~120 days). Unreliable in haemolytic anaemia, sickle cell, recent transfusion, iron deficiency."],
["Fasting Plasma\nGlucose (FPG)", "Normal: 70–99 mg/dL (3.9–5.5 mmol/L)\nTarget in DM: 80–130 mg/dL (4.4–7.2 mmol/L)",
"Regular self-monitoring;\nroutine labs", "8-hour fast required. High day-to-day biological variation."],
["Postprandial\nGlucose (2h PPG)", "Normal: <140 mg/dL (<7.8 mmol/L)\nTarget in DM: <180 mg/dL (<10.0 mmol/L)",
"2 hours after start of meal; especially useful in T2DM",
"Better predictor of HbA1c than FPG alone; important in gestational DM management."],
["Time-in-Range\n(TIR) - CGM", "Target: >70% time in range 70–180 mg/dL\nTime below 70: <4%\nTime below 54: <1%\nTime above 180: <25%",
"Continuous Glucose Monitor (CGM); real-time data",
"Used with CGM devices. Emerging gold-standard for glycaemic assessment alongside HbA1c."],
["Fructosamine\n(Glycated Serum Protein)", "Normal: 205–285 µmol/L\nDiabetes (poorly controlled): >285 µmol/L",
"Used when HbA1c unreliable;\nreflects ~2–3 week average BG",
"Useful in haemolytic anaemia, haemoglobinopathies. Affected by serum protein levels (albumin must be ≥3 g/dL)."],
["1,5-Anhydroglucitol\n(1,5-AG)", "Normal: 10.7–32.0 µg/mL (M);\n6.8–29.3 µg/mL (F)\nLow in poorly controlled DM",
"Reflects postprandial hyperglycaemia over preceding 1–2 weeks",
"Rapidly decreases when BG exceeds renal threshold (~180 mg/dL). Falsely low with SGLT2 inhibitors."],
["Urine Glucose\n(Glucosuria)", "Normal: Absent / Negative\n(<15 mg/dL by dipstick)",
"Qualitative screening only; not for monitoring",
"Appears when BG exceeds renal threshold ~180 mg/dL. Unreliable - NOT used for diagnosis or monitoring."],
]
content.append(tbl(gly_data, [3.0*cm, 4.0*cm, 3.2*cm, 7.2*cm]))
content.append(Spacer(1, 6))
# ── SECTION 5: AUTOANTIBODIES & TYPING ──────────────────────────────────────
content.append(h1("5. Autoantibody Tests (Type 1 DM Diagnosis & Typing)"))
content.append(Spacer(1, 5))
content.append(Paragraph(
"Islet autoantibodies are present in <b>85–90%</b> of individuals with immune-mediated (Type 1) diabetes at initial diagnosis. "
"Multiple autoantibodies predict near 100% progression to T1DM in high-risk individuals.",
body_style))
ab_data = [
["Autoantibody", "Sensitivity in T1DM", "Specificity", "Clinical Use"],
["GAD65\n(Anti-glutamic acid decarboxylase)", "~80%", "High (>98% in controls)", "Most commonly used; also found in LADA (5–10% of T2DM). Persists longest."],
["IA-2A\n(Insulinoma-associated protein 2)", "~60–70%", "High", "Predicts rapid progression to T1DM; combined with GADA gives better predictive value."],
["IAA\n(Insulin Autoantibodies)", "~50% at diagnosis\nHigher in young children",
"Good (lower specificity if patient already on insulin)", "NOT useful after insulin therapy started. Most specific predictor in children <5 years."],
["ZnT8A\n(Zinc Transporter 8)", "~60–80% at onset", "High (>98%)", "Detected in ~26% of T1DM patients negative for other antibodies. FDA-approved (2014)."],
["ICA\n(Islet Cell Antibodies)", "~80% at onset\n(older assay)", "Good", "Indirect immunofluorescence method; largely replaced by more specific assays above."],
["C-Peptide", "Low/undetectable in T1DM:\n<0.2 nmol/L (fasting)\nNormal T2DM: 0.5–3.0 nmol/L",
"N/A", "Differentiates T1DM (low/absent) from T2DM (preserved). Useful to assess residual β-cell function. Stimulated C-peptide with glucagon >0.6 nmol/L = adequate reserve."],
["Serum Insulin\n(Fasting)", "T1DM: Low/Undetectable\nT2DM: Normal/High (early) → Low (late)\nNormal fasting: 2–25 µIU/mL (14–174 pmol/L)",
"N/A", "Not routinely used for diagnosis. HOMA-IR = (Fasting insulin × Fasting glucose) / 405 – index of insulin resistance."],
]
content.append(tbl(ab_data, [3.2*cm, 3.0*cm, 2.8*cm, 8.4*cm]))
content.append(Spacer(1, 6))
# ── SECTION 6: ACUTE COMPLICATIONS ──────────────────────────────────────────
content.append(h1("6. Labs for Acute Diabetic Complications"))
content.append(Spacer(1, 5))
acute_data = [
["Test", "DKA\n(Diabetic Ketoacidosis)", "HHS\n(Hyperosmolar Hyperglycaemic State)", "Hypoglycaemia"],
["Plasma Glucose", "250–600 mg/dL\n(13.9–33.3 mmol/L)", ">600 mg/dL (often 900–1200)\n(>33.3 mmol/L)", "<70 mg/dL (<3.9 mmol/L)\nSevere: <54 mg/dL (<3.0)"],
["Arterial pH", "<7.30 (acidosis)\nSevere DKA: <7.00", "Normal to slightly low\n(7.35–7.45)", "Normal"],
["Serum Bicarbonate", "<18 mEq/L\nSevere: <10 mEq/L", ">18 mEq/L (usually normal)", "Normal"],
["Anion Gap", "↑↑ (>12 mEq/L)\nHigh anion gap metabolic acidosis", "Normal or mildly ↑\n(8–16 mEq/L)", "Normal"],
["Serum Ketones\n(β-hydroxybutyrate)", "Markedly elevated\n>3.0 mmol/L (often >5)\nNormal: <0.3 mmol/L", "Absent or trace\n(<0.3 mmol/L)", "Normal or low\n(fasting hypoglycaemia)"],
["Urine Ketones\n(Dipstick)", "Large / 3+", "Absent to trace", "Normal"],
["Serum Osmolality", "290–320 mOsm/kg\n(Normal: 275–295)", ">320 mOsm/kg\n(often 350–380)", "Normal"],
["Serum Sodium (Na⁺)", "May be low, normal, or high\n(corrected Na+ = Na + 1.6 × [(Glu-100)/100])", "Normal to high\n(130–150 mEq/L)", "Normal"],
["Serum Potassium (K⁺)", "Initially normal/high (shift from ICF)\nthen falls rapidly with insulin Rx\n(Monitor closely!)", "May be normal to high", "Normal"],
["Serum Creatinine\n& BUN", "May be ↑ (dehydration)\nCreatinine: 0.6–1.2 mg/dL (normal)", "↑↑ (severe dehydration)\nBUN often >30 mg/dL", "Normal"],
["CBC / WBC", "Leukocytosis (stress response)\n10,000–25,000/µL (not always infection)", "Leukocytosis", "Normal"],
["Phosphate", "Initially normal/high → falls with treatment\nMonitor during Rx", "May be mildly low", "Normal"],
["Lactate", "May be mildly elevated; exclude lactic acidosis\n(Normal: 0.5–2.0 mmol/L)", "Normal", "Low if insulin-induced"],
["Serum Insulin\n& C-Peptide", "Low/undetectable (T1DM)\nOr inappropriately low for glucose level", "Present (T2DM)", "Low = exogenous; High = endogenous overproduction (insulinoma)"],
]
content.append(tbl(acute_data, [3.2*cm, 4.8*cm, 4.6*cm, 4.8*cm]))
content.append(Spacer(1, 6))
# ── SECTION 7: CHRONIC COMPLICATIONS ────────────────────────────────────────
content.append(h1("7. Monitoring for Chronic Complications"))
content.append(Spacer(1, 5))
comp_data = [
["Complication /\nSystem", "Test", "Normal Value", "Abnormal / Action Threshold", "Frequency"],
["Diabetic\nNephropathy\n(DKD)",
"Urine Albumin-to-Creatinine Ratio (UACR)\nSpot urine (morning preferred)",
"<30 mg/g (normoalbuminuria)",
"30–300 mg/g = Moderately ↑ albuminuria (microalbuminuria)\n>300 mg/g = Severely ↑ albuminuria (macroalbuminuria/overt nephropathy)",
"Annually from T1DM diagnosis ≥5 yrs;\nannually from T2DM diagnosis"],
["Diabetic\nNephropathy",
"eGFR (Serum Creatinine\n+ CKD-EPI or MDRD formula)",
">60 mL/min/1.73m²",
"CKD Stage 3: eGFR 30–59\nCKD Stage 4: eGFR 15–29\nCKD Stage 5: <15 (ESRD)",
"Annually; more frequent if eGFR <60"],
["Diabetic\nNephropathy",
"24-hr Urine Albumin\n(alternative to spot UACR)",
"<30 mg/24h",
"30–300 mg/24h = microalbuminuria\n>300 mg/24h = macroalbuminuria",
"If UACR unreliable"],
["Lipid Panel\n(Dyslipidaemia)",
"Total Cholesterol\nLDL-C\nHDL-C\nTriglycerides\nNon-HDL-C",
"TC: <200 mg/dL\nLDL: <100 mg/dL\nHDL: >40 (M), >50 (F) mg/dL\nTG: <150 mg/dL\nNon-HDL: <130 mg/dL",
"LDL target in DM: <70 mg/dL (high CV risk)\nLDL <55 mg/dL (very high CV risk)\nTG >500 = pancreatitis risk\nHDL <40(M)/<50(F) = risk",
"At diagnosis, then annually (or more often if on statin therapy)"],
["Liver\n(NAFLD/NASH)",
"ALT, AST\nHepatic steatosis (FIB-4 score)",
"ALT: 7–56 U/L\nAST: 10–40 U/L",
"ALT/AST ↑ in fatty liver disease; FIB-4 >2.67 = advanced fibrosis risk",
"At diagnosis and periodically (especially on statins/thiazolidinediones)"],
["Diabetic\nRetinopathy",
"Dilated fundoscopy\n(no specific blood test)\nHbA1c as surrogate",
"No retinopathy",
"HbA1c ↑ correlates with retinopathy risk;\nannual ophthalmology referral after 5 yrs T1DM;at diagnosis T2DM",
"Annually"],
["Diabetic\nNeuropathy",
"Nerve conduction studies\n(clinical assessment primary)\nThyroid screen (to exclude hypothyroid neuropathy)",
"Normal NCS",
"Reduced nerve conduction velocity;\nTSH elevated if hypothyroid",
"Annually from diagnosis"],
["Thyroid\n(associated autoimmunity\nin T1DM)",
"TSH\nFree T4\nAnti-TPO antibodies",
"TSH: 0.4–4.0 mIU/L\nFT4: 0.8–1.8 ng/dL",
"TSH ↑ = hypothyroidism (Hashimoto's)\nAnti-TPO +ve = autoimmune thyroid disease",
"At diagnosis in T1DM; then every 1–2 yrs"],
["Coeliac Disease\n(associated with T1DM)",
"Anti-tissue transglutaminase IgA (tTG-IgA)\nTotal serum IgA (to exclude IgA deficiency)",
"tTG-IgA: Negative (<4 U/mL)\nTotal IgA: 70–400 mg/dL",
"tTG-IgA >10× ULN = diagnostic of coeliac;\nIf IgA deficient, use IgG-based tests",
"At T1DM diagnosis; repeat if symptoms"],
["Cardiovascular\nRisk",
"hs-CRP\nHomocysteine\nECG",
"hs-CRP: <1.0 mg/L (low risk)\n1.0–3.0 (intermediate)\n>3.0 (high)\nHomocysteine: 5–15 µmol/L",
"hs-CRP >3.0 mg/L = high CV risk\nHomocysteine >15 = hyperhomocysteinaemia (B12/folate deficiency)",
"At baseline; periodically based on risk"],
["Blood Pressure\n& Electrolytes",
"Serum Na, K, Cl, CO₂\nSerum Creatinine/eGFR\nUrine K (if on ACEi/ARB)",
"Na: 136–145 mEq/L\nK: 3.5–5.0 mEq/L\nCr: 0.6–1.2 mg/dL",
"Hyperkalaemia (K >5.5) with ACEi/ARB + DKD;\nHyponatraemia in SIADH",
"Baseline; annually; more frequent if on renin-angiotensin drugs"],
]
content.append(tbl(comp_data, [2.8*cm, 3.2*cm, 3.2*cm, 5.0*cm, 3.2*cm]))
content.append(Spacer(1, 6))
# ── SECTION 8: ROUTINE PANEL ────────────────────────────────────────────────
content.append(h1("8. Routine Laboratory Panel for All Diabetic Patients"))
content.append(Spacer(1, 5))
routine_data = [
["Investigation", "Normal Reference Range", "Finding in DM / Significance"],
["Fasting Plasma Glucose (FPG)", "70–99 mg/dL (3.9–5.5 mmol/L)", "↑ for diagnosis and monitoring; target 80–130 mg/dL in treated DM"],
["HbA1c", "Non-diabetic: <5.7% (<39 mmol/mol)\nPrediabetes: 5.7–6.4%\nTarget in treated DM: <7%", "Primary long-term glycaemic control marker; every 3–6 months"],
["Urine UACR\n(spot urine)", "Normal: <30 mg/g creatinine", "Microalbuminuria 30–300; macroalbuminuria >300; indicates DKD onset"],
["eGFR\n(estimated GFR)", ">60 mL/min/1.73m²", "Tracks DKD progression; guides dosing of metformin and other renally-cleared drugs"],
["Serum Creatinine", "M: 0.7–1.3 mg/dL\nF: 0.6–1.1 mg/dL", "↑ in DKD; required to calculate eGFR"],
["BUN (Blood Urea Nitrogen)", "8–20 mg/dL", "↑ in DKD and dehydration (DKA/HHS)"],
["Serum Electrolytes\n(Na, K, Cl, HCO₃)", "Na 136–145; K 3.5–5.0;\nCl 98–106; HCO₃ 22–29 mEq/L", "K⁺ and HCO₃ critical in DKA; Na⁺ in HHS; K⁺ monitoring on ACEi/ARB"],
["Lipid Panel\n(Total-C, LDL, HDL, TG)", "TC <200; LDL <100; HDL >40(M)/>50(F); TG <150 mg/dL", "Dyslipidaemia common in T2DM; TG ↑↑ = insulin resistance; LDL target <70 (high risk)"],
["Liver Function Tests\n(ALT, AST, ALP, GGT)", "ALT 7–56; AST 10–40;\nALP 44–147; GGT 9–48 U/L", "Fatty liver common in T2DM; monitor on statins and thiazolidinediones; pioglitazone may ↑ ALT"],
["CBC (Full Blood Count)", "Hb M 13.5–17.5, F 12–15.5 g/dL\nWBC 4–11 × 10³/µL\nPlatelets 150–400 × 10³/µL", "Anaemia of CKD; leukocytosis in infections; macrocytosis if B12/folate deficient"],
["Thyroid Function\n(TSH)", "TSH: 0.4–4.0 mIU/L", "Hypothyroidism worsens glycaemic control and dyslipidaemia; mandatory in T1DM"],
["Serum Uric Acid", "M: 3.5–7.2 mg/dL\nF: 2.6–6.0 mg/dL", "↑ in insulin resistance/MetS; associated with DKD progression and gout"],
["Serum Vitamin B12", "200–900 pg/mL (148–664 pmol/L)", "↓ with long-term metformin use; causes neuropathy - check annually in patients on metformin"],
["Urine Dipstick\n(Glucose, Ketones, Protein)", "All negative / trace", "Glucosuria at BG >180 mg/dL; ketonuria in DKA; proteinuria in DKD"],
["Blood Pressure\n(office/home)", "Normal: <130/80 mmHg\nTarget in DM: <130/80 mmHg", "Hypertension in >70% of T2DM; BP control reduces CV and renal events"],
["BMI / Waist Circumference", "BMI 18.5–24.9 kg/m²\nWaist: M <94cm, F <80cm (European)", "Obesity central to T2DM pathogenesis; target weight loss in overweight/obese"],
]
content.append(tbl(routine_data, [3.5*cm, 4.2*cm, 9.7*cm]))
content.append(Spacer(1, 6))
# ── SECTION 9: INSULIN RESISTANCE ───────────────────────────────────────────
content.append(h1("9. Insulin Resistance & Beta-Cell Function Tests"))
content.append(Spacer(1, 5))
ir_data = [
["Test", "Formula / Normal Value", "Interpretation"],
["HOMA-IR\n(Homeostatic Model\nAssessment - Insulin Resistance)",
"HOMA-IR = (Fasting insulin µIU/mL × Fasting glucose mg/dL) / 405\nNormal: <1.9\nInsulin resistance: >2.9",
"Simple estimate of insulin resistance from fasting insulin and glucose. Used in research; not routinely used clinically. Requires accurate fasting insulin assay."],
["HOMA-β\n(Beta-Cell Function)",
"HOMA-β = (20 × Fasting insulin µIU/mL) / (Fasting glucose mmol/L − 3.5)\nNormal: 100%",
"Reflects residual β-cell secretory capacity. Progressively declines in T2DM. <50% suggests significant β-cell loss."],
["Fasting C-Peptide",
"Normal: 0.5–3.0 nmol/L (1.5–9.0 ng/mL)\nT1DM: <0.2 nmol/L\nT2DM/Insulin resistance: Normal/↑",
"Equimolar with insulin; not affected by exogenous insulin. Best test to assess endogenous insulin secretion. Stimulated (glucagon) C-peptide >0.6 nmol/L = adequate reserve."],
["Fasting Insulin",
"Normal fasting: 2–25 µIU/mL (14–174 pmol/L)\nInsulin resistance: >25 µIU/mL (fasting)",
"Elevated fasting insulin = insulin resistance (in absence of hypoglycaemia). If low + hypoglycaemia = exogenous insulin or insulinoma requires further workup."],
["Proinsulin",
"Normal: <13.5 pmol/L\nFasting: <20% of total immunoreactive insulin",
"↑ in insulinoma, β-cell dysfunction. Disproportionate proinsulin >25% total = β-cell dysfunction in T2DM."],
["Hyperinsulinaemic\nEuglycaemic Clamp",
"Gold standard for insulin resistance\nGIR (Glucose Infusion Rate) measures insulin sensitivity",
"Research tool only - not used clinically. GIR <4 mg/kg/min = insulin resistance."],
]
content.append(tbl(ir_data, [3.2*cm, 4.5*cm, 9.7*cm]))
content.append(Spacer(1, 6))
# ── SECTION 10: KETONE TESTING ───────────────────────────────────────────────
content.append(h1("10. Ketone Testing in Diabetes"))
content.append(Spacer(1, 5))
ket_data = [
["Test", "Method", "Normal", "DKA Range", "Notes"],
["Blood β-hydroxybutyrate\n(BOHB)", "Point-of-care meter\nor laboratory",
"<0.3 mmol/L", ">3.0 mmol/L\n(often 5–10 mmol/L in severe DKA)",
"PREFERRED method. Highest sensitivity and specificity for DKA. Falls with successful treatment. Does NOT cross-react with acetone."],
["Urine Ketones\n(Acetotest / Dipstick)", "Dipstick (nitroprusside reaction)",
"Negative", "Large / 3+",
"Detects acetoacetate and acetone ONLY - not β-hydroxybutyrate. May remain positive even as DKA improves (BOHB converts to AcAc). NOT used to monitor treatment."],
["Serum Ketones\n(Acetest tablets)", "Nitroprusside reaction",
"Negative", "Strongly positive",
"Same limitation as urine - does not detect BOHB. Largely replaced by blood BOHB meters."],
["Anion Gap\n(indirect ketosis marker)", "Na − (Cl + HCO₃)\nNormal: 8–12 mEq/L",
"8–12 mEq/L", ">12 mEq/L\n(often >20 in DKA)",
"Used alongside pH and bicarbonate to monitor DKA severity and recovery. Should normalise as DKA resolves."],
]
content.append(tbl(ket_data, [3.0*cm, 2.8*cm, 2.2*cm, 3.2*cm, 6.2*cm]))
content.append(Spacer(1, 6))
# ── SECTION 11: SUMMARY QUICK-REFERENCE ─────────────────────────────────────
content.append(h1("11. Quick-Reference Summary: Key Values at a Glance"))
content.append(Spacer(1, 5))
qr_data = [
["Parameter", "Normal", "Prediabetes", "Diabetes / Target in DM"],
["Fasting Plasma Glucose", "<100 mg/dL\n<5.6 mmol/L", "100–125 mg/dL\n5.6–6.9 mmol/L", "≥126 mg/dL (diagnosis)\nTarget in treated: 80–130 mg/dL"],
["2-hr OGTT Glucose", "<140 mg/dL\n<7.8 mmol/L", "140–199 mg/dL\n7.8–11.0 mmol/L", "≥200 mg/dL (diagnosis)\nTarget in treated: <180 mg/dL (PPG)"],
["HbA1c", "<5.7%\n<39 mmol/mol", "5.7–6.4%\n39–47 mmol/mol", "≥6.5% (diagnosis)\nTarget in treated: <7% (<53 mmol/mol)"],
["Random Glucose", "<140 mg/dL", "N/A", "≥200 mg/dL + symptoms (diagnosis)"],
["Urine UACR", "<30 mg/g", "N/A", "30–300 = microalbuminuria\n>300 = macroalbuminuria"],
["eGFR", ">90 mL/min/1.73m²", "N/A", "CKD Stage 3: 30–59; Stage 4: 15–29; Stage 5: <15"],
["LDL Cholesterol", "<130 mg/dL", "N/A", "Target in DM: <70 mg/dL (high CVD risk)\n<55 mg/dL (very high CVD risk)"],
["Blood Pressure", "<120/80 mmHg", "N/A", "Target in DM: <130/80 mmHg"],
["Serum Creatinine", "M: 0.7–1.3 mg/dL\nF: 0.6–1.1 mg/dL", "N/A", "↑ in DKD; calculate eGFR to stage CKD"],
["TSH (T1DM screen)", "0.4–4.0 mIU/L", "N/A", "Check at diagnosis; ↑ = hypothyroidism"],
["Vitamin B12\n(Metformin patients)", "200–900 pg/mL", "N/A", "Screen annually; replace if <300 pg/mL or symptomatic neuropathy"],
["Blood β-hydroxybutyrate", "<0.3 mmol/L", "N/A", ">3.0 = DKA; 0.6–1.5 = impending ketosis"],
["Arterial pH (DKA)", "7.35–7.45", "N/A", "<7.30 = DKA; <7.00 = severe DKA"],
["Fasting C-Peptide", "0.5–3.0 nmol/L", "N/A", "<0.2 nmol/L = T1DM (absolute insulin deficiency)"],
["HOMA-IR", "<1.9", "N/A", ">2.9 = significant insulin resistance"],
]
content.append(tbl(qr_data, [3.5*cm, 3.5*cm, 3.8*cm, 6.6*cm]))
content.append(Spacer(1, 6))
# ── SECTION 12: MONITORING SCHEDULE ─────────────────────────────────────────
content.append(h1("12. Recommended Monitoring Schedule (ADA 2024)"))
content.append(Spacer(1, 5))
sched_data = [
["Test", "Every Visit\n(3–4 months)", "Every 6 Months", "Annually", "At Diagnosis"],
["HbA1c", "✓ (if not at target)", "✓ (if at target)", "", "✓"],
["Blood Pressure", "✓", "", "", "✓"],
["Weight / BMI", "✓", "", "", "✓"],
["Fasting Glucose", "✓ (self-monitoring)", "", "", "✓"],
["Lipid Panel (Full)", "", "", "✓", "✓"],
["Urine UACR", "", "", "✓", "✓"],
["Serum Creatinine / eGFR", "", "", "✓", "✓"],
["Foot Examination\n(Neuropathy screening)", "", "", "✓", "✓"],
["Dilated Eye Exam", "", "", "✓ (T1DM >5yrs; T2DM from Dx)", "✓ (T2DM)"],
["TSH (T1DM)", "", "", "Every 1–2 yrs", "✓"],
["Vitamin B12\n(on Metformin)", "", "", "✓", "✓"],
["tTG-IgA (T1DM)", "", "", "If symptomatic", "✓"],
["Liver Function Tests", "", "", "✓", "✓"],
["Dental Examination", "", "", "✓", "✓"],
["Flu Vaccine", "✓ (annually)", "", "", ""],
]
content.append(tbl(sched_data, [4.0*cm, 3.5*cm, 3.0*cm, 4.3*cm, 2.6*cm]))
content.append(Spacer(1, 8))
# ── REFERENCES ───────────────────────────────────────────────────────────────
content.append(HRFlowable(width="100%", thickness=1, color=GRIDCLR, spaceBefore=4, spaceAfter=5))
content.append(Paragraph("<b>References</b>", h2_style))
refs = [
"1. American Diabetes Association. <i>Standards of Medical Care in Diabetes 2024.</i> Diabetes Care 2024;47(Suppl 1).",
"2. Atkinson MA, Eisenbarth GS, Michels AW. Type 1 diabetes. In: <i>Harrison's Principles of Internal Medicine, 22nd Ed.</i> McGraw Hill; 2025.",
"3. McPherson RA, Pincus MR. Diabetes mellitus. In: <i>Henry's Clinical Diagnosis and Management by Laboratory Methods, 23rd Ed.</i> Elsevier; 2017.",
"4. Sacks DB, et al. Chapter 33: Carbohydrates. In: <i>Tietz Textbook of Laboratory Medicine, 7th Ed.</i> Elsevier; 2023.",
"5. Katzung BG. Pancreatic Hormones and Antidiabetic Drugs. In: <i>Basic and Clinical Pharmacology, 16th Ed.</i> McGraw Hill; 2021.",
"6. Creasy RK, et al. Gestational Diabetes. In: <i>Maternal-Fetal Medicine: Principles and Practice, 8th Ed.</i> Elsevier; 2019.",
]
for r in refs:
content.append(Paragraph(r, note_style))
content.append(Spacer(1, 5))
content.append(Paragraph(
"Generated by Orris Medical Reference • July 2026 • For educational use only. Always correlate with clinical findings and current institutional guidelines.",
footer_style))
# Build
doc.build(content)
print(f"PDF created: {OUTPUT}")
Failed to create session: bad request: failed to resolve container IP after 3 attempts: no IP address found. Is the Sandbox started?
We encountered an error while processing your request. Please try again or reach out to us for help.
Laboratory investigations for diabetes in pdf format
mkdir -p /home/daytona/workspace/diabetes-pdf && ls /home/daytona/workspace/diabetes-pdf/
~/diabetes-pdf/gen.py
from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.units import inch, cm
from reportlab.platypus import (
SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, HRFlowable
)
from reportlab.lib.enums import TA_CENTER, TA_JUSTIFY
OUT = "/home/daytona/workspace/diabetes-pdf/Diabetes_Laboratory_Investigations.pdf"
doc = SimpleDocTemplate(OUT, pagesize=A4,
rightMargin=1.8*cm, leftMargin=1.8*cm,
topMargin=2*cm, bottomMargin=2*cm,
title="Laboratory Investigations for Diabetes Mellitus")
styles = getSampleStyleSheet()
W = 17.4*cm
NAVY = colors.HexColor('#0d3b6e')
LTGRAY = colors.HexColor('#eef4fb')
WHITE = colors.white
GRID = colors.HexColor('#b0c8e8')
title_s = ParagraphStyle('T', parent=styles['Title'], fontSize=21,
textColor=NAVY, spaceAfter=4, alignment=TA_CENTER, fontName='Helvetica-Bold')
sub_s = ParagraphStyle('S', parent=styles['Normal'], fontSize=10,
textColor=colors.HexColor('#444'), spaceAfter=10, alignment=TA_CENTER)
body_s = ParagraphStyle('B', parent=styles['Normal'], fontSize=9,
textColor=colors.HexColor('#222'), spaceAfter=4, leading=13, alignment=TA_JUSTIFY)
note_s = ParagraphStyle('N', parent=styles['Normal'], fontSize=8,
textColor=colors.HexColor('#555'), spaceAfter=3, leading=11,
leftIndent=8, fontName='Helvetica-Oblique')
foot_s = ParagraphStyle('F', parent=styles['Normal'], fontSize=7.5,
textColor=colors.HexColor('#888'), alignment=TA_CENTER)
h2_s = ParagraphStyle('H2', parent=styles['Normal'], fontSize=10.5,
textColor=NAVY, spaceBefore=6, spaceAfter=3, fontName='Helvetica-Bold')
def sec(text):
inner = ParagraphStyle('hi', parent=styles['Normal'], fontSize=11.5,
textColor=WHITE, fontName='Helvetica-Bold', leading=16)
t = Table([[Paragraph(text, inner)]], colWidths=[W])
t.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,-1), NAVY),
('TOPPADDING', (0,0), (-1,-1), 7),
('BOTTOMPADDING', (0,0), (-1,-1), 7),
('LEFTPADDING', (0,0), (-1,-1), 10),
]))
return t
def tbl(data, widths):
t = Table(data, colWidths=widths)
t.setStyle(TableStyle([
('BACKGROUND', (0,0), (-1,0), NAVY),
('TEXTCOLOR', (0,0), (-1,0), WHITE),
('FONTNAME', (0,0), (-1,0), 'Helvetica-Bold'),
('FONTSIZE', (0,0), (-1,0), 8.5),
('ALIGN', (0,0), (-1,0), 'CENTER'),
('VALIGN', (0,0), (-1,-1), 'MIDDLE'),
('FONTNAME', (0,1), (-1,-1), 'Helvetica'),
('FONTSIZE', (0,1), (-1,-1), 8),
('ROWBACKGROUNDS', (0,1), (-1,-1), [LTGRAY, WHITE]),
('GRID', (0,0), (-1,-1), 0.4, GRID),
('TOPPADDING', (0,0), (-1,-1), 4),
('BOTTOMPADDING', (0,0), (-1,-1), 4),
('LEFTPADDING', (0,0), (-1,-1), 5),
('RIGHTPADDING', (0,0), (-1,-1), 5),
('WORDWRAP', (0,0), (-1,-1), True),
]))
return t
c = []
# ── TITLE ────────────────────────────────────────────────────────────────────
c.append(Spacer(1, 0.35*inch))
c.append(Paragraph("Laboratory Investigations", title_s))
c.append(Paragraph("for Diabetes Mellitus", title_s))
c.append(Paragraph("Diagnostic Criteria • Monitoring Tests • Complication Markers • Reference Values", sub_s))
c.append(HRFlowable(width="100%", thickness=2, color=NAVY, spaceAfter=5))
c.append(Paragraph(
"Sources: Harrison's Principles of Internal Medicine 22E • Henry's Clinical Diagnosis & Management by Laboratory Methods 23E • "
"Tietz Textbook of Laboratory Medicine 7E • ADA Standards of Medical Care 2024 • Katzung's Basic & Clinical Pharmacology 16E",
note_s))
c.append(Spacer(1, 0.12*inch))
# ── 1. CLASSIFICATION ────────────────────────────────────────────────────────
c.append(sec("1. Classification of Diabetes Mellitus"))
c.append(Spacer(1,5))
cls = [
["Type", "Key Features", "Pathophysiology"],
["Type 1 DM\n(T1DM)", "Onset usually <30 yrs; lean; absolute insulin deficiency; prone to DKA; autoimmune markers +ve", "Autoimmune β-cell destruction; HLA-DR3/DR4 association; GAD65, IA-2, ZnT8, IAA autoantibodies"],
["Type 2 DM\n(T2DM)", ">90% of cases; onset usually >40 yrs (earlier with obesity); insulin resistance + relative deficiency; rarely DKA", "Progressive β-cell secretory failure on background of insulin resistance; strong genetic and lifestyle component"],
["Gestational DM\n(GDM)", "Diagnosed during pregnancy 24–28 weeks; resolves postpartum in most; ↑ risk of future T2DM", "Hormonal insulin resistance (hPL, progesterone, cortisol)"],
["LADA", "Adult onset; resembles T2DM initially; slow β-cell destruction; GAD65 antibodies +ve", "5–10% of adults clinically diagnosed as T2DM; ultimately requires insulin"],
["Other Types", "MODY (monogenic); drug-induced (steroids, antipsychotics); pancreatic disease; endocrinopathies", "Exocrine pancreatic disease; Cushing's; acromegaly; haemochromatosis; drugs"],
]
c.append(tbl(cls, [2.3*cm, 7.5*cm, 7.6*cm]))
c.append(Spacer(1,6))
# ── 2. DIAGNOSTIC CRITERIA ───────────────────────────────────────────────────
c.append(sec("2. Diagnostic Criteria (ADA 2024)"))
c.append(Spacer(1,5))
c.append(Paragraph(
"Any <b>ONE</b> of the four criteria below is sufficient for diagnosis. "
"In the absence of unequivocal hyperglycaemia, diagnosis requires <b>two abnormal results</b> "
"from the same sample or two separate samples.",
body_s))
diag = [
["Test", "Normal", "Prediabetes", "Diabetes (Diagnostic)", "Conditions / Notes"],
["Fasting Plasma Glucose\n(FPG)", "<100 mg/dL\n(<5.6 mmol/L)", "IFG: 100–125 mg/dL\n(5.6–6.9 mmol/L)", "≥126 mg/dL\n(≥7.0 mmol/L)", "Fast ≥8 hours (no caloric intake). High biological variation - repeat near threshold."],
["2-hr Plasma Glucose\n75 g OGTT", "<140 mg/dL\n(<7.8 mmol/L)", "IGT: 140–199 mg/dL\n(7.8–11.0 mmol/L)", "≥200 mg/dL\n(≥11.1 mmol/L)", "75 g anhydrous glucose in water. Morning after 3 days unrestricted diet + 10–16h fast."],
["HbA1c\n(Glycated Haemoglobin)", "<5.7%\n(<39 mmol/mol)", "5.7–6.4%\n(39–47 mmol/mol)", "≥6.5%\n(≥48 mmol/mol)", "NGSP-certified, DCCT-standardised lab method only. NOT valid with haemoglobinopathies, haemolysis, recent transfusion."],
["Random Plasma Glucose\n+ Classic Symptoms", "N/A", "N/A", "≥200 mg/dL\n(≥11.1 mmol/L)\n+ symptoms", "Symptoms = polyuria, polydipsia, unexplained weight loss. Sufficient alone if classic symptoms present."],
]
c.append(tbl(diag, [2.9*cm, 2.5*cm, 2.8*cm, 2.7*cm, 6.5*cm]))
c.append(Paragraph("<i>IFG = Impaired Fasting Glucose; IGT = Impaired Glucose Tolerance; OGTT = Oral Glucose Tolerance Test</i>", note_s))
c.append(Spacer(1,6))
# ── 3. GESTATIONAL DM ────────────────────────────────────────────────────────
c.append(sec("3. Gestational Diabetes (GDM) – Screening & Diagnostic Values"))
c.append(Spacer(1,5))
c.append(Paragraph("Screen all women at 24–28 weeks gestation. High-risk women: screen at first prenatal visit.", body_s))
gdm = [
["Approach", "Test", "Time Point", "GDM Threshold (any ONE met)"],
["One-Step IADPSG\n(75 g OGTT, fasting)", "Plasma glucose\n(any ONE value = GDM)", "Fasting\n1 hour\n2 hour", "≥92 mg/dL (5.1 mmol/L)\n≥180 mg/dL (10.0 mmol/L)\n≥153 mg/dL (8.5 mmol/L)"],
["Two-Step (NIH/ACOG)\nStep 1: 50 g GCT\n(non-fasting)", "Plasma glucose at 1h\n→ if positive, do Step 2", "1 hour", "≥130–140 mg/dL (7.2–7.8 mmol/L)\n[threshold varies by institution]"],
["Step 2: 100 g OGTT\n(fasting)\n≥2 values met = GDM", "Carpenter/Coustan\n\nNDDG", "Fasting/1h/2h/3h\n\nFasting/1h/2h/3h", "95 / 180 / 155 / 140 mg/dL\n\n105 / 190 / 165 / 145 mg/dL"],
]
c.append(tbl(gdm, [3.3*cm, 3.5*cm, 2.5*cm, 8.1*cm]))
c.append(Spacer(1,6))
# ── 4. GLYCAEMIC MONITORING ──────────────────────────────────────────────────
c.append(sec("4. Glycaemic Monitoring Tests"))
c.append(Spacer(1,5))
gly = [
["Test", "Reference / Target Values", "Frequency", "Notes & Limitations"],
["HbA1c\n(Glycated Hb)", "Non-diabetic: <5.7% (<39 mmol/mol)\nTarget most adults: <7.0% (<53)\nElderly/frail: <8.0%\nSelected patients: <6.5%", "Every 3 months if uncontrolled;\nevery 6 months if at target", "Reflects ~3-month average BG (RBC lifespan). UNRELIABLE in: haemolytic anaemia, sickle cell disease, thalassaemia, recent transfusion, uremia, iron deficiency."],
["Fasting Plasma\nGlucose (FPG)", "Normal: 70–99 mg/dL\n(3.9–5.5 mmol/L)\nTarget in treated DM: 80–130 mg/dL\n(4.4–7.2 mmol/L)", "Regular self-monitoring;\nroutine clinic labs", "Requires ≥8h fast. High day-to-day biological variation within individuals."],
["Postprandial\nGlucose (2h PPG)", "Normal: <140 mg/dL (<7.8 mmol/L)\nTarget in treated DM: <180 mg/dL\n(<10.0 mmol/L)", "2 hours after start of meal", "Better predictor of HbA1c than FPG alone. Important in gestational DM management."],
["Fructosamine\n(Glycated Serum Protein)", "Normal: 205–285 µmol/L\nPoorly controlled DM: >285 µmol/L", "Use when HbA1c unreliable; reflects ~2–3 week average BG", "Affected by serum albumin levels (requires albumin ≥3 g/dL for reliable result)."],
["1,5-Anhydroglucitol\n(1,5-AG)", "Normal: 10.7–32.0 µg/mL (M)\n6.8–29.3 µg/mL (F)\nLow = poorly controlled DM", "Reflects postprandial hyperglycaemia over preceding 1–2 weeks", "Decreases rapidly when BG >180 mg/dL. Falsely low with SGLT2 inhibitors."],
["Continuous Glucose\nMonitor (CGM)\nTime-in-Range", "Target: >70% in 70–180 mg/dL\nTime below 70 mg/dL: <4%\nTime below 54 mg/dL: <1%\nTime above 180 mg/dL: <25%", "Continuous real-time monitoring", "Cannot be used to diagnose diabetes (requires lab plasma glucose confirmation)."],
["Urine Glucose\n(Glucosuria)", "Absent (negative)", "Screening only; not for diagnosis or monitoring", "Appears only when BG exceeds renal threshold (~180 mg/dL). False negatives in well-controlled DM."],
]
c.append(tbl(gly, [2.8*cm, 4.0*cm, 3.2*cm, 7.4*cm]))
c.append(Spacer(1,6))
# ── 5. AUTOANTIBODIES ────────────────────────────────────────────────────────
c.append(sec("5. Autoantibody Tests – Type 1 DM Diagnosis & Typing"))
c.append(Spacer(1,5))
c.append(Paragraph(
"Islet autoantibodies present in <b>85–90%</b> of immune-mediated T1DM at initial diagnosis. "
"Multiple autoantibodies confer near 100% risk of T1DM progression.",
body_s))
ab = [
["Autoantibody", "Sensitivity in T1DM", "Key Clinical Use"],
["GAD65\n(Anti-glutamic acid decarboxylase)", "~80% at onset; persists longest", "First-line test. Also found in LADA (5–10% of apparent T2DM adults). Most widely used clinically."],
["IA-2A\n(Insulinoma-associated protein 2)", "~60–70%", "Predicts rapid progression. Combined with GADA improves predictive value significantly."],
["IAA\n(Insulin Autoantibodies)", "~50% at diagnosis\nHigher in young children (<5 yrs)", "DO NOT test after insulin therapy started (cannot distinguish from exogenous-insulin antibodies). Most specific predictor in young children."],
["ZnT8A\n(Zinc Transporter 8)", "~60–80% at onset", "Detected in ~26% of T1DM patients negative for other autoantibodies. FDA-approved assay (2014)."],
["ICA\n(Islet Cell Antibodies)", "~80% at onset (older method)", "Largely replaced by more specific assays above. Detected by indirect immunofluorescence."],
["C-Peptide\n(Fasting)", "T1DM: <0.2 nmol/L\nT2DM: 0.5–3.0 nmol/L (normal/high early)", "Best test for endogenous insulin secretion. Not affected by exogenous insulin. Stimulated (post-glucagon) C-peptide >0.6 nmol/L = adequate β-cell reserve."],
["Fasting Serum Insulin", "Normal: 2–25 µIU/mL\n(14–174 pmol/L)\nT1DM: low/undetectable", "Not routine for diagnosis. Used with glucose for HOMA-IR. High fasting insulin + high glucose = insulin resistance (T2DM pattern)."],
]
c.append(tbl(ab, [3.5*cm, 3.0*cm, 10.9*cm]))
c.append(Spacer(1,6))
# ── 6. INSULIN RESISTANCE ────────────────────────────────────────────────────
c.append(sec("6. Insulin Resistance & Beta-Cell Function Indices"))
c.append(Spacer(1,5))
ir = [
["Index", "Formula & Normal Value", "Interpretation"],
["HOMA-IR", "= (Fasting insulin µIU/mL × Fasting glucose mg/dL) / 405\nNormal: <1.9\nInsulin resistance: >2.9", "Widely used research tool. Simple estimate from fasting values. Requires accurate fasting insulin assay; not validated in all populations."],
["HOMA-β", "= (20 × Fasting insulin µIU/mL) / (Fasting glucose mmol/L − 3.5)\nNormal: ~100%", "Estimates residual β-cell secretory capacity. Progressively declines in T2DM natural history."],
["Fasting C-Peptide", "Normal: 0.5–3.0 nmol/L (1.5–9.0 ng/mL)\nT1DM: <0.2 nmol/L\nT2DM early: normal/↑", "Gold standard for measuring endogenous insulin secretion. Stimulated C-peptide >0.6 nmol/L = preserved β-cell function."],
["Proinsulin", "Normal fasting: <13.5 pmol/L\n(<20% of total immunoreactive insulin", "↑ in insulinoma; disproportionate proinsulin (>25% of total) = β-cell dysfunction in T2DM."],
]
c.append(tbl(ir, [2.5*cm, 5.5*cm, 9.4*cm]))
c.append(Spacer(1,6))
# ── 7. ACUTE COMPLICATIONS ───────────────────────────────────────────────────
c.append(sec("7. Laboratory Findings in Acute Diabetic Emergencies"))
c.append(Spacer(1,5))
acute = [
["Parameter", "DKA (Diabetic Ketoacidosis)", "HHS (Hyperosmolar Hyperglycaemic State)", "Hypoglycaemia"],
["Plasma Glucose", "250–600 mg/dL\n(13.9–33.3 mmol/L)", ">600 mg/dL\n(often 900–1200 mg/dL)", "<70 mg/dL (<3.9)\nSevere: <54 mg/dL (<3.0)"],
["Arterial pH", "<7.30\nSevere: <7.00", "Normal to slightly ↓\n(7.35–7.45)", "Normal (7.35–7.45)"],
["Serum Bicarbonate\n(HCO₃)", "<18 mEq/L\nSevere: <10 mEq/L", ">18 mEq/L\n(usually normal)", "Normal (22–29 mEq/L)"],
["Anion Gap\n[Na − (Cl + HCO₃)]", "↑↑ >12 mEq/L\n(often >20; high AG metabolic acidosis)\nNormal: 8–12 mEq/L", "Normal or mildly ↑\n(8–16 mEq/L)", "Normal"],
["Blood β-OH-Butyrate\n(β-hydroxybutyrate)", "Markedly ↑: >3.0 mmol/L\n(often 5–10 mmol/L)\nNormal: <0.3 mmol/L", "Absent or trace\n(<0.3 mmol/L)", "Normal or ↓\n(fasting hypoglycaemia)"],
["Urine Ketones\n(dipstick)", "Large / 3+ positive", "Absent to trace", "Normal"],
["Serum Osmolality", "290–320 mOsm/kg\n(Normal: 275–295)", ">320 mOsm/kg\n(often 350–380)", "Normal"],
["Serum Sodium (Na⁺)", "Variable – may be low/normal/high\nCorrected Na = Na + 1.6×[(Glu−100)/100]", "Normal to high\n(130–150 mEq/L)", "Normal"],
["Serum Potassium (K⁺)", "Initially normal/high (ICF shift)\nthen FALLS rapidly with insulin Rx\n– Monitor every 1–2h!", "May be normal to high", "Normal"],
["Serum Creatinine / eGFR", "May be ↑ (dehydration)\nNormal: Cr 0.6–1.2 mg/dL", "↑↑ (severe dehydration)\nBUN often >30 mg/dL", "Normal"],
["WBC Count", "Leukocytosis 10,000–25,000/µL\n(stress response; does not always = infection)", "Leukocytosis", "Normal"],
["Serum Phosphate", "Initially normal/high → falls rapidly with insulin treatment. Monitor during treatment.", "May be mildly ↓", "Normal"],
["Serum Lactate", "May be mildly ↑; exclude concurrent lactic acidosis\nNormal: 0.5–2.0 mmol/L", "Normal", "Low in severe insulin-induced hypoglycaemia"],
]
c.append(tbl(acute, [3.2*cm, 4.9*cm, 4.8*cm, 4.5*cm]))
c.append(Paragraph("<i>Key DKA criteria: Glucose >250 mg/dL + pH <7.30 + Bicarbonate <18 + Ketones positive. HHS: Glucose >600 + Osmolality >320 + No significant ketosis.</i>", note_s))
c.append(Spacer(1,6))
# ── 8. KETONE TESTING ────────────────────────────────────────────────────────
c.append(sec("8. Ketone Testing in Diabetes"))
c.append(Spacer(1,5))
ket = [
["Test", "Normal", "DKA Range", "Clinical Notes"],
["Blood β-hydroxybutyrate\n(BOHB) – PREFERRED", "<0.3 mmol/L", ">3.0 mmol/L\n(severe: >5 mmol/L)", "Most sensitive/specific for DKA. Falls with treatment (unlike acetoacetate). Use to monitor DKA recovery. Available on point-of-care meters."],
["Urine Ketones\n(Acetest / Nitroprusside dipstick)", "Negative", "Large / 3+", "Detects acetoacetate and acetone ONLY – NOT β-hydroxybutyrate. May remain positive even as DKA resolves. NOT suitable for monitoring treatment response."],
["Anion Gap\n(indirect marker)", "8–12 mEq/L", ">12 (often >20 in DKA)", "Falls as DKA resolves. Should normalise before stopping IV insulin infusion."],
["Urine pH / Dipstick", "pH 4.5–8.0 (typically ~6)", "pH <5 (acidic)\nKetones 3+", "Urine dipstick ketones confirm ketonuria. Always confirm with blood BOHB if available."],
]
c.append(tbl(ket, [3.2*cm, 2.5*cm, 2.8*cm, 8.9*cm]))
c.append(Spacer(1,6))
# ── 9. RENAL & COMPLICATIONS ─────────────────────────────────────────────────
c.append(sec("9. Monitoring for Chronic Complications"))
c.append(Spacer(1,5))
comp = [
["Complication", "Test", "Normal Value", "Abnormal Threshold", "Frequency"],
["Diabetic Kidney\nDisease (DKD)", "Urine Albumin-to-Creatinine\nRatio (UACR – spot urine)", "<30 mg/g\n(normoalbuminuria)", "30–300 mg/g = moderately ↑\n(microalbuminuria)\n>300 mg/g = severely ↑\n(macroalbuminuria)", "Annually: T1DM from 5 yrs post-diagnosis; T2DM from diagnosis"],
["DKD", "eGFR (Serum Creatinine\n+ CKD-EPI formula)", ">60 mL/min/\n1.73m²", "Stage 3: 30–59\nStage 4: 15–29\nStage 5 (ESRD): <15", "Annually; more frequent if eGFR <60"],
["DKD", "24-hr Urine Albumin\n(if UACR unreliable)", "<30 mg/24h", "30–300 = micro\n>300 = macro\n>3500 = nephrotic", "Selectively"],
["Dyslipidaemia\n(CVD risk)", "Fasting Lipid Panel\n(TC, LDL-C, HDL-C, TG,\nNon-HDL-C)", "TC <200 mg/dL\nLDL <100 mg/dL\nHDL >40(M)/>50(F) mg/dL\nTG <150 mg/dL\nNon-HDL <130 mg/dL", "LDL target in DM: <70 mg/dL\n(high CV risk);\n<55 mg/dL (very high risk)\nTG >500 = pancreatitis risk", "At diagnosis; then annually"],
["Liver (NAFLD/NASH)", "ALT, AST\nFIB-4 score", "ALT 7–56 U/L\nAST 10–40 U/L", "ALT/AST >3× ULN = significant hepatocellular injury\nFIB-4 >2.67 = advanced fibrosis", "At diagnosis; annually (esp. on statins/pioglitazone)"],
["Thyroid\n(autoimmunity T1DM)", "TSH, Free T4\nAnti-TPO antibodies", "TSH: 0.4–4.0 mIU/L\nFT4: 0.8–1.8 ng/dL", "↑ TSH = hypothyroidism\n(Hashimoto's)\nAnti-TPO +ve = autoimmune thyroid disease", "At T1DM diagnosis; every 1–2 yrs"],
["Coeliac Disease\n(associated T1DM)", "Anti-tTG IgA\nTotal serum IgA", "tTG-IgA: <4 U/mL\nIgA: 70–400 mg/dL", ">10× ULN = diagnostic\n(if IgA deficient: use IgG-based tests)", "At T1DM diagnosis; if symptomatic"],
["Cardiovascular\nRisk", "hs-CRP\nHomocysteine", "hs-CRP: <1.0 mg/L\nHomocysteine: 5–15 µmol/L", "hs-CRP >3.0 mg/L = high CV risk\nHomocysteine >15 = hyperhomocysteinaemia", "Baseline; periodically"],
["Neuropathy", "Nerve Conduction Studies\n(clinical + monofilament test)", "Normal NCS", "Reduced conduction velocity;\nLoss of 10-g monofilament sensation", "Annually from diagnosis"],
["Vitamin B12\n(Metformin use)", "Serum Vitamin B12", "200–900 pg/mL\n(148–664 pmol/L)", "Deficiency: <200 pg/mL\n(↑ risk with long-term metformin)", "Annually in metformin users"],
["Uric Acid", "Serum Uric Acid", "M: 3.5–7.2 mg/dL\nF: 2.6–6.0 mg/dL", "↑ in insulin resistance/MetS;\nassociated with DKD progression and gout", "At diagnosis; periodically"],
]
c.append(tbl(comp, [2.5*cm, 3.0*cm, 3.1*cm, 5.0*cm, 3.8*cm]))
c.append(Spacer(1,6))
# ── 10. ROUTINE PANEL ────────────────────────────────────────────────────────
c.append(sec("10. Routine Laboratory Panel for All Diabetic Patients"))
c.append(Spacer(1,5))
rout = [
["Investigation", "Normal Reference Range", "Finding in Diabetes / Significance"],
["Fasting Plasma Glucose", "70–99 mg/dL\n(3.9–5.5 mmol/L)", "↑ for diagnosis (≥126) and monitoring. Target in treated DM: 80–130 mg/dL."],
["HbA1c", "Non-diabetic: <5.7% (<39 mmol/mol)", "Primary long-term glycaemic marker. Diagnostic ≥6.5%. Treatment target <7% for most adults."],
["Urine UACR (spot)", "<30 mg/g creatinine", "Microalbuminuria 30–300; macroalbuminuria >300; signals onset of diabetic kidney disease."],
["Serum Creatinine\n+ eGFR", "Cr: M 0.7–1.3, F 0.6–1.1 mg/dL\neGFR: >60 mL/min/1.73m²", "Tracks DKD progression; eGFR guides dosing of metformin (hold if eGFR <30) and other renally-cleared drugs."],
["Serum Electrolytes\n(Na, K, Cl, HCO₃)", "Na 136–145; K 3.5–5.0;\nCl 98–106; HCO₃ 22–29 mEq/L", "K⁺ and HCO₃⁻ critical in DKA/HHS. K⁺ monitoring essential on ACEi/ARB + DKD. HCO₃⁻ monitors acidosis resolution."],
["BUN (Urea)", "8–20 mg/dL\n(2.9–7.1 mmol/L)", "↑ in DKD and in dehydration (DKA/HHS). BUN:Cr ratio >20 = pre-renal."],
["Lipid Panel\n(Full fasting)", "TC <200; LDL <100; HDL >40/50;\nTG <150 mg/dL", "Dyslipidaemia common in T2DM (↑TG, ↓HDL, small dense LDL). LDL target <70 mg/dL in high CV risk."],
["Liver Function Tests\n(ALT, AST, ALP, GGT)", "ALT 7–56; AST 10–40;\nALP 44–147; GGT 9–48 U/L", "NAFLD/NASH common in T2DM. Monitor on statins and thiazolidinediones. ALT ↑ in pioglitazone-related hepatotoxicity."],
["CBC (Full Blood Count)", "Hb M 13.5–17.5, F 12–15.5 g/dL\nWBC 4–11×10³/µL\nPlatelets 150–400×10³/µL", "Anaemia of CKD in DKD. Leukocytosis signals infection (especially foot infections, UTI). Macrocytosis: B12/folate deficiency."],
["Thyroid Function (TSH)", "TSH: 0.4–4.0 mIU/L", "Hypothyroidism worsens glycaemic control and dyslipidaemia. Mandatory at T1DM diagnosis; check in unexplained T2DM worsening."],
["Vitamin B12", "200–900 pg/mL\n(148–664 pmol/L)", "↓ with long-term metformin use (blocks B12 absorption). Causes neuropathy – check annually in long-term metformin users."],
["Serum Uric Acid", "M 3.5–7.2; F 2.6–6.0 mg/dL", "↑ in insulin resistance/metabolic syndrome. Associated with DKD progression. Risk of gout."],
["Blood Pressure\n(office/home)", "Normal: <120/80 mmHg\nTarget in DM: <130/80 mmHg", "Hypertension in >70% of T2DM. BP control reduces CV events, DKD progression, retinopathy, and stroke risk."],
["Urine Dipstick\n(Glucose, Ketones, Protein)", "All negative/trace", "Glucosuria at BG >180 mg/dL; ketonuria in DKA; proteinuria signals DKD (confirm with UACR)."],
]
c.append(tbl(rout, [3.5*cm, 3.8*cm, 10.1*cm]))
c.append(Spacer(1,6))
# ── 11. QUICK REFERENCE ──────────────────────────────────────────────────────
c.append(sec("11. Quick-Reference: Key Values at a Glance"))
c.append(Spacer(1,5))
qr = [
["Parameter", "Normal", "Prediabetes", "Diabetes / Treatment Target"],
["Fasting Plasma Glucose", "<100 mg/dL\n<5.6 mmol/L", "100–125 mg/dL\n5.6–6.9 mmol/L", "Diagnosis: ≥126 mg/dL\nTarget: 80–130 mg/dL (treated)"],
["2-hr OGTT Glucose", "<140 mg/dL\n<7.8 mmol/L", "140–199 mg/dL\n7.8–11.0 mmol/L", "Diagnosis: ≥200 mg/dL\nTarget: <180 mg/dL (PPG, treated)"],
["HbA1c", "<5.7%\n<39 mmol/mol", "5.7–6.4%\n39–47 mmol/mol", "Diagnosis: ≥6.5%\nTarget: <7.0% (most adults)"],
["Urine UACR", "<30 mg/g", "—", "30–300 = microalbuminuria\n>300 = macroalbuminuria"],
["eGFR", ">90 mL/min/1.73m²", "—", "Stage 3: 30–59; Stage 4: 15–29;\nStage 5 (ESRD): <15"],
["LDL Cholesterol", "<130 mg/dL", "—", "Target in DM: <70 mg/dL\nVery high CV risk: <55 mg/dL"],
["Blood Pressure", "<120/80 mmHg", "—", "Target in DM: <130/80 mmHg"],
["Blood β-OH-Butyrate", "<0.3 mmol/L", "—", "0.6–1.5 = impending ketosis\n>3.0 = DKA"],
["Arterial pH (DKA)", "7.35–7.45", "—", "<7.30 = DKA\n<7.00 = severe DKA"],
["Fasting C-Peptide", "0.5–3.0 nmol/L", "—", "<0.2 nmol/L = T1DM (absolute insulin deficiency)"],
["HOMA-IR", "<1.9", "—", ">2.9 = significant insulin resistance"],
["Vitamin B12\n(Metformin users)", "200–900 pg/mL", "—", "<200 = deficiency; <300 = borderline\n(replace if symptomatic neuropathy)"],
["TSH", "0.4–4.0 mIU/L", "—", "↑ = hypothyroidism; screen all T1DM\nat diagnosis and every 1–2 yrs"],
]
c.append(tbl(qr, [3.8*cm, 3.3*cm, 3.6*cm, 6.7*cm]))
c.append(Spacer(1,6))
# ── 12. MONITORING SCHEDULE ──────────────────────────────────────────────────
c.append(sec("12. Recommended Monitoring Schedule (ADA 2024)"))
c.append(Spacer(1,5))
sched = [
["Test / Investigation", "At\nDiagnosis", "Every Visit\n(3–4 months)", "Every\n6 Months", "Annually"],
["HbA1c", "✓", "✓ (if not at target)", "✓ (if at target)", "—"],
["Blood Pressure", "✓", "✓", "—", "—"],
["Weight / BMI / Waist", "✓", "✓", "—", "—"],
["Fasting Glucose (self-monitor)", "✓", "✓", "—", "—"],
["Lipid Panel (full)", "✓", "—", "—", "✓"],
["Urine UACR", "✓", "—", "—", "✓"],
["Serum Creatinine / eGFR", "✓", "—", "—", "✓"],
["Liver Function Tests", "✓", "—", "—", "✓"],
["Dilated Eye Exam", "✓ (T2DM)\nAt 5 yrs (T1DM)", "—", "—", "✓"],
["Foot Exam (neuropathy)", "✓", "—", "—", "✓"],
["TSH (T1DM)", "✓", "—", "—", "Every 1–2 yrs"],
["Vitamin B12 (metformin)", "✓", "—", "—", "✓"],
["tTG-IgA Coeliac (T1DM)", "✓", "—", "—", "If symptomatic"],
["Uric Acid", "✓", "—", "—", "✓"],
["Annual Flu Vaccine", "—", "—", "—", "✓"],
["Dental Examination", "✓", "—", "—", "✓"],
]
c.append(tbl(sched, [5.0*cm, 2.2*cm, 3.2*cm, 2.5*cm, 4.5*cm]))
c.append(Spacer(1,8))
# ── REFERENCES ───────────────────────────────────────────────────────────────
c.append(HRFlowable(width="100%", thickness=1, color=GRID, spaceBefore=4, spaceAfter=5))
c.append(Paragraph("<b>References</b>", h2_s))
refs = [
"1. American Diabetes Association. <i>Standards of Medical Care in Diabetes 2024.</i> Diabetes Care 2024;47(Suppl 1).",
"2. Atkinson MA, Eisenbarth GS, Michels AW. Type 1 Diabetes. In: <i>Harrison's Principles of Internal Medicine, 22nd Ed.</i> McGraw Hill; 2025.",
"3. McPherson RA, Pincus MR. Diabetes Mellitus. In: <i>Henry's Clinical Diagnosis and Management by Laboratory Methods, 23rd Ed.</i> Elsevier.",
"4. Sacks DB, et al. Carbohydrates. In: <i>Tietz Textbook of Laboratory Medicine, 7th Ed.</i> Elsevier; 2023.",
"5. Katzung BG. Pancreatic Hormones and Antidiabetic Drugs. In: <i>Basic and Clinical Pharmacology, 16th Ed.</i> McGraw Hill; 2021.",
"6. Resnik R, et al. Gestational Diabetes. In: <i>Creasy & Resnik's Maternal-Fetal Medicine, 8th Ed.</i> Elsevier; 2019.",
]
for r in refs:
c.append(Paragraph(r, note_s))
c.append(Spacer(1,5))
c.append(Paragraph(
"Generated by Orris Medical Reference • July 2026 • For educational use only. Always correlate with clinical findings and institutional guidelines.",
foot_s))
doc.build(c)
print("Done:", OUT)
cd /home/daytona/workspace/diabetes-pdf && python gen.py
ls -lh /home/daytona/workspace/diabetes-pdf/Diabetes_Laboratory_Investigations.pdf
Diabetes Laboratory Investigations
PDF Document · PDF