. Conclusion Nutritional disorders represent a broad and clinically significant domain of pathology with profound consequences for individual health and global public health. The two ends of the nutritional spectrum — undernutrition and overnutrition — are both responsible for enormous disease burden. Protein-energy malnutrition remains devastating in low-resource settings, particularly among children under five, contributing to growth failure, immune dysfunction, and death. At the same time, the global epidemic of obesity drives an unprecedented rise in metabolic syndrome, type 2 diabetes, cardiovascular disease, and cancer. Micronutrient deficiencies — despite being preventable and often treatable — continue to afflict billions. Vitamin A deficiency is the leading preventable cause of childhood blindness. Iodine deficiency remains the most common preventable cause of intellectual disability. Iron deficiency anaemia affects over a billion people globally. Vitamin D deficiency causes a spectrum of skeletal and non-skeletal disorders that are increasingly recognised in all age groups and geographies. As highlighted by Harsh Mohan and Robbins, the pathological lesions of nutritional disorders — from the fatty liver and oedema of kwashiorkor to the perifollicular haemorrhages of scurvy and the rachitic rosary of vitamin D deficiency — reflect predictable biochemical consequences of specific nutrient deficits. Understanding these mechanisms is essential for accurate diagnosis, rational treatment, and effective prevention. Prevention strategies — including universal salt iodisation, vitamin A supplementation programmes, iron fortification of food, periconceptional folate supplementation, and promotion of breastfeeding and diversified diets — have proven to be among the most cost- effective public health interventions. The pathologist's contribution to this domain includes not only diagnosing nutritional disorders in clinical specimens but also understanding the molecular and cellular mechanisms that translate dietary insufficiency into tissue damage. In summary, nutritional disorders are preventable, treatable, and directly tied to social determinants of health — poverty, food insecurity, access to education, and healthcare. Addressing them requires both biomedical understanding and policy-level commitment to nutrition security. Shorter the above conclusion

Here is a shortened version of the conclusion:

Conclusion
Nutritional disorders span two extremes - undernutrition and overnutrition - both carrying enormous disease burden. Protein-energy malnutrition devastates children in low-resource settings, while the global obesity epidemic fuels diabetes, cardiovascular disease, and cancer. Micronutrient deficiencies, though preventable, remain widespread: vitamin A deficiency is the leading cause of childhood blindness, iodine deficiency the most common preventable cause of intellectual disability, and iron deficiency anaemia affects over a billion people worldwide.
As described by Harsh Mohan and Robbins, the pathological lesions of nutritional disorders reflect predictable biochemical consequences of specific nutrient deficits - knowledge essential for diagnosis and treatment. Proven interventions such as salt iodisation, vitamin A supplementation, iron fortification, and folate supplementation rank among the most cost-effective public health tools available.
Ultimately, nutritional disorders are preventable and treatable, but addressing them demands both biomedical understanding and policy-level commitment to tackling poverty, food insecurity, and inequitable access to healthcare.

Create a summary document of key nutritional disorders and their prevention strategies

Asking for Preferences
Reading File
Reading File
Finding Sources
Finding Sources
Finding Sources
Reading File
Finding Sources
Finding Sources
Reading File
Finding Sources
Finding Sources
Running Command

mkdir -p /tmp/workspace/nutritional-disorders && ls /tmp/workspace/

Writing File

~/nutritional-disorders/generate_pdf.py

from reportlab.lib.pagesizes import A4
from reportlab.lib import colors
from reportlab.lib.units import cm
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    HRFlowable, PageBreak, KeepTogether
)
from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont
import os

OUTPUT = "/tmp/workspace/nutritional-disorders/Nutritional_Disorders_Summary.pdf"

# ---------- Colour palette ----------
DARK_BLUE   = colors.HexColor("#1A3A5C")
MID_BLUE    = colors.HexColor("#2E6DA4")
LIGHT_BLUE  = colors.HexColor("#D6E8F7")
ACCENT      = colors.HexColor("#E8720C")
GREEN       = colors.HexColor("#2E7D32")
LIGHT_GREEN = colors.HexColor("#E8F5E9")
GOLD        = colors.HexColor("#F5A623")
LIGHT_GREY  = colors.HexColor("#F4F6F8")
MID_GREY    = colors.HexColor("#7F8C8D")
RED_SOFT    = colors.HexColor("#C0392B")
TEAL        = colors.HexColor("#00796B")
LIGHT_TEAL  = colors.HexColor("#E0F2F1")

# ---------- Styles ----------
styles = getSampleStyleSheet()

def S(name, **kw):
    return ParagraphStyle(name, **kw)

TITLE_STYLE = S("DocTitle",
    fontSize=26, fontName="Helvetica-Bold",
    textColor=colors.white, alignment=TA_CENTER,
    spaceAfter=6, leading=32)

SUBTITLE_STYLE = S("DocSubtitle",
    fontSize=13, fontName="Helvetica",
    textColor=colors.HexColor("#CCE5FF"), alignment=TA_CENTER,
    spaceAfter=4, leading=18)

META_STYLE = S("Meta",
    fontSize=10, fontName="Helvetica-Oblique",
    textColor=colors.HexColor("#B0C4DE"), alignment=TA_CENTER,
    spaceAfter=2)

SEC_HEADER = S("SectionHeader",
    fontSize=15, fontName="Helvetica-Bold",
    textColor=colors.white, alignment=TA_LEFT,
    leftIndent=8, spaceAfter=0, spaceBefore=0, leading=20)

SUBSEC_HEADER = S("SubSecHeader",
    fontSize=12, fontName="Helvetica-Bold",
    textColor=DARK_BLUE, spaceAfter=4, spaceBefore=8, leading=16)

BODY = S("Body",
    fontSize=10, fontName="Helvetica",
    textColor=colors.HexColor("#2C3E50"),
    alignment=TA_JUSTIFY, spaceAfter=5, spaceBefore=2, leading=14)

BULLET = S("Bullet",
    fontSize=10, fontName="Helvetica",
    textColor=colors.HexColor("#2C3E50"),
    leftIndent=16, bulletIndent=4,
    spaceAfter=3, spaceBefore=1, leading=13,
    bulletText="\u2022")

BOLD_INLINE = S("BoldInline",
    fontSize=10, fontName="Helvetica-Bold",
    textColor=DARK_BLUE)

CAPTION = S("Caption",
    fontSize=8, fontName="Helvetica-Oblique",
    textColor=MID_GREY, alignment=TA_CENTER, spaceAfter=4)

BOX_TEXT = S("BoxText",
    fontSize=10, fontName="Helvetica",
    textColor=colors.HexColor("#1B4332"),
    leftIndent=6, spaceAfter=3, leading=14)

BOX_TITLE = S("BoxTitle",
    fontSize=11, fontName="Helvetica-Bold",
    textColor=GREEN, spaceAfter=5, leading=15)

PREVENTION_TEXT = S("PrevText",
    fontSize=10, fontName="Helvetica",
    textColor=colors.HexColor("#1A237E"),
    leftIndent=6, spaceAfter=3, leading=14)

TABLE_HEADER = S("TableHeader",
    fontSize=10, fontName="Helvetica-Bold",
    textColor=colors.white, alignment=TA_CENTER, leading=13)

