attachment
attachment

Diagnosis and treatment

Reading File
analyse_media
Finding Sources
Finding Sources
Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
I now have enough information to provide a thorough clinical interpretation. Here is the full analysis:

Lab Report Analysis - Mr. Arbaz, 23M (09-Jul-2026)

Abnormal Results Summary

TestResultReferenceStatus
Triglycerides409 mg/dL< 150HIGH
LDL:HDL Ratio3.61< 3.22Above target
Cholesterol:HDL Ratio5.61< 6.0Borderline
SGOT (AST)77.44 U/L0-38~2x elevated
SGPT (ALT)171.41 U/L0-41~4x elevated
GGTP85.75 U/L7-34~2.5x elevated
Bilirubin Total0.75 mg/dL0-1.0Normal
Bilirubin Direct0.17 mg/dL0-0.25Normal

Diagnosis

1. Hypertriglyceridemia (High Grade - 409 mg/dL)

This falls in the HIGH category (200-499 mg/dL) per NCEP 2002 classification. At 23 years of age, this is significantly elevated and indicates an independent cardiovascular risk factor. Common contributing causes in a young male include:
  • Obesity / overweight
  • High-carbohydrate or high-fat diet
  • Insulin resistance / undiagnosed Type 2 diabetes
  • Alcohol consumption
  • Genetic dyslipidemia (familial hypertriglyceridemia)
  • Sedentary lifestyle
  • Metabolic syndrome

2. Hepatocellular Pattern Liver Injury

  • SGPT (ALT) is 4.2x the upper limit of normal (171 vs. 41) - the most liver-specific enzyme
  • SGOT (AST) is 2x the upper limit (77 vs. 38)
  • GGTP is 2.5x elevated (86 vs. 34), suggesting possible alcohol-related or biliary component
  • Bilirubin is normal - no jaundice, no cholestasis, early stage
AST:ALT ratio = 77:171 ≈ 0.45 - This ratio < 1.0 (ALT predominant) is characteristic of non-alcoholic fatty liver disease (NAFLD/MASLD) or metabolic dysfunction-associated steatotic liver disease (MASLD).
An AST:ALT ratio > 2:1 would suggest alcoholic liver disease; a ratio < 1 points strongly toward NAFLD/MASLD or viral hepatitis.

Most Likely Unified Diagnosis: Metabolic Syndrome with NAFLD/MASLD

The combination of high triglycerides + elevated liver enzymes (ALT-dominant) in a young male is the classic presentation of NAFLD/MASLD, which is strongly associated with insulin resistance, dyslipidemia, and obesity. These conditions frequently co-exist and share a common metabolic pathway.

Differential Diagnosis to Exclude

  1. Viral Hepatitis (B or C) - needs hepatitis B surface antigen (HBsAg) and anti-HCV testing
  2. Alcoholic liver disease - AST:ALT < 2 makes this less likely, but alcohol history is important
  3. Autoimmune hepatitis - less common, needs ANA/ASMA testing if above excluded
  4. Drug-induced liver injury - review all current medications
  5. Wilson's disease - rare, but must consider in young patients with unexplained liver disease
  6. Familial hypertriglyceridemia / Type IV hyperlipidemia - possible genetic component at age 23

Recommended Investigations

Urgent / First-line:
  • Fasting blood glucose + HbA1c (rule out diabetes/pre-diabetes)
  • Full lipid profile (LDL, HDL, total cholesterol) - likely missing from this report
  • Hepatitis B surface antigen (HBsAg), Hepatitis C antibody (anti-HCV)
  • Serum insulin + HOMA-IR (insulin resistance index)
  • Abdominal ultrasound (liver echogenicity - will show fatty infiltration)
