Classification of diets according to nutrients for bsc final year nutrition students a pdf on this please toooo

Reading File
Reading File
Finding Sources
Finding Sources
Searching the Web

classification of diets according to nutrients BSc nutrition

Finding Sources
Finding Sources
Searching the Web

classification of diets based on nutrients macronutrients micronutrients energy forming protective body building

Reading Web Page

https://www.fao.org/4/w0078e/w0078e08.htm

Finding Sources
Running Command

mkdir -p /home/daytona/workspace/diet-classification && ls /home/daytona/workspa…

Writing File

~/diet-classification/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 cm, mm
from reportlab.platypus import (
    SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle,
    HRFlowable, PageBreak, KeepTogether
)
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.pdfgen import canvas
from reportlab.platypus import BaseDocTemplate, Frame, PageTemplate

OUTPUT = "/home/daytona/workspace/diet-classification/Classification_of_Diets_According_to_Nutrients.pdf"

# ── Colour palette ──────────────────────────────────────────────────────────
DEEP_GREEN   = colors.HexColor("#1B5E20")
MID_GREEN    = colors.HexColor("#2E7D32")
LIGHT_GREEN  = colors.HexColor("#A5D6A7")
PALE_GREEN   = colors.HexColor("#E8F5E9")
ACCENT_GOLD  = colors.HexColor("#F9A825")
ACCENT_LIGHT = colors.HexColor("#FFF8E1")
DARK_GREY    = colors.HexColor("#263238")
MID_GREY     = colors.HexColor("#546E7A")
LIGHT_GREY   = colors.HexColor("#ECEFF1")
WHITE        = colors.white
RED_DARK     = colors.HexColor("#B71C1C")
BLUE_DARK    = colors.HexColor("#0D47A1")
BLUE_MID     = colors.HexColor("#1976D2")
BLUE_LIGHT   = colors.HexColor("#E3F2FD")
ORANGE_DARK  = colors.HexColor("#E65100")
ORANGE_LIGHT = colors.HexColor("#FFF3E0")

PAGE_W, PAGE_H = A4

# ── Header / Footer ─────────────────────────────────────────────────────────
def on_page(canv, doc):
    canv.saveState()
    # top banner
    canv.setFillColor(DEEP_GREEN)
    canv.rect(0, PAGE_H - 22*mm, PAGE_W, 22*mm, fill=1, stroke=0)
    canv.setFillColor(WHITE)
    canv.setFont("Helvetica-Bold", 9)
    canv.drawCentredString(PAGE_W/2, PAGE_H - 13*mm,
        "CLASSIFICATION OF DIETS ACCORDING TO NUTRIENTS  |  BSc Final Year Nutrition")
    # thin gold line
    canv.setFillColor(ACCENT_GOLD)
    canv.rect(0, PAGE_H - 24*mm, PAGE_W, 2*mm, fill=1, stroke=0)
    # footer
    canv.setFillColor(LIGHT_GREY)
    canv.rect(0, 0, PAGE_W, 12*mm, fill=1, stroke=0)
    canv.setFillColor(MID_GREY)
    canv.setFont("Helvetica", 7.5)
    canv.drawString(15*mm, 4*mm, "BSc Nutrition — Dietary Sciences  |  Academic Study Notes")
    canv.drawRightString(PAGE_W - 15*mm, 4*mm, f"Page {doc.page}")
    canv.restoreState()

def on_first_page(canv, doc):
    on_page(canv, doc)

# ── Styles ───────────────────────────────────────────────────────────────────
styles = getSampleStyleSheet()

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

title_s = S("TitleS", fontName="Helvetica-Bold", fontSize=22,
            textColor=WHITE, alignment=TA_CENTER, leading=28)
sub_s   = S("SubS",   fontName="Helvetica",      fontSize=11,
            textColor=LIGHT_GREEN, alignment=TA_CENTER, leading=16)

h1 = S("H1", fontName="Helvetica-Bold", fontSize=14,
        textColor=WHITE, leading=18,
        backColor=MID_GREEN, borderPad=6,
        leftIndent=0, rightIndent=0, spaceBefore=14, spaceAfter=6)
h2 = S("H2", fontName="Helvetica-Bold", fontSize=12,
        textColor=DEEP_GREEN, leading=16, spaceBefore=10, spaceAfter=4)
h3 = S("H3", fontName="Helvetica-BoldOblique", fontSize=10.5,
        textColor=MID_GREEN, leading=14, spaceBefore=8, spaceAfter=3)
body = S("Body", fontName="Helvetica", fontSize=10,
         textColor=DARK_GREY, leading=15, spaceBefore=3, spaceAfter=3,
         alignment=TA_JUSTIFY)
bullet = S("Bullet", fontName="Helvetica", fontSize=10,
           textColor=DARK_GREY, leading=14, spaceBefore=2, spaceAfter=2,
           leftIndent=14, firstLineIndent=-10)
note = S("Note", fontName="Helvetica-Oblique", fontSize=9,
         textColor=MID_GREY, leading=13, leftIndent=10, spaceBefore=4)
def_key = S("DefKey", fontName="Helvetica-Bold", fontSize=10,
            textColor=BLUE_DARK, leading=14)
callout = S("Callout", fontName="Helvetica-Bold", fontSize=10.5,
            textColor=ORANGE_DARK, leading=15, alignment=TA_CENTER)

# ── Helper builders ──────────────────────────────────────────────────────────
def section_bar(text, bg=MID_GREEN, fg=WHITE, fs=13):
    style = S("_sb", fontName="Helvetica-Bold", fontSize=fs,
              textColor=fg, backColor=bg, leading=fs+5,
              leftIndent=6, rightIndent=6, spaceBefore=14, spaceAfter=6,
              borderPad=5)
    return Paragraph(text, style)

def sub_bar(text):
    style = S("_ssb", fontName="Helvetica-Bold", fontSize=11,
              textColor=DEEP_GREEN, backColor=PALE_GREEN, leading=15,
              leftIndent=4, borderPad=4, spaceBefore=8, spaceAfter=4)
    return Paragraph(text, style)