TABLE_CELL = S("TableCell",
    fontSize=9, fontName="Helvetica",
    textColor=colors.HexColor("#2C3E50"),
    alignment=TA_LEFT, leading=12, spaceAfter=2)

TABLE_CELL_C = S("TableCellC",
    fontSize=9, fontName="Helvetica",
    textColor=colors.HexColor("#2C3E50"),
    alignment=TA_CENTER, leading=12)

# ============================================================
# Helper: coloured section banner
# ============================================================
def section_banner(title, color=DARK_BLUE):
    data = [[Paragraph(title, SEC_HEADER)]]
    t = Table(data, colWidths=[17*cm])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), color),
        ("TOPPADDING",    (0,0), (-1,-1), 8),
        ("BOTTOMPADDING", (0,0), (-1,-1), 8),
        ("LEFTPADDING",   (0,0), (-1,-1), 10),
        ("ROUNDEDCORNERS", [6, 6, 6, 6]),
    ]))
    return t

def subheading(text, color=MID_BLUE):
    return Paragraph(f'<font color="#{color.hexval()[2:]}"><b>{text}</b></font>', SUBSEC_HEADER)

def para(text):
    return Paragraph(text, BODY)

def bullet(text):
    return Paragraph(f"<bullet>\u2022</bullet> {text}", BULLET)

def spacer(h=0.25):
    return Spacer(1, h*cm)

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

def green_box(title, items):
    """A bordered prevention strategy box."""
    content = [Paragraph(title, BOX_TITLE)]
    for item in items:
        content.append(Paragraph(f"\u2714  {item}", BOX_TEXT))
    data = [[content]]
    t = Table(data, colWidths=[17*cm])
    t.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,-1), LIGHT_GREEN),
        ("BOX",           (0,0), (-1,-1), 1.5, GREEN),
        ("TOPPADDING",    (0,0), (-1,-1), 10),
        ("BOTTOMPADDING", (0,0), (-1,-1), 10),
        ("LEFTPADDING",   (0,0), (-1,-1), 12),
        ("RIGHTPADDING",  (0,0), (-1,-1), 10),
    ]))
    return t

def blue_box(title, items):
    """A bordered key facts box."""
    content = [Paragraph(title, S("BT2", fontSize=11, fontName="Helvetica-Bold", textColor=MID_BLUE, spaceAfter=5))]
    for item in items:
        content.append(Paragraph(f"\u25B6  {item}", PREVENTION_TEXT))
    data = [[content]]
    t = Table(data, colWidths=[17*cm])
    t.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (-1,-1), LIGHT_BLUE),
        ("BOX",           (0,0), (-1,-1), 1.5, MID_BLUE),
        ("TOPPADDING",    (0,0), (-1,-1), 10),
        ("BOTTOMPADDING", (0,0), (-1,-1), 10),
        ("LEFTPADDING",   (0,0), (-1,-1), 12),
        ("RIGHTPADDING",  (0,0), (-1,-1), 10),
    ]))
    return t

# ============================================================
# Build the document
# ============================================================
doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=A4,
    leftMargin=2*cm, rightMargin=2*cm,
    topMargin=2*cm, bottomMargin=2.2*cm,
    title="Key Nutritional Disorders & Prevention Strategies",
    author="Orris Medical Library",
    subject="Nutritional Pathology Summary for Medical Students"
)

story = []

# -------- COVER --------
cover_data = [[
    Paragraph("KEY NUTRITIONAL DISORDERS", TITLE_STYLE),
    Paragraph("& Prevention Strategies", SUBTITLE_STYLE),
    Paragraph("A Structured Summary for Medical Students", META_STYLE),
    Spacer(1, 0.3*cm),
    Paragraph("Based on Robbins & Kumar Pathology | Park's PSM | Lippincott Biochemistry | Harrison's Medicine", META_STYLE),
    Spacer(1, 0.15*cm),
    Paragraph("July 2026", META_STYLE),
]]
cover_table = Table(cover_data, colWidths=[17*cm])
cover_table.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,-1), DARK_BLUE),
    ("TOPPADDING",    (0,0), (-1,-1), 24),
    ("BOTTOMPADDING", (0,0), (-1,-1), 24),
    ("LEFTPADDING",   (0,0), (-1,-1), 18),
    ("RIGHTPADDING",  (0,0), (-1,-1), 18),
]))
story.append(cover_table)
story.append(spacer(0.5))

# -------- INTRO --------
story.append(section_banner("INTRODUCTION"))
story.append(spacer(0.2))
story.append(para(
    "Nutritional disorders span two extremes of the dietary spectrum - "
    "<b>undernutrition</b> and <b>overnutrition</b> - both contributing enormous disease burden globally. "
    "These disorders are preventable, often treatable, and intimately linked to social determinants of health "
    "including poverty, food insecurity, education, and access to healthcare."
))
story.append(para(
    "This document provides a structured overview of the major nutritional disorders encountered in clinical "
    "pathology and preventive medicine, including their aetiology, pathophysiology, clinical features, "
    "morphological findings, and prevention strategies - aligned with the curricula of Robbins, Harsh Mohan, "
    "Park's PSM, and Lippincott Biochemistry."
))
story.append(spacer(0.3))

# -------- OVERVIEW TABLE --------
story.append(section_banner("OVERVIEW: SPECTRUM OF NUTRITIONAL DISORDERS", MID_BLUE))
story.append(spacer(0.2))

ov_header = [
    Paragraph("Disorder", TABLE_HEADER),
    Paragraph("Type", TABLE_HEADER),
    Paragraph("Primary Nutrient Deficit", TABLE_HEADER),
    Paragraph("Key Consequence", TABLE_HEADER),
]
ov_rows = [
    ["Marasmus", "Undernutrition (PEM)", "Calories + Protein", "Severe wasting, no oedema"],
    ["Kwashiorkor", "Undernutrition (PEM)", "Protein (calories spared)", "Oedema, fatty liver, skin changes"],
    ["Vitamin A Deficiency", "Micronutrient", "Retinol (Vitamin A)", "Xerophthalmia, night blindness"],
    ["Iodine Deficiency", "Micronutrient", "Iodine", "Goitre, cretinism, intellectual disability"],
    ["Iron Deficiency Anaemia", "Micronutrient", "Iron (Fe)", "Hypochromic microcytic anaemia"],
    ["Vitamin D Deficiency", "Micronutrient", "Cholecalciferol (Vit D)", "Rickets (children), Osteomalacia (adults)"],
    ["Scurvy", "Micronutrient", "Vitamin C (Ascorbic acid)", "Perifollicular haemorrhages, impaired healing"],
    ["Thiamine Deficiency", "Micronutrient (B1)", "Thiamine (Vit B1)", "Beriberi, Wernicke-Korsakoff"],
    ["Folate / B12 Deficiency", "Micronutrient", "Folate or Cobalamin", "Megaloblastic anaemia, NTDs"],
    ["Obesity", "Overnutrition", "Excess calorie intake", "Metabolic syndrome, T2DM, CVD, cancer"],
]

ov_data = [ov_header]
for i, row in enumerate(ov_rows):
    bg = LIGHT_GREY if i % 2 == 0 else colors.white
    ov_data.append([Paragraph(row[j], TABLE_CELL if j != 0 else
                              S(f"TC{i}", fontSize=9, fontName="Helvetica-Bold", textColor=DARK_BLUE, leading=12))
                    for j in range(4)])

