attachment
attachment
attachment
attachment
attachment

Create my nutrition file this type and more information for ragi congi topic

Checking Date & Time
Reading File
Reading File

Create file

Reading File
Running Command

ls -la /home/daytona/workspace/ 2>/dev/null || echo "workspace empty or not found"

Running Command

mkdir -p /home/daytona/workspace/nutrition-file

Writing File

~/nutrition-file/create_nutrition.js

const {
  Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
  AlignmentType, HeadingLevel, BorderStyle, WidthType, ShadingType,
  VerticalAlign, LevelFormat, PageBreak, TableLayoutType
} = require('docx');
const fs = require('fs');

// Color scheme matching handwritten notebook style
const COLORS = {
  teal: "008080",
  darkRed: "8B0000",
  orange: "CC5500",
  purple: "6A0DAD",
  blue: "1A3A8A",
  darkBlue: "003366",
  green: "006400",
  black: "000000",
  lightBlue: "D6EAF8",
  lightOrange: "FDEBD0",
  lightPurple: "F3E5F5",
  lightGreen: "E9F7EF",
  lightTeal: "E0F2F1",
  lightRed: "FDEDEC",
  white: "FFFFFF",
  headerBg: "2E4057",
};

function bigTitle(text, color) {
  return new Paragraph({
    alignment: AlignmentType.CENTER,
    spacing: { before: 400, after: 200 },
    children: [new TextRun({ text, bold: true, size: 72, color, font: "Arial Black" })]
  });
}

function sectionTitle(text, color) {
  return new Paragraph({
    alignment: AlignmentType.CENTER,
    spacing: { before: 300, after: 160 },
    border: {
      bottom: { style: BorderStyle.SINGLE, size: 8, color }
    },
    children: [new TextRun({ text, bold: true, size: 40, color, font: "Arial" })]
  });
}

function subHeading(text, color) {
  return new Paragraph({
    spacing: { before: 200, after: 80 },
    children: [new TextRun({ text, bold: true, size: 30, color, font: "Arial" })]
  });
}

function bodyText(text, bold = false) {
  return new Paragraph({
    spacing: { before: 60, after: 60 },
    children: [new TextRun({ text, bold, size: 22, font: "Arial" })]
  });
}

function bulletItem(text, color = "000000") {
  return new Paragraph({
    spacing: { before: 60, after: 60 },
    numbering: { reference: "bullets", level: 0 },
    children: [new TextRun({ text, size: 22, font: "Arial", color })]
  });
}

function pageBreak() {
  return new Paragraph({ children: [new PageBreak()] });
}

function boxedCell(text, bgColor, textColor = "000000", bold = false, width = 4500) {
  return new TableCell({
    width: { size: width, type: WidthType.DXA },
    shading: { fill: bgColor, type: ShadingType.CLEAR },
    verticalAlign: VerticalAlign.CENTER,
    margins: { top: 80, bottom: 80, left: 120, right: 120 },
    children: [new Paragraph({
      alignment: AlignmentType.CENTER,
      children: [new TextRun({ text, bold, size: 22, color: textColor, font: "Arial" })]
    })]
  });
}

function emptyCell(width = 500) {
  return new TableCell({
    width: { size: width, type: WidthType.DXA },
    borders: { top: { style: BorderStyle.NONE }, bottom: { style: BorderStyle.NONE }, left: { style: BorderStyle.NONE }, right: { style: BorderStyle.NONE } },
    children: [new Paragraph({ children: [] })]
  });
}

