Explain T2 DM DIAGNOSIS AND SUGGEST DIAGNOSIS AND TREATMENT STEP BY STEP
"type 2 diabetes"[MeSH Terms] AND "diagnosis"[MeSH Terms]
"type 2 diabetes" AND "treatment guidelines"
| Risk Factor | Detail |
|---|---|
| Age ≥ 35–45 years | Screen all asymptomatic adults |
| Overweight/Obesity | BMI > 25 (>23 in Asian populations) |
| Family history | First-degree relative with T2DM |
| Physical inactivity | Sedentary lifestyle |
| Prediabetes | Prior IFG, IGT, or HbA1c 5.7–6.4% |
| Hypertension | BP ≥ 140/90 mmHg |
| Dyslipidemia | HDL < 35, TG > 250 mg/dL |
| History of GDM | Gestational diabetes |
| PCOS | Polycystic ovary syndrome |
| Ethnicity | African American, Hispanic, Asian, Native American |
The ADA recommends screening overweight/obese adults with any one risk factor above, and universal screening at age 35+ regardless of risk factors. — Henry's Clinical Diagnosis and Management by Laboratory Methods
| Test | Diagnostic Threshold |
|---|---|
| HbA1c | ≥ 6.5% (≥ 48 mmol/mol) |
| Fasting Plasma Glucose (FPG) | ≥ 126 mg/dL (≥ 7.0 mmol/L) — fasting = no caloric intake for ≥8 hrs |
| 2-hour Plasma Glucose (OGTT) | ≥ 200 mg/dL (≥ 11.1 mmol/L) using 75g oral glucose load |
| Random Plasma Glucose | ≥ 200 mg/dL + classic symptoms (polyuria, polydipsia, unexplained weight loss) |
"In a patient without classic symptoms, a single abnormal test result is not sufficient for diagnosis. A confirmatory test is required." — Tietz Textbook of Laboratory Medicine, 7th Ed
| Category | Value |
|---|---|
| Impaired Fasting Glucose (IFG) | FPG 100–125 mg/dL (5.6–6.9 mmol/L) |
| Impaired Glucose Tolerance (IGT) | 2-hr OGTT 140–199 mg/dL (7.8–11.0 mmol/L) |
| Intermediate HbA1c | 5.7–6.4% (39–46 mmol/mol) |
Prediabetes carries a 5-year cumulative diabetes incidence of 12–25% and also increases cardiovascular risk. — Tietz Textbook of Laboratory Medicine, 7th Ed