ov_table = Table(ov_data, colWidths=[4.2*cm, 3.5*cm, 4.3*cm, 5*cm])
ov_table.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,0), DARK_BLUE),
    ("ROWBACKGROUNDS",(0,1), (-1,-1), [LIGHT_GREY, colors.white]),
    ("BOX",           (0,0), (-1,-1), 1, MID_BLUE),
    ("INNERGRID",     (0,0), (-1,-1), 0.4, colors.HexColor("#BDC3C7")),
    ("TOPPADDING",    (0,0), (-1,-1), 6),
    ("BOTTOMPADDING", (0,0), (-1,-1), 6),
    ("LEFTPADDING",   (0,0), (-1,-1), 6),
    ("VALIGN",        (0,0), (-1,-1), "MIDDLE"),
]))
story.append(ov_table)
story.append(spacer(0.4))

# ============================================================
# SECTION 1 - PROTEIN-ENERGY MALNUTRITION
# ============================================================
story.append(PageBreak())
story.append(section_banner("1. PROTEIN-ENERGY MALNUTRITION (PEM)", colors.HexColor("#6A1B9A")))
story.append(spacer(0.2))

story.append(para(
    "PEM encompasses a spectrum of deficiency states resulting from inadequate protein and/or caloric intake. "
    "The two polar forms are <b>Marasmus</b> (calorie + protein deficit) and <b>Kwashiorkor</b> "
    "(predominantly protein deficit with relative calorie sparing). A mixed form - <b>Marasmic Kwashiorkor</b> - "
    "is also recognised. PEM predominantly affects children under 5 in low-resource settings."
))
story.append(spacer(0.15))

# Side-by-side comparison table
comp_header = [
    Paragraph("Feature", TABLE_HEADER),
    Paragraph("Marasmus", TABLE_HEADER),
    Paragraph("Kwashiorkor", TABLE_HEADER),
]
comp_rows = [
    ["Primary deficit",     "Calories + protein",                       "Protein (calories relatively preserved)"],
    ["Age of onset",        "Infancy (< 1 year)",                       "Weaning age (1-3 years)"],
    ["Body weight",         "< 60% expected (severe wasting)",          "60-80% expected"],
    ["Oedema",              "Absent",                                   "Present (hypoalbuminaemia)"],
    ["Subcutaneous fat",    "Markedly depleted",                        "May be present"],
    ["Muscle wasting",      "Severe",                                   "Moderate"],
    ["Skin changes",        "Loose, wrinkled skin",                     "Flaky paint / crazy paving dermatosis"],
    ["Hair changes",        "Thin, sparse hair",                        "Flag sign (alternating light/dark bands)"],
    ["Serum albumin",       "Low but relatively maintained",            "Markedly low (< 2.8 g/dL)"],
    ["Fatty liver",         "Absent",                                   "Present (hallmark)"],
    ["Appetite",            "Usually preserved",                        "Often poor"],
    ["Immune function",     "Severely impaired",                        "Severely impaired"],
    ["Prognosis",           "Grave without intervention",               "Worse than marasmus when severe"],
]

comp_data = [comp_header]
for row in comp_rows:
    comp_data.append([
        Paragraph(f"<b>{row[0]}</b>", TABLE_CELL),
        Paragraph(row[1], TABLE_CELL),
        Paragraph(row[2], TABLE_CELL),
    ])

comp_table = Table(comp_data, colWidths=[4.5*cm, 6.1*cm, 6.4*cm])
comp_table.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,0), colors.HexColor("#6A1B9A")),
    ("ROWBACKGROUNDS",(0,1), (-1,-1), [colors.HexColor("#F3E5F5"), colors.white]),
    ("BOX",           (0,0), (-1,-1), 1, colors.HexColor("#7B1FA2")),
    ("INNERGRID",     (0,0), (-1,-1), 0.4, colors.HexColor("#CE93D8")),
    ("TOPPADDING",    (0,0), (-1,-1), 5),
    ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING",   (0,0), (-1,-1), 6),
    ("VALIGN",        (0,0), (-1,-1), "TOP"),
]))
story.append(comp_table)
story.append(spacer(0.25))

story.append(subheading("Pathological Features (Robbins & Kumar)"))
story.append(bullet("Growth failure is universal in both forms"))
story.append(bullet("Kwashiorkor: <b>fatty change in the liver</b> due to decreased apolipoprotein B synthesis, impairing VLDL assembly"))
story.append(bullet("Peripheral oedema in kwashiorkor is caused by <b>hypoalbuminaemia reducing plasma oncotic pressure</b>"))
story.append(bullet("Marasmus: severe atrophy of all organs except brain (brain-sparing effect in early disease)"))
story.append(bullet("Both: thymic and lymphoid atrophy, impaired cell-mediated immunity - increased susceptibility to infection"))
story.append(spacer(0.2))

story.append(green_box(
    "Prevention Strategies - PEM",
    [
        "Promotion and support of exclusive breastfeeding for 6 months",
        "Introduction of diversified complementary foods rich in protein (legumes, eggs, dairy)",
        "Ready-to-use therapeutic food (RUTF) for treatment of severe acute malnutrition",
        "Community-based nutritional surveillance and growth monitoring",
        "Nutrition education programmes targeting mothers and caregivers",
        "Food security policies and social protection programmes for vulnerable populations",
        "WHO/UNICEF Integrated Management of Acute Malnutrition (IMAM) protocol",
    ]
))
story.append(spacer(0.4))

# ============================================================
# SECTION 2 - VITAMIN A DEFICIENCY
# ============================================================
story.append(PageBreak())
story.append(section_banner("2. VITAMIN A DEFICIENCY", colors.HexColor("#E65100")))
story.append(spacer(0.2))

story.append(para(
    "<b>Vitamin A (Retinol)</b> is a fat-soluble vitamin essential for vision (synthesis of rhodopsin), "
    "epithelial integrity, immune function, and embryonic development. It is the "
    "<b>leading preventable cause of childhood blindness</b> worldwide, affecting an estimated "
    "250,000-500,000 children annually, half of whom die within a year of going blind."
))
story.append(spacer(0.15))

story.append(subheading("Aetiology & At-Risk Groups"))
story.append(bullet("Dietary deficiency: inadequate intake of animal products (liver, eggs, dairy) and dark green/orange vegetables"))
story.append(bullet("Fat malabsorption: celiac disease, cystic fibrosis, cholestatic liver disease"))
story.append(bullet("Children 6 months to 5 years in Sub-Saharan Africa and South/Southeast Asia"))
story.append(bullet("Pregnant and lactating women"))
story.append(spacer(0.15))