function twoColFlowchart(rootText, leftTitle, leftItems, rightTitle, rightItems, rootColor, leftColor, rightColor) {
  const noBorder = { style: BorderStyle.NONE, size: 0, color: "FFFFFF" };
  const allNoBorder = { top: noBorder, bottom: noBorder, left: noBorder, right: noBorder };

  // Root box
  const rootRow = new TableRow({ children: [
    new TableCell({ columnSpan: 3, borders: allNoBorder,
      children: [new Paragraph({ alignment: AlignmentType.CENTER,
        children: [new TextRun({ text: rootText, bold: true, size: 26, color: "FFFFFF", font: "Arial" })] })],
      shading: { fill: rootColor, type: ShadingType.CLEAR },
      margins: { top: 100, bottom: 100, left: 200, right: 200 }
    })
  ]});

  // Arrow row
  const arrowRow = new TableRow({ children: [
    new TableCell({ borders: allNoBorder, children: [new Paragraph({ alignment: AlignmentType.CENTER, children: [new TextRun({ text: "↙", size: 28, font: "Arial" })] })] }),
    emptyCell(500),
    new TableCell({ borders: allNoBorder, children: [new Paragraph({ alignment: AlignmentType.CENTER, children: [new TextRun({ text: "↘", size: 28, font: "Arial" })] })] }),
  ]});

  // Left + Right title row
  const titleRow = new TableRow({ children: [
    new TableCell({
      borders: allNoBorder,
      shading: { fill: leftColor, type: ShadingType.CLEAR },
      margins: { top: 80, bottom: 80, left: 120, right: 120 },
      children: [new Paragraph({ alignment: AlignmentType.CENTER, children: [new TextRun({ text: leftTitle, bold: true, size: 24, color: "FFFFFF", font: "Arial" })] })]
    }),
    emptyCell(500),
    new TableCell({
      borders: allNoBorder,
      shading: { fill: rightColor, type: ShadingType.CLEAR },
      margins: { top: 80, bottom: 80, left: 120, right: 120 },
      children: [new Paragraph({ alignment: AlignmentType.CENTER, children: [new TextRun({ text: rightTitle, bold: true, size: 24, color: "FFFFFF", font: "Arial" })] })]
    }),
  ]});

  // Items rows
  const maxLen = Math.max(leftItems.length, rightItems.length);
  const itemRows = [];
  for (let i = 0; i < maxLen; i++) {
    itemRows.push(new TableRow({ children: [
      new TableCell({
        borders: allNoBorder,
        children: [new Paragraph({ children: [new TextRun({ text: leftItems[i] ? "→ " + leftItems[i] : "", size: 20, font: "Arial" })] })]
      }),
      emptyCell(500),
      new TableCell({
        borders: allNoBorder,
        children: [new Paragraph({ children: [new TextRun({ text: rightItems[i] ? "→ " + rightItems[i] : "", size: 20, font: "Arial" })] })]
      }),
    ]}));
  }

  return new Table({
    layout: TableLayoutType.FIXED,
    width: { size: 9000, type: WidthType.DXA },
    rows: [rootRow, arrowRow, titleRow, ...itemRows],
    borders: { top: noBorder, bottom: noBorder, left: noBorder, right: noBorder, insideH: noBorder, insideV: noBorder }
  });
}

function infoTable(rows, headerColor) {
  const tableRows = rows.map((row, i) => new TableRow({
    children: row.map(cell => new TableCell({
      shading: { fill: i === 0 ? headerColor : (i % 2 === 0 ? "F2F2F2" : "FFFFFF"), type: ShadingType.CLEAR },
      margins: { top: 80, bottom: 80, left: 120, right: 120 },
      children: [new Paragraph({
        alignment: i === 0 ? AlignmentType.CENTER : AlignmentType.LEFT,
        children: [new TextRun({ text: cell, bold: i === 0, size: i === 0 ? 22 : 20, color: i === 0 ? "FFFFFF" : "000000", font: "Arial" })]
      })]
    }))
  }));
  return new Table({
    width: { size: 9000, type: WidthType.DXA },
    rows: tableRows
  });
}

// ─────────────────────────────────────────────
// PAGE 1: COVER
// ─────────────────────────────────────────────
const coverPage = [
  new Paragraph({ spacing: { before: 1200, after: 200 }, alignment: AlignmentType.CENTER,
    children: [new TextRun({ text: "NUTRITION", bold: true, size: 96, color: COLORS.teal, font: "Arial Black" })] }),
  new Paragraph({ alignment: AlignmentType.CENTER, spacing: { before: 100, after: 100 },
    children: [new TextRun({ text: "A Comprehensive Study File", size: 40, color: COLORS.darkBlue, font: "Arial", italics: true })] }),
  new Paragraph({ alignment: AlignmentType.CENTER, spacing: { before: 600, after: 100 },
    children: [new TextRun({ text: "Topics Covered:", bold: true, size: 28, color: COLORS.black, font: "Arial" })] }),
  ...[
    "1. Vitamins – Classification & Details",
    "2. Method of Cooking",
    "3. Balanced Diet with Food Pyramid",
    "4. Proteins",
    "5. Method of Food Preservation",
    "6. Ragi Congee – Nutrition & Benefits",
  ].map(t => new Paragraph({ alignment: AlignmentType.CENTER, spacing: { before: 80, after: 80 },
    children: [new TextRun({ text: t, size: 24, font: "Arial", color: COLORS.darkBlue })] })),
  new Paragraph({ alignment: AlignmentType.CENTER, spacing: { before: 400 },
    children: [new TextRun({ text: "April 2026", size: 22, color: "888888", font: "Arial", italics: true })] }),
  pageBreak(),
];