def bp(text):
    return Paragraph(f"•  {text}", bullet)

def body_p(text):
    return Paragraph(text, body)

def key_value(key, value):
    style = S("_kv", fontName="Helvetica", fontSize=10,
              textColor=DARK_GREY, leading=14, spaceBefore=2,
              leftIndent=14)
    return Paragraph(f"<b>{key}:</b> {value}", style)

def info_box(lines, bg=BLUE_LIGHT, border=BLUE_MID):
    data = [[Paragraph(l, body)] for l in lines]
    t = Table(data, colWidths=[16*cm])
    t.setStyle(TableStyle([
        ("BACKGROUND", (0,0), (-1,-1), bg),
        ("BOX",        (0,0), (-1,-1), 0.8, border),
        ("LEFTPADDING",(0,0), (-1,-1), 10),
        ("RIGHTPADDING",(0,0),(-1,-1), 10),
        ("TOPPADDING", (0,0), (-1,-1), 6),
        ("BOTTOMPADDING",(0,0),(-1,-1), 6),
    ]))
    return t

def gold_box(lines):
    return info_box(lines, bg=ACCENT_LIGHT, border=ACCENT_GOLD)

def orange_box(lines):
    return info_box(lines, bg=ORANGE_LIGHT, border=ORANGE_DARK)

def simple_table(headers, rows, col_widths=None, hdr_bg=MID_GREEN):
    if col_widths is None:
        n = len(headers)
        col_widths = [16*cm/n]*n
    hdr_cells = [Paragraph(f"<b>{h}</b>",
                    S("_th", fontName="Helvetica-Bold", fontSize=9.5,
                      textColor=WHITE, leading=13)) for h in headers]
    table_data = [hdr_cells]
    for i, row in enumerate(rows):
        cells = [Paragraph(str(c),
                    S("_td", fontName="Helvetica", fontSize=9,
                      textColor=DARK_GREY, leading=13)) for c in row]
        table_data.append(cells)
    t = Table(table_data, colWidths=col_widths, repeatRows=1)
    row_bg = [
        ("BACKGROUND", (0,0), (-1,0), hdr_bg),
        ("GRID", (0,0), (-1,-1), 0.4, colors.HexColor("#B0BEC5")),
        ("ROWBACKGROUNDS", (0,1), (-1,-1), [WHITE, LIGHT_GREY]),
        ("LEFTPADDING",(0,0),(-1,-1), 7),
        ("RIGHTPADDING",(0,0),(-1,-1), 7),
        ("TOPPADDING",(0,0),(-1,-1), 5),
        ("BOTTOMPADDING",(0,0),(-1,-1), 5),
        ("VALIGN",(0,0),(-1,-1),"MIDDLE"),
    ]
    t.setStyle(TableStyle(row_bg))
    return t

# ── Build story ──────────────────────────────────────────────────────────────
story = []
SP = Spacer(1, 0.35*cm)
LP = Spacer(1, 0.7*cm)

# ════════════════════════════════════════════════════════════════════════════
#  COVER PAGE
# ════════════════════════════════════════════════════════════════════════════
story.append(Spacer(1, 2.8*cm))

# cover background box
cover_data = [[
    Paragraph("CLASSIFICATION OF DIETS<br/>ACCORDING TO NUTRIENTS",
        S("_ct", fontName="Helvetica-Bold", fontSize=24,
          textColor=WHITE, alignment=TA_CENTER, leading=32)),
]]
cover_t = Table(cover_data, colWidths=[17*cm])
cover_t.setStyle(TableStyle([
    ("BACKGROUND",(0,0),(-1,-1), DEEP_GREEN),
    ("BOX",(0,0),(-1,-1), 3, ACCENT_GOLD),
    ("TOPPADDING",(0,0),(-1,-1), 20),
    ("BOTTOMPADDING",(0,0),(-1,-1), 20),
    ("LEFTPADDING",(0,0),(-1,-1), 18),
    ("RIGHTPADDING",(0,0),(-1,-1), 18),
]))
story.append(cover_t)
story.append(Spacer(1, 0.5*cm))
story.append(Paragraph("Comprehensive Academic Study Notes", sub_s))
story.append(Spacer(1, 0.3*cm))
story.append(HRFlowable(width="80%", thickness=2, color=ACCENT_GOLD,
                        hAlign="CENTER"))
story.append(Spacer(1, 0.4*cm))
story.append(Paragraph("BSc Final Year — Nutrition &amp; Dietetics", sub_s))
story.append(Spacer(1, 0.5*cm))

# quick-reference badge
badge_data = [
    [Paragraph("TOPICS COVERED", S("_bt", fontName="Helvetica-Bold",
        fontSize=10, textColor=WHITE, alignment=TA_CENTER))],
    [Paragraph(
        "• Nutrient Classification Framework<br/>"
        "• Macronutrients in Detail (Carbohydrates, Proteins, Lipids)<br/>"
        "• Micronutrients (Vitamins &amp; Minerals)<br/>"
        "• Water &amp; Dietary Fibre<br/>"
        "• Functional Food Classification<br/>"
        "• Dietary Patterns &amp; Therapeutic Diets<br/>"
        "• Energy Values &amp; RDA at a Glance",
        S("_bc", fontName="Helvetica", fontSize=9.5, textColor=DARK_GREY,
          leading=16, leftIndent=6))
    ],
]
badge_t = Table(badge_data, colWidths=[14*cm])
badge_t.setStyle(TableStyle([
    ("BACKGROUND",(0,0),(0,0), MID_GREEN),
    ("BACKGROUND",(0,1),(0,1), PALE_GREEN),
    ("BOX",(0,0),(-1,-1), 1, MID_GREEN),
    ("TOPPADDING",(0,0),(-1,-1), 7),
    ("BOTTOMPADDING",(0,0),(-1,-1), 7),
    ("LEFTPADDING",(0,0),(-1,-1), 12),
    ("RIGHTPADDING",(0,0),(-1,-1), 12),
]))
story.append(badge_t)
story.append(PageBreak())