story.append(subheading("Clinical Manifestations (WHO Classification)"))
ocular_data = [
    [Paragraph("<b>Stage</b>", TABLE_HEADER), Paragraph("<b>Feature</b>", TABLE_HEADER), Paragraph("<b>Reversibility</b>", TABLE_HEADER)],
    [Paragraph("XN", TABLE_CELL_C), Paragraph("Night blindness (nyctalopia) - earliest sign", TABLE_CELL), Paragraph("Reversible", TABLE_CELL_C)],
    [Paragraph("X1A", TABLE_CELL_C), Paragraph("Conjunctival xerosis (dryness)", TABLE_CELL), Paragraph("Reversible", TABLE_CELL_C)],
    [Paragraph("X1B", TABLE_CELL_C), Paragraph("Bitot's spots (foamy triangular patches on bulbar conjunctiva)", TABLE_CELL), Paragraph("Reversible", TABLE_CELL_C)],
    [Paragraph("X2", TABLE_CELL_C), Paragraph("Corneal xerosis", TABLE_CELL), Paragraph("Reversible", TABLE_CELL_C)],
    [Paragraph("X3A", TABLE_CELL_C), Paragraph("Corneal ulceration < 1/3 cornea", TABLE_CELL), Paragraph("Partially reversible", TABLE_CELL_C)],
    [Paragraph("X3B", TABLE_CELL_C), Paragraph("Keratomalacia - corneal liquefaction", TABLE_CELL), Paragraph("<b>Irreversible - blindness</b>", TABLE_CELL_C)],
]
ot = Table(ocular_data, colWidths=[2.5*cm, 10*cm, 4.5*cm])
ot.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,0), colors.HexColor("#E65100")),
    ("ROWBACKGROUNDS",(0,1), (-1,-1), [colors.HexColor("#FFF3E0"), colors.white]),
    ("BOX",           (0,0), (-1,-1), 1, colors.HexColor("#E65100")),
    ("INNERGRID",     (0,0), (-1,-1), 0.4, colors.HexColor("#FFCC80")),
    ("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(ot)
story.append(spacer(0.15))

story.append(subheading("Systemic Effects"))
story.append(bullet("Squamous metaplasia of respiratory, GI, and urinary tract epithelium - increased infection risk"))
story.append(bullet("Impaired T-cell differentiation and reduced NK cell activity"))
story.append(bullet("Impaired growth in children"))
story.append(bullet("Increased severity of measles and other childhood infections"))
story.append(spacer(0.2))

story.append(green_box(
    "Prevention Strategies - Vitamin A Deficiency",
    [
        "High-dose vitamin A supplementation (100,000-200,000 IU) given to children 6-59 months twice yearly",
        "Vitamin A supplementation to mothers within 6 weeks postpartum in deficient areas",
        "Fortification of commonly consumed foods: sugar, cooking oil, margarine, flour",
        "Promotion of dietary diversification - dark green leafy vegetables, orange/yellow fruits",
        "Golden Rice biofortification programme (in development)",
        "Promotion of exclusive breastfeeding (breast milk is a significant source of vitamin A)",
        "WHO/UNICEF vitamin A supplementation programme in conjunction with childhood immunisation",
    ]
))
story.append(spacer(0.4))

# ============================================================
# SECTION 3 - IODINE DEFICIENCY
# ============================================================
story.append(PageBreak())
story.append(section_banner("3. IODINE DEFICIENCY DISORDERS (IDD)", TEAL))
story.append(spacer(0.2))

story.append(para(
    "Iodine is an essential trace mineral required for synthesis of thyroid hormones (T3 and T4). "
    "Iodine deficiency is the <b>most common preventable cause of intellectual disability worldwide</b>. "
    "It affects an estimated 2 billion people, particularly in mountainous regions and areas distant from the ocean. "
    "The spectrum of iodine deficiency disorders (IDD) includes goitre, hypothyroidism, and cretinism."
))
story.append(spacer(0.15))

story.append(subheading("Spectrum of Iodine Deficiency Disorders"))
idd_data = [
    [Paragraph("Stage / Form", TABLE_HEADER), Paragraph("Population", TABLE_HEADER), Paragraph("Key Features", TABLE_HEADER)],
    [Paragraph("Goitre", TABLE_CELL), Paragraph("All ages", TABLE_CELL), Paragraph("Thyroid enlargement due to TSH-driven hyperplasia; may cause compressive symptoms", TABLE_CELL)],
    [Paragraph("Hypothyroidism", TABLE_CELL), Paragraph("Adults", TABLE_CELL), Paragraph("Fatigue, weight gain, cold intolerance, myxoedema, decreased metabolic rate", TABLE_CELL)],
    [Paragraph("Cretinism (Congenital IDD)", TABLE_CELL), Paragraph("Neonates / infants", TABLE_CELL), Paragraph("Intellectual disability, short stature, coarse facies, protruding tongue, umbilical hernia, deafness", TABLE_CELL)],
    [Paragraph("Subclinical hypothyroidism", TABLE_CELL), Paragraph("Adults", TABLE_CELL), Paragraph("Elevated TSH, normal T4; fatigue, mild cognitive impairment", TABLE_CELL)],
    [Paragraph("Foetal loss / stillbirth", TABLE_CELL), Paragraph("Pregnant women", TABLE_CELL), Paragraph("Severe deficiency in pregnancy leads to miscarriage, preterm birth, stillbirth", TABLE_CELL)],
]
it = Table(idd_data, colWidths=[4.2*cm, 3.8*cm, 9*cm])
it.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,0), TEAL),
    ("ROWBACKGROUNDS",(0,1), (-1,-1), [LIGHT_TEAL, colors.white]),
    ("BOX",           (0,0), (-1,-1), 1, TEAL),
    ("INNERGRID",     (0,0), (-1,-1), 0.4, colors.HexColor("#80CBC4")),
    ("TOPPADDING",    (0,0), (-1,-1), 5), ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING",   (0,0), (-1,-1), 6), ("VALIGN", (0,0), (-1,-1), "TOP"),
]))
story.append(it)
story.append(spacer(0.15))

story.append(subheading("Pathophysiology"))
story.append(bullet("Low iodine intake -> reduced T3/T4 synthesis -> increased TSH secretion by pituitary"))
story.append(bullet("Chronic TSH stimulation causes thyroid follicular cell hyperplasia and colloid accumulation -> goitre"))
story.append(bullet("During pregnancy, foetal T4 depends on maternal iodine; severe deficiency causes irreversible neurological damage"))
story.append(spacer(0.2))

story.append(green_box(
    "Prevention Strategies - Iodine Deficiency",
    [
        "Universal salt iodisation (USI) - most cost-effective intervention; target of 15-40 ppm potassium iodate",
        "Iodine supplementation (oral or intramuscular) in highly deficient areas not yet reached by USI",
        "Iodine supplementation in pregnancy and lactation (WHO recommends 250 mcg/day)",
        "Iodisation of irrigation water in severely deficient regions",
        "Regular monitoring of urinary iodine concentration (UIC) to assess population status",
        "Public education on dietary iodine sources (seafood, dairy, iodised salt)",
    ]
))
story.append(spacer(0.4))

# ============================================================
# SECTION 4 - IRON DEFICIENCY ANAEMIA
# ============================================================
story.append(section_banner("4. IRON DEFICIENCY ANAEMIA (IDA)", colors.HexColor("#B71C1C")))
story.append(spacer(0.2))

story.append(para(
    "<b>Iron deficiency anaemia</b> is the most common nutritional deficiency globally, "
    "affecting over <b>1.6 billion people</b> (WHO). It is particularly prevalent among "
    "preschool children, pregnant women, and women of reproductive age in low-income countries. "
    "Iron deficiency reduces haemoglobin synthesis, resulting in <b>hypochromic microcytic anaemia</b>."
))
story.append(spacer(0.15))