// ─────────────────────────────────────────────
// PAGE 2: VITAMINS
// ─────────────────────────────────────────────
const vitaminsPage = [
  bigTitle("VITAMINS", COLORS.teal),
  sectionTitle("Classification of Vitamins", COLORS.teal),
  new Paragraph({ spacing: { before: 200, after: 200 }, alignment: AlignmentType.CENTER,
    children: [new TextRun({ text: "Vitamins are organic compounds required in small quantities for normal body function.", italics: true, size: 22, font: "Arial", color: "555555" })] }),

  // Flowchart
  twoColFlowchart(
    "VITAMINS",
    "Water Soluble Vitamins",
    ["Thiamine (Vitamin B1)", "Riboflavin (Vitamin B2)", "Niacin / Nicotinic Acid (B3)", "Pyridoxine Acid (Vitamin B6)", "Pantothenic Acid (Vitamin B5)", "Folic Acid (Vitamin B9)", "Vitamin B12 (Cobalamin)", "Ascorbic Acid (Vitamin C)"],
    "Fat Soluble Vitamins",
    ["Vitamin A (Retinol)", "Vitamin D (Calciferol)", "Vitamin E (Tocopherol)", "Vitamin K (Phylloquinone)"],
    "2E86AB", "008080", "CC5500"
  ),

  new Paragraph({ spacing: { before: 300, after: 100 } }),
  subHeading("Water Soluble Vitamins – Key Details", COLORS.teal),
  infoTable([
    ["Vitamin", "Other Name", "Food Sources", "Deficiency Disease"],
    ["B1", "Thiamine", "Whole grains, legumes, nuts", "Beriberi"],
    ["B2", "Riboflavin", "Milk, eggs, leafy greens", "Ariboflavinosis"],
    ["B3", "Niacin", "Meat, fish, peanuts", "Pellagra"],
    ["B6", "Pyridoxine", "Poultry, fish, potatoes", "Peripheral neuropathy"],
    ["B5", "Pantothenic Acid", "Avocado, chicken, whole grains", "Burning feet syndrome"],
    ["B9", "Folic Acid", "Leafy greens, legumes, citrus", "Neural tube defects, Anaemia"],
    ["B12", "Cobalamin", "Meat, dairy, eggs", "Pernicious Anaemia"],
    ["C", "Ascorbic Acid", "Citrus fruits, guava, bell pepper", "Scurvy"],
  ], "008080"),

  new Paragraph({ spacing: { before: 200, after: 100 } }),
  subHeading("Fat Soluble Vitamins – Key Details", COLORS.orange),
  infoTable([
    ["Vitamin", "Other Name", "Food Sources", "Deficiency Disease"],
    ["A", "Retinol", "Liver, dairy, orange/yellow vegetables", "Night blindness, Xerophthalmia"],
    ["D", "Calciferol", "Sunlight, fish liver oil, fortified milk", "Rickets (children), Osteomalacia (adults)"],
    ["E", "Tocopherol", "Nuts, seeds, vegetable oils", "Haemolytic anaemia, nerve damage"],
    ["K", "Phylloquinone", "Green leafy vegetables, broccoli", "Bleeding disorders"],
  ], "CC5500"),

  pageBreak(),
];