# ════════════════════════════════════════════════════════════════════════════
#  SECTION 1 — INTRODUCTION
# ════════════════════════════════════════════════════════════════════════════
story.append(section_bar("1.  INTRODUCTION TO NUTRIENTS AND DIETS"))
story.append(body_p(
    "A <b>nutrient</b> is any chemical substance in food that the body uses to sustain "
    "physiological processes — growth, energy production, repair, and regulation of "
    "metabolism. The study of how food and its components affect health is the foundation "
    "of nutrition science. For a BSc Nutrition student, understanding the classification "
    "of diets and nutrients is the first step toward clinical and community nutrition practice."
))
story.append(SP)
story.append(body_p(
    "Diets can be classified in several ways. The most academically important classification "
    "is <b>according to nutrient composition</b> — that is, by the type, quantity, and "
    "proportion of nutrients they contain. This document covers that classification "
    "systematically, from the broadest categories (macronutrients vs. micronutrients) "
    "down to individual nutrient classes, dietary patterns, and therapeutic diet modifications."
))
story.append(SP)
story.append(gold_box([
    "<b>Definition (WHO/FAO):</b> A diet is the sum of food consumed by a person, "
    "characterised by the types and amounts of food, beverages, and nutrients it provides. "
    "Classifying diets by nutrients means categorising them based on which nutrient groups "
    "are dominant, absent, or modified."
]))
story.append(LP)

# ════════════════════════════════════════════════════════════════════════════
#  SECTION 2 — PRIMARY CLASSIFICATION FRAMEWORK
# ════════════════════════════════════════════════════════════════════════════
story.append(section_bar("2.  PRIMARY CLASSIFICATION: MACRONUTRIENTS vs. MICRONUTRIENTS"))
story.append(body_p(
    "The most fundamental classification divides all nutrients into two major groups based "
    "on the quantity in which they are required by the body:"
))
story.append(SP)

# Two-column overview table
story.append(simple_table(
    ["Category", "Required Amount", "Primary Nutrients", "Main Functions"],
    [
        ["Macronutrients", "Grams per day\n(large amounts)",
         "Carbohydrates, Proteins, Lipids (Fats)", "Energy supply, structural building, metabolic regulation"],
        ["Micronutrients", "Milligrams or micrograms\n(small amounts)",
         "Vitamins, Minerals", "Enzyme cofactors, antioxidants, tissue development"],
        ["Water", "~2–3 litres/day", "Water (H₂O)", "Solvent, transport medium, thermoregulation"],
        ["Dietary Fibre", "25–38 g/day", "Non-starch polysaccharides", "Gut health, cholesterol regulation, elimination"],
    ],
    col_widths=[3.5*cm, 3.2*cm, 5*cm, 5*cm],
))
story.append(LP)

# ════════════════════════════════════════════════════════════════════════════
#  SECTION 3 — MACRONUTRIENTS
# ════════════════════════════════════════════════════════════════════════════
story.append(section_bar("3.  MACRONUTRIENTS"))

# 3.1 Carbohydrates
story.append(sub_bar("3.1  Carbohydrates"))
story.append(body_p(
    "Carbohydrates are organic molecules composed of carbon, hydrogen, and oxygen (CHO). "
    "They are the <b>primary and preferred source of energy</b> for the body, particularly "
    "for the brain and central nervous system. Each gram of carbohydrate yields <b>4 kcal</b>."
))
story.append(SP)
story.append(Paragraph("Classification of Carbohydrates:", h3))
story.append(simple_table(
    ["Class", "Degree of Polymerisation", "Examples", "Digestion"],
    [
        ["Monosaccharides", "1", "Glucose, Fructose, Galactose", "Directly absorbed"],
        ["Disaccharides", "2", "Sucrose, Lactose, Maltose", "Rapidly digested"],
        ["Oligosaccharides", "3–10", "Maltodextrins, Raffinose, FOS", "Partially digested"],
        ["Polysaccharides\n(Starch)", ">10", "Amylose, Amylopectin", "Slowly digested → glucose"],
        ["Non-starch\nPolysaccharides (NSP)", ">10", "Cellulose, Pectin, Inulin", "Not digested (dietary fibre)"],
    ],
    col_widths=[3.8*cm, 3.5*cm, 4.5*cm, 4.5*cm],
))
story.append(SP)
story.append(Paragraph("Dietary Significance:", h3))
for t in [
    "Simple/refined carbohydrates (sugar, white flour) → rapid glycaemic response, linked to obesity and T2DM.",
    "Complex carbohydrates (wholegrains, legumes) → slow glucose release, high satiety, fibre-rich.",
    "Recommended intake: <b>45–65% of total daily energy (AMDR).</b>",
    "Minimum for brain function: ~130 g/day (IOM recommendation).",
]:
    story.append(bp(t))
story.append(SP)

# 3.2 Proteins
story.append(sub_bar("3.2  Proteins"))
story.append(body_p(
    "Proteins are complex macromolecules made of amino acids linked by peptide bonds. "
    "They are primarily <b>body-building nutrients</b> — essential for growth, repair, "
    "enzyme synthesis, hormone production, immune function, and transport. "
    "Each gram yields <b>4 kcal</b>, but protein is used for energy only when carbohydrate "
    "and fat stores are depleted."
))
story.append(SP)
story.append(Paragraph("Classification of Dietary Proteins:", h3))
story.append(simple_table(
    ["Type", "Description", "Examples"],
    [
        ["Complete (High biological value)", "Contains all 9 essential amino acids in adequate proportions",
         "Eggs, meat, fish, poultry, dairy"],
        ["Incomplete (Low biological value)", "Deficient in one or more essential amino acids",
         "Legumes, cereals, nuts, seeds"],
        ["Complementary proteins", "Two incomplete proteins together provide all EAAs",
         "Rice + lentils, maize + beans"],
    ],
    col_widths=[4.5*cm, 6*cm, 5.5*cm],
))
story.append(SP)
story.append(Paragraph("Essential Amino Acids (9):", h3))
story.append(body_p(
    "Histidine, Isoleucine, Leucine, Lysine, Methionine, Phenylalanine, Threonine, "
    "Tryptophan, Valine — must be obtained from the diet as the body cannot synthesise them."
))
story.append(SP)
for t in [
    "Recommended intake: <b>10–35% of total energy (AMDR); ~0.8 g/kg/day (RDA adults).</b>",
    "Athletes/growing children may need 1.2–2.0 g/kg/day.",
    "Protein quality is assessed by PDCAAS (Protein Digestibility Corrected Amino Acid Score) or DIAAS.",
]:
    story.append(bp(t))