story.append(subheading("Causes"))
story.append(bullet("<b>Inadequate intake:</b> low dietary iron (especially haem iron from animal sources)"))
story.append(bullet("<b>Increased demand:</b> pregnancy, lactation, rapid growth in infancy/adolescence"))
story.append(bullet("<b>Chronic blood loss:</b> menorrhagia, GI bleeding (hookworm, peptic ulcer, colorectal carcinoma)"))
story.append(bullet("<b>Malabsorption:</b> coeliac disease, gastric bypass, achlorhydria"))
story.append(spacer(0.15))

story.append(subheading("Stages of Iron Deficiency"))
stage_data = [
    [Paragraph("Stage", TABLE_HEADER), Paragraph("Iron Stores", TABLE_HEADER), Paragraph("Serum Iron", TABLE_HEADER), Paragraph("TIBC", TABLE_HEADER), Paragraph("Haemoglobin", TABLE_HEADER)],
    ["1 - Pre-latent", "Depleted", "Normal", "Normal", "Normal"],
    ["2 - Latent", "Absent", "Reduced", "Increased", "Normal"],
    ["3 - IDA", "Absent", "Reduced", "Increased", "Reduced"],
]
sd = [[Paragraph(c if isinstance(c, str) else c.text, TABLE_CELL_C if i > 0 else TABLE_CELL) if isinstance(c, str) else c
       for c in row] for i, row in enumerate(stage_data)]
sd[0] = stage_data[0]
for i in range(1, len(stage_data)):
    sd[i] = [Paragraph(c, TABLE_CELL_C) for c in stage_data[i]]

st_t = Table(sd, colWidths=[3.5*cm, 3.4*cm, 3.4*cm, 3.4*cm, 3.3*cm])
st_t.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,0), colors.HexColor("#B71C1C")),
    ("ROWBACKGROUNDS",(0,1), (-1,-1), [colors.HexColor("#FFEBEE"), colors.white]),
    ("BOX",           (0,0), (-1,-1), 1, colors.HexColor("#B71C1C")),
    ("INNERGRID",     (0,0), (-1,-1), 0.4, colors.HexColor("#EF9A9A")),
    ("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(st_t)
story.append(spacer(0.15))

story.append(subheading("Clinical Features"))
story.append(bullet("General: fatigue, pallor, exertional dyspnoea, palpitations, reduced work capacity"))
story.append(bullet("Epithelial: koilonychia (spoon-shaped nails), angular stomatitis, glossitis, brittle hair/nails"))
story.append(bullet("Neurological: impaired cognitive development in children, poor school performance"))
story.append(bullet("Pica (geophagia): craving for non-food items - a distinctive feature"))
story.append(bullet("Plummer-Vinson syndrome: IDA + oesophageal web + glossitis (rare)"))
story.append(spacer(0.2))

story.append(green_box(
    "Prevention Strategies - Iron Deficiency Anaemia",
    [
        "Food fortification: iron fortification of wheat flour, rice, and staple cereals (WHO-endorsed)",
        "Iron supplementation: daily iron-folic acid tablets in pregnancy; weekly supplements for adolescent girls",
        "Promotion of dietary diversification: haem iron from meat, fish; non-haem iron from legumes and leafy greens",
        "Vitamin C co-ingestion to enhance non-haem iron absorption",
        "Avoidance of inhibitors: limit tea/coffee with meals (tannins reduce absorption)",
        "Control of hookworm and other intestinal parasites (mass deworming programmes)",
        "Delayed cord clamping at birth - increases neonatal iron stores",
        "Promotion of breastfeeding and appropriate weaning with iron-rich foods",
    ]
))
story.append(spacer(0.4))

# ============================================================
# SECTION 5 - VITAMIN D DEFICIENCY
# ============================================================
story.append(PageBreak())
story.append(section_banner("5. VITAMIN D DEFICIENCY (RICKETS / OSTEOMALACIA)", colors.HexColor("#F57F17")))
story.append(spacer(0.2))

story.append(para(
    "<b>Vitamin D</b> is a fat-soluble prohormone synthesised in the skin on exposure to UVB radiation "
    "(cholecalciferol, D3) and obtained from dietary sources. It undergoes hepatic hydroxylation to "
    "25-hydroxyvitamin D [25(OH)D], then renal hydroxylation to the active form "
    "<b>1,25-dihydroxyvitamin D [calcitriol]</b>, which promotes intestinal calcium and phosphate absorption. "
    "Deficiency causes <b>Rickets</b> in children (before growth plate fusion) and "
    "<b>Osteomalacia</b> in adults (defective mineralisation of mature bone)."
))
story.append(spacer(0.15))

story.append(subheading("Clinical Features - Rickets (Children)"))
story.append(bullet("<b>Rachitic rosary</b> - swelling at costochondral junctions creating a 'string of beads'"))
story.append(bullet("<b>Craniotabes</b> - softening and thinning of the skull in infants"))
story.append(bullet("<b>Frontal bossing</b> and delayed fontanelle closure"))
story.append(bullet("<b>Genu varum (bow legs)</b> or genu valgum (knock-knees) - lower limb deformities"))
story.append(bullet("<b>Harrison's sulcus</b> - horizontal groove along the lower chest wall"))
story.append(bullet("Widened wrists and ankles; delayed dentition; growth failure"))
story.append(spacer(0.15))

story.append(subheading("Clinical Features - Osteomalacia (Adults)"))
story.append(bullet("Diffuse bone pain and tenderness, particularly in pelvis, spine, and lower limbs"))
story.append(bullet("Proximal muscle weakness and fatigue"))
story.append(bullet("<b>Looser zones (Milkman fractures)</b> - pseudofractures on X-ray"))
story.append(bullet("Pelvic deformity - may cause obstructed labour in females"))
story.append(spacer(0.15))

story.append(subheading("Laboratory Findings in Vitamin D Deficiency"))
lab_data = [
    [Paragraph("Parameter", TABLE_HEADER), Paragraph("Finding", TABLE_HEADER), Paragraph("Note", TABLE_HEADER)],
    ["Serum 25(OH)D", "< 20 ng/mL (deficiency)", "Gold standard test"],
    ["Serum calcium", "Low or normal", "Secondary hyperparathyroidism maintains Ca"],
    ["Serum phosphate", "Low", "PTH promotes renal phosphate wasting"],
    ["ALP (alkaline phosphatase)", "Elevated", "Reflects active osteoblastic activity"],
    ["PTH", "Elevated (secondary)", "Compensatory response to low Ca"],
    ["Urine calcium", "Low (hypocalciuria)", "Reduced intestinal absorption + renal reabsorption"],
]
ld = [[Paragraph(c, TABLE_CELL if i > 0 else TABLE_HEADER) for c in row] for i, row in enumerate(lab_data)]
ld[0] = [Paragraph(c, TABLE_HEADER) for c in lab_data[0]]

lt = Table(ld, colWidths=[5*cm, 5*cm, 7*cm])
lt.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,0), colors.HexColor("#F57F17")),
    ("ROWBACKGROUNDS",(0,1), (-1,-1), [colors.HexColor("#FFF9C4"), colors.white]),
    ("BOX",           (0,0), (-1,-1), 1, colors.HexColor("#F9A825")),
    ("INNERGRID",     (0,0), (-1,-1), 0.4, colors.HexColor("#FFE082")),
    ("TOPPADDING",    (0,0), (-1,-1), 5), ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING",   (0,0), (-1,-1), 6), ("VALIGN", (0,0), (-1,-1), "TOP"),
]))
story.append(lt)
story.append(spacer(0.2))