// ─────────────────────────────────────────────
// PAGE 3: METHOD OF COOKING
// ─────────────────────────────────────────────
const cookingPage = [
  bigTitle("METHOD OF COOKING", COLORS.darkRed),
  sectionTitle("Classification of Cooking Methods", COLORS.darkRed),
  new Paragraph({ spacing: { before: 200, after: 200 }, alignment: AlignmentType.CENTER,
    children: [new TextRun({ text: "Cooking transforms food through heat, improving digestibility, palatability and safety.", italics: true, size: 22, font: "Arial", color: "555555" })] }),

  // Three-column table for methods
  new Table({
    width: { size: 9000, type: WidthType.DXA },
    rows: [
      new TableRow({ children: [
        new TableCell({ shading: { fill: "1A5276", type: ShadingType.CLEAR }, margins: { top: 100, bottom: 100, left: 120, right: 120 },
          children: [new Paragraph({ alignment: AlignmentType.CENTER, children: [new TextRun({ text: "Moist Heat Method", bold: true, size: 24, color: "FFFFFF", font: "Arial" })] })] }),
        new TableCell({ shading: { fill: "922B21", type: ShadingType.CLEAR }, margins: { top: 100, bottom: 100, left: 120, right: 120 },
          children: [new Paragraph({ alignment: AlignmentType.CENTER, children: [new TextRun({ text: "Dry Heat Method", bold: true, size: 24, color: "FFFFFF", font: "Arial" })] })] }),
        new TableCell({ shading: { fill: "1E8449", type: ShadingType.CLEAR }, margins: { top: 100, bottom: 100, left: 120, right: 120 },
          children: [new Paragraph({ alignment: AlignmentType.CENTER, children: [new TextRun({ text: "Combination Method", bold: true, size: 24, color: "FFFFFF", font: "Arial" })] })] }),
      ]}),
      ...Array.from({ length: 7 }, (_, i) => {
        const moist = ["Blanching", "Boiling", "Poaching", "Pressure Cooking", "Simmering", "Steaming", "Stewing"][i] || "";
        const dry = ["Baking", "Frying", "Grilling & Broiling", "Roasting", "Sautéing", "Tossing", "Microwave Cooking"][i] || "";
        const combo = ["Braising", "", "", "", "", "", ""][i] || "";
        return new TableRow({ children: [
          new TableCell({ shading: { fill: i % 2 === 0 ? "D6EAF8" : "EBF5FB", type: ShadingType.CLEAR }, margins: { top: 80, bottom: 80, left: 120, right: 120 },
            children: [new Paragraph({ children: [new TextRun({ text: moist ? "→ " + moist : "", size: 20, font: "Arial" })] })] }),
          new TableCell({ shading: { fill: i % 2 === 0 ? "FADBD8" : "FDEDEC", type: ShadingType.CLEAR }, margins: { top: 80, bottom: 80, left: 120, right: 120 },
            children: [new Paragraph({ children: [new TextRun({ text: dry ? "→ " + dry : "", size: 20, font: "Arial" })] })] }),
          new TableCell({ shading: { fill: i % 2 === 0 ? "D5F5E3" : "EAFAF1", type: ShadingType.CLEAR }, margins: { top: 80, bottom: 80, left: 120, right: 120 },
            children: [new Paragraph({ children: [new TextRun({ text: combo ? "→ " + combo : "", size: 20, font: "Arial" })] })] }),
        ]});
      })
    ]
  }),

  new Paragraph({ spacing: { before: 200 } }),
  subHeading("Brief Notes on Each Method", COLORS.darkRed),
  infoTable([
    ["Method", "Description", "Examples"],
    ["Boiling", "Cooking in water at 100°C", "Rice, pasta, eggs"],
    ["Steaming", "Cooking by steam above boiling water", "Idli, vegetables, fish"],
    ["Pressure Cooking", "Cooking under high pressure (>100°C)", "Dal, meat, beans"],
    ["Baking", "Dry heat in an oven", "Bread, cakes, biscuits"],
    ["Frying", "Cooking in hot oil/fat", "Puri, chips, fritters"],
    ["Roasting", "Dry heat with occasional fat", "Chicken, potatoes, nuts"],
    ["Braising", "Browning then slow-cooking in liquid", "Pot roast, lentils"],
    ["Microwave", "Electromagnetic waves heat food rapidly", "Reheating, quick cooking"],
  ], "8B0000"),

  pageBreak(),
];

// ─────────────────────────────────────────────
// PAGE 4: BALANCED DIET WITH FOOD PYRAMID
// ─────────────────────────────────────────────
const balancedDietPage = [
  bigTitle("BALANCED DIET WITH FOOD PYRAMID", COLORS.orange),
  sectionTitle("The Food Guide Pyramid", COLORS.orange),
  new Paragraph({ spacing: { before: 160, after: 160 }, alignment: AlignmentType.CENTER,
    children: [new TextRun({ text: "A balanced diet provides all essential nutrients in adequate amounts for health, growth and development.", italics: true, size: 22, font: "Arial", color: "555555" })] }),

  // Pyramid as a table
  new Table({
    width: { size: 9000, type: WidthType.DXA },
    rows: [
      new TableRow({ children: [new TableCell({
        shading: { fill: "E74C3C", type: ShadingType.CLEAR },
        margins: { top: 100, bottom: 100, left: 120, right: 120 },
        children: [
          new Paragraph({ alignment: AlignmentType.CENTER, children: [new TextRun({ text: "▲  TIP — Fats, Oils & Sweets", bold: true, size: 22, color: "FFFFFF", font: "Arial" })] }),
          new Paragraph({ alignment: AlignmentType.CENTER, children: [new TextRun({ text: "Use Sparingly", size: 20, color: "FFFFFF", font: "Arial", italics: true })] }),
        ]
      })] }),
      new TableRow({ children: [new TableCell({
        shading: { fill: "E67E22", type: ShadingType.CLEAR },
        margins: { top: 100, bottom: 100, left: 120, right: 120 },
        children: [
          new Paragraph({ alignment: AlignmentType.CENTER, children: [new TextRun({ text: "Milk, Yogurt & Cheese Group  |  Meat, Poultry, Fish, Eggs & Nuts Group", bold: true, size: 22, color: "FFFFFF", font: "Arial" })] }),
          new Paragraph({ alignment: AlignmentType.CENTER, children: [new TextRun({ text: "2–3 Servings each", size: 20, color: "FFFFFF", font: "Arial", italics: true })] }),
        ]
      })] }),
      new TableRow({ children: [new TableCell({
        shading: { fill: "27AE60", type: ShadingType.CLEAR },
        margins: { top: 100, bottom: 100, left: 120, right: 120 },
        children: [
          new Paragraph({ alignment: AlignmentType.CENTER, children: [new TextRun({ text: "Vegetable Group  |  Fruit Group", bold: true, size: 22, color: "FFFFFF", font: "Arial" })] }),
          new Paragraph({ alignment: AlignmentType.CENTER, children: [new TextRun({ text: "Vegetables: 3–5 Servings  |  Fruits: 2–4 Servings", size: 20, color: "FFFFFF", font: "Arial", italics: true })] }),
        ]
      })] }),
      new TableRow({ children: [new TableCell({
        shading: { fill: "F39C12", type: ShadingType.CLEAR },
        margins: { top: 100, bottom: 100, left: 120, right: 120 },
        children: [
          new Paragraph({ alignment: AlignmentType.CENTER, children: [new TextRun({ text: "BASE — Bread, Cereal, Rice & Pasta Group", bold: true, size: 22, color: "FFFFFF", font: "Arial" })] }),
          new Paragraph({ alignment: AlignmentType.CENTER, children: [new TextRun({ text: "6–11 Servings", size: 20, color: "FFFFFF", font: "Arial", italics: true })] }),
        ]
      })] }),
    ]
  }),

  new Paragraph({ spacing: { before: 200 } }),
  subHeading("Characteristics of a Balanced Diet", COLORS.orange),
  ...[
    "Provides all macronutrients (carbohydrates, proteins, fats) and micronutrients (vitamins, minerals).",
    "Meets the energy requirements of the individual based on age, sex, and activity level.",
    "Contains adequate dietary fibre for digestive health.",
    "Includes sufficient water intake (8–10 glasses/day).",
    "Avoids excess sugar, salt, and saturated fats.",
    "Emphasises variety – different foods provide different nutrients.",
  ].map(t => bulletItem(t, COLORS.darkBlue)),

  new Paragraph({ spacing: { before: 200 } }),
  subHeading("Recommended Daily Allowances (RDA)", COLORS.orange),
  infoTable([
    ["Nutrient Group", "Serving Size Example", "Daily Servings"],
    ["Grains (Bread, Rice, Pasta)", "1 slice bread / ½ cup cooked rice", "6–11"],
    ["Vegetables", "1 cup raw / ½ cup cooked", "3–5"],
    ["Fruits", "1 medium fruit / ½ cup juice", "2–4"],
    ["Dairy (Milk, Yogurt, Cheese)", "1 cup milk / 45g cheese", "2–3"],
    ["Proteins (Meat, Fish, Eggs, Nuts)", "85g meat / 2 eggs / ½ cup beans", "2–3"],
    ["Fats, Oils & Sweets", "—", "Use Sparingly"],
  ], "CC5500"),

  pageBreak(),
];