story.append(SP)

# 3.3 Lipids
story.append(sub_bar("3.3  Lipids (Fats and Oils)"))
story.append(body_p(
    "Lipids are a diverse group of hydrophobic organic molecules. They are the most "
    "energy-dense macronutrient, yielding <b>9 kcal per gram</b>. They serve as stored "
    "energy, insulate the body, protect organs, and transport fat-soluble vitamins (A, D, E, K). "
    "Cell membranes are composed of phospholipids."
))
story.append(SP)
story.append(Paragraph("Classification of Dietary Lipids:", h3))
story.append(simple_table(
    ["Type", "Chemical Nature", "Food Sources", "Health Effect"],
    [
        ["Saturated fatty acids (SFA)", "No double bonds; solid at room temperature",
         "Butter, ghee, coconut oil, red meat", "↑ LDL cholesterol — limit intake"],
        ["Monounsaturated fatty acids (MUFA)", "One double bond",
         "Olive oil, avocado, almonds", "↓ LDL, ↑ HDL — cardioprotective"],
        ["Polyunsaturated fatty acids (PUFA)", "Two or more double bonds",
         "Fish, flaxseed, sunflower oil", "Essential; include omega-3 and omega-6"],
        ["Trans fatty acids (TFA)", "Artificially hydrogenated; uncommon in nature",
         "Margarine, processed snacks, fried food", "↑ LDL, ↓ HDL — harmful; limit <1% energy"],
        ["Cholesterol", "Sterol; not a fatty acid",
         "Egg yolk, liver, shellfish", "Essential for hormones/bile; excess raises CVD risk"],
    ],
    col_widths=[3.8*cm, 3.5*cm, 3.8*cm, 4.7*cm],
))
story.append(SP)
story.append(orange_box([
    "<b>Essential Fatty Acids:</b> Linoleic acid (omega-6) and alpha-linolenic acid (omega-3) "
    "cannot be synthesised by the body. From these, the body derives arachidonic acid (AA), "
    "EPA (eicosapentaenoic acid), and DHA (docosahexaenoic acid) — critical for brain "
    "development, inflammation regulation, and cardiovascular health."
]))
story.append(LP)

# ════════════════════════════════════════════════════════════════════════════
#  SECTION 4 — MICRONUTRIENTS
# ════════════════════════════════════════════════════════════════════════════
story.append(section_bar("4.  MICRONUTRIENTS"))
story.append(body_p(
    "Micronutrients are required in milligram or microgram quantities. Though needed in "
    "small amounts, they are indispensable for biochemical reactions, immune function, "
    "bone development, antioxidant defence, and gene expression. They are classified "
    "into <b>vitamins</b> and <b>minerals</b>."
))
story.append(SP)

# 4.1 Vitamins
story.append(sub_bar("4.1  Vitamins"))
story.append(body_p(
    "Vitamins are organic micronutrients classified primarily by their <b>solubility</b>:"
))
story.append(SP)
story.append(Paragraph("A. Fat-Soluble Vitamins (A, D, E, K)", h3))
story.append(body_p(
    "Stored in adipose tissue and liver. Can accumulate to toxic levels if consumed "
    "in excess (hypervitaminosis). Absorbed along with dietary fat."
))
story.append(simple_table(
    ["Vitamin", "Key Functions", "Deficiency Disease", "Food Sources"],
    [
        ["A (Retinol)", "Vision, epithelial integrity, immune function", "Night blindness, Xerophthalmia", "Liver, egg yolk, dairy, orange vegetables"],
        ["D (Calciferol)", "Ca²⁺ & PO₄ absorption, bone mineralisation, immune modulation", "Rickets (children), Osteomalacia (adults)", "Sunlight (skin synthesis), fatty fish, fortified milk"],
        ["E (Tocopherol)", "Antioxidant, membrane protection, immune function", "Haemolytic anaemia (rare)", "Nuts, seeds, vegetable oils, green leafy vegetables"],
        ["K (Phylloquinone/Menaquinone)", "Blood clotting (clotting factors II, VII, IX, X), bone metabolism", "Bleeding disorders, haemorrhage", "Green leafy vegetables, fermented foods, liver"],
    ],
    col_widths=[2.5*cm, 4.5*cm, 3.5*cm, 5*cm],
))
story.append(SP)
story.append(Paragraph("B. Water-Soluble Vitamins (B-complex + Vitamin C)", h3))
story.append(body_p(
    "Not stored significantly; excreted in urine when in excess. Regular dietary intake required. "
    "Rarely toxic in food form."
))
story.append(simple_table(
    ["Vitamin", "Key Functions", "Deficiency Disease", "Food Sources"],
    [
        ["B1 (Thiamin)", "Carbohydrate metabolism (pyruvate dehydrogenase)", "Beriberi, Wernicke's encephalopathy", "Whole grains, legumes, pork"],
        ["B2 (Riboflavin)", "FAD/FMN coenzyme in oxidative phosphorylation", "Ariboflavinosis (glossitis, cheilosis)", "Dairy, eggs, meat, leafy greens"],
        ["B3 (Niacin)", "NAD/NADP — energy metabolism", "Pellagra (3Ds: dermatitis, diarrhoea, dementia)", "Meat, fish, peanuts, fortified cereals"],
        ["B5 (Pantothenic acid)", "Coenzyme A synthesis", "Rare — burning feet syndrome", "Widespread in all foods"],
        ["B6 (Pyridoxine)", "Amino acid metabolism, neurotransmitter synthesis", "Peripheral neuropathy, seborrhoeic dermatitis", "Meat, fish, potatoes, bananas"],
        ["B7 (Biotin)", "Carboxylation reactions (fatty acid synthesis, gluconeogenesis)", "Rare — dermatitis, alopecia", "Egg yolk, liver, nuts"],
        ["B9 (Folate)", "DNA synthesis, cell division; critical in pregnancy", "Megaloblastic anaemia, Neural tube defects", "Green leafy veg, legumes, fortified cereals"],
        ["B12 (Cobalamin)", "Myelin synthesis, DNA metabolism, homocysteine conversion", "Pernicious anaemia, subacute combined degeneration of cord", "Animal products ONLY (meat, fish, dairy, eggs)"],
        ["C (Ascorbic acid)", "Collagen synthesis, antioxidant, enhances Fe absorption", "Scurvy (bleeding gums, impaired wound healing)", "Citrus fruit, bell peppers, berries, tomatoes"],
    ],
    col_widths=[2.5*cm, 4.5*cm, 3.5*cm, 4.8*cm],
))
story.append(LP)