story.append(green_box(
    "Prevention Strategies - Vitamin D Deficiency",
    [
        "Adequate sun exposure: 15-30 min of midday sun on face and arms, 2-3 times per week",
        "Dietary sources: oily fish, egg yolk, fortified dairy products and cereals",
        "Vitamin D supplementation: 400 IU/day for infants 0-12 months (all breastfed infants)",
        "600-800 IU/day for adults; 800-2000 IU/day for elderly and high-risk groups",
        "Fortification of milk, margarine, and orange juice with Vitamin D3",
        "Routine screening of high-risk groups: dark-skinned individuals in low-sun areas, veiled women",
        "Supplementation in pregnancy to prevent neonatal rickets",
    ]
))
story.append(spacer(0.4))

# ============================================================
# SECTION 6 - SCURVY
# ============================================================
story.append(section_banner("6. SCURVY (VITAMIN C DEFICIENCY)", colors.HexColor("#1B5E20")))
story.append(spacer(0.2))

story.append(para(
    "<b>Vitamin C (Ascorbic acid)</b> is a water-soluble antioxidant essential for collagen synthesis "
    "(hydroxylation of proline and lysine in collagen), iron absorption, catecholamine synthesis, and "
    "immune function. Scurvy develops after approximately <b>1-3 months</b> of severely deficient intake "
    "(< 10 mg/day). At-risk groups include infants fed only cow's milk, elderly people with restricted diets, "
    "alcoholics, and prisoners."
))
story.append(spacer(0.15))

story.append(subheading("Pathophysiology"))
story.append(bullet("Defective collagen synthesis -> impaired wound healing, weakened blood vessel walls"))
story.append(bullet("Capillary fragility leads to <b>perifollicular haemorrhages</b> (classic sign) and ecchymoses"))
story.append(bullet("Impaired osteoid formation -> periosteal haemorrhages, growth failure in children"))
story.append(spacer(0.15))

story.append(subheading("Clinical Features"))
story.append(bullet("<b>Perifollicular haemorrhages</b> - most characteristic sign; petechiae around hair follicles with coiled (corkscrew) hairs"))
story.append(bullet("<b>Spongy, bleeding gums</b> with gingivitis (only in those with teeth)"))
story.append(bullet("Impaired wound healing and wound dehiscence"))
story.append(bullet("Subperiosteal haemorrhages - painful tender bones, especially in children"))
story.append(bullet("Anaemia (due to poor iron absorption and bleeding)"))
story.append(bullet("'Sabre tibia' and rosary of scorbutic beads at costochondral junctions in children"))
story.append(bullet("Psychological symptoms: irritability, depression"))
story.append(spacer(0.2))

story.append(green_box(
    "Prevention Strategies - Scurvy",
    [
        "Dietary diversification: citrus fruits (lemon, orange, lime), guava, kiwi, bell peppers, strawberries",
        "Minimum dietary requirement: 10 mg/day (prevention); RDA is 65-90 mg/day",
        "Supplementation (500-1000 mg/day) for at-risk groups: elderly, alcoholics, food-restricted individuals",
        "Food fortification programmes in institutional settings (prisons, long-term care facilities)",
        "Antenatal care education on vitamin C-rich food intake",
        "Avoid prolonged cooking of vegetables - destroys vitamin C",
    ]
))
story.append(spacer(0.4))

# ============================================================
# SECTION 7 - THIAMINE / B-VITAMINS
# ============================================================
story.append(PageBreak())
story.append(section_banner("7. B-VITAMIN DEFICIENCIES", colors.HexColor("#004D40")))
story.append(spacer(0.2))

bvit_data = [
    [Paragraph("Vitamin", TABLE_HEADER), Paragraph("Deficiency Syndrome", TABLE_HEADER), Paragraph("Key Clinical Features", TABLE_HEADER), Paragraph("At-Risk Groups", TABLE_HEADER)],
    ["Thiamine (B1)", "Beriberi; Wernicke-Korsakoff", "Wet beriberi: HF, peripheral oedema; Dry beriberi: peripheral neuropathy; Wernicke: ophthalmoplegia, ataxia, confusion; Korsakoff: amnesia", "Alcoholics, extreme diet, gastric bypass"],
    ["Riboflavin (B2)", "Ariboflavinosis", "Angular stomatitis, cheilitis, glossitis (magenta tongue), corneal vascularisation", "Poverty, alcohol, malabsorption"],
    ["Niacin (B3)", "Pellagra", "The 3 Ds: Dermatitis, Diarrhoea, Dementia (+/- Death); Casal's necklace rash", "Maize-based diets (low tryptophan)"],
    ["Pyridoxine (B6)", "B6 deficiency", "Peripheral neuropathy, stomatitis, microcytic anaemia, seizures in neonates", "Alcoholics, INH therapy, malabsorption"],
    ["Folate (B9)", "Megaloblastic anaemia; NTDs", "Macrocytic anaemia; Neural tube defects in foetus (anencephaly, spina bifida)", "Pregnant women, alcoholics, malabsorption"],
    ["Cobalamin (B12)", "Subacute combined degeneration", "Megaloblastic anaemia + subacute combined degeneration of spinal cord (B12-specific), peripheral neuropathy", "Vegans, pernicious anaemia, elderly"],
]

bv = [[Paragraph(c, TABLE_CELL) for c in row] for row in bvit_data]
bv[0] = [Paragraph(c, TABLE_HEADER) for c in bvit_data[0]]

bvt = Table(bv, colWidths=[3*cm, 4*cm, 6*cm, 4*cm])
bvt.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,0), colors.HexColor("#004D40")),
    ("ROWBACKGROUNDS",(0,1), (-1,-1), [LIGHT_TEAL, colors.white]),
    ("BOX",           (0,0), (-1,-1), 1, colors.HexColor("#00695C")),
    ("INNERGRID",     (0,0), (-1,-1), 0.4, colors.HexColor("#80CBC4")),
    ("TOPPADDING",    (0,0), (-1,-1), 5), ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING",   (0,0), (-1,-1), 5), ("VALIGN", (0,0), (-1,-1), "TOP"),
]))
story.append(bvt)
story.append(spacer(0.2))

story.append(green_box(
    "Prevention Strategies - B-Vitamin Deficiencies",
    [
        "Folate: periconceptional folic acid supplementation (0.4-5 mg/day) to prevent neural tube defects",
        "Folate fortification of flour (mandatory in many countries)",
        "Thiamine: adequate dietary intake; supplementation for all patients with alcohol use disorder",
        "Niacin: dietary diversification away from maize monoculture; niacin fortification of staples",
        "B12: supplementation for all vegans and vegetarians; B12 injections for pernicious anaemia",
        "Pyridoxine: prophylactic B6 for patients on isoniazid (INH) therapy for TB",
    ]
))
story.append(spacer(0.4))

# ============================================================
# SECTION 8 - OBESITY
# ============================================================
story.append(section_banner("8. OBESITY & OVERNUTRITION", colors.HexColor("#880E4F")))
story.append(spacer(0.2))