// ─────────────────────────────────────────────
// PAGE 5: PROTEINS
// ─────────────────────────────────────────────
const proteinsPage = [
  bigTitle("PROTEINS", COLORS.purple),
  sectionTitle("Understanding Proteins in Nutrition", COLORS.purple),
  new Paragraph({ spacing: { before: 160, after: 160 }, alignment: AlignmentType.CENTER,
    children: [new TextRun({ text: "Proteins are large biomolecules made of amino acids, essential for growth, repair, and all body functions.", italics: true, size: 22, font: "Arial", color: "555555" })] }),

  subHeading("Classification of Proteins", COLORS.purple),
  twoColFlowchart(
    "PROTEINS",
    "Complete Proteins (Animal Sources)",
    ["Meat (chicken, beef, pork)", "Fish & seafood", "Eggs", "Dairy (milk, cheese, yogurt)"],
    "Incomplete Proteins (Plant Sources)",
    ["Legumes (dal, lentils, beans)", "Nuts & seeds", "Whole grains", "Soy (complete plant protein)"],
    "6A0DAD", "5B2C8A", "1A7A4A"
  ),

  new Paragraph({ spacing: { before: 200 } }),
  subHeading("Functions of Proteins", COLORS.purple),
  ...[
    "Growth & Repair: Builds and repairs body tissues, muscles, skin, and organs.",
    "Enzyme Production: Most enzymes are proteins that catalyse biochemical reactions.",
    "Hormone Synthesis: Insulin, glucagon and growth hormone are protein-based.",
    "Immune Function: Antibodies are proteins that defend against pathogens.",
    "Transport: Haemoglobin transports oxygen; albumin transports nutrients in blood.",
    "Energy Source: Provides 4 kcal/g when carbohydrates and fats are insufficient.",
    "Fluid Balance: Maintains oncotic pressure to prevent oedema.",
    "Structural Role: Collagen, keratin and elastin provide structural integrity.",
  ].map(t => bulletItem(t, COLORS.purple)),

  new Paragraph({ spacing: { before: 200 } }),
  subHeading("Protein Content in Common Foods", COLORS.purple),
  infoTable([
    ["Food", "Protein (per 100g)", "Quality"],
    ["Chicken breast (cooked)", "31g", "Complete"],
    ["Eggs (whole)", "13g", "Complete"],
    ["Milk (whole)", "3.4g", "Complete"],
    ["Lentils (cooked)", "9g", "Incomplete"],
    ["Peanuts", "26g", "Incomplete"],
    ["Ragi (Finger millet)", "7.3g", "Incomplete"],
    ["Soybean", "36g", "Complete (plant)"],
  ], "6A0DAD"),

  new Paragraph({ spacing: { before: 200 } }),
  subHeading("Protein Deficiency Diseases", COLORS.purple),
  infoTable([
    ["Condition", "Description", "Affected Population"],
    ["Kwashiorkor", "Protein deficiency with adequate calories; oedema, skin lesions", "Children after weaning"],
    ["Marasmus", "Severe protein & calorie deficiency; extreme wasting", "Infants & young children"],
    ["PEM (Protein-Energy Malnutrition)", "Combined deficiency of protein and energy", "Developing countries"],
  ], "6A0DAD"),

  pageBreak(),
];