# 4.2 Minerals
story.append(sub_bar("4.2  Minerals"))
story.append(body_p(
    "Minerals are inorganic elements that cannot be synthesised by the body. They are "
    "classified by the quantity required:"
))
story.append(SP)
story.append(Paragraph("A. Macrominerals (>100 mg/day)", h3))
story.append(simple_table(
    ["Mineral", "Functions", "Deficiency", "Sources"],
    [
        ["Calcium (Ca)", "Bone/teeth structure, muscle contraction, nerve signalling, blood clotting",
         "Osteoporosis, Tetany, Rickets", "Dairy, tofu, leafy greens, fortified foods"],
        ["Phosphorus (P)", "Bone/teeth, ATP, phospholipids, acid-base balance",
         "Rare — weakness, bone pain", "Meat, dairy, whole grains, legumes"],
        ["Magnesium (Mg)", ">300 enzyme reactions, protein synthesis, neuromuscular function",
         "Muscle cramps, arrhythmia, hypomagnesaemia", "Nuts, seeds, whole grains, green veg"],
        ["Sodium (Na)", "Fluid balance, nerve impulse transmission, BP regulation",
         "Hyponatraemia (nausea, confusion)", "Salt, processed food, bread, cheese"],
        ["Potassium (K)", "Intracellular fluid, heart rhythm, muscle contraction",
         "Hypokalaemia (weakness, arrhythmia)", "Bananas, potatoes, legumes, tomatoes"],
        ["Chloride (Cl)", "Gastric acid (HCl), fluid balance (with Na)",
         "Rare — metabolic alkalosis", "Table salt, seaweed"],
        ["Sulphur (S)", "Component of amino acids (Met, Cys), glutathione, CoA",
         "Rare — low protein intake", "Eggs, meat, legumes, garlic"],
    ],
    col_widths=[2.5*cm, 5*cm, 3.5*cm, 4.8*cm],
))
story.append(SP)
story.append(Paragraph("B. Microminerals / Trace Elements (<100 mg/day)", h3))
story.append(simple_table(
    ["Mineral", "Functions", "Deficiency", "Sources"],
    [
        ["Iron (Fe)", "Haemoglobin/myoglobin synthesis, oxygen transport, electron transport chain",
         "Iron-deficiency anaemia (most common nutritional deficiency worldwide)", "Red meat, legumes, dark leafy veg, fortified cereals"],
        ["Zinc (Zn)", "100+ enzyme reactions, wound healing, immune function, DNA synthesis",
         "Growth retardation, impaired immunity, hypogonadism", "Oysters, meat, legumes, seeds"],
        ["Iodine (I)", "Thyroid hormone synthesis (T3, T4) — metabolism regulation",
         "Goitre, cretinism (congenital)", "Iodised salt, seafood, dairy"],
        ["Selenium (Se)", "Antioxidant (glutathione peroxidase), thyroid hormone metabolism",
         "Keshan disease (cardiomyopathy), Kashin-Beck disease", "Brazil nuts, seafood, meat, whole grains"],
        ["Copper (Cu)", "Iron metabolism (ceruloplasmin), collagen cross-linking, antioxidant",
         "Anaemia, neurological symptoms (rare)", "Liver, shellfish, nuts, seeds"],
        ["Fluoride (F)", "Enamel mineralisation, dental caries prevention",
         "Dental caries, osteoporosis", "Fluoridated water, tea, seafood"],
        ["Chromium (Cr)", "Insulin potentiation, glucose tolerance factor",
         "Glucose intolerance, neuropathy (rare)", "Broccoli, whole grains, meat"],
        ["Manganese (Mn)", "Antioxidant enzyme (MnSOD), bone formation, carbohydrate metabolism",
         "Rare — skeletal abnormalities", "Whole grains, nuts, leafy vegetables, tea"],
    ],
    col_widths=[2.5*cm, 4.8*cm, 3.5*cm, 4.5*cm],
))
story.append(LP)

# ════════════════════════════════════════════════════════════════════════════
#  SECTION 5 — WATER AND DIETARY FIBRE
# ════════════════════════════════════════════════════════════════════════════
story.append(section_bar("5.  WATER AND DIETARY FIBRE"))
story.append(sub_bar("5.1  Water"))
story.append(body_p(
    "Water is the most abundant component of the human body (~60% of body weight). "
    "Although it provides no calories, water is essential for every physiological process."
))
for t in [
    "<b>Functions:</b> Solvent for biochemical reactions; transport medium for nutrients, gases, and waste; thermoregulation through sweating; joint lubrication; maintenance of blood pressure.",
    "<b>Requirement:</b> ~2.5–3.7 L/day for men; ~2.0–2.7 L/day for women (total from food + beverages).",
    "<b>Sources:</b> Beverages (water, milk, juices), and from food (~20% of daily intake from fruits and vegetables).",
    "<b>Dehydration consequences:</b> >2% body weight loss → impaired cognitive performance and exercise capacity; >5% → heat stroke risk.",
]:
    story.append(bp(t))