story.append(para(
    "Obesity (BMI >= 30 kg/m²) represents the overnutrition end of the nutritional spectrum and has reached "
    "epidemic proportions globally. The WHO estimates over <b>650 million adults</b> are obese and over "
    "<b>1.9 billion are overweight</b>. Obesity is a major driver of metabolic syndrome, type 2 diabetes, "
    "cardiovascular disease, and multiple cancers."
))
story.append(spacer(0.15))

story.append(subheading("BMI Classification (WHO)"))
bmi_data = [
    [Paragraph("Category", TABLE_HEADER), Paragraph("BMI (kg/m²)", TABLE_HEADER), Paragraph("Health Risk", TABLE_HEADER)],
    ["Underweight", "< 18.5", "Increased (malnutrition)"],
    ["Normal weight", "18.5 - 24.9", "Lowest"],
    ["Overweight", "25.0 - 29.9", "Mildly increased"],
    ["Obese Class I", "30.0 - 34.9", "Moderate"],
    ["Obese Class II", "35.0 - 39.9", "Severe"],
    ["Obese Class III (Morbid)", ">= 40", "Very severe"],
]
bmi_t_data = [[Paragraph(c, TABLE_CELL_C if i > 0 else TABLE_HEADER) for c in row] for i, row in enumerate(bmi_data)]
bmi_t_data[0] = [Paragraph(c, TABLE_HEADER) for c in bmi_data[0]]