// ─────────────────────────────────────────────
// PAGE 6: METHOD OF FOOD PRESERVATION
// ─────────────────────────────────────────────
const preservationPage = [
  bigTitle("METHOD OF FOOD PRESERVATION", COLORS.blue),
  sectionTitle("Classification of Food Preservation Methods", COLORS.blue),
  new Paragraph({ spacing: { before: 160, after: 160 }, alignment: AlignmentType.CENTER,
    children: [new TextRun({ text: "Food preservation prevents spoilage, extends shelf life, and retains nutritional value.", italics: true, size: 22, font: "Arial", color: "555555" })] }),

  twoColFlowchart(
    "METHOD OF FOOD PRESERVATION",
    "Household Methods",
    ["Cold Method (Refrigeration)", "Drying & Dehydration", "Smoking", "Salting & Pickling"],
    "Commercial Methods",
    ["Canning", "Freezing", "Chemical Preservation", "Irradiation"],
    "1A3A8A", "154360", "7D6608"
  ),

  new Paragraph({ spacing: { before: 200 } }),
  subHeading("Household Methods – Details", COLORS.blue),
  infoTable([
    ["Method", "Principle", "Examples"],
    ["Cold Method", "Low temperature slows microbial growth", "Refrigerating milk, storing fruits"],
    ["Drying & Dehydration", "Removes moisture to inhibit microbial activity", "Sun-dried tomatoes, dried fish, papad"],
    ["Smoking", "Smoke chemicals have antimicrobial properties", "Smoked fish, smoked meat"],
    ["Salting", "High salt concentration draws water out (osmosis)", "Salted fish, pickles"],
    ["Pickling", "Acid (vinegar) or fermentation lowers pH", "Mango pickle, kimchi, sauerkraut"],
  ], "1A3A8A"),

  new Paragraph({ spacing: { before: 200 } }),
  subHeading("Commercial Methods – Details", COLORS.darkBlue),
  infoTable([
    ["Method", "Principle", "Examples"],
    ["Canning", "Heat treatment + airtight sealing prevents contamination", "Canned beans, tuna, tomatoes"],
    ["Freezing", "Temperatures below -18°C stop microbial growth", "Frozen peas, ice cream, meat"],
    ["Chemical Preservation", "Permitted additives inhibit microbial/enzymatic activity", "Sodium benzoate in juices, BHA in fats"],
    ["Irradiation", "Ionising radiation destroys pathogens and insects", "Spices, fresh produce, grains"],
  ], "003366"),

  pageBreak(),
];