story.append(SP)

story.append(sub_bar("5.2  Dietary Fibre"))
story.append(body_p(
    "Dietary fibre includes all non-digestible carbohydrates and lignin found in plant foods. "
    "It is fermented to varying degrees by the gut microbiota."
))
story.append(simple_table(
    ["Type", "Chemical Nature", "Properties", "Health Effects", "Sources"],
    [
        ["Soluble fibre", "Pectin, beta-glucan, guar gum, inulin",
         "Dissolves in water → forms gel", "↓ LDL cholesterol, glycaemic control, prebiotic effect",
         "Oats, barley, apples, legumes, psyllium"],
        ["Insoluble fibre", "Cellulose, hemicellulose, lignin",
         "Does not dissolve; increases bulk", "Prevents constipation, reduces colorectal cancer risk",
         "Wheat bran, whole grains, vegetables, nuts"],
    ],
    col_widths=[2.5*cm, 3.5*cm, 3*cm, 4*cm, 3*cm],
))
story.append(SP)
story.append(body_p(
    "<b>Recommended intake:</b> 25 g/day (women) to 38 g/day (men) (Dietary Reference Intakes, IOM). "
    "Most populations consume well below this."
))
story.append(LP)

# ════════════════════════════════════════════════════════════════════════════
#  SECTION 6 — CLASSIFICATION BY FUNCTIONAL ROLE (TRADITIONAL)
# ════════════════════════════════════════════════════════════════════════════
story.append(section_bar("6.  TRADITIONAL FUNCTIONAL CLASSIFICATION OF FOODS/DIETS"))
story.append(body_p(
    "A classic nutritional classification groups foods — and therefore diets — by their "
    "<b>functional role</b> in the body. Originally described as the 'Three Food Groups' "
    "by early nutritionists (FAO/WHO nutrition education materials), this system classifies "
    "nutrients and the diets containing them into:"
))
story.append(SP)
story.append(simple_table(
    ["Group", "Dominant Nutrient", "Primary Function", "Examples of Foods"],
    [
        ["Energy-giving foods", "Carbohydrates, Fats",
         "Fuel for body heat, physical activity, and metabolic processes",
         "Cereals, rice, wheat, sugar, oils, ghee, nuts"],
        ["Body-building foods", "Proteins, Calcium, Iron",
         "Growth, repair and maintenance of body tissues; haemoglobin synthesis",
         "Meat, fish, eggs, milk, legumes, dals"],
        ["Protective foods", "Vitamins, Minerals, Antioxidants",
         "Regulation of metabolic processes, immune defence, protection from disease",
         "Fruits, vegetables, dairy, eggs, organ meats"],
    ],
    col_widths=[3.5*cm, 3.5*cm, 5*cm, 5*cm],
))
story.append(SP)
story.append(orange_box([
    "<b>Academic Note:</b> The three-food-group framework is now considered oversimplified "
    "because most foods contribute to more than one category. For example, milk is "
    "body-building (protein/calcium) AND protective (riboflavin/vitamin A) AND energy-giving (fat/lactose). "
    "Modern nutrition education uses food-based dietary guidelines and MyPlate-style models. "
    "However, this classification remains standard exam content for BSc Nutrition."
]))
story.append(LP)

# ════════════════════════════════════════════════════════════════════════════
#  SECTION 7 — CLASSIFICATION BY DIETARY PATTERN
# ════════════════════════════════════════════════════════════════════════════
story.append(section_bar("7.  CLASSIFICATION OF DIETS BY PATTERN"))
story.append(body_p(
    "Beyond individual nutrients, complete diets are classified by their overall "
    "nutrient composition and food-inclusion patterns:"
))
story.append(SP)
story.append(simple_table(
    ["Diet Pattern", "Nutrient Profile", "Characteristic Features"],
    [
        ["Omnivorous diet", "All macronutrients, all vitamins, complete amino acids",
         "Includes animal and plant foods; nutritionally complete if varied"],
        ["Vegetarian diet (lacto-ovo)", "Lower saturated fat; adequate protein from eggs + dairy",
         "Excludes meat/fish; includes dairy and eggs"],
        ["Vegan diet", "No cholesterol; high fibre; may be low in B12, heme-Fe, zinc, DHA, Ca",
         "All plant-based; requires supplementation or fortified foods"],
        ["Mediterranean diet", "High MUFA (olive oil), omega-3, fibre, antioxidants; low SFA",
         "Plant-forward with fish; reduces CVD and T2DM risk"],
        ["DASH diet", "High K, Ca, Mg, fibre; low sodium, saturated fat",
         "Designed to reduce blood pressure; rich in fruits, vegetables, low-fat dairy"],
        ["Ketogenic diet", "Very low carbohydrate (<50g/day), high fat, moderate protein",
         "Induces ketosis; used for epilepsy, weight loss, T2DM management"],
        ["Low-carbohydrate diet", "Reduced CHO (<130g/day); increased fat and protein",
         "Used for weight management and glycaemic control"],
        ["High-protein diet", "Protein >25% of energy intake",
         "Popular for muscle gain; concern for renal load in at-risk individuals"],
        ["Low-fat diet", "Fat <30% of energy; often <20% in therapeutic settings",
         "Used for weight loss and cardiovascular risk reduction"],
    ],
    col_widths=[4*cm, 5*cm, 7*cm],
))
story.append(LP)