bmi_t = Table(bmi_t_data, colWidths=[5.5*cm, 5.5*cm, 6*cm])
bmi_t.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,0), colors.HexColor("#880E4F")),
    ("ROWBACKGROUNDS",(0,1), (-1,-1), [colors.HexColor("#FCE4EC"), colors.white]),
    ("BOX",           (0,0), (-1,-1), 1, colors.HexColor("#AD1457")),
    ("INNERGRID",     (0,0), (-1,-1), 0.4, colors.HexColor("#F48FB1")),
    ("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(bmi_t)
story.append(spacer(0.15))

story.append(subheading("Health Consequences of Obesity"))
story.append(bullet("<b>Metabolic syndrome</b>: central obesity + insulin resistance + dyslipidaemia + hypertension"))
story.append(bullet("<b>Type 2 diabetes</b>: adipokine dysregulation promotes insulin resistance"))
story.append(bullet("<b>Cardiovascular disease</b>: coronary artery disease, hypertension, stroke, heart failure"))
story.append(bullet("<b>Non-alcoholic fatty liver disease (NAFLD)</b> and its progression to NASH, cirrhosis"))
story.append(bullet("<b>Cancer</b>: increased risk of endometrial, breast, colorectal, oesophageal, renal, pancreatic"))
story.append(bullet("<b>Obstructive sleep apnoea</b> and obesity hypoventilation syndrome"))
story.append(bullet("<b>Osteoarthritis</b>, PCOS, gallstones, and pregnancy complications"))
story.append(spacer(0.2))

story.append(green_box(
    "Prevention Strategies - Obesity",
    [
        "Population-level dietary guidelines: limit ultra-processed foods, added sugars, saturated fats",
        "Promotion of physical activity: WHO recommends 150-300 min/week of moderate-intensity exercise",
        "Sugar-sweetened beverage taxation (proven effective in multiple countries)",
        "Front-of-pack food labelling (traffic light system) to guide consumer choices",
        "Restriction of junk food advertising to children",
        "School-based interventions: healthy canteen policies, physical education",
        "Medical management: behavioural counselling, pharmacotherapy (orlistat, GLP-1 agonists like semaglutide)",
        "Bariatric surgery for BMI >= 40 (or >= 35 with comorbidities)",
    ]
))
story.append(spacer(0.4))

# ============================================================
# SECTION 9 - QUICK REFERENCE SUMMARY TABLE
# ============================================================
story.append(PageBreak())
story.append(section_banner("9. RAPID REVISION: KEY FACTS FOR EXAMINATIONS", DARK_BLUE))
story.append(spacer(0.2))

qr_data = [
    [Paragraph("Disorder", TABLE_HEADER),
     Paragraph("Pathognomonic / Buzzword", TABLE_HEADER),
     Paragraph("Lab Hallmark", TABLE_HEADER),
     Paragraph("Key Prevention", TABLE_HEADER)],
    ["Kwashiorkor", "Fatty liver + oedema + flaky paint skin", "Low albumin; lipid accumulation in liver", "Protein-rich weaning foods"],
    ["Marasmus", "'Old man face'; brain-sparing; no oedema", "Low all indices; preserved albumin", "Caloric supplementation (RUTF)"],
    ["Vitamin A", "Bitot's spots; keratomalacia; night blindness", "Low serum retinol", "Biannual high-dose supplementation"],
    ["Iodine", "Endemic goitre; cretinism", "Low UIC; raised TSH; low T4", "Universal salt iodisation"],
    ["Iron (IDA)", "Koilonychia; pica; Plummer-Vinson", "Low ferritin; low MCHC; high TIBC", "Iron fortification; deworming"],
    ["Vitamin D", "Rachitic rosary; Looser zones", "Low 25(OH)D; low PO4; high ALP; high PTH", "Sun exposure; D3 supplementation"],
    ["Scurvy", "Perifollicular haemorrhages; corkscrew hairs", "Low plasma ascorbate; prolonged PT", "Citrus fruits; 65-90 mg/day Vit C"],
    ["Pellagra", "3 Ds: Dermatitis, Diarrhoea, Dementia", "Low urinary N-methyl nicotinamide", "Niacin fortification; dietary diversification"],
    ["Folate/B12", "Megaloblastic anaemia; NTDs (folate)", "Raised MCV; hypersegmented neutrophils", "Periconceptional folate; B12 injections"],
    ["Thiamine", "Wernicke triad: ophthalmoplegia, ataxia, confusion", "Low RBC transketolase activity", "Thiamine supplementation in alcoholics"],
    ["Obesity", "Metabolic syndrome; NAFLD; increased cancer risk", "High BMI, HbA1c, LDL, ALT", "Diet + exercise; GLP-1 agonists; surgery"],
]

qr_t = [[Paragraph(c, TABLE_CELL if i > 0 else TABLE_HEADER) for c in row] for i, row in enumerate(qr_data)]
qr_t[0] = [Paragraph(c, TABLE_HEADER) for c in qr_data[0]]

qrt = Table(qr_t, colWidths=[3.8*cm, 5*cm, 4.2*cm, 4*cm])
qrt.setStyle(TableStyle([
    ("BACKGROUND",    (0,0), (-1,0), DARK_BLUE),
    ("ROWBACKGROUNDS",(0,1), (-1,-1), [LIGHT_GREY, colors.white]),
    ("BOX",           (0,0), (-1,-1), 1, MID_BLUE),
    ("INNERGRID",     (0,0), (-1,-1), 0.4, colors.HexColor("#BDC3C7")),
    ("TOPPADDING",    (0,0), (-1,-1), 5), ("BOTTOMPADDING", (0,0), (-1,-1), 5),
    ("LEFTPADDING",   (0,0), (-1,-1), 5), ("VALIGN", (0,0), (-1,-1), "TOP"),
]))
story.append(qrt)
story.append(spacer(0.4))

# ============================================================
# SECTION 10 - GLOBAL PUBLIC HEALTH STRATEGIES
# ============================================================
story.append(section_banner("10. GLOBAL PUBLIC HEALTH STRATEGIES", GREEN))
story.append(spacer(0.2))

story.append(para(
    "The following nutrition interventions are recognised as among the most cost-effective public health "
    "measures available (Copenhagen Consensus, WHO, World Bank):"
))
story.append(spacer(0.1))

strategies = [
    ("Universal Salt Iodisation (USI)", "Eliminates IDD; target 15-40 ppm iodate; > 90% coverage in many countries."),
    ("Vitamin A Supplementation (VAS)", "WHO/UNICEF programme; biannual high-dose capsules for children 6-59 months; reduces under-5 mortality by 12-24%."),
    ("Iron and Folic Acid Supplementation", "Antenatal IFA supplements; weekly IFA for adolescent girls; dramatically reduces anaemia and NTD prevalence."),
    ("Food Fortification", "Staple food fortification (flour, rice, oil, sugar) with iron, vitamin A, D, folic acid, B12 - reaches entire population."),
    ("Exclusive Breastfeeding Promotion", "Protects against malnutrition and micronutrient deficiency in infants 0-6 months."),
    ("Deworming Programmes", "Mass drug administration in endemic areas - reduces iron loss and improves nutritional status."),
    ("Biofortification", "Developing micronutrient-enriched crop varieties (Orange Sweet Potato for Vit A; iron-biofortified beans/wheat)."),
    ("Community-Based Management", "IMAM protocol for severe acute malnutrition using RUTF; outpatient model has transformed outcomes."),
]

for title, desc in strategies:
    row_data = [[
        Paragraph(f"<b>{title}</b>", S("ST", fontSize=10, fontName="Helvetica-Bold", textColor=DARK_BLUE, leading=14)),
        Paragraph(desc, BODY),
    ]]
    rt = Table(row_data, colWidths=[5*cm, 12*cm])
    rt.setStyle(TableStyle([
        ("BACKGROUND",    (0,0), (0,0), LIGHT_GREEN),
        ("BACKGROUND",    (1,0), (1,0), colors.white),
        ("BOX",           (0,0), (-1,-1), 0.5, colors.HexColor("#A5D6A7")),
        ("TOPPADDING",    (0,0), (-1,-1), 6), ("BOTTOMPADDING", (0,0), (-1,-1), 6),
        ("LEFTPADDING",   (0,0), (-1,-1), 8), ("VALIGN", (0,0), (-1,-1), "TOP"),
    ]))
    story.append(rt)
    story.append(Spacer(1, 2))

story.append(spacer(0.3))

# -------- FOOTER / REFERENCES --------
story.append(hr(DARK_BLUE, 1.5))
story.append(Paragraph(
    "<b>References & Sources:</b> Robbins & Kumar Basic Pathology (10th ed.) | Robbins, Cotran & Kumar Pathologic "
    "Basis of Disease (10th ed.) | Park's Textbook of Preventive and Social Medicine (25th ed.) | "
    "Lippincott Illustrated Reviews: Biochemistry (8th ed.) | Harrison's Principles of Internal Medicine (22nd ed.) | "
    "WHO Nutrition Guidelines (2024) | Goodman & Gilman's Pharmacological Basis of Therapeutics",
    S("Ref", fontSize=8, fontName="Helvetica-Oblique", textColor=MID_GREY, leading=11, spaceAfter=4)
))
story.append(Paragraph(
    "This document is prepared for medical student educational use. Always verify clinical decisions "
    "against current institutional guidelines and standard textbooks.",
    S("Disclaimer", fontSize=8, fontName="Helvetica-Oblique", textColor=colors.HexColor("#C0392B"),
      leading=11, spaceAfter=2)
))

# ============================================================
# Build
# ============================================================
def add_page_number(canvas, doc):
    canvas.saveState()
    canvas.setFont("Helvetica", 8)
    canvas.setFillColor(MID_GREY)
    page_num = canvas.getPageNumber()
    text = f"Nutritional Disorders Summary  |  Page {page_num}  |  For Medical Students"
    canvas.drawCentredString(A4[0] / 2.0, 1.2*cm, text)
    canvas.restoreState()

doc.build(story, onFirstPage=add_page_number, onLaterPages=add_page_number)
print(f"PDF created at: {OUTPUT}")
print(f"File size: {os.path.getsize(OUTPUT):,} bytes")
Running Command

cd /tmp/workspace/nutritional-disorders && python generate_pdf.py 2>&1

Editing File

~/nutritional-disorders/generate_pdf.py

Successfully replaced 1 instance(s) of the string in '/tmp/workspace/nutritional-disorders/generate_pdf.py'
Editing File

~/nutritional-disorders/generate_pdf.py

Successfully replaced 1 instance(s) of the string in '/tmp/workspace/nutritional-disorders/generate_pdf.py'
Editing File

~/nutritional-disorders/generate_pdf.py

Successfully replaced 1 instance(s) of the string in '/tmp/workspace/nutritional-disorders/generate_pdf.py'
Running Command

cd /tmp/workspace/nutritional-disorders && python generate_pdf.py 2>&1

Editing File

~/nutritional-disorders/generate_pdf.py

Successfully replaced 1 instance(s) of the string in '/tmp/workspace/nutritional-disorders/generate_pdf.py'
Running Command

cd /tmp/workspace/nutritional-disorders && python generate_pdf.py 2>&1

Editing File

~/nutritional-disorders/generate_pdf.py

Successfully replaced 1 instance(s) of the string in '/tmp/workspace/nutritional-disorders/generate_pdf.py'
Running Command

cd /tmp/workspace/nutritional-disorders && python generate_pdf.py 2>&1

Your PDF summary document is ready for download:

Nutritional Disorders Summary

PDF Document · PDF


What's inside the document (10 sections, A4, colour-coded):
SectionContent
Cover + IntroductionScope, sources, intended audience
Overview TableAll 10 disorders at a glance - type, nutrient deficit, key consequence
1. Protein-Energy MalnutritionMarasmus vs Kwashiorkor comparison table, pathological features, prevention
2. Vitamin A DeficiencyWHO xerophthalmia staging table, systemic effects, prevention
3. Iodine DeficiencyIDD spectrum table (goitre to cretinism), pathophysiology, prevention
4. Iron Deficiency Anaemia3-stage iron depletion table, clinical features, prevention
5. Vitamin D DeficiencyRickets vs osteomalacia, lab findings table, prevention
6. ScurvyPathophysiology, clinical features including perifollicular haemorrhages, prevention
7. B-Vitamin DeficienciesFull table: B1, B2, B3, B6, B9, B12 - syndromes, features, at-risk groups
8. ObesityWHO BMI classification table, health consequences, prevention
9. Rapid Revision TableBuzzwords + lab hallmarks + key prevention for all 11 disorders
10. Global Public Health StrategiesUSI, VAS, fortification, IMAM, biofortification
Sources cited: Robbins & Kumar Basic Pathology, Robbins Cotran Pathologic Basis of Disease, Park's PSM (25th ed.), Lippincott Biochemistry (8th ed.), Harrison's Internal Medicine (22nd ed.), Goodman & Gilman's Pharmacology.
This is a shared conversation. Sign in to Orris to start your own chat.