// ─────────────────────────────────────────────
// PAGE 7: RAGI CONGEE (KANJI)
// ─────────────────────────────────────────────
const ragiCongeePage = [
  bigTitle("RAGI CONGEE (KANJI)", COLORS.green),
  sectionTitle("Introduction to Ragi Congee", COLORS.green),
  bodyText("Ragi Congee (also known as Ragi Kanji or Finger Millet Porridge) is a traditional South Indian and Sri Lankan nutritional drink/porridge made from finger millet (Eleusine coracana). It has been used for centuries as a weaning food, therapeutic food, and daily staple due to its outstanding nutritional profile."),

  new Paragraph({ spacing: { before: 200 } }),
  subHeading("What is Ragi?", COLORS.green),
  ...[
    "Scientific Name: Eleusine coracana",
    "Common Names: Finger millet, Nachni (Hindi), Kezhvaragu (Tamil), Ragi (Kannada/Telugu)",
    "Type: Small-seeded cereal grain; belongs to the Poaceae (grass) family",
    "Colour: Dark reddish-brown (high tannin/phenolic content)",
    "Origin: Highlands of Ethiopia & Uganda; cultivated in India for 4,000+ years",
    "Climate: Drought-resistant; grows in dry, semi-arid regions",
  ].map(t => bulletItem(t, COLORS.green)),

  new Paragraph({ spacing: { before: 200 } }),
  subHeading("Nutritional Composition of Ragi (per 100g raw)", COLORS.green),
  infoTable([
    ["Nutrient", "Amount", "% Daily Value (approx.)"],
    ["Energy", "336 kcal", "17%"],
    ["Carbohydrates", "72.6 g", "24%"],
    ["Dietary Fibre", "11.5 g", "46%"],
    ["Protein", "7.3 g", "15%"],
    ["Fat", "1.5 g", "2%"],
    ["Calcium", "344 mg", "34%"],
    ["Iron", "3.9 mg", "22%"],
    ["Phosphorus", "283 mg", "28%"],
    ["Potassium", "408 mg", "12%"],
    ["Zinc", "2.3 mg", "16%"],
    ["Vitamin B1 (Thiamine)", "0.42 mg", "28%"],
    ["Vitamin B2 (Riboflavin)", "0.19 mg", "11%"],
    ["Vitamin B3 (Niacin)", "1.1 mg", "6%"],
    ["Vitamin B6 (Pyridoxine)", "0.05 mg", "3%"],
    ["Folic Acid (B9)", "18 mcg", "5%"],
    ["Tryptophan (amino acid)", "~100 mg", "—"],
    ["Methionine (amino acid)", "~150 mg", "—"],
  ], "006400"),

  new Paragraph({ spacing: { before: 200 } }),
  subHeading("How Ragi Congee is Prepared", COLORS.green),
  infoTable([
    ["Step", "Process", "Notes"],
    ["1. Soaking", "Soak ragi seeds/flour in water for 6–12 hours or overnight", "Reduces anti-nutrients (phytates, tannins)"],
    ["2. Fermentation (Optional)", "Allow soaked ragi to ferment 8–24 hours", "Improves bioavailability of iron & zinc"],
    ["3. Grinding/Mixing", "Grind soaked ragi to smooth paste or use pre-made flour", "Ragi flour is convenient for home use"],
    ["4. Cooking", "Mix with water/milk, boil 10–15 min on medium heat, stir continuously", "Ratio: 1 part ragi : 8–10 parts water"],
    ["5. Seasoning", "Add salt or jaggery; optional: ginger, buttermilk, or cardamom", "Jaggery adds iron; buttermilk adds probiotics"],
    ["6. Serving", "Serve warm as a porridge or semi-liquid drink", "Best consumed fresh"],
  ], "006400"),

  new Paragraph({ spacing: { before: 200 } }),
  subHeading("Health Benefits of Ragi Congee", COLORS.green),
  ...[
    "Bone Health: Highest calcium content among all cereals (344 mg/100g) – prevents osteoporosis, rickets, and dental decay.",
    "Anaemia Prevention: Good source of iron (3.9 mg/100g); fermented ragi has significantly higher bioavailable iron.",
    "Diabetes Management: Low glycaemic index (GI ~54); high fibre slows glucose absorption, controls blood sugar spikes.",
    "Weight Management: High fibre + protein content promotes satiety, reducing overeating.",
    "Digestive Health: Insoluble fibre promotes bowel regularity and prevents constipation.",
    "Infant & Child Nutrition: Ideal weaning food (6 months+); rich in amino acids tryptophan and methionine for brain development.",
    "Lactation: Traditionally given to breastfeeding mothers to boost milk production.",
    "Celiac-Friendly: Naturally gluten-free; safe for individuals with gluten intolerance.",
    "Cooling Effect: Acts as a natural coolant for the body; reduces body heat in summer.",
    "Antioxidant Properties: Polyphenols and tannins in ragi neutralise free radicals.",
    "Cholesterol Reduction: Amino acid methionine and lecithin lower bad cholesterol (LDL).",
    "Relaxation & Sleep: Tryptophan is a precursor to serotonin and melatonin – aids sleep and reduces anxiety.",
  ].map(t => bulletItem(t, COLORS.green)),

  new Paragraph({ spacing: { before: 200 } }),
  subHeading("Ragi Congee for Different Age Groups", COLORS.green),
  infoTable([
    ["Age Group", "Serving Suggestion", "Key Benefit"],
    ["Infants (6–12 months)", "Thin ragi porridge with breastmilk/formula", "Weaning food; bone & brain development"],
    ["Toddlers (1–3 years)", "Ragi porridge with jaggery & milk", "Calcium for growing teeth & bones"],
    ["Children (4–12 years)", "Ragi kanji as morning breakfast", "Energy, iron, focus at school"],
    ["Pregnant Women", "Ragi congee with milk & dates", "Folic acid, iron, calcium for foetal growth"],
    ["Lactating Mothers", "Ragi kanji with fenugreek seeds", "Boosts breast milk production"],
    ["Adults (Active)", "Ragi congee as pre/post-workout meal", "Sustained energy, muscle repair"],
    ["Diabetic Patients", "Plain ragi congee without sugar", "Controls blood glucose levels"],
    ["Elderly", "Thin warm ragi porridge", "Bone health, easy digestion, constipation relief"],
  ], "1E8449"),

  new Paragraph({ spacing: { before: 200 } }),
  subHeading("Comparison: Ragi vs Other Cereals (per 100g)", COLORS.green),
  infoTable([
    ["Nutrient", "Ragi", "Rice (white)", "Wheat", "Maize"],
    ["Calcium (mg)", "344", "10", "41", "26"],
    ["Iron (mg)", "3.9", "0.7", "3.5", "2.7"],
    ["Fibre (g)", "11.5", "0.2", "1.9", "2.7"],
    ["Protein (g)", "7.3", "6.8", "11.8", "9.2"],
    ["Energy (kcal)", "336", "345", "341", "342"],
    ["GI", "~54 (Low)", "~73 (High)", "~69 (Medium)", "~52 (Low)"],
  ], "006400"),

  new Paragraph({ spacing: { before: 200 } }),
  subHeading("Varieties of Ragi-Based Preparations", COLORS.green),
  infoTable([
    ["Preparation", "Region", "Description"],
    ["Ragi Mudde", "Karnataka, India", "Thick stiff balls; eaten with sambar or curry"],
    ["Ragi Dosa", "South India", "Thin fermented crepes; crispy texture"],
    ["Ragi Kanji / Congee", "Tamil Nadu, Sri Lanka", "Thin porridge; weaning & therapeutic food"],
    ["Ragi Roti", "Karnataka/Maharashtra", "Flat unleavened bread; eaten with chutney"],
    ["Ragi Malt (Sathu Maavu)", "South India", "Powdered mix with milk; popular infant food"],
    ["Ragi Ladoo", "Pan-India", "Sweet balls with jaggery & ghee"],
    ["Ragi Ambli", "Odisha/Andhra", "Fermented thin gruel; probiotic drink"],
  ], "145A32"),

  new Paragraph({ spacing: { before: 200 } }),
  subHeading("Precautions & Considerations", COLORS.green),
  ...[
    "Kidney Stones: High calcium content – individuals with calcium oxalate kidney stones should limit intake.",
    "Anti-Nutrients: Raw ragi contains phytic acid and tannins that reduce mineral absorption; soaking, sprouting or fermenting reduces these significantly.",
    "Thyroid: Contains goitrogens that may interfere with thyroid function if consumed in very large quantities.",
    "Celiac: Ragi is gluten-free, but cross-contamination can occur during processing – check packaging.",
    "Portion Control: Despite being healthy, excess consumption can cause weight gain due to caloric density.",
  ].map(t => bulletItem(t, "CC0000")),

  pageBreak(),

  // Summary Table
  bigTitle("QUICK REFERENCE SUMMARY", COLORS.darkBlue),
  infoTable([
    ["Topic", "Key Points"],
    ["Vitamins", "Water-soluble (B complex + C) vs Fat-soluble (A, D, E, K); stored in liver/fat tissue"],
    ["Cooking Methods", "Moist heat (boiling, steaming) | Dry heat (baking, roasting) | Combination (braising)"],
    ["Balanced Diet", "Food pyramid: Base (grains 6–11) → Vegetables/Fruits → Dairy/Protein → Fats (sparingly)"],
    ["Proteins", "Complete (animal) vs Incomplete (plant); builds tissues, enzymes, hormones, antibodies"],
    ["Food Preservation", "Household (cold, drying, salting) vs Commercial (canning, freezing, irradiation)"],
    ["Ragi Congee", "Highest Ca among cereals (344mg); low GI; gluten-free; ideal for all ages; fermentation boosts bioavailability"],
  ], COLORS.darkBlue),
];