# ════════════════════════════════════════════════════════════════════════════
#  SECTION 8 — THERAPEUTIC DIET CLASSIFICATIONS
# ════════════════════════════════════════════════════════════════════════════
story.append(section_bar("8.  THERAPEUTIC DIET CLASSIFICATIONS BY NUTRIENT MODIFICATION"))
story.append(body_p(
    "Therapeutic or clinical diets are prescribed to manage medical conditions by "
    "modifying one or more nutrient parameters:"
))
story.append(SP)
story.append(simple_table(
    ["Therapeutic Diet", "Nutrient Modified", "Clinical Indication"],
    [
        ["Calorie-restricted diet", "↓ Total energy (500–1000 kcal deficit)", "Obesity, metabolic syndrome, type 2 diabetes"],
        ["Protein-restricted diet", "↓ Protein (0.6 g/kg/day or less)", "Chronic kidney disease (non-dialysis), hepatic encephalopathy"],
        ["High-protein diet", "↑ Protein (1.2–1.5 g/kg/day)", "Malnutrition, post-surgery, burns, cancer cachexia"],
        ["Fat-restricted diet", "↓ Fat (<40–50 g/day)", "Gallbladder disease, malabsorption (steatorrhoea), pancreatitis"],
        ["Low-sodium diet", "↓ Na (1.5–2 g/day)", "Hypertension, heart failure, oedema, liver cirrhosis"],
        ["Low-potassium diet", "↓ K (<2 g/day)", "Renal failure with hyperkalaemia"],
        ["High-iron diet", "↑ Haem iron + enhancers (vitamin C)", "Iron-deficiency anaemia"],
        ["Calcium-modified diet", "↑ or ↓ Ca depending on condition", "↑ for osteoporosis; ↓ for hypercalciuria/kidney stones"],
        ["Gluten-free diet", "Elimination of gluten (wheat, rye, barley)", "Coeliac disease, non-coeliac gluten sensitivity"],
        ["Low-FODMAP diet", "↓ Fermentable oligo-, di-, mono-saccharides and polyols", "Irritable bowel syndrome (IBS)"],
        ["Diabetic diet", "Controlled CHO (45–60 g/meal); low GI foods; ↓ SFA", "Type 1 and Type 2 diabetes mellitus"],
        ["Dysphagia diet", "Texture modified (IDDSI framework: Levels 0–7)", "Swallowing difficulties (stroke, neurological disease)"],
    ],
    col_widths=[4.5*cm, 4*cm, 7.5*cm],
))
story.append(LP)

# ════════════════════════════════════════════════════════════════════════════
#  SECTION 9 — ENERGY VALUES AT A GLANCE
# ════════════════════════════════════════════════════════════════════════════
story.append(section_bar("9.  ENERGY VALUES AND RECOMMENDED DAILY ALLOWANCES"))
story.append(sub_bar("9.1  Atwater Factors — Energy per Gram"))
story.append(simple_table(
    ["Nutrient", "Energy (kcal/g)", "Energy (kJ/g)", "Notes"],
    [
        ["Carbohydrates", "4", "17", "Including sugars and starch"],
        ["Proteins", "4", "17", "Amino acid catabolism"],
        ["Lipids (fats/oils)", "9", "37", "Most energy-dense macronutrient"],
        ["Dietary fibre (soluble)", "2", "8", "Partial fermentation by gut bacteria"],
        ["Alcohol (ethanol)", "7", "29", "NOT a recommended energy source"],
        ["Water", "0", "0", "No caloric value"],
    ],
    col_widths=[4.5*cm, 3.5*cm, 3.5*cm, 4.5*cm],
))
story.append(SP)

story.append(sub_bar("9.2  AMDR — Acceptable Macronutrient Distribution Ranges (IOM, Adults)"))
story.append(simple_table(
    ["Macronutrient", "AMDR (% of Total Energy)", "Example for 2000 kcal diet"],
    [
        ["Carbohydrates", "45–65%", "225–325 g/day"],
        ["Proteins", "10–35%", "50–175 g/day"],
        ["Fats (Total)", "20–35%", "44–78 g/day"],
        ["  Saturated fats", "<10%", "<22 g/day"],
        ["  Trans fats", "<1%", "<2 g/day"],
        ["  Omega-6 PUFA (linoleic acid)", "5–10%", "11–22 g/day"],
        ["  Omega-3 PUFA (ALA)", "0.6–1.2%", "1.3–2.7 g/day"],
    ],
    col_widths=[5.5*cm, 5.5*cm, 5*cm],
))
story.append(LP)

# ════════════════════════════════════════════════════════════════════════════
#  SECTION 10 — QUICK SUMMARY / EXAM REVISION TABLE
# ════════════════════════════════════════════════════════════════════════════
story.append(section_bar("10.  EXAM QUICK REFERENCE SUMMARY"))
story.append(simple_table(
    ["Classification Basis", "Categories", "Key Point"],
    [
        ["Quantity required", "Macronutrients vs. Micronutrients", "Macro = grams; Micro = mg/mcg"],
        ["Solubility (vitamins)", "Fat-soluble (A, D, E, K) vs. Water-soluble (B-complex, C)", "Fat-soluble stored; water-soluble excreted"],
        ["Mineral quantity", "Macrominerals (>100mg) vs. Trace elements (<100mg)", "Ca, P, Mg, Na, K = macro; Fe, Zn, I = trace"],
        ["Carbohydrate structure", "Mono, Di, Oligo, Polysaccharides, NSP", "Classified by degree of polymerisation"],
        ["Fatty acid saturation", "SFA, MUFA, PUFA, TFA", "Trans fats most harmful; omega-3 PUFA most beneficial"],
        ["Protein quality", "Complete (HBV) vs. Incomplete (LBV)", "Animal proteins = complete; most plants = incomplete"],
        ["Functional role (classic)", "Energy-giving, Body-building, Protective", "Oversimplified but still examined"],
        ["Dietary pattern", "Omnivorous, Vegetarian, Vegan, Mediterranean, DASH, Ketogenic", "Classified by food inclusion/exclusion and nutrient profile"],
        ["Therapeutic purpose", "Calorie-restricted, Low-protein, Low-Na, Diabetic, Gluten-free, etc.", "Nutrient modification to manage disease"],
        ["Fibre type", "Soluble vs. Insoluble", "Soluble: ↓ cholesterol; Insoluble: ↓ constipation"],
    ],
    col_widths=[4.5*cm, 5.5*cm, 6*cm],
))
story.append(LP)