"Metformin is generally accepted as the first-line treatment of type 2 diabetes and is the most commonly used oral agent." — Goodman & Gilman's, 14th Ed
| Priority Condition | Preferred Add-On |
|---|---|
| ASCVD (established CV disease) | GLP-1 receptor agonist (liraglutide, semaglutide) OR SGLT-2 inhibitor (empagliflozin, dapagliflozin) |
| Heart Failure | SGLT-2 inhibitor (empagliflozin, dapagliflozin) |
| Diabetic Nephropathy (CKD) | SGLT-2 inhibitor first; GLP-1 RA as alternative |
| Obesity / Weight loss desired | GLP-1 receptor agonist (semaglutide, liraglutide) |
| Hypoglycemia risk | DPP-4 inhibitor (sitagliptin, saxagliptin) — weight neutral, no hypoglycemia |
| Cost is major concern | Sulfonylurea (glimepiride, glipizide) — effective, cheap; risk of hypoglycemia + weight gain |
"Progressive insulin deficiency in type 2 diabetes often makes it increasingly difficult to achieve the glycemic goal solely with oral agents; thus, insulin is necessary in a substantial proportion." — Goodman & Gilman's
| Measure | General Target | Notes |
|---|---|---|
| HbA1c | < 7% | < 6.5% in young/newly dx; < 8% in elderly/frail |
| Fasting glucose | 80–130 mg/dL | |
| 2-hr post-prandial | < 180 mg/dL | |
| Blood pressure | < 130/80 mmHg | |
| LDL cholesterol | < 100 mg/dL (< 70 if ASCVD) | Statin therapy for most patients |
| Test | Frequency |
|---|---|
| HbA1c | Every 3 months until at goal, then every 6 months |
| Fasting glucose / SMBG | As indicated by medication regimen |
| Urine albumin (microalbuminuria) | Annually |
| eGFR / serum creatinine | Annually |
| Lipid panel | Annually |
| Retinal exam | Annually (or every 1–2 years if stable) |
| Foot exam (monofilament) | Annually or at every visit |
| Blood pressure | Every visit |
| Dental exam | Annually |
| Complication | Prevention Strategy |
|---|---|
| Retinopathy | Tight glycemic + BP control; annual retinal screening |
| Nephropathy | SGLT-2 inhibitors; ACE inhibitors/ARBs for microalbuminuria |
| Neuropathy | Glycemic control; foot care; gabapentin/duloxetine for pain |
| Cardiovascular disease | Statin, antihypertensive, aspirin (if high CV risk), GLP-1 RA or SGLT-2i |
| Foot ulcers | Regular inspection, appropriate footwear, monofilament testing |
Screening (risk factors or age ≥35)
↓
Diagnostic Testing (FPG, HbA1c, OGTT)
↓
Confirm T2DM Diagnosis
↓
Baseline Workup (HbA1c, lipids, eGFR, urine albumin, retinal exam, neuro exam)
↓
STEP 1: Lifestyle + Metformin → Reassess HbA1c in 3 months
↓ (if not at goal)
STEP 2: Metformin + Second Agent (chosen by comorbidities)
↓ (if not at goal)
STEP 3: Triple Therapy or Add Basal Insulin
↓ (progressive disease)
STEP 4: Basal-Bolus Insulin ± Oral Agents
Generate a diabetes monitoring checklist template
ls /home/daytona/workspace/ && ls /home/daytona/skills/docx/
mkdir -p /home/daytona/workspace/diabetes-checklist && ls /home/daytona/workspac…
~/diabetes-checklist/generate.js
const {
Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
Header, Footer, AlignmentType, HeadingLevel, BorderStyle, WidthType,
ShadingType, VerticalAlign, PageNumber, PageBreak, UnderlineType
} = require('docx');
const fs = require('fs');
// ─── Colour palette ───────────────────────────────────────────────
const BLUE_DARK = "1A3C5E"; // deep navy
const BLUE_MID = "2E6DA4"; // section header bar
const BLUE_LIGHT = "D6E8F7"; // alternating row tint
const BLUE_PALE = "EBF4FB"; // table header tint
const GREEN_DARK = "1B5E20";
const RED_DARK = "B71C1C";
const GREY_TEXT = "555555";
const WHITE = "FFFFFF";
// ─── Helpers ──────────────────────────────────────────────────────
function pt(n) { return n * 20; } // half-points → points
function colorBar(text) {
return new Paragraph({
children: [new TextRun({ text, bold: true, color: WHITE, size: pt(12), font: "Calibri" })],
shading: { type: ShadingType.SOLID, color: BLUE_MID },
spacing: { before: 160, after: 60 },
indent: { left: 100 },
});
}
function sectionTitle(text) {
return new Paragraph({
children: [new TextRun({ text: text.toUpperCase(), bold: true, color: BLUE_DARK, size: pt(11), font: "Calibri" })],
spacing: { before: 240, after: 80 },
border: { bottom: { style: BorderStyle.SINGLE, size: 6, color: BLUE_MID } },
});
}
function note(text) {
return new Paragraph({
children: [new TextRun({ text: `⚠ ${text}`, italics: true, color: GREY_TEXT, size: pt(9), font: "Calibri" })],
spacing: { before: 40, after: 40 },
indent: { left: 200 },
});
}
function spacer(before = 100, after = 60) {
return new Paragraph({ text: "", spacing: { before, after } });
}
// ─── Checkbox row helper for a simple 3-col table ─────────────────
// col widths: 400, 5000, 2100 (twips)
function checkRow(label, value = "", target = "", shade = false) {
const bg = shade ? BLUE_LIGHT : WHITE;
return new TableRow({
children: [
new TableCell({
children: [new Paragraph({
children: [new TextRun({ text: "☐", size: pt(11), font: "Segoe UI Symbol" })],
alignment: AlignmentType.CENTER,
})],
shading: { type: ShadingType.SOLID, color: bg },
verticalAlign: VerticalAlign.CENTER,
width: { size: 400, type: WidthType.DXA },
}),
new TableCell({
children: [new Paragraph({
children: [new TextRun({ text: label, size: pt(10), font: "Calibri", color: "222222" })],
})],
shading: { type: ShadingType.SOLID, color: bg },
verticalAlign: VerticalAlign.CENTER,
width: { size: 5000, type: WidthType.DXA },
}),
new TableCell({
children: [new Paragraph({
children: [new TextRun({ text: target, size: pt(9), italics: true, color: GREY_TEXT, font: "Calibri" })],
})],
shading: { type: ShadingType.SOLID, color: bg },
verticalAlign: VerticalAlign.CENTER,
width: { size: 2100, type: WidthType.DXA },
}),
],
});
}
function tableHeader(c1, c2, c3) {
return new TableRow({
tableHeader: true,
children: [
new TableCell({
children: [new Paragraph({ children: [new TextRun({ text: c1, bold: true, size: pt(9), color: BLUE_DARK, font: "Calibri" })], alignment: AlignmentType.CENTER })],
shading: { type: ShadingType.SOLID, color: BLUE_PALE },
width: { size: 400, type: WidthType.DXA },
}),
new TableCell({
children: [new Paragraph({ children: [new TextRun({ text: c2, bold: true, size: pt(9), color: BLUE_DARK, font: "Calibri" })] })],
shading: { type: ShadingType.SOLID, color: BLUE_PALE },
width: { size: 5000, type: WidthType.DXA },
}),
new TableCell({
children: [new Paragraph({ children: [new TextRun({ text: c3, bold: true, size: pt(9), color: BLUE_DARK, font: "Calibri" })] })],
shading: { type: ShadingType.SOLID, color: BLUE_PALE },
width: { size: 2100, type: WidthType.DXA },
}),
],
});
}
function makeTable(rows) {
return new Table({
rows,
width: { size: 7500, type: WidthType.DXA },
borders: {
top: { style: BorderStyle.SINGLE, size: 4, color: "B0C4DE" },
bottom: { style: BorderStyle.SINGLE, size: 4, color: "B0C4DE" },
left: { style: BorderStyle.SINGLE, size: 4, color: "B0C4DE" },
right: { style: BorderStyle.SINGLE, size: 4, color: "B0C4DE" },
insideH: { style: BorderStyle.SINGLE, size: 2, color: "D0DFF0" },
insideV: { style: BorderStyle.SINGLE, size: 2, color: "D0DFF0" },
},
});
}
// ─── Patient log row (5 cols) ──────────────────────────────────────
function logRow(date, glucose, bp, weight, notes, shade) {
const bg = shade ? BLUE_LIGHT : WHITE;
const cell = (txt, w) => new TableCell({
children: [new Paragraph({ children: [new TextRun({ text: txt, size: pt(9), font: "Calibri" })], alignment: AlignmentType.CENTER })],
shading: { type: ShadingType.SOLID, color: bg },
verticalAlign: VerticalAlign.CENTER,
width: { size: w, type: WidthType.DXA },
});
return new TableRow({ children: [cell(date,1200), cell(glucose,1300), cell(bp,1200), cell(weight,1100), cell(notes,2700)] });
}
function logHeader(labels, widths) {
return new TableRow({
tableHeader: true,
children: labels.map((l, i) => new TableCell({
children: [new Paragraph({ children: [new TextRun({ text: l, bold: true, size: pt(9), color: BLUE_DARK, font: "Calibri" })], alignment: AlignmentType.CENTER })],
shading: { type: ShadingType.SOLID, color: BLUE_PALE },
width: { size: widths[i], type: WidthType.DXA },
})),
});
}
function makeLogTable() {
const hdr = logHeader(["Date","Blood Glucose (mg/dL)","Blood Pressure","Weight (kg)","Notes / Symptoms"],[1200,1300,1200,1100,2700]);
const blankRow = (i) => logRow("","","","","", i%2===0);
const rows = [hdr, ...Array.from({length:14}, (_,i)=>blankRow(i))];
return new Table({
rows,
width: { size: 8500, type: WidthType.DXA },
borders: {
top: { style: BorderStyle.SINGLE, size: 4, color: "B0C4DE" },
bottom: { style: BorderStyle.SINGLE, size: 4, color: "B0C4DE" },
left: { style: BorderStyle.SINGLE, size: 4, color: "B0C4DE" },
right: { style: BorderStyle.SINGLE, size: 4, color: "B0C4DE" },
insideH: { style: BorderStyle.SINGLE, size: 2, color: "D0DFF0" },
insideV: { style: BorderStyle.SINGLE, size: 2, color: "D0DFF0" },
},
});
}
// ─── Main title block ──────────────────────────────────────────────
function titleBlock() {
return [
new Paragraph({
children: [new TextRun({ text: "🩺 DIABETES MONITORING CHECKLIST", bold: true, size: pt(18), color: WHITE, font: "Calibri" })],
alignment: AlignmentType.CENTER,
shading: { type: ShadingType.SOLID, color: BLUE_DARK },
spacing: { before: 0, after: 0 },
indent: { left: 0, right: 0 },
}),
new Paragraph({
children: [new TextRun({ text: "Type 2 Diabetes Mellitus — Combined Clinical & Patient Self-Monitoring Template", size: pt(10), color: WHITE, font: "Calibri", italics: true })],
alignment: AlignmentType.CENTER,
shading: { type: ShadingType.SOLID, color: BLUE_MID },
spacing: { before: 0, after: 200 },
}),
];
}
// ─── Patient info fields ───────────────────────────────────────────
function infoField(label, width=3000) {
return new TableCell({
children: [
new Paragraph({ children: [new TextRun({ text: label + ":", bold: true, size: pt(9), color: BLUE_DARK, font: "Calibri" })] }),
new Paragraph({ text: "", border: { bottom: { style: BorderStyle.SINGLE, size: 4, color: BLUE_MID } }, spacing: { after: 60 } }),
],
width: { size: width, type: WidthType.DXA },
borders: { top:{style:BorderStyle.NONE}, bottom:{style:BorderStyle.NONE}, left:{style:BorderStyle.NONE}, right:{style:BorderStyle.NONE} },
});
}
function patientInfoTable() {
return new Table({
rows: [
new TableRow({ children: [infoField("Patient Name",3500), infoField("DOB",1800), infoField("MRN / ID",2200)] }),
new TableRow({ children: [infoField("Physician",3500), infoField("Diagnosis Date",1800), infoField("Visit Date",2200)] }),
],
width: { size: 7500, 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} },
});
}
// ─── Build document ───────────────────────────────────────────────
const children = [
...titleBlock(),
spacer(80, 120),
// --- Patient Information ---
sectionTitle("Patient Information"),
spacer(40, 60),
patientInfoTable(),
spacer(160, 60),
// ══════════════════════════════════════
// SECTION A — CLINICAL VISIT CHECKLIST
// ══════════════════════════════════════
colorBar("SECTION A — CLINICAL VISIT CHECKLIST (Clinician Use)"),
spacer(60, 40),
// A1 Glycemic
sectionTitle("A1 · Glycemic Monitoring"),
makeTable([
tableHeader("✓","Assessment Item","Target / Action"),
checkRow("HbA1c measurement", "", "< 7% (individualise)", false),
checkRow("Fasting plasma glucose", "", "80–130 mg/dL", true),
checkRow("2-hour post-prandial glucose", "", "< 180 mg/dL", false),
checkRow("Self-monitoring blood glucose (SMBG) review", "", "Per regimen", true),
checkRow("Continuous glucose monitor (CGM) data review (if applicable)", "", "TIR > 70%", false),
checkRow("Hypoglycaemia episodes documented & assessed", "", "Frequency / severity", true),
]),
note("Reassess HbA1c every 3 months until target reached; then every 6 months."),
spacer(120, 60),
// A2 Cardiovascular
sectionTitle("A2 · Cardiovascular & Metabolic"),
makeTable([
tableHeader("✓","Assessment Item","Target / Action"),
checkRow("Blood pressure measurement", "", "< 130/80 mmHg", false),
checkRow("Fasting lipid panel (LDL, HDL, TG, TC)", "", "LDL < 100 (<70 ASCVD)", true),
checkRow("Statin therapy reviewed / initiated", "", "Moderate–high intensity", false),
checkRow("Body weight & BMI recorded", "", "Target 5–10% ↓ if obese", true),
checkRow("Waist circumference", "", "M < 94 cm | F < 80 cm", false),
checkRow("Cardiovascular risk score calculated (e.g. ASCVD 10-yr)", "", "Document & act", true),
checkRow("ECG (annual if high CV risk)", "", "Baseline & as needed", false),
]),
spacer(120, 60),
// A3 Renal
sectionTitle("A3 · Renal Monitoring"),
makeTable([
tableHeader("✓","Assessment Item","Target / Action"),
checkRow("Serum creatinine + eGFR", "", "≥ 60 mL/min/1.73m²", false),
checkRow("Urine albumin-to-creatinine ratio (UACR)", "", "< 30 mg/g (normal)", true),
checkRow("Electrolytes (Na, K, HCO₃)", "", "Within normal limits", false),
checkRow("SGLT-2 inhibitor initiated / reviewed (if CKD / HF)", "", "eGFR threshold", true),
checkRow("ACE inhibitor / ARB for microalbuminuria", "", "UACR ≥ 30 mg/g", false),
]),
note("Screen for diabetic kidney disease from diagnosis of T2DM (annually thereafter)."),
spacer(120, 60),
// A4 Retinal & Ocular
sectionTitle("A4 · Ocular Monitoring"),
makeTable([
tableHeader("✓","Assessment Item","Target / Action"),
checkRow("Dilated retinal examination", "", "Annually", false),
checkRow("Visual acuity recorded", "", "Baseline & annually", true),
checkRow("Referral to ophthalmology (if retinopathy detected)", "", "Prompt referral", false),
checkRow("Glaucoma / cataract screening discussed", "", "Higher risk in DM", true),
]),
spacer(120, 60),
// A5 Neuropathy
sectionTitle("A5 · Neuropathy & Foot Care"),
makeTable([
tableHeader("✓","Assessment Item","Target / Action"),
checkRow("10 g monofilament foot exam", "", "Annually (minimum)", false),
checkRow("Vibration sense (128 Hz tuning fork)", "", "Annually", true),
checkRow("Ankle reflexes assessed", "", "Document findings", false),
checkRow("Peripheral pulses (dorsalis pedis, tibialis posterior)", "", "ABI if indicated", true),
checkRow("Foot inspection — ulcers, calluses, deformity", "", "Every visit", false),
checkRow("Footwear assessed — appropriate, well-fitting", "", "Patient education", true),
checkRow("Referral to podiatry (if high-risk foot)", "", "As indicated", false),
]),
spacer(120, 60),
// A6 Medications
sectionTitle("A6 · Medication Review"),
makeTable([
tableHeader("✓","Assessment Item","Target / Action"),
checkRow("Current medications reconciled", "", "Full list", false),
checkRow("Metformin dose reviewed / optimised", "", "Max 2g/day (tolerated)", true),
checkRow("Second-line agent reviewed (SGLT-2i / GLP-1 RA / SU / DPP-4i)", "", "Per comorbidities", false),
checkRow("Insulin type, dose, injection technique reviewed (if on insulin)", "", "Rotating sites", true),
checkRow("Hypoglycaemia risk assessed with current regimen", "", "Minimise SU/insulin risk", false),
checkRow("Aspirin / antiplatelet therapy reviewed (if ASCVD)", "", "75–100 mg/day", true),
checkRow("Adherence barriers identified & addressed", "", "Cost, side-effects, beliefs", false),
checkRow("Drug interactions checked", "", "Particularly with new Rx", true),
]),
spacer(120, 60),
// A7 Lifestyle & Mental Health
sectionTitle("A7 · Lifestyle & Psychosocial"),
makeTable([
tableHeader("✓","Assessment Item","Target / Action"),
checkRow("Dietary assessment / referral to dietitian", "", "MNT reinforcement", false),
checkRow("Physical activity review", "", "≥ 150 min/week moderate", true),
checkRow("Smoking status documented", "", "Cessation support offered", false),
checkRow("Alcohol intake assessed", "", "Moderate or abstain", true),
checkRow("Depression / diabetes distress screening (PHQ-2 or PHQ-9)", "", "Annually", false),
checkRow("Diabetes education / self-management support", "", "Ongoing", true),
checkRow("Immunisations reviewed (flu, pneumococcal, COVID-19)", "", "As per schedule", false),
checkRow("Sick day rules / emergency contacts discussed", "", "Patient aware", true),
]),
spacer(120, 60),
// A8 Lab Summary
sectionTitle("A8 · Lab Results Summary (Fill at Visit)"),
new Table({
rows: [
new TableRow({ tableHeader: true, children: [
new TableCell({ children:[new Paragraph({children:[new TextRun({text:"Test",bold:true,size:pt(9),color:BLUE_DARK,font:"Calibri"})]})], shading:{type:ShadingType.SOLID,color:BLUE_PALE}, width:{size:2200,type:WidthType.DXA}}),
new TableCell({ children:[new Paragraph({children:[new TextRun({text:"Result",bold:true,size:pt(9),color:BLUE_DARK,font:"Calibri"})],alignment:AlignmentType.CENTER})], shading:{type:ShadingType.SOLID,color:BLUE_PALE}, width:{size:2000,type:WidthType.DXA}}),
new TableCell({ children:[new Paragraph({children:[new TextRun({text:"Target",bold:true,size:pt(9),color:BLUE_DARK,font:"Calibri"})],alignment:AlignmentType.CENTER})], shading:{type:ShadingType.SOLID,color:BLUE_PALE}, width:{size:1800,type:WidthType.DXA}}),
new TableCell({ children:[new Paragraph({children:[new TextRun({text:"In Target?",bold:true,size:pt(9),color:BLUE_DARK,font:"Calibri"})],alignment:AlignmentType.CENTER})], shading:{type:ShadingType.SOLID,color:BLUE_PALE}, width:{size:1200,type:WidthType.DXA}}),
new TableCell({ children:[new Paragraph({children:[new TextRun({text:"Action Required",bold:true,size:pt(9),color:BLUE_DARK,font:"Calibri"})],alignment:AlignmentType.CENTER})], shading:{type:ShadingType.SOLID,color:BLUE_PALE}, width:{size:2300,type:WidthType.DXA}}),
]}),
...["HbA1c (%)","FPG (mg/dL)","LDL (mg/dL)","eGFR (mL/min)","UACR (mg/g)","BP (mmHg)","Weight (kg)","BMI","TG (mg/dL)"].map((t,i) =>
new TableRow({ children: [
new TableCell({ children:[new Paragraph({children:[new TextRun({text:t,size:pt(9),font:"Calibri"})]})], shading:{type:ShadingType.SOLID,color:i%2===0?WHITE:BLUE_LIGHT}, width:{size:2200,type:WidthType.DXA}}),
new TableCell({ children:[new Paragraph({text:""})], shading:{type:ShadingType.SOLID,color:i%2===0?WHITE:BLUE_LIGHT}, width:{size:2000,type:WidthType.DXA}}),
new TableCell({ children:[new Paragraph({children:[new TextRun({text:["<7%","80–130","<100","≥60","<30","<130/80","","<25","<150"][i],size:pt(9),italics:true,color:GREY_TEXT,font:"Calibri"})],alignment:AlignmentType.CENTER})], shading:{type:ShadingType.SOLID,color:i%2===0?WHITE:BLUE_LIGHT}, width:{size:1800,type:WidthType.DXA}}),
new TableCell({ children:[new Paragraph({children:[new TextRun({text:"☐ Yes ☐ No",size:pt(9),font:"Segoe UI Symbol"})]})], shading:{type:ShadingType.SOLID,color:i%2===0?WHITE:BLUE_LIGHT}, width:{size:1200,type:WidthType.DXA}}),
new TableCell({ children:[new Paragraph({text:""})], shading:{type:ShadingType.SOLID,color:i%2===0?WHITE:BLUE_LIGHT}, width:{size:2300,type:WidthType.DXA}}),
]})
),
],
width: { size: 9500, type: WidthType.DXA },
borders: { top:{style:BorderStyle.SINGLE,size:4,color:"B0C4DE"}, bottom:{style:BorderStyle.SINGLE,size:4,color:"B0C4DE"}, left:{style:BorderStyle.SINGLE,size:4,color:"B0C4DE"}, right:{style:BorderStyle.SINGLE,size:4,color:"B0C4DE"}, insideH:{style:BorderStyle.SINGLE,size:2,color:"D0DFF0"}, insideV:{style:BorderStyle.SINGLE,size:2,color:"D0DFF0"} },
}),
spacer(200, 60),
// ══════════════════════════════════════
// SECTION B — PATIENT SELF-MONITORING LOG
// ══════════════════════════════════════
new Paragraph({ children:[new PageBreak()] }),
...titleBlock(),
spacer(80, 80),
colorBar("SECTION B — PATIENT SELF-MONITORING LOG (Patient Use — Daily / Weekly)"),
spacer(60, 40),
// B1 daily log
sectionTitle("B1 · Daily Glucose, BP & Weight Log (2-Week Tracker)"),
note("Record fasting glucose every morning before eating. Record blood pressure and weight at the same time each day."),
spacer(40, 60),
makeLogTable(),
spacer(120, 60),
// B2 Medication tracker
sectionTitle("B2 · Daily Medication Adherence Tracker"),
new Table({
rows: [
new TableRow({ tableHeader: true, children: [
new TableCell({ children:[new Paragraph({children:[new TextRun({text:"Medication",bold:true,size:pt(9),color:BLUE_DARK,font:"Calibri"})]})], shading:{type:ShadingType.SOLID,color:BLUE_PALE}, width:{size:2500,type:WidthType.DXA}}),
new TableCell({ children:[new Paragraph({children:[new TextRun({text:"Dose",bold:true,size:pt(9),color:BLUE_DARK,font:"Calibri"})],alignment:AlignmentType.CENTER})], shading:{type:ShadingType.SOLID,color:BLUE_PALE}, width:{size:1200,type:WidthType.DXA}}),
...["Mon","Tue","Wed","Thu","Fri","Sat","Sun"].map(d =>
new TableCell({ children:[new Paragraph({children:[new TextRun({text:d,bold:true,size:pt(9),color:BLUE_DARK,font:"Calibri"})],alignment:AlignmentType.CENTER})], shading:{type:ShadingType.SOLID,color:BLUE_PALE}, width:{size:700,type:WidthType.DXA}})
),
]}),
...Array.from({length:5},(_,i)=>
new TableRow({ children: [
new TableCell({ children:[new Paragraph({text:""})], shading:{type:ShadingType.SOLID,color:i%2===0?WHITE:BLUE_LIGHT}, width:{size:2500,type:WidthType.DXA}}),
new TableCell({ children:[new Paragraph({text:""})], shading:{type:ShadingType.SOLID,color:i%2===0?WHITE:BLUE_LIGHT}, width:{size:1200,type:WidthType.DXA}}),
...Array.from({length:7},()=>
new TableCell({ children:[new Paragraph({children:[new TextRun({text:"☐",size:pt(11),font:"Segoe UI Symbol"})],alignment:AlignmentType.CENTER})], shading:{type:ShadingType.SOLID,color:i%2===0?WHITE:BLUE_LIGHT}, width:{size:700,type:WidthType.DXA}})
),
]})
),
],
width: { size: 8500, type: WidthType.DXA },
borders: { top:{style:BorderStyle.SINGLE,size:4,color:"B0C4DE"}, bottom:{style:BorderStyle.SINGLE,size:4,color:"B0C4DE"}, left:{style:BorderStyle.SINGLE,size:4,color:"B0C4DE"}, right:{style:BorderStyle.SINGLE,size:4,color:"B0C4DE"}, insideH:{style:BorderStyle.SINGLE,size:2,color:"D0DFF0"}, insideV:{style:BorderStyle.SINGLE,size:2,color:"D0DFF0"} },
}),
spacer(120, 60),
// B3 Symptoms
sectionTitle("B3 · Symptom Diary — Report to Doctor If Present"),
makeTable([
tableHeader("✓","Symptom to Watch For","When to Act"),
checkRow("Unusual thirst or frequent urination", "", "Persistent → call clinic", false),
checkRow("Blurred vision", "", "Any new change → urgent", true),
checkRow("Numbness, tingling or pain in feet / hands", "", "Report at next visit", false),
checkRow("Chest pain, shortness of breath", "", "Emergency — call 999/112", true),
checkRow("Dizziness, sweating, shakiness (hypoglycaemia signs)", "", "Treat immediately (15g glucose)", false),
checkRow("Slow-healing cuts or sores on feet", "", "Report within 24–48 hrs", true),
checkRow("Persistent nausea, vomiting (DKA risk)", "", "Emergency — seek care", false),
checkRow("Swelling in legs / ankles", "", "Report at next visit", true),
checkRow("Skin infections, recurring UTIs", "", "Contact clinic", false),
]),
spacer(120, 60),
// B4 Lifestyle goals
sectionTitle("B4 · Weekly Lifestyle Self-Assessment"),
makeTable([
tableHeader("✓","Lifestyle Goal","My This-Week Score"),
checkRow("Ate a balanced, low-GI diet (limit refined carbs & sugars)", "", "0–7 days: ___", false),
checkRow("Completed ≥ 150 min moderate exercise this week", "", "Total mins: ___", true),
checkRow("Avoided smoking", "", "☐ Yes ☐ No", false),
checkRow("Limited alcohol (≤1 unit/day women; ≤2 units/day men)", "", "☐ Yes ☐ No", true),
checkRow("Maintained regular sleep schedule (7–9 hrs)", "", "Avg hrs/night: ___", false),
checkRow("Performed daily foot inspection", "", "0–7 days: ___", true),
checkRow("Wore appropriate, well-fitting footwear all day", "", "☐ Yes ☐ No", false),
checkRow("Attended all scheduled clinic appointments", "", "☐ Yes ☐ No", true),
]),
spacer(120, 60),
// B5 Emergency targets card
sectionTitle("B5 · Quick Reference — My Target Numbers"),
new Table({
rows: [
new TableRow({ tableHeader: true, children: [
new TableCell({ children:[new Paragraph({children:[new TextRun({text:"Measurement",bold:true,size:pt(9),color:WHITE,font:"Calibri"})]})], shading:{type:ShadingType.SOLID,color:BLUE_DARK}, width:{size:2800,type:WidthType.DXA}}),
new TableCell({ children:[new Paragraph({children:[new TextRun({text:"My Personal Target",bold:true,size:pt(9),color:WHITE,font:"Calibri"})],alignment:AlignmentType.CENTER})], shading:{type:ShadingType.SOLID,color:BLUE_DARK}, width:{size:2400,type:WidthType.DXA}}),
new TableCell({ children:[new Paragraph({children:[new TextRun({text:"General Guideline",bold:true,size:pt(9),color:WHITE,font:"Calibri"})],alignment:AlignmentType.CENTER})], shading:{type:ShadingType.SOLID,color:BLUE_DARK}, width:{size:2300,type:WidthType.DXA}}),
]}),
...[
["HbA1c","__________","< 7%"],
["Fasting Blood Glucose","__________","80–130 mg/dL"],
["2-hr Post-Meal Glucose","__________","< 180 mg/dL"],
["Blood Pressure","__________","< 130/80 mmHg"],
["LDL Cholesterol","__________","< 100 mg/dL"],
["Weight / BMI","__________","Discuss with doctor"],
].map(([label, mine, guide], i) =>
new TableRow({ children: [
new TableCell({ children:[new Paragraph({children:[new TextRun({text:label,size:pt(10),bold:true,color:"222222",font:"Calibri"})]})], shading:{type:ShadingType.SOLID,color:i%2===0?WHITE:BLUE_LIGHT}, width:{size:2800,type:WidthType.DXA}}),
new TableCell({ children:[new Paragraph({children:[new TextRun({text:mine,size:pt(10),color:BLUE_MID,font:"Calibri"})],alignment:AlignmentType.CENTER})], shading:{type:ShadingType.SOLID,color:i%2===0?WHITE:BLUE_LIGHT}, width:{size:2400,type:WidthType.DXA}}),
new TableCell({ children:[new Paragraph({children:[new TextRun({text:guide,size:pt(9),italics:true,color:GREY_TEXT,font:"Calibri"})],alignment:AlignmentType.CENTER})], shading:{type:ShadingType.SOLID,color:i%2===0?WHITE:BLUE_LIGHT}, width:{size:2300,type:WidthType.DXA}}),
]})
),
],
width: { size: 7500, type: WidthType.DXA },
borders: { top:{style:BorderStyle.SINGLE,size:4,color:"B0C4DE"}, bottom:{style:BorderStyle.SINGLE,size:4,color:"B0C4DE"}, left:{style:BorderStyle.SINGLE,size:4,color:"B0C4DE"}, right:{style:BorderStyle.SINGLE,size:4,color:"B0C4DE"}, insideH:{style:BorderStyle.SINGLE,size:2,color:"D0DFF0"}, insideV:{style:BorderStyle.SINGLE,size:2,color:"D0DFF0"} },
}),
spacer(200, 80),
// Footer note
new Paragraph({
children: [new TextRun({ text: "This template is based on ADA Standards of Medical Care in Diabetes. It is a monitoring tool only and does not replace professional medical advice. Always consult your healthcare provider for treatment decisions.", size: pt(8), color: GREY_TEXT, italics: true, font: "Calibri" })],
alignment: AlignmentType.CENTER,
border: { top: { style: BorderStyle.SINGLE, size: 4, color: BLUE_LIGHT } },
spacing: { before: 120 },
}),
];
// ─── Assemble document ────────────────────────────────────────────
const doc = new Document({
styles: {
default: {
document: {
run: { font: "Calibri", size: pt(10), color: "222222" },
},
},
},
sections: [{
properties: {
page: {
margin: { top: 720, bottom: 720, left: 900, right: 900 },
},
},
headers: {
default: new Header({
children: [new Paragraph({
children: [
new TextRun({ text: "DIABETES MONITORING CHECKLIST | Type 2 DM", bold: true, size: pt(9), color: BLUE_MID, font: "Calibri" }),
new TextRun({ text: " Page ", size: pt(9), color: GREY_TEXT, font: "Calibri" }),
new TextRun({ children: [PageNumber.CURRENT], size: pt(9), color: GREY_TEXT, font: "Calibri" }),
],
border: { bottom: { style: BorderStyle.SINGLE, size: 4, color: BLUE_LIGHT } },
alignment: AlignmentType.RIGHT,
})],
}),
},
children,
}],
});
Packer.toBuffer(doc).then(buf => {
fs.writeFileSync("/home/daytona/workspace/diabetes-checklist/Diabetes_Monitoring_Checklist.docx", buf);
console.log("✅ Written successfully.");
}).catch(err => {
console.error("❌ Error:", err.message);
process.exit(1);
});