// ─────────────────────────────────────────────
// ASSEMBLE DOCUMENT
// ─────────────────────────────────────────────
const doc = new Document({
  numbering: {
    config: [
      {
        reference: "bullets",
        levels: [{
          level: 0,
          format: LevelFormat.BULLET,
          text: "•",
          alignment: AlignmentType.LEFT,
          style: { paragraph: { indent: { left: 720, hanging: 360 } } }
        }]
      }
    ]
  },
  styles: {
    default: {
      document: { run: { font: "Arial", size: 22 } }
    }
  },
  sections: [{
    properties: {
      page: {
        margin: { top: 720, bottom: 720, left: 900, right: 900 }
      }
    },
    children: [
      ...coverPage,
      ...vitaminsPage,
      ...cookingPage,
      ...balancedDietPage,
      ...proteinsPage,
      ...preservationPage,
      ...ragiCongeePage,
    ]
  }]
});

Packer.toBuffer(doc).then(buffer => {
  fs.writeFileSync('/home/daytona/workspace/nutrition-file/Nutrition_File.docx', buffer);
  console.log('SUCCESS: Nutrition_File.docx created!');
}).catch(err => {
  console.error('ERROR:', err);
  process.exit(1);
});
You've run out of free credits. Sign up for a free account to continue using Orris.
This is a shared conversation. Sign in to Orris to start your own chat.