story.append(gold_box([
    "<b>Key Exam Points to Remember:</b>",
    "1. Macronutrients provide energy; micronutrients regulate metabolism — neither group can substitute the other.",
    "2. The Atwater factors: CHO = 4 kcal/g, Protein = 4 kcal/g, Fat = 9 kcal/g, Alcohol = 7 kcal/g.",
    "3. Only vitamin B12 is found exclusively in animal products — vegans must supplement.",
    "4. EFAs (linoleic acid and alpha-linolenic acid) must come from diet; all other fatty acids can be synthesised.",
    "5. The three food groups (energy, body-building, protective) are historically important but nutritionally oversimplified.",
    "6. AMDR for CHO: 45-65%; Protein: 10-35%; Fat: 20-35% of total energy."
]))
story.append(LP)

# ════════════════════════════════════════════════════════════════════════════
#  REFERENCES
# ════════════════════════════════════════════════════════════════════════════
story.append(HRFlowable(width="100%", thickness=1, color=LIGHT_GREEN))
story.append(SP)
story.append(Paragraph("References", h2))
for ref in [
    "FAO/WHO. (1997). <i>Agriculture, Food and Nutrition for Africa — A Resource Book for Teachers of Agriculture.</i> Chapter 7: Food, Nutrients and Diets. FAO, Rome.",
    "Institute of Medicine. (2005). <i>Dietary Reference Intakes for Energy, Carbohydrate, Fiber, Fat, Fatty Acids, Cholesterol, Protein, and Amino Acids.</i> National Academies Press.",
    "StatPearls. (2024). <i>Biochemistry, Nutrients.</i> NBK554545. NCBI Bookshelf, NIH.",
    "StatPearls. (2023). <i>Nutrition: Macronutrient Intake, Imbalances, and Interventions.</i> NBK594226. NCBI Bookshelf, NIH.",
    "Centre for Health Protection, Hong Kong. (2023). <i>Nutrient Classifications.</i> CHP, Department of Health.",
    "WHO. (2020). <i>Healthy Diet Fact Sheet.</i> World Health Organization, Geneva.",
    "Mahan, L.K. & Raymond, J.L. (2017). <i>Krause's Food & the Nutrition Care Process</i> (14th ed.). Elsevier Saunders.",
]:
    story.append(Paragraph(ref, note))
    story.append(Spacer(1, 2*mm))

# ── Build PDF ────────────────────────────────────────────────────────────────
doc = BaseDocTemplate(
    OUTPUT,
    pagesize=A4,
    leftMargin=2*cm,
    rightMargin=2*cm,
    topMargin=3.2*cm,
    bottomMargin=2.2*cm,
)
frame = Frame(doc.leftMargin, doc.bottomMargin,
              doc.width, doc.height, id='normal')
doc.addPageTemplates([
    PageTemplate(id='all', frames=frame,
                 onPage=on_page, onPageEnd=None)
])
doc.build(story)
print(f"PDF created: {OUTPUT}")
Running Command

cd /home/daytona/workspace/diet-classification && python generate_pdf.py 2>&1

Editing File

~/diet-classification/generate_pdf.py

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/diet-classification/generate_pdf.py'
Running Command

cd /home/daytona/workspace/diet-classification && python generate_pdf.py 2>&1

Editing File

~/diet-classification/generate_pdf.py

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/diet-classification/generate_pdf.py'
Running Command

cd /home/daytona/workspace/diet-classification && python generate_pdf.py 2>&1

Editing File

~/diet-classification/generate_pdf.py

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/diet-classification/generate_pdf.py'
Running Command

cd /home/daytona/workspace/diet-classification && python generate_pdf.py 2>&1

Running Command

ls -lh /home/daytona/workspace/diet-classification/Classification_of_Diets_Accor…

Your PDF is ready! Here it is:

Classification of Diets According to Nutrients

PDF Document · PDF


Here's a summary of everything covered in the PDF (10 full sections, A4, colour-coded, with tables throughout):

What's Inside the PDF

Section 1 - Introduction Defines nutrients and explains why nutrient-based diet classification is the foundation of nutrition science.
Section 2 - Primary Classification: Macronutrients vs. Micronutrients Overview table comparing both categories by required amount, primary nutrients, and functions.
Section 3 - Macronutrients (detailed)
  • Carbohydrates — classified by degree of polymerisation (mono → polysaccharides → NSP); AMDR 45-65%; glycaemic significance
  • Proteins — complete vs. incomplete; 9 essential amino acids; PDCAAS/DIAAS quality scoring
  • Lipids — SFA, MUFA, PUFA, TFA, cholesterol; essential fatty acids (omega-3 and omega-6); 9 kcal/g
Section 4 - Micronutrients (comprehensive tables)
  • Vitamins — fat-soluble (A, D, E, K) and water-soluble (B1–B12, C) with functions, deficiency diseases, and food sources
  • Minerals — macrominerals (Ca, P, Mg, Na, K, Cl, S) and 8 trace elements (Fe, Zn, I, Se, Cu, F, Cr, Mn)
Section 5 - Water and Dietary Fibre Soluble vs. insoluble fibre; functions; recommended intakes.
Section 6 - Traditional Functional Classification (3 Food Groups) Energy-giving / Body-building / Protective — with academic note on why this is oversimplified but still exam content.
Section 7 - Classification by Dietary Pattern 9 major diet patterns (Omnivorous, Vegan, Mediterranean, DASH, Ketogenic, etc.) with nutrient profiles.
Section 8 - Therapeutic Diet Classifications 12 clinical diets with the specific nutrient modified and the medical indication (renal diet, diabetic diet, gluten-free, FODMAP, etc.).
Section 9 - Energy Values and AMDR Atwater factors (CHO = 4, Protein = 4, Fat = 9 kcal/g) and AMDR breakdown for a 2000 kcal diet.
Section 10 - Exam Quick Reference Table 10-row revision table covering all classification bases at a glance.
This is a shared conversation. Sign in to Orris to start your own chat.