Second-line (if above inconclusive):
  • LFT repeat in 4-6 weeks after lifestyle changes
  • Thyroid function tests (TSH) - hypothyroidism can raise triglycerides
  • Renal function tests (BUN/Creatinine)
  • ANA, ASMA (if autoimmune hepatitis suspected)
  • Serum ceruloplasmin (Wilson's disease in young patients)

Treatment

A. Lifestyle Modifications (First-Line for Both Conditions)

These are mandatory and form the foundation of treatment, per the Washington Manual of Medical Therapeutics:
  • Diet: Very low refined carbohydrate and sugar intake (sugars/white rice/maida spike triglycerides most); limit saturated fats; increase fiber; Mediterranean-style diet
  • Weight loss: Even 5-10% body weight reduction significantly improves both liver enzymes and triglycerides
  • Physical activity: 150 minutes/week of moderate aerobic exercise (brisk walking, cycling)
  • Alcohol: Complete avoidance - alcohol worsens both hypertriglyceridemia and liver inflammation
  • Omega-3 rich foods: Fatty fish (salmon, sardines), flaxseed, walnuts

B. Pharmacological Treatment

For Hypertriglyceridemia (TG 409 mg/dL): Since TG is in the "High" range (200-499) - not yet "Very High" - lifestyle changes are attempted first. If TG remains elevated after 3 months of lifestyle change, consider:
  • Fenofibrate (preferred fibrate) - 145 mg once daily; more effective than gemfibrozil for TG lowering; also raises HDL. Use with caution given elevated liver enzymes - monitor LFTs. - Lippincott Pharmacology
  • Omega-3 fatty acids (prescription) - icosapentaenoic acid (EPA) 4 g/day as adjunct - Washington Manual
  • Niacin - effective but poorly tolerated; less commonly used now
Caution: Statins are NOT the primary drug for hypertriglyceridemia (they target LDL). With the current liver enzyme elevation (ALT > 3x ULN), statins should be used cautiously and are generally deferred until liver status is clarified.
For Liver (NAFLD/MASLD):
  • No specific FDA-approved drug for NAFLD as yet; lifestyle modification is the mainstay
  • Vitamin E (800 IU/day) - has shown benefit in non-diabetic NAFLD (off-label)
  • Treat underlying insulin resistance/diabetes if confirmed
  • Avoid hepatotoxic drugs and alcohol strictly

C. Monitoring Plan

TimeframeAction
NowHepatitis serology, fasting glucose/HbA1c, ultrasound abdomen
4-6 weeksRepeat LFTs after lifestyle modification begins
3 monthsRepeat fasting lipid panel; decide on pharmacotherapy need
OngoingAnnual lipid panel, LFT, glucose monitoring

Key Clinical Points

  • At age 23, this profile is a serious warning sign for future cardiovascular disease and cirrhosis if untreated
  • The LDL:HDL ratio of 3.61 (borderline risk range 3.0-6.0) indicates an atherogenic lipid profile
  • The Cholesterol:HDL ratio of 5.61 (just below the 6.0 cutoff) suggests moderate cardiovascular risk
  • NCEP 2002 identifies elevated triglycerides as an independent risk factor for Coronary Heart Disease
  • An ALT of 171 (4x ULN) warrants further evaluation before starting any lipid-lowering drug that may have hepatic effects
Important: This analysis is for informational and educational purposes. The patient should see a physician (ideally a hepatologist and/or cardiologist) for clinical evaluation, history-taking, and individualized management. Lab results must always be interpreted in the context of symptoms, physical examination, and clinical history.

Create a treatment plan summary document for patient counseling

Reading File
Running Command

mkdir -p /home/daytona/workspace/patient-counseling && ls /home/daytona/workspac…

Writing File

~/patient-counseling/generate.js

const {
  Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
  HeadingLevel, AlignmentType, BorderStyle, WidthType, ShadingType,
  VerticalAlign, PageNumber, Header, Footer, TabStopType, TabStopPosition
} = require('docx');
const fs = require('fs');

// ─── Colour palette ───────────────────────────────────────────────────────────
const BLUE_DARK  = "1A3A5C";   // deep navy - headings / header bar
const BLUE_MID   = "2E6DA4";   // medium blue - section titles
const BLUE_LIGHT = "D6E8F7";   // pale blue - table header shading
const RED_ALERT  = "C0392B";   // red - abnormal values
const GREEN_OK   = "1E7E34";   // green - normal values
const GREY_BG    = "F4F6F8";   // light grey - alternating rows
const WHITE      = "FFFFFF";
const BLACK      = "000000";

// ─── Helpers ──────────────────────────────────────────────────────────────────
function bold(text, size=22, color=BLACK) {
  return new TextRun({ text, bold: true, size, color, font: "Calibri" });
}
function normal(text, size=20, color=BLACK) {
  return new TextRun({ text, size, color, font: "Calibri" });
}
function italic(text, size=18, color="555555") {
  return new TextRun({ text, italics: true, size, color, font: "Calibri" });
}

function sectionHeading(text) {
  return new Paragraph({
    children: [new TextRun({ text, bold: true, size: 26, color: BLUE_MID, font: "Calibri" })],
    spacing: { before: 300, after: 100 },
    border: { bottom: { style: BorderStyle.SINGLE, size: 6, color: BLUE_MID, space: 4 } }
  });
}

function bullet(text, level=0) {
  return new Paragraph({
    children: [normal(text, 20)],
    bullet: { level },
    spacing: { before: 40, after: 40 }
  });
}

function spacer() {
  return new Paragraph({ children: [], spacing: { before: 80, after: 80 } });
}

// ─── Lab Results Table ────────────────────────────────────────────────────────
function labRow(test, result, ref, status, shade) {
  const statusColor = status === "HIGH" || status === "ELEVATED" ? RED_ALERT : GREEN_OK;
  const rowShade = shade ? GREY_BG : WHITE;
  return new TableRow({
    children: [
      new TableCell({
        children: [new Paragraph({ children: [bold(test, 19)], spacing: { before: 60, after: 60 } })],
        shading: { fill: rowShade, type: ShadingType.CLEAR },
        width: { size: 30, type: WidthType.PERCENTAGE },
        margins: { top: 60, bottom: 60, left: 100, right: 80 }
      }),
      new TableCell({
        children: [new Paragraph({ children: [bold(result, 20, statusColor)], alignment: AlignmentType.CENTER, spacing: { before: 60, after: 60 } })],
        shading: { fill: rowShade, type: ShadingType.CLEAR },
        width: { size: 20, type: WidthType.PERCENTAGE },
        verticalAlign: VerticalAlign.CENTER,
        margins: { top: 60, bottom: 60, left: 80, right: 80 }
      }),
      new TableCell({
        children: [new Paragraph({ children: [normal(ref, 19)], alignment: AlignmentType.CENTER, spacing: { before: 60, after: 60 } })],
        shading: { fill: rowShade, type: ShadingType.CLEAR },
        width: { size: 25, type: WidthType.PERCENTAGE },
        verticalAlign: VerticalAlign.CENTER,
        margins: { top: 60, bottom: 60, left: 80, right: 80 }
      }),
      new TableCell({
        children: [new Paragraph({ children: [bold(status, 19, statusColor)], alignment: AlignmentType.CENTER, spacing: { before: 60, after: 60 } })],
        shading: { fill: rowShade, type: ShadingType.CLEAR },
        width: { size: 25, type: WidthType.PERCENTAGE },
        verticalAlign: VerticalAlign.CENTER,
        margins: { top: 60, bottom: 60, left: 80, right: 80 }
      })
    ]
  });
}

function tableHeaderRow() {
  const cells = [
    { text: "Test", w: 30 }, { text: "Your Result", w: 20 },
    { text: "Normal Range", w: 25 }, { text: "Status", w: 25 }
  ];
  return new TableRow({
    tableHeader: true,
    children: cells.map(c => new TableCell({
      children: [new Paragraph({ children: [bold(c.text, 20, WHITE)], alignment: AlignmentType.CENTER, spacing: { before: 80, after: 80 } })],
      shading: { fill: BLUE_DARK, type: ShadingType.CLEAR },
      width: { size: c.w, type: WidthType.PERCENTAGE },
      margins: { top: 80, bottom: 80, left: 100, right: 80 }
    }))
  });
}

// ─── Monitoring Table ─────────────────────────────────────────────────────────
function monitorRow(when, action, shade) {
  const rowShade = shade ? GREY_BG : WHITE;
  return new TableRow({
    children: [
      new TableCell({
        children: [new Paragraph({ children: [bold(when, 19, BLUE_MID)], spacing: { before: 60, after: 60 } })],
        shading: { fill: rowShade, type: ShadingType.CLEAR },
        width: { size: 25, type: WidthType.PERCENTAGE },
        margins: { top: 60, bottom: 60, left: 100, right: 80 }
      }),
      new TableCell({
        children: [new Paragraph({ children: [normal(action, 19)], spacing: { before: 60, after: 60 } })],
        shading: { fill: rowShade, type: ShadingType.CLEAR },
        width: { size: 75, type: WidthType.PERCENTAGE },
        margins: { top: 60, bottom: 60, left: 100, right: 80 }
      })
    ]
  });
}

// ─── Diet Table ───────────────────────────────────────────────────────────────
function dietRow(category, eat, avoid, shade) {
  const rowShade = shade ? GREY_BG : WHITE;
  return new TableRow({
    children: [
      new TableCell({
        children: [new Paragraph({ children: [bold(category, 19, BLUE_MID)], spacing: { before: 60, after: 60 } })],
        shading: { fill: rowShade, type: ShadingType.CLEAR },
        width: { size: 20, type: WidthType.PERCENTAGE },
        margins: { top: 60, bottom: 60, left: 100, right: 80 }
      }),
      new TableCell({
        children: [new Paragraph({ children: [normal(eat, 19, "1A5C2E")], spacing: { before: 60, after: 60 } })],
        shading: { fill: rowShade, type: ShadingType.CLEAR },
        width: { size: 40, type: WidthType.PERCENTAGE },
        margins: { top: 60, bottom: 60, left: 80, right: 80 }
      }),
      new TableCell({
        children: [new Paragraph({ children: [normal(avoid, 19, RED_ALERT)], spacing: { before: 60, after: 60 } })],
        shading: { fill: rowShade, type: ShadingType.CLEAR },
        width: { size: 40, type: WidthType.PERCENTAGE },
        margins: { top: 60, bottom: 60, left: 80, right: 80 }
      })
    ]
  });
}

// ─── Build Document ───────────────────────────────────────────────────────────
const doc = new Document({
  styles: {
    default: {
      document: {
        run: { font: "Calibri", size: 20 }
      }
    }
  },
  sections: [{
    properties: {
      page: {
        margin: { top: 720, bottom: 720, left: 900, right: 900 }
      }
    },
    headers: {
      default: new Header({
        children: [
          new Paragraph({
            children: [
              bold("PATIENT TREATMENT PLAN & COUNSELING SUMMARY", 22, WHITE),
              new TextRun({ text: "\t", size: 22, font: "Calibri" }),
              bold("Confidential", 18, "CCDDEE")
            ],
            tabStops: [{ type: TabStopType.RIGHT, position: TabStopPosition.MAX }],
            shading: { fill: BLUE_DARK, type: ShadingType.CLEAR },
            spacing: { before: 120, after: 120 },
            indent: { left: 200, right: 200 }
          })
        ]
      })
    },
    footers: {
      default: new Footer({
        children: [
          new Paragraph({
            children: [
              italic("This document is for patient education only. Always follow your doctor's advice.", 16),
              new TextRun({ text: "  |  Page ", size: 16, italics: true, font: "Calibri", color: "888888" }),
              new TextRun({ children: [PageNumber.CURRENT], size: 16, font: "Calibri", color: "888888" })
            ],
            alignment: AlignmentType.CENTER,
            border: { top: { style: BorderStyle.SINGLE, size: 4, color: "CCCCCC", space: 4 } }
          })
        ]
      })
    },
    children: [

      // ── Patient Info Banner ──────────────────────────────────────────────────
      spacer(),
      new Table({
        width: { size: 100, type: WidthType.PERCENTAGE },
        rows: [
          new TableRow({
            children: [
              new TableCell({
                children: [
                  new Paragraph({ children: [bold("Patient Name:", 20, WHITE), normal("  MR. ARBAZ", 20, "D6E8F7")], spacing: { before: 80, after: 40 } }),
                  new Paragraph({ children: [bold("Age / Gender:", 20, WHITE), normal("  23 Years / Male", 20, "D6E8F7")], spacing: { before: 40, after: 80 } })
                ],
                shading: { fill: BLUE_DARK, type: ShadingType.CLEAR },
                width: { size: 34, type: WidthType.PERCENTAGE },
                margins: { top: 100, bottom: 100, left: 200, right: 100 }
              }),
              new TableCell({
                children: [
                  new Paragraph({ children: [bold("Lab Date:", 20, WHITE), normal("  09-Jul-2026", 20, "D6E8F7")], spacing: { before: 80, after: 40 } }),
                  new Paragraph({ children: [bold("Report Date:", 20, WHITE), normal("  10-Jul-2026", 20, "D6E8F7")], spacing: { before: 40, after: 80 } })
                ],
                shading: { fill: BLUE_DARK, type: ShadingType.CLEAR },
                width: { size: 33, type: WidthType.PERCENTAGE },
                margins: { top: 100, bottom: 100, left: 100, right: 100 }
              }),
              new TableCell({
                children: [
                  new Paragraph({ children: [bold("Ref. Lab:", 20, WHITE), normal("  Laxmi Clinical Lab, Rajouri", 20, "D6E8F7")], spacing: { before: 80, after: 40 } }),
                  new Paragraph({ children: [bold("Physician:", 20, WHITE), normal("  Dr. Self / Treating Physician", 20, "D6E8F7")], spacing: { before: 40, after: 80 } })
                ],
                shading: { fill: BLUE_DARK, type: ShadingType.CLEAR },
                width: { size: 33, type: WidthType.PERCENTAGE },
                margins: { top: 100, bottom: 100, left: 100, right: 200 }
              })
            ]
          })
        ]
      }),

      spacer(),

      // ── Section 1: Diagnoses ─────────────────────────────────────────────────
      sectionHeading("SECTION 1 — CLINICAL DIAGNOSES"),
      spacer(),

      // Diagnosis cards as a 2-col table
      new Table({
        width: { size: 100, type: WidthType.PERCENTAGE },
        rows: [
          new TableRow({
            children: [
              new TableCell({
                children: [
                  new Paragraph({ children: [bold("Primary Diagnosis 1", 20, WHITE)], spacing: { before: 80, after: 40 }, alignment: AlignmentType.CENTER }),
                  new Paragraph({ children: [bold("Hypertriglyceridemia (High Grade)", 22, WHITE)], alignment: AlignmentType.CENTER, spacing: { before: 40, after: 40 } }),
                  new Paragraph({ children: [normal("TG: 409 mg/dL  (Normal < 150)", 20, "FFEEDD")], alignment: AlignmentType.CENTER, spacing: { before: 40, after: 80 } })
                ],
                shading: { fill: "B03A2E", type: ShadingType.CLEAR },
                width: { size: 50, type: WidthType.PERCENTAGE },
                margins: { top: 120, bottom: 120, left: 160, right: 160 }
              }),
              new TableCell({
                children: [
                  new Paragraph({ children: [bold("Primary Diagnosis 2", 20, WHITE)], spacing: { before: 80, after: 40 }, alignment: AlignmentType.CENTER }),
                  new Paragraph({ children: [bold("Metabolic Liver Disease (MASLD/NAFLD)", 22, WHITE)], alignment: AlignmentType.CENTER, spacing: { before: 40, after: 40 } }),
                  new Paragraph({ children: [normal("ALT 4x, AST 2x, GGTP 2.5x elevated", 20, "DDEEFF")], alignment: AlignmentType.CENTER, spacing: { before: 40, after: 80 } })
                ],
                shading: { fill: "1A4C7C", type: ShadingType.CLEAR },
                width: { size: 50, type: WidthType.PERCENTAGE },
                margins: { top: 120, bottom: 120, left: 160, right: 160 }
              })
            ]
          })
        ]
      }),

      spacer(),
      new Paragraph({
        children: [
          bold("Combined Metabolic Syndrome Pattern: ", 20, BLUE_DARK),
          normal("The combination of high triglycerides + elevated liver enzymes (ALT-dominant, AST:ALT ratio 0.45) in a 23-year-old male strongly suggests Metabolic Dysfunction-Associated Steatotic Liver Disease (MASLD) driven by insulin resistance and dyslipidemia. This requires urgent attention to prevent progression to cirrhosis and cardiovascular disease.", 20)
        ],
        spacing: { before: 80, after: 80 },
        border: {
          left: { style: BorderStyle.THICK, size: 12, color: BLUE_MID, space: 8 }
        },
        indent: { left: 200 }
      }),

      spacer(),

      // ── Section 2: Lab Results ───────────────────────────────────────────────
      sectionHeading("SECTION 2 — YOUR LAB RESULTS AT A GLANCE"),
      spacer(),

      new Table({
        width: { size: 100, type: WidthType.PERCENTAGE },
        rows: [
          tableHeaderRow(),
          labRow("Triglycerides", "409 mg/dL", "< 150 mg/dL", "HIGH", false),
          labRow("LDL : HDL Ratio", "3.61", "< 3.22", "BORDERLINE", true),
          labRow("Cholesterol : HDL Ratio", "5.61", "< 6.0", "ACCEPTABLE", false),
          labRow("SGOT (AST)", "77.44 U/L", "0 – 38 U/L", "ELEVATED", true),
          labRow("SGPT (ALT)", "171.41 U/L", "0 – 41 U/L", "ELEVATED", false),
          labRow("GGTP", "85.75 U/L", "7 – 34 U/L", "ELEVATED", true),
          labRow("Bilirubin Total", "0.75 mg/dL", "0.0 – 1.0 mg/dL", "NORMAL", false),
          labRow("Bilirubin Direct", "0.17 mg/dL", "0.0 – 0.25 mg/dL", "NORMAL", true),
          labRow("Bilirubin Indirect", "0.58 mg/dL", "0.0 – 0.75 mg/dL", "NORMAL", false)
        ]
      }),

      spacer(),

      // ── Section 3: Investigations Needed ────────────────────────────────────
      sectionHeading("SECTION 3 — INVESTIGATIONS RECOMMENDED"),
      spacer(),
      new Paragraph({ children: [bold("Immediate / First Priority:", 21, BLUE_DARK)], spacing: { before: 60, after: 60 } }),
      bullet("Fasting Blood Glucose + HbA1c — to rule out diabetes or pre-diabetes"),
      bullet("Full Lipid Profile (LDL, HDL, Total Cholesterol) — complete cardiovascular risk assessment"),
      bullet("Hepatitis B Surface Antigen (HBsAg) + Hepatitis C Antibody (anti-HCV) — rule out viral hepatitis"),
      bullet("Serum Insulin + HOMA-IR — check for insulin resistance"),
      bullet("Abdominal Ultrasound — look for fatty liver (bright echogenic liver)"),
      spacer(),
      new Paragraph({ children: [bold("Second Priority (if above inconclusive):", 21, BLUE_DARK)], spacing: { before: 60, after: 60 } }),
      bullet("Thyroid Function Test (TSH) — hypothyroidism can cause elevated triglycerides"),
      bullet("Renal Function Tests (BUN / Creatinine)"),
      bullet("Repeat Liver Function Tests after 4-6 weeks of lifestyle changes"),
      bullet("ANA, Anti-Smooth Muscle Antibody (ASMA) — if autoimmune hepatitis suspected"),
      bullet("Serum Ceruloplasmin — to exclude Wilson's disease in a young patient"),

      spacer(),

      // ── Section 4: Treatment Plan ────────────────────────────────────────────
      sectionHeading("SECTION 4 — TREATMENT PLAN"),
      spacer(),

      // 4A Lifestyle
      new Paragraph({ children: [bold("4A. Lifestyle Modifications (Start Immediately)", 22, BLUE_MID)], spacing: { before: 80, after: 80 } }),
      new Paragraph({ children: [italic("Lifestyle changes are the most effective and first-line treatment for both your conditions.", 19)] , spacing: { before: 40, after: 60 } }),

      // Diet table
      new Table({
        width: { size: 100, type: WidthType.PERCENTAGE },
        rows: [
          new TableRow({
            tableHeader: true,
            children: [
              new TableCell({
                children: [new Paragraph({ children: [bold("Food Category", 19, WHITE)], alignment: AlignmentType.CENTER })],
                shading: { fill: BLUE_MID, type: ShadingType.CLEAR },
                width: { size: 20, type: WidthType.PERCENTAGE },
                margins: { top: 80, bottom: 80, left: 100, right: 80 }
              }),
              new TableCell({
                children: [new Paragraph({ children: [bold("✔  EAT MORE", 19, WHITE)], alignment: AlignmentType.CENTER })],
                shading: { fill: "1E7E34", type: ShadingType.CLEAR },
                width: { size: 40, type: WidthType.PERCENTAGE },
                margins: { top: 80, bottom: 80, left: 100, right: 80 }
              }),
              new TableCell({
                children: [new Paragraph({ children: [bold("✘  AVOID / REDUCE", 19, WHITE)], alignment: AlignmentType.CENTER })],
                shading: { fill: "B03A2E", type: ShadingType.CLEAR },
                width: { size: 40, type: WidthType.PERCENTAGE },
                margins: { top: 80, bottom: 80, left: 100, right: 80 }
              })
            ]
          }),
          dietRow("Carbs", "Whole grains, oats, millets, brown rice", "White rice, maida (refined flour), bread, sugary drinks", false),
          dietRow("Fats", "Olive oil, mustard oil, walnuts, flaxseeds, fatty fish", "Fried foods, ghee in excess, vanaspati, butter, cream", true),
          dietRow("Proteins", "Legumes, dal, egg whites, lean chicken, fish", "Processed meats, red meat in excess", false),
          dietRow("Fruits/Veg", "Green leafy vegetables, berries, citrus, cucumber", "Mangoes, bananas, grapes, fruit juices (high sugar)", true),
          dietRow("Drinks", "Water (2-3 L/day), green tea, buttermilk", "Alcohol (strictly avoid), soft drinks, packaged juices", false),
          dietRow("Snacks", "Roasted chana, sprouts, nuts (handful), salads", "Chips, biscuits, namkeen, sweets, mithai", true)
        ]
      }),

      spacer(),
      new Paragraph({ children: [bold("Exercise Plan:", 21, BLUE_MID)], spacing: { before: 80, after: 60 } }),
      bullet("150 minutes per week of moderate aerobic exercise (brisk walking, cycling, swimming)"),
      bullet("Aim for 30 minutes daily, 5 days a week"),
      bullet("Avoid prolonged sitting — take a 5-minute walk every hour"),
      bullet("Weight loss of even 5-10% of body weight can significantly improve both triglycerides and liver enzymes"),

      spacer(),
      new Paragraph({ children: [bold("Other Lifestyle Steps:", 21, BLUE_MID)], spacing: { before: 80, after: 60 } }),
      bullet("STOP all alcohol consumption completely — alcohol worsens both liver damage and triglycerides"),
      bullet("Quit smoking if applicable"),
      bullet("Sleep 7-8 hours per night — poor sleep worsens insulin resistance"),
      bullet("Manage stress (yoga, meditation, adequate rest)"),

      spacer(),

      // 4B Medication
      new Paragraph({ children: [bold("4B. Medications (As Prescribed by Your Doctor)", 22, BLUE_MID)], spacing: { before: 80, after: 80 } }),
      new Paragraph({
        children: [
          bold("IMPORTANT: ", 20, RED_ALERT),
          normal("Do NOT self-medicate. All medications listed below are for your awareness only. Take only what your treating physician prescribes after clinical examination.", 20)
        ],
        border: { left: { style: BorderStyle.THICK, size: 12, color: RED_ALERT, space: 8 } },
        indent: { left: 200 },
        spacing: { before: 60, after: 80 }
      }),

      new Table({
        width: { size: 100, type: WidthType.PERCENTAGE },
        rows: [
          new TableRow({
            tableHeader: true,
            children: [
              new TableCell({ children: [new Paragraph({ children: [bold("Purpose", 19, WHITE)], alignment: AlignmentType.CENTER })], shading: { fill: BLUE_DARK, type: ShadingType.CLEAR }, width: { size: 25, type: WidthType.PERCENTAGE }, margins: { top: 80, bottom: 80, left: 100, right: 80 } }),
              new TableCell({ children: [new Paragraph({ children: [bold("Medication Options", 19, WHITE)], alignment: AlignmentType.CENTER })], shading: { fill: BLUE_DARK, type: ShadingType.CLEAR }, width: { size: 30, type: WidthType.PERCENTAGE }, margins: { top: 80, bottom: 80, left: 80, right: 80 } }),
              new TableCell({ children: [new Paragraph({ children: [bold("Notes", 19, WHITE)], alignment: AlignmentType.CENTER })], shading: { fill: BLUE_DARK, type: ShadingType.CLEAR }, width: { size: 45, type: WidthType.PERCENTAGE }, margins: { top: 80, bottom: 80, left: 80, right: 80 } })
            ]
          }),
          new TableRow({
            children: [
              new TableCell({ children: [new Paragraph({ children: [bold("Lower Triglycerides", 19)], spacing: { before: 60, after: 60 } })], shading: { fill: GREY_BG, type: ShadingType.CLEAR }, width: { size: 25, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 100, right: 80 } }),
              new TableCell({ children: [new Paragraph({ children: [normal("Fenofibrate 145 mg\nOmega-3 Fatty Acids 4g/day", 19)], spacing: { before: 60, after: 60 } })], shading: { fill: GREY_BG, type: ShadingType.CLEAR }, width: { size: 30, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 80, right: 80 } }),
              new TableCell({ children: [new Paragraph({ children: [normal("First try lifestyle changes for 3 months. Prescribed only if TG remains high. Liver function monitored closely.", 19)], spacing: { before: 60, after: 60 } })], shading: { fill: GREY_BG, type: ShadingType.CLEAR }, width: { size: 45, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 80, right: 80 } })
            ]
          }),
          new TableRow({
            children: [
              new TableCell({ children: [new Paragraph({ children: [bold("Liver Support (NAFLD)", 19)], spacing: { before: 60, after: 60 } })], shading: { fill: WHITE, type: ShadingType.CLEAR }, width: { size: 25, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 100, right: 80 } }),
              new TableCell({ children: [new Paragraph({ children: [normal("Vitamin E 800 IU/day\n(off-label)", 19)], spacing: { before: 60, after: 60 } })], shading: { fill: WHITE, type: ShadingType.CLEAR }, width: { size: 30, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 80, right: 80 } }),
              new TableCell({ children: [new Paragraph({ children: [normal("Shown to reduce liver inflammation in non-diabetic NAFLD. Lifestyle changes remain primary treatment.", 19)], spacing: { before: 60, after: 60 } })], shading: { fill: WHITE, type: ShadingType.CLEAR }, width: { size: 45, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 80, right: 80 } })
            ]
          }),
          new TableRow({
            children: [
              new TableCell({ children: [new Paragraph({ children: [bold("Statins (if LDL high)", 19)], spacing: { before: 60, after: 60 } })], shading: { fill: GREY_BG, type: ShadingType.CLEAR }, width: { size: 25, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 100, right: 80 } }),
              new TableCell({ children: [new Paragraph({ children: [normal("Rosuvastatin / Atorvastatin", 19)], spacing: { before: 60, after: 60 } })], shading: { fill: GREY_BG, type: ShadingType.CLEAR }, width: { size: 30, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 80, right: 80 } }),
              new TableCell({ children: [new Paragraph({ children: [normal("DEFERRED until liver enzymes are re-evaluated. ALT > 3x ULN is a caution for statin use.", 19, RED_ALERT)], spacing: { before: 60, after: 60 } })], shading: { fill: GREY_BG, type: ShadingType.CLEAR }, width: { size: 45, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 80, right: 80 } })
            ]
          })
        ]
      }),

      spacer(),

      // ── Section 5: Monitoring ────────────────────────────────────────────────
      sectionHeading("SECTION 5 — MONITORING & FOLLOW-UP SCHEDULE"),
      spacer(),

      new Table({
        width: { size: 100, type: WidthType.PERCENTAGE },
        rows: [
          new TableRow({
            tableHeader: true,
            children: [
              new TableCell({ children: [new Paragraph({ children: [bold("Timeframe", 19, WHITE)], alignment: AlignmentType.CENTER })], shading: { fill: BLUE_DARK, type: ShadingType.CLEAR }, width: { size: 25, type: WidthType.PERCENTAGE }, margins: { top: 80, bottom: 80, left: 100, right: 80 } }),
              new TableCell({ children: [new Paragraph({ children: [bold("Action Required", 19, WHITE)], alignment: AlignmentType.CENTER })], shading: { fill: BLUE_DARK, type: ShadingType.CLEAR }, width: { size: 75, type: WidthType.PERCENTAGE }, margins: { top: 80, bottom: 80, left: 100, right: 80 } })
            ]
          }),
          monitorRow("NOW (This Week)", "Hepatitis B & C serology | Fasting glucose + HbA1c | Abdominal ultrasound | Full lipid panel | TSH | HOMA-IR", false),
          monitorRow("4 – 6 Weeks", "Repeat LFT (SGOT, SGPT, GGTP) — assess response to lifestyle changes", true),
          monitorRow("3 Months", "Repeat fasting lipid panel — decide if TG-lowering medication is needed", false),
          monitorRow("6 Months", "Comprehensive review: LFT + lipid panel + glucose + weight + blood pressure", true),
          monitorRow("Every Year", "Annual lipid panel, LFT, HbA1c, kidney function — ongoing cardiovascular monitoring", false)
        ]
      }),

      spacer(),

      // ── Section 6: Warning Signs ─────────────────────────────────────────────
      sectionHeading("SECTION 6 — WARNING SIGNS (Seek Immediate Medical Help)"),
      spacer(),
      new Paragraph({
        children: [bold("Go to the nearest doctor or hospital if you experience any of these:", 20, RED_ALERT)],
        spacing: { before: 60, after: 80 }
      }),

      new Table({
        width: { size: 100, type: WidthType.PERCENTAGE },
        rows: [
          new TableRow({
            children: [
              new TableCell({
                children: [
                  new Paragraph({ children: [bold("Liver Warning Signs", 20, WHITE)], spacing: { before: 80, after: 60 } }),
                  new Paragraph({ children: [normal("• Yellowing of skin or eyes (jaundice)", 19, "FFEEDD")], spacing: { before: 40, after: 40 } }),
                  new Paragraph({ children: [normal("• Severe pain in upper right abdomen", 19, "FFEEDD")], spacing: { before: 40, after: 40 } }),
                  new Paragraph({ children: [normal("• Dark-coloured urine (tea-coloured)", 19, "FFEEDD")], spacing: { before: 40, after: 40 } }),
                  new Paragraph({ children: [normal("• Persistent nausea and vomiting", 19, "FFEEDD")], spacing: { before: 40, after: 80 } })
                ],
                shading: { fill: "8B0000", type: ShadingType.CLEAR },
                width: { size: 50, type: WidthType.PERCENTAGE },
                margins: { top: 100, bottom: 100, left: 160, right: 80 }
              }),
              new TableCell({
                children: [
                  new Paragraph({ children: [bold("Cardiac / Pancreatitis Warning Signs", 20, WHITE)], spacing: { before: 80, after: 60 } }),
                  new Paragraph({ children: [normal("• Severe pain in the upper abdomen or back", 19, "DDEEFF")], spacing: { before: 40, after: 40 } }),
                  new Paragraph({ children: [normal("• Chest pain or tightness, shortness of breath", 19, "DDEEFF")], spacing: { before: 40, after: 40 } }),
                  new Paragraph({ children: [normal("• Sudden dizziness or loss of consciousness", 19, "DDEEFF")], spacing: { before: 40, after: 40 } }),
                  new Paragraph({ children: [normal("• Severe headache or visual disturbance", 19, "DDEEFF")], spacing: { before: 40, after: 80 } })
                ],
                shading: { fill: "1A2A6C", type: ShadingType.CLEAR },
                width: { size: 50, type: WidthType.PERCENTAGE },
                margins: { top: 100, bottom: 100, left: 80, right: 160 }
              })
            ]
          })
        ]
      }),

      spacer(),

      // ── Section 7: Why Act Now? ──────────────────────────────────────────────
      sectionHeading("SECTION 7 — WHY ACT NOW? (For Patient Motivation)"),
      spacer(),
      new Paragraph({
        children: [
          bold("You are only 23 years old. ", 21, BLUE_DARK),
          normal("This is actually good news — catching these problems early means you have the best chance of reversing them completely with lifestyle changes alone, before they become permanent. Here is what can happen if left untreated:", 20)
        ],
        spacing: { before: 60, after: 80 }
      }),

      new Table({
        width: { size: 100, type: WidthType.PERCENTAGE },
        rows: [
          new TableRow({
            tableHeader: true,
            children: [
              new TableCell({ children: [new Paragraph({ children: [bold("Condition", 19, WHITE)] })], shading: { fill: BLUE_MID, type: ShadingType.CLEAR }, width: { size: 30, type: WidthType.PERCENTAGE }, margins: { top: 80, bottom: 80, left: 100, right: 80 } }),
              new TableCell({ children: [new Paragraph({ children: [bold("If Untreated — Risk Over Time", 19, WHITE)] })], shading: { fill: BLUE_MID, type: ShadingType.CLEAR }, width: { size: 40, type: WidthType.PERCENTAGE }, margins: { top: 80, bottom: 80, left: 80, right: 80 } }),
              new TableCell({ children: [new Paragraph({ children: [bold("With Treatment — Outcome", 19, WHITE)] })], shading: { fill: "1E7E34", type: ShadingType.CLEAR }, width: { size: 30, type: WidthType.PERCENTAGE }, margins: { top: 80, bottom: 80, left: 80, right: 80 } })
            ]
          }),
          new TableRow({
            children: [
              new TableCell({ children: [new Paragraph({ children: [bold("High Triglycerides", 19)], spacing: { before: 60, after: 60 } })], shading: { fill: GREY_BG, type: ShadingType.CLEAR }, width: { size: 30, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 100, right: 80 } }),
              new TableCell({ children: [new Paragraph({ children: [normal("Acute pancreatitis, heart attack, stroke by 30s-40s", 19, RED_ALERT)], spacing: { before: 60, after: 60 } })], shading: { fill: GREY_BG, type: ShadingType.CLEAR }, width: { size: 40, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 80, right: 80 } }),
              new TableCell({ children: [new Paragraph({ children: [normal("Normalises within 3-6 months of diet + exercise", 19, "1E7E34")], spacing: { before: 60, after: 60 } })], shading: { fill: GREY_BG, type: ShadingType.CLEAR }, width: { size: 30, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 80, right: 80 } })
            ]
          }),
          new TableRow({
            children: [
              new TableCell({ children: [new Paragraph({ children: [bold("Fatty Liver (NAFLD)", 19)], spacing: { before: 60, after: 60 } })], shading: { fill: WHITE, type: ShadingType.CLEAR }, width: { size: 30, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 100, right: 80 } }),
              new TableCell({ children: [new Paragraph({ children: [normal("Can progress to liver fibrosis, cirrhosis, liver failure", 19, RED_ALERT)], spacing: { before: 60, after: 60 } })], shading: { fill: WHITE, type: ShadingType.CLEAR }, width: { size: 40, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 80, right: 80 } }),
              new TableCell({ children: [new Paragraph({ children: [normal("Fully reversible in early stage with weight loss + diet", 19, "1E7E34")], spacing: { before: 60, after: 60 } })], shading: { fill: WHITE, type: ShadingType.CLEAR }, width: { size: 30, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 80, right: 80 } })
            ]
          }),
          new TableRow({
            children: [
              new TableCell({ children: [new Paragraph({ children: [bold("Metabolic Syndrome", 19)], spacing: { before: 60, after: 60 } })], shading: { fill: GREY_BG, type: ShadingType.CLEAR }, width: { size: 30, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 100, right: 80 } }),
              new TableCell({ children: [new Paragraph({ children: [normal("Type 2 Diabetes, hypertension, early cardiovascular disease", 19, RED_ALERT)], spacing: { before: 60, after: 60 } })], shading: { fill: GREY_BG, type: ShadingType.CLEAR }, width: { size: 40, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 80, right: 80 } }),
              new TableCell({ children: [new Paragraph({ children: [normal("Prevented / reversed with sustained lifestyle change", 19, "1E7E34")], spacing: { before: 60, after: 60 } })], shading: { fill: GREY_BG, type: ShadingType.CLEAR }, width: { size: 30, type: WidthType.PERCENTAGE }, margins: { top: 60, bottom: 60, left: 80, right: 80 } })
            ]
          })
        ]
      }),

      spacer(),

      // ── Disclaimer Box ───────────────────────────────────────────────────────
      new Table({
        width: { size: 100, type: WidthType.PERCENTAGE },
        rows: [
          new TableRow({
            children: [
              new TableCell({
                children: [
                  new Paragraph({
                    children: [bold("MEDICAL DISCLAIMER  ", 18, RED_ALERT), italic("This document is prepared for patient education and counseling purposes only. It does not constitute a formal medical prescription or replace the advice of a qualified physician. All treatment decisions must be made by a licensed healthcare professional after proper clinical evaluation of this patient.", 18, "333333")],
                    spacing: { before: 80, after: 80 }
                  })
                ],
                shading: { fill: "FFF3CD", type: ShadingType.CLEAR },
                margins: { top: 100, bottom: 100, left: 200, right: 200 },
                borders: {
                  top: { style: BorderStyle.SINGLE, size: 4, color: "FFC107" },
                  bottom: { style: BorderStyle.SINGLE, size: 4, color: "FFC107" },
                  left: { style: BorderStyle.THICK, size: 12, color: "FFC107" },
                  right: { style: BorderStyle.SINGLE, size: 4, color: "FFC107" }
                }
              })
            ]
          })
        ]
      }),

      spacer()
    ]
  }]
});

Packer.toBuffer(doc).then(buffer => {
  fs.writeFileSync("/home/daytona/workspace/patient-counseling/TreatmentPlan_Arbaz.docx", buffer);
  console.log("Document created successfully.");
});
Running Command

cd /home/daytona/workspace/patient-counseling && node generate.js 2>&1

Running Command

python /home/daytona/skills/docx/scripts/office/validate.py /home/daytona/worksp…

Running Command

cd /home/daytona/workspace/patient-counseling && python3 -c " import zipfile, os…

The patient counseling document is ready for download:

TreatmentPlan Arbaz

Word Document · DOCX


Here is what the document includes across 7 structured sections:
SectionContent
Patient Info BannerName, age, gender, lab date, referring lab
Section 1 - Clinical DiagnosesTwo diagnosis cards: Hypertriglyceridemia (High Grade) + MASLD/NAFLD, with explanation of the combined metabolic syndrome pattern
Section 2 - Lab ResultsFull colour-coded table - abnormal values in red, normal values in green
Section 3 - Investigations NeededFirst-priority and second-priority tests clearly listed
Section 4 - Treatment PlanDiet table (Eat More vs. Avoid), exercise plan, lifestyle steps, medication table with dosing notes and statin deferral warning
Section 5 - Follow-up Schedule5-timepoint monitoring calendar from "this week" to annual review
Section 6 - Warning SignsRed-alert symptoms for liver vs. cardiac/pancreatitis emergencies
Section 7 - Why Act NowMotivational risk-vs-outcome table tailored for a 23-year-old patient
The document uses a navy/blue professional colour scheme, has a branded header and footer with page numbers, and includes a medical disclaimer box at the end. It is print-ready and suitable for handing to the patient at the consultation.
This is a shared conversation. Sign in to Orris to start your own chat.