~/lifestyle-plan/generate.js
const {
Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
HeadingLevel, AlignmentType, BorderStyle, WidthType, ShadingType,
VerticalAlign, PageNumber, Header, Footer, TableOfContents,
PageBreak, UnderlineType
} = require('docx');
const fs = require('fs');
// βββ Colour palette ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
const TEAL = "1B6B78";
const TEAL_LIGHT = "E8F4F6";
const AMBER = "D97706";
const AMBER_LIGHT= "FEF3C7";
const GREEN = "166534";
const GREEN_LIGHT= "DCFCE7";
const RED_LIGHT = "FEE2E2";
const GRAY_DARK = "374151";
const GRAY_MID = "6B7280";
const WHITE = "FFFFFF";
// βββ Helpers βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
function spacer(pts = 120) {
return new Paragraph({ spacing: { before: pts, after: 0 }, children: [] });
}
function sectionHeading(text, color = TEAL) {
return new Paragraph({
heading: HeadingLevel.HEADING_1,
spacing: { before: 360, after: 120 },
border: { bottom: { style: BorderStyle.SINGLE, size: 6, color: color, space: 4 } },
children: [new TextRun({ text, color, bold: true, size: 28, font: "Calibri" })]
});
}
function subHeading(text, color = GRAY_DARK) {
return new Paragraph({
heading: HeadingLevel.HEADING_2,
spacing: { before: 240, after: 80 },
children: [new TextRun({ text, color, bold: true, size: 24, font: "Calibri" })]
});
}
function body(text, opts = {}) {
return new Paragraph({
spacing: { before: 60, after: 60 },
children: [new TextRun({ text, size: 22, font: "Calibri", color: GRAY_DARK, ...opts })]
});
}
function bullet(text, level = 0) {
return new Paragraph({
bullet: { level },
spacing: { before: 40, after: 40 },
children: [new TextRun({ text, size: 22, font: "Calibri", color: GRAY_DARK })]
});
}
function callout(text, bgColor = AMBER_LIGHT, textColor = AMBER) {
return new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
borders: {
top: { style: BorderStyle.NONE },
bottom: { style: BorderStyle.NONE },
left: { style: BorderStyle.THICK, size: 12, color: textColor },
right: { style: BorderStyle.NONE },
insideH:{ style: BorderStyle.NONE },
insideV:{ style: BorderStyle.NONE },
},
rows: [new TableRow({
children: [new TableCell({
shading: { type: ShadingType.SOLID, color: bgColor },
margins: { top: 80, bottom: 80, left: 160, right: 160 },
children: [new Paragraph({
spacing: { before: 0, after: 0 },
children: [new TextRun({ text, size: 21, font: "Calibri", color: GRAY_DARK, italics: true })]
})]
})]
})]
});
}
function colorTable(headers, rows, headerBg = TEAL, headerText = WHITE) {
const makeCell = (text, isHeader = false, bg = null) =>
new TableCell({
shading: isHeader ? { type: ShadingType.SOLID, color: headerBg }
: bg ? { type: ShadingType.SOLID, color: bg } : undefined,
margins: { top: 80, bottom: 80, left: 120, right: 120 },
verticalAlign: VerticalAlign.CENTER,
children: [new Paragraph({
spacing: { before: 0, after: 0 },
alignment: isHeader ? AlignmentType.CENTER : AlignmentType.LEFT,
children: [new TextRun({
text, size: isHeader ? 21 : 20, font: "Calibri",
color: isHeader ? headerText : GRAY_DARK,
bold: isHeader
})]
})]
});
return new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
borders: {
top: { style: BorderStyle.SINGLE, size: 4, color: "CCCCCC" },
bottom: { style: BorderStyle.SINGLE, size: 4, color: "CCCCCC" },
left: { style: BorderStyle.SINGLE, size: 4, color: "CCCCCC" },
right: { style: BorderStyle.SINGLE, size: 4, color: "CCCCCC" },
insideH:{ style: BorderStyle.SINGLE, size: 4, color: "CCCCCC" },
insideV:{ style: BorderStyle.SINGLE, size: 4, color: "CCCCCC" },
},
rows: [
new TableRow({
tableHeader: true,
children: headers.map(h => makeCell(h, true))
}),
...rows.map((row, ri) => new TableRow({
children: row.map((cell, ci) => {
const bg = ri % 2 === 0 ? "F9FAFB" : WHITE;
return makeCell(cell, false, bg);
})
}))
]
});
}
// βββ COVER PAGE ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
const coverPage = [
spacer(800),
new Paragraph({
alignment: AlignmentType.CENTER,
spacing: { before: 0, after: 60 },
children: [new TextRun({ text: "PERSONALISED LIFESTYLE PLAN", size: 44, bold: true, color: TEAL, font: "Calibri" })]
}),
new Paragraph({
alignment: AlignmentType.CENTER,
spacing: { before: 0, after: 120 },
children: [new TextRun({ text: "Targeting Inflammation & Vitamin D Deficiency", size: 28, color: AMBER, font: "Calibri", italics: true })]
}),
new Paragraph({
alignment: AlignmentType.CENTER,
border: { bottom: { style: BorderStyle.DOUBLE, size: 6, color: TEAL, space: 4 } },
spacing: { before: 0, after: 240 },
children: []
}),
spacer(120),
new Paragraph({
alignment: AlignmentType.CENTER,
spacing: { before: 60, after: 40 },
children: [new TextRun({ text: "Prepared for:", size: 22, color: GRAY_MID, font: "Calibri" })]
}),
new Paragraph({
alignment: AlignmentType.CENTER,
spacing: { before: 0, after: 40 },
children: [new TextRun({ text: "Shahnaz Bano", size: 32, bold: true, color: GRAY_DARK, font: "Calibri" })]
}),
new Paragraph({
alignment: AlignmentType.CENTER,
spacing: { before: 0, after: 40 },
children: [new TextRun({ text: "64 years | Female", size: 22, color: GRAY_MID, font: "Calibri" })]
}),
new Paragraph({
alignment: AlignmentType.CENTER,
spacing: { before: 40, after: 40 },
children: [new TextRun({ text: "Based on Lab Report dated: 04 July 2026", size: 22, color: GRAY_MID, font: "Calibri" })]
}),
new Paragraph({
alignment: AlignmentType.CENTER,
spacing: { before: 40, after: 40 },
children: [new TextRun({ text: "Report Generated: 12 July 2026", size: 22, color: GRAY_MID, font: "Calibri" })]
}),
spacer(200),
new Table({
width: { size: 70, type: WidthType.PERCENTAGE },
borders: { top:{style:BorderStyle.NONE},bottom:{style:BorderStyle.NONE},left:{style:BorderStyle.NONE},right:{style:BorderStyle.NONE},insideH:{style:BorderStyle.NONE},insideV:{style:BorderStyle.NONE} },
rows: [new TableRow({ children: [
new TableCell({
shading: { type: ShadingType.SOLID, color: RED_LIGHT },
margins: { top: 80, bottom: 80, left: 140, right: 140 },
children: [
new Paragraph({ alignment: AlignmentType.CENTER, spacing:{before:0,after:0}, children:[new TextRun({text:"hs-CRP", bold:true, size:20, color:"991B1B", font:"Calibri"})]}),
new Paragraph({ alignment: AlignmentType.CENTER, spacing:{before:0,after:0}, children:[new TextRun({text:"7.33 mg/L", bold:true, size:24, color:"991B1B", font:"Calibri"})]}),
new Paragraph({ alignment: AlignmentType.CENTER, spacing:{before:0,after:0}, children:[new TextRun({text:"(ref <1.0)", size:18, color:"991B1B", font:"Calibri"})]})
]
}),
new TableCell({ width:{size:40,type:WidthType.DXA}, borders:{top:{style:BorderStyle.NONE},bottom:{style:BorderStyle.NONE},left:{style:BorderStyle.NONE},right:{style:BorderStyle.NONE},insideH:{style:BorderStyle.NONE},insideV:{style:BorderStyle.NONE}}, children:[new Paragraph({children:[]})] }),
new TableCell({
shading: { type: ShadingType.SOLID, color: AMBER_LIGHT },
margins: { top: 80, bottom: 80, left: 140, right: 140 },
children: [
new Paragraph({ alignment: AlignmentType.CENTER, spacing:{before:0,after:0}, children:[new TextRun({text:"Vitamin D", bold:true, size:20, color:"92400E", font:"Calibri"})]}),
new Paragraph({ alignment: AlignmentType.CENTER, spacing:{before:0,after:0}, children:[new TextRun({text:"19.98 ng/mL", bold:true, size:24, color:"92400E", font:"Calibri"})]}),
new Paragraph({ alignment: AlignmentType.CENTER, spacing:{before:0,after:0}, children:[new TextRun({text:"(ref 30-100)", size:18, color:"92400E", font:"Calibri"})]})
]
})
]})]
}),
spacer(800),
new Paragraph({ children: [new PageBreak()] })
];
// βββ SECTION 1 β Understanding the Issues βββββββββββββββββββββββββββββββββ
const section1 = [
sectionHeading("1. Understanding Your Key Health Concerns"),
spacer(80),
subHeading("1.1 Systemic Inflammation (Elevated hs-CRP)"),
body("Your hs-CRP reading of 7.33 mg/L is over seven times the optimal level of <1.0 mg/L. C-Reactive Protein is produced by the liver in response to inflammation anywhere in the body. Chronic low-grade inflammation of this magnitude is a well-established independent risk factor for:"),
bullet("Cardiovascular disease and atherosclerosis"),
bullet("Type 2 diabetes progression"),
bullet("Cognitive decline and dementia"),
bullet("Accelerated ageing and joint deterioration"),
spacer(80),
callout("The good news: hs-CRP is highly responsive to lifestyle changes. Studies consistently show that diet, exercise, weight management, and sleep can reduce CRP by 30-50% within 8-12 weeks.", TEAL_LIGHT, TEAL),
spacer(120),
subHeading("1.2 Vitamin D Deficiency"),
body("Your Vitamin D (25-OH) level of 19.98 ng/mL falls in the deficiency range (below 20 ng/mL). Optimal levels are 30-100 ng/mL. Vitamin D functions more like a hormone than a vitamin - it regulates over 200 genes and is essential for:"),
bullet("Calcium absorption and bone density (critical at age 64 to prevent osteoporosis)"),
bullet("Immune system modulation - low Vitamin D is directly linked to higher inflammation markers"),
bullet("Muscle strength and neuromuscular function - reducing fall risk"),
bullet("Mood regulation - low levels are associated with depression and fatigue"),
bullet("Cardiovascular protection and insulin sensitivity"),
spacer(80),
callout("There is a direct connection between these two problems: Vitamin D deficiency itself drives inflammation. Correcting your Vitamin D levels will help lower your hs-CRP as well.", AMBER_LIGHT, AMBER),
new Paragraph({ children: [new PageBreak()] })
];
// βββ SECTION 2 β Nutrition Plan ββββββββββββββββββββββββββββββββββββββββββββ
const section2 = [
sectionHeading("2. Anti-Inflammatory Nutrition Plan"),
spacer(80),
body("Food is one of the most powerful tools to reduce inflammation. The plan below is based on an anti-inflammatory Mediterranean-style approach tailored to your profile."),
spacer(80),
subHeading("2.1 Foods to Eat Daily"),
colorTable(
["Food Group", "Examples", "Why It Helps"],
[
["Fatty fish", "Salmon, mackerel, sardines, rohu, hilsa (2-3x/week)", "Rich in omega-3 (EPA/DHA) - the most potent natural anti-inflammatory"],
["Colourful vegetables", "Spinach, broccoli, capsicum, tomatoes, beetroot, carrots", "Antioxidants & polyphenols neutralise free radicals that drive inflammation"],
["Berries & fruits", "Blueberries, pomegranate, papaya, guava, oranges", "Quercetin, resveratrol, Vitamin C - all suppress inflammatory pathways"],
["Turmeric", "Fresh or powdered with black pepper (piperin enhances absorption)", "Curcumin is one of the best-studied natural COX-2 inhibitors"],
["Ginger", "Fresh ginger in tea, cooking, or warm water daily", "Gingerols inhibit pro-inflammatory cytokines"],
["Extra virgin olive oil", "2 tbsp daily in cooking or salad dressing", "Oleocanthal has similar mechanism to ibuprofen"],
["Nuts & seeds", "Walnuts (best), almonds, flaxseeds, chia seeds", "ALA omega-3, Vitamin E, magnesium - all anti-inflammatory"],
["Legumes", "Lentils, chickpeas, rajma, moong dal (daily)", "Fibre feeds gut bacteria that produce anti-inflammatory short-chain fatty acids"],
["Whole grains", "Oats, brown rice, whole wheat roti, millets (jowar, bajra)", "Low glycaemic index - reduces insulin spikes that trigger inflammation"],
["Green tea", "2-3 cups per day", "EGCG polyphenol is a strong anti-inflammatory and antioxidant"],
]
),
spacer(120),
subHeading("2.2 Vitamin D-Rich Foods"),
body("While sunlight is the primary source, these foods meaningfully contribute to your Vitamin D intake:"),
colorTable(
["Food", "Approximate Vitamin D per Serving"],
[
["Salmon (100g)", "~600-1000 IU"],
["Sardines, canned (85g)", "~300 IU"],
["Egg yolk (1 large)", "~40 IU"],
["Fortified milk (1 cup)", "~100-120 IU"],
["Fortified orange juice (1 cup)", "~100 IU"],
["Mushrooms, sun-exposed (100g)", "~400 IU"],
["Hilsa fish (100g)", "~360 IU"],
]
),
spacer(80),
callout("Note: Food alone cannot correct Vitamin D deficiency from 19.98 ng/mL to optimal levels. Supplementation prescribed by your doctor is essential alongside dietary improvements.", AMBER_LIGHT, AMBER),
spacer(120),
subHeading("2.3 Foods to Reduce or Avoid"),
colorTable(
["Avoid / Limit", "Why"],
[
["Refined sugar & sugary drinks", "Directly activates NF-kB, the master inflammatory pathway"],
["Refined white flour (maida)", "Rapid glucose spikes trigger pro-inflammatory cytokine release"],
["Red meat & processed meats", "Saturated fat + arachidonic acid + advanced glycation end-products all pro-inflammatory"],
["Trans fats (vanaspati, packaged snacks)", "Strongly associated with elevated CRP and cardiovascular risk"],
["Vegetable / seed oils (sunflower, soya in excess)", "High omega-6 to omega-3 ratio promotes inflammation"],
["Alcohol", "Disrupts gut barrier, increases endotoxin levels, drives systemic inflammation"],
["Excess salt & pickles", "Promotes immune dysregulation and hypertension risk"],
["Ultra-processed foods", "Multiple additives and preservatives promote oxidative stress"],
]
),
spacer(120),
subHeading("2.4 Sample Daily Meal Plan"),
colorTable(
["Meal", "Example (Indian-friendly)"],
[
["Early Morning (7 AM)", "Warm water with juice of half lemon + 1 tsp turmeric + pinch of black pepper"],
["Breakfast (8-9 AM)", "Oats porridge with walnuts, flaxseeds, berries OR 2 whole wheat rotis with moong dal + 1 boiled egg"],
["Mid-Morning (11 AM)", "Green tea + a small handful of almonds (8-10) or a fruit (guava/orange/papaya)"],
["Lunch (1-2 PM)", "Brown rice / 2 rotis + rajma/dal + sabzi (leafy greens) + raita + salad with olive oil dressing"],
["Evening Snack (4-5 PM)", "Green tea + handful of walnuts OR roasted chana"],
["Dinner (7-8 PM)", "Grilled/baked fish OR egg curry + 1-2 rotis + steamed vegetables + dal"],
["Post-dinner", "Warm turmeric milk (haldi doodh) with black pepper"],
]
),
new Paragraph({ children: [new PageBreak()] })
];
// βββ SECTION 3 β Exercise Plan βββββββββββββββββββββββββββββββββββββββββββββ
const section3 = [
sectionHeading("3. Physical Activity Plan"),
spacer(80),
body("Regular physical activity is one of the most powerful anti-inflammatory interventions available. Exercise reduces CRP, increases Vitamin D metabolism, and improves every system in the body. The plan is tailored for a 64-year-old woman with a BMI of 29.55, starting gradually and building progressively."),
spacer(80),
subHeading("3.1 Weekly Exercise Target"),
callout("Goal: 150 minutes of moderate aerobic activity per week + 2 strength sessions + daily mobility work. This matches WHO guidelines for adults 60+ and has strong evidence for CRP reduction.", GREEN_LIGHT, GREEN),
spacer(120),
subHeading("3.2 Weekly Exercise Schedule"),
colorTable(
["Day", "Activity", "Duration", "Intensity"],
[
["Monday", "Brisk walking", "30 min", "Moderate (can talk but slightly breathless)"],
["Tuesday", "Strength training (bodyweight/bands)", "25 min", "Light to moderate"],
["Wednesday", "Brisk walking + gentle yoga", "30+15 min","Moderate + Low"],
["Thursday", "Rest or gentle stretching", "15-20 min","Light"],
["Friday", "Brisk walking", "30 min", "Moderate"],
["Saturday", "Strength training + balance exercises", "25 min", "Light to moderate"],
["Sunday", "Yoga / tai chi / leisure walk", "30 min", "Low to moderate"],
]
),
spacer(120),
subHeading("3.3 Vitamin D - Sunlight Protocol"),
body("Sunlight is the most efficient source of Vitamin D. The skin synthesises Vitamin D3 when UVB rays hit it directly (not through glass)."),
spacer(60),
colorTable(
["Parameter", "Recommendation"],
[
["Timing", "10 AM - 12 PM (optimal UVB angle in India; avoid peak heat 12-3 PM in summer)"],
["Duration", "15-20 minutes daily (lighter skin tones need less; darker skin needs more)"],
["Body exposure", "Arms, legs, and face exposed - avoid sunscreen during this window"],
["Frequency", "Daily, at least 5 days per week"],
["Caution", "If outdoors in peak summer, shift to 8-10 AM and limit to 10-15 minutes"],
]
),
spacer(80),
callout("Combine your morning walk with sunlight exposure - 20-30 minutes of morning walking outdoors achieves both anti-inflammatory exercise and Vitamin D synthesis simultaneously.", GREEN_LIGHT, GREEN),
spacer(120),
subHeading("3.4 Strength Training - Bodyweight Exercises (Beginner Level)"),
body("Perform 2-3 sets of 10-12 repetitions each, 2x per week:"),
bullet("Chair squats (squat to and from a chair)"),
bullet("Wall push-ups"),
bullet("Seated leg raises"),
bullet("Calf raises (standing, holding a wall)"),
bullet("Glute bridges (lying on back)"),
bullet("Resistance band rows (for upper back)"),
spacer(80),
body("Progress: Add one set or 2 repetitions every 2 weeks as strength improves."),
new Paragraph({ children: [new PageBreak()] })
];
// βββ SECTION 4 β Supplementation βββββββββββββββββββββββββββββββββββββββββββ
const section4 = [
sectionHeading("4. Supplementation Guidance"),
spacer(80),
callout("IMPORTANT: All supplements, especially Vitamin D and B12, should be prescribed by your doctor who will determine the correct dose based on your levels, kidney function, and other medications. Do not self-prescribe.", RED_LIGHT, "991B1B"),
spacer(120),
subHeading("4.1 Likely Supplements Your Doctor May Prescribe"),
colorTable(
["Supplement", "Typical Dose (to discuss with doctor)", "Purpose", "Notes"],
[
["Vitamin D3 (Cholecalciferol)", "60,000 IU weekly x 8-12 weeks (loading), then 1000-2000 IU/day maintenance", "Correct deficiency", "Always taken with Vitamin K2 (MK7) to guide calcium to bones, not arteries"],
["Vitamin K2 (MK-7)", "100-200 mcg/day", "Works with Vitamin D", "Prevents arterial calcification"],
["Methylcobalamin (B12)", "500-1500 mcg/day", "Lower elevated homocysteine", "Methylcobalamin form is better absorbed than cyanocobalamin"],
["Folate (Methyl-folate)", "400-800 mcg/day", "Lower homocysteine with B12", "Methylfolate preferred over folic acid"],
["Omega-3 Fish Oil", "1000-2000 mg EPA+DHA/day", "Anti-inflammatory", "Pharmaceutical grade; take with meals to reduce fishy aftertaste"],
["Magnesium Glycinate", "200-400 mg/day at night", "Anti-inflammatory, sleep, bone health, activates Vitamin D", "Glycinate form is best tolerated"],
]
),
spacer(120),
subHeading("4.2 Natural Anti-Inflammatory Additions"),
body("These can be safely added to diet or taken as supplements without a prescription:"),
colorTable(
["Natural Supplement", "How to Use"],
[
["Turmeric + Black Pepper", "1/4-1/2 tsp turmeric daily in food or warm milk; always with black pepper (piperine boosts absorption 2000%)"],
["Ginger", "1-2 cm fresh ginger in tea, cooking, or warm water - daily"],
["Flaxseed (ground)", "1 tablespoon ground flaxseed in yoghurt, dal, or smoothie daily"],
["Walnuts", "6-8 walnuts daily - highest plant omega-3 content (ALA)"],
]
),
new Paragraph({ children: [new PageBreak()] })
];
// βββ SECTION 5 β Sleep & Stress ββββββββββββββββββββββββββββββββββββββββββββ
const section5 = [
sectionHeading("5. Sleep & Stress Management"),
spacer(80),
body("Poor sleep and chronic stress are two of the biggest drivers of elevated CRP. Both activate the HPA axis, flood the body with cortisol, and trigger pro-inflammatory cytokine release. Addressing these is as important as diet and exercise."),
spacer(80),
subHeading("5.1 Sleep Optimisation"),
colorTable(
["Target", "Details"],
[
["Duration", "7-8 hours of uninterrupted sleep per night"],
["Consistency", "Sleep and wake at the same time every day (even weekends)"],
["Screen-free time","No phone/TV screens 60 minutes before bed (blue light suppresses melatonin)"],
["Room environment","Cool (22-25Β°C), dark, and quiet"],
["Evening routine", "Warm bath/shower 1-2 hours before bed, followed by light stretching or reading"],
["Avoid", "Caffeine after 2 PM, heavy meals within 3 hours of bedtime"],
["Turmeric milk", "Warm haldi doodh 30 minutes before bed - natural anti-inflammatory and sleep aid"],
]
),
spacer(120),
subHeading("5.2 Stress Reduction Techniques"),
body("Chronic psychological stress directly raises CRP. These evidence-based practices help:"),
spacer(60),
colorTable(
["Practice", "Recommended Dose", "Evidence for CRP Reduction"],
[
["Diaphragmatic breathing", "5-10 min, twice daily", "Activates parasympathetic nervous system, lowers cortisol within minutes"],
["Mindfulness meditation", "10-20 min daily", "Meta-analyses show 15-25% CRP reduction with consistent 8-week practice"],
["Yoga (gentle/restorative)", "3-4x/week, 30-45 min", "Reduces cortisol, IL-6, and TNF-alpha - key inflammatory markers"],
["Socialising & connection", "Daily interaction with family/friends", "Social isolation is associated with a 30% increase in inflammatory markers"],
["Nature exposure", "15-30 min outdoors daily", "Forest bathing (Shinrin-yoku) reduces cortisol and CRP"],
["Journaling / gratitude", "5-10 min before bed", "Positive affect is inversely correlated with inflammatory biomarkers"],
]
),
spacer(80),
callout("A simple daily breathing practice: Inhale for 4 counts - Hold for 4 counts - Exhale for 6 counts. Repeat 10 times. Do this morning and evening. Research shows this activates the vagus nerve and reduces systemic inflammation.", GREEN_LIGHT, GREEN),
new Paragraph({ children: [new PageBreak()] })
];
// βββ SECTION 6 β Weight Management βββββββββββββββββββββββββββββββββββββββββ
const section6 = [
sectionHeading("6. Weight Management"),
spacer(80),
body("Your current BMI is 29.55 (overweight range). Adipose (fat) tissue - particularly abdominal fat - is metabolically active and secretes pro-inflammatory adipokines (TNF-alpha, IL-6, leptin). Weight reduction will directly lower hs-CRP."),
spacer(80),
callout("Research finding: Even a 5-10% reduction in body weight (approximately 3.5-7 kg for you) can reduce hs-CRP by up to 40% and significantly improve Vitamin D metabolism.", TEAL_LIGHT, TEAL),
spacer(120),
subHeading("6.1 Safe Weight Loss Target"),
bullet("Target: 0.5 kg per week (sustainable and safe for age 64)"),
bullet("This requires a daily caloric deficit of approximately 500 calories"),
bullet("Avoid crash diets - rapid weight loss increases cortisol and inflammation"),
bullet("Focus on quality of food first, then quantity"),
spacer(120),
subHeading("6.2 Practical Weight Management Tips"),
colorTable(
["Strategy", "How to Apply"],
[
["Plate method", "Half the plate = vegetables; 1/4 = protein (fish/dal/egg); 1/4 = whole grain"],
["Eat slowly", "Put fork down between bites; aim for 20 minutes per meal - satiety signals take time"],
["Portion control", "Use smaller plates (25 cm vs. 30 cm reduces intake by ~22% subconsciously)"],
["Intermittent fasting", "12:12 window (e.g., eat 7 AM - 7 PM, fast the rest) - reduces inflammation and improves metabolic health"],
["Hydration", "2-2.5 litres of water daily; drink a full glass of water before each meal"],
["Cook at home", "Restaurant food is high in seed oils, salt, and refined carbs that drive inflammation"],
]
),
new Paragraph({ children: [new PageBreak()] })
];
// βββ SECTION 7 β Monitoring Plan βββββββββββββββββββββββββββββββββββββββββββ
const section7 = [
sectionHeading("7. Monitoring & Follow-Up Schedule"),
spacer(80),
body("Tracking progress with repeat blood tests confirms that your interventions are working and allows you to adjust the plan accordingly."),
spacer(80),
subHeading("7.1 Recommended Follow-Up Tests"),
colorTable(
["Test", "Repeat At", "Target by 3 Months"],
[
["hs-CRP", "6 weeks + 3 months", "<3.0 mg/L (ideally <1.0 mg/L)"],
["Vitamin D (25-OH)", "3 months", ">30 ng/mL (ideally 40-60 ng/mL)"],
["Homocysteine", "3 months", "<10 Β΅mol/L"],
["Vitamin B12", "3 months", ">500 pg/mL"],
["Lipid Profile", "3 months", "LDL <100 mg/dL, Total Cholesterol <200 mg/dL"],
["Complete Blood Count (CBC)", "6 weeks", "Hb >12 g/dL, Lymphocytes within range"],
["Uric Acid", "3 months", "<6.0 mg/dL"],
["Fasting Blood Glucose + HbA1c", "3 months", "FBS <100, HbA1c <5.7%"],
["Body weight + BMI", "Monthly", "BMI <27 within 6 months"],
]
),
spacer(120),
subHeading("7.2 Signs of Improvement to Watch For"),
body("Within 4-8 weeks of following this plan consistently, you may notice:"),
bullet("Improved energy levels and reduced fatigue"),
bullet("Better sleep quality"),
bullet("Reduced joint aches or stiffness"),
bullet("Improved mood and mental clarity"),
bullet("Gradual weight loss (0.5-1 kg per week)"),
bullet("Reduced bloating and improved digestion"),
spacer(120),
subHeading("7.3 Warning Signs - Consult Your Doctor If:"),
bullet("Muscle weakness or cramps worsen (may indicate Vitamin D or magnesium deficiency progressing)"),
bullet("Unexplained weight loss or gain"),
bullet("New joint pain or swelling"),
bullet("Persistent fatigue not responding to lifestyle changes"),
bullet("Chest discomfort, palpitations, or breathlessness during exercise"),
new Paragraph({ children: [new PageBreak()] })
];
// βββ SECTION 8 β Quick Reference Summary βββββββββββββββββββββββββββββββββββ
const section8 = [
sectionHeading("8. Quick Reference - Daily Checklist"),
spacer(80),
body("Print this page and stick it on your refrigerator or bathroom mirror as a daily reminder."),
spacer(80),
colorTable(
["Time", "Action", "Purpose"],
[
["Morning (on waking)", "Warm lemon water + turmeric + black pepper", "Kickstart anti-inflammatory cascade"],
["7-8 AM", "Healthy breakfast (oats/eggs/whole grain roti + dal)", "Stable blood sugar, anti-inflammatory nutrients"],
["8-9 AM", "30-minute outdoor walk in morning sun", "Exercise (anti-inflammatory) + Vitamin D synthesis"],
["10 AM", "Vitamin D supplement (with breakfast/K2)", "Correct deficiency"],
["11 AM", "Green tea + handful of walnuts/almonds", "Antioxidants, omega-3"],
["1-2 PM", "Balanced lunch (fish/dal + greens + whole grain)", "Main anti-inflammatory meal"],
["3 PM", "5-10 min deep breathing / meditation", "Cortisol reduction"],
["4-5 PM", "Light snack + water", "Avoid energy crash"],
["5-7 PM (alt. days)", "Strength training or yoga", "Muscle building, inflammation reduction"],
["7-8 PM", "Light anti-inflammatory dinner", "Omega-3, vegetables, protein"],
["9 PM", "Screens off; reading/relaxation", "Melatonin production, better sleep"],
["9:30 PM", "Turmeric milk (haldi doodh)", "Anti-inflammatory, sleep aid"],
["10 PM", "Sleep", "7-8 hours of repair and recovery"],
]
),
spacer(120),
callout("Remember: Consistency over perfection. Following 80% of this plan consistently for 12 weeks will produce measurable improvements in your blood test results. Small daily actions compound into profound health changes.", TEAL_LIGHT, TEAL),
spacer(120),
new Paragraph({
alignment: AlignmentType.CENTER,
spacing: { before: 200, after: 100 },
border: { top: { style: BorderStyle.SINGLE, size: 4, color: TEAL, space: 6 } },
children: [new TextRun({ text: "This plan is prepared for informational purposes and does not replace medical advice. Please consult your physician before starting any new supplement regimen or vigorous exercise programme.", size: 18, italics: true, color: GRAY_MID, font: "Calibri" })]
}),
new Paragraph({
alignment: AlignmentType.CENTER,
spacing: { before: 40, after: 60 },
children: [new TextRun({ text: "Orris Health Intelligence | July 2026", size: 18, color: GRAY_MID, font: "Calibri" })]
}),
];
// βββ DOCUMENT ASSEMBLY βββββββββββββββββββββββββββββββββββββββββββββββββββββ
const doc = new Document({
title: "Personalised Lifestyle Plan - Shahnaz Bano",
description: "Anti-Inflammatory and Vitamin D Deficiency Correction Plan",
creator: "Orris Health Intelligence",
styles: {
default: {
document: { run: { font: "Calibri", size: 22, color: GRAY_DARK } }
}
},
sections: [{
properties: {
page: {
margin: { top: 1080, bottom: 1080, left: 1080, right: 1080 }
}
},
headers: {
default: new Header({
children: [
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
borders: { top:{style:BorderStyle.NONE},bottom:{style:BorderStyle.SINGLE,size:4,color:TEAL},left:{style:BorderStyle.NONE},right:{style:BorderStyle.NONE},insideH:{style:BorderStyle.NONE},insideV:{style:BorderStyle.NONE} },
rows: [new TableRow({ children: [
new TableCell({ borders:{top:{style:BorderStyle.NONE},bottom:{style:BorderStyle.NONE},left:{style:BorderStyle.NONE},right:{style:BorderStyle.NONE},insideH:{style:BorderStyle.NONE},insideV:{style:BorderStyle.NONE}}, children: [new Paragraph({ children: [new TextRun({ text: "Personalised Lifestyle Plan - Shahnaz Bano", bold: true, color: TEAL, size: 18, font: "Calibri" })] })] }),
new TableCell({ borders:{top:{style:BorderStyle.NONE},bottom:{style:BorderStyle.NONE},left:{style:BorderStyle.NONE},right:{style:BorderStyle.NONE},insideH:{style:BorderStyle.NONE},insideV:{style:BorderStyle.NONE}}, children: [new Paragraph({ alignment: AlignmentType.RIGHT, children: [new TextRun({ text: "CONFIDENTIAL", color: GRAY_MID, size: 16, font: "Calibri" })] })] }),
]})]
})
]
})
},
footers: {
default: new Footer({
children: [
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
borders: { top:{style:BorderStyle.SINGLE,size:4,color:TEAL},bottom:{style:BorderStyle.NONE},left:{style:BorderStyle.NONE},right:{style:BorderStyle.NONE},insideH:{style:BorderStyle.NONE},insideV:{style:BorderStyle.NONE} },
rows: [new TableRow({ children: [
new TableCell({ borders:{top:{style:BorderStyle.NONE},bottom:{style:BorderStyle.NONE},left:{style:BorderStyle.NONE},right:{style:BorderStyle.NONE},insideH:{style:BorderStyle.NONE},insideV:{style:BorderStyle.NONE}}, children: [new Paragraph({ children: [new TextRun({ text: "Orris Health Intelligence | July 2026", color: GRAY_MID, size: 16, font: "Calibri" })] })] }),
new TableCell({ borders:{top:{style:BorderStyle.NONE},bottom:{style:BorderStyle.NONE},left:{style:BorderStyle.NONE},right:{style:BorderStyle.NONE},insideH:{style:BorderStyle.NONE},insideV:{style:BorderStyle.NONE}}, children: [new Paragraph({ alignment: AlignmentType.RIGHT, children: [new TextRun({ text: "Page ", color: GRAY_MID, size: 16, font: "Calibri" }), new TextRun({ children: [PageNumber.CURRENT], color: GRAY_MID, size: 16, font: "Calibri" }), new TextRun({ text: " of ", color: GRAY_MID, size: 16, font: "Calibri" }), new TextRun({ children: [PageNumber.TOTAL_PAGES], color: GRAY_MID, size: 16, font: "Calibri" })] })] }),
]})]
})
]
})
},
children: [
...coverPage,
...section1,
...section2,
...section3,
...section4,
...section5,
...section6,
...section7,
...section8,
]
}]
});
Packer.toBuffer(doc).then(buf => {
fs.writeFileSync("/home/daytona/workspace/lifestyle-plan/Lifestyle_Plan_Shahnaz_Bano.docx", buf);
console.log("SUCCESS: Document written.");
}).catch(err => {
console.error("ERROR:", err);
process.exit(1);
});