Patient information leaflet
/home/daytona/workspace
/home/daytona/skills/docx
mkdir -p /home/daytona/workspace/t2d-leaflet
~/t2d-leaflet/create_leaflet.js
const {
Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
HeadingLevel, AlignmentType, BorderStyle, WidthType, ShadingType,
VerticalAlign, PageNumber, Header, Footer, ImageRun
} = require('docx');
const fs = require('fs');
// Colour palette
const BLUE = "1A5276";
const LIGHT_BLUE = "D6EAF8";
const ORANGE = "E67E22";
const LIGHT_ORANGE = "FDEBD0";
const GRAY = "7F8C8D";
const WHITE = "FFFFFF";
const DARK = "1C2833";
// Helper: create a coloured banner paragraph
function banner(text, bgColor = BLUE, textColor = WHITE, fontSize = 28) {
return new Paragraph({
children: [
new TextRun({
text,
bold: true,
color: textColor,
size: fontSize,
font: "Calibri",
}),
],
alignment: AlignmentType.CENTER,
shading: { type: ShadingType.SOLID, color: bgColor },
spacing: { before: 100, after: 100 },
indent: { left: 200, right: 200 },
});
}
// Helper: section heading
function sectionHeading(text, color = BLUE) {
return new Paragraph({
children: [
new TextRun({
text,
bold: true,
color,
size: 26,
font: "Calibri",
}),
],
spacing: { before: 280, after: 80 },
border: {
bottom: { style: BorderStyle.SINGLE, size: 6, color },
},
});
}
// Helper: body text
function body(text, bold = false, color = DARK) {
return new Paragraph({
children: [
new TextRun({ text, bold, color, size: 22, font: "Calibri" }),
],
spacing: { before: 60, after: 60 },
});
}
// Helper: bullet point
function bullet(text, bold = false) {
return new Paragraph({
children: [
new TextRun({ text: "• ", bold: true, color: ORANGE, size: 22, font: "Calibri" }),
new TextRun({ text, bold, color: DARK, size: 22, font: "Calibri" }),
],
spacing: { before: 40, after: 40 },
indent: { left: 300 },
});
}
// Helper: highlighted info box (table with 1 row, coloured background)
function infoBox(title, items, bgColor = LIGHT_BLUE, titleColor = BLUE) {
const cellChildren = [
new Paragraph({
children: [new TextRun({ text: title, bold: true, color: titleColor, size: 24, font: "Calibri" })],
spacing: { before: 60, after: 80 },
}),
...items.map(item =>
new Paragraph({
children: [
new TextRun({ text: "✓ ", bold: true, color: titleColor, size: 22, font: "Calibri" }),
new TextRun({ text: item, size: 22, font: "Calibri", color: DARK }),
],
spacing: { before: 40, after: 40 },
indent: { left: 200 },
})
),
];
return new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
borders: {
top: { style: BorderStyle.SINGLE, size: 4, color: titleColor },
bottom: { style: BorderStyle.SINGLE, size: 4, color: titleColor },
left: { style: BorderStyle.SINGLE, size: 4, color: titleColor },
right: { style: BorderStyle.SINGLE, size: 4, color: titleColor },
},
rows: [
new TableRow({
children: [
new TableCell({
children: cellChildren,
shading: { type: ShadingType.SOLID, color: bgColor },
margins: { top: 150, bottom: 150, left: 200, right: 200 },
}),
],
}),
],
});
}
// Helper: two-column info table
function twoColTable(rows, header1 = "", header2 = "") {
const tableRows = [];
if (header1) {
tableRows.push(
new TableRow({
children: [
new TableCell({
children: [new Paragraph({ children: [new TextRun({ text: header1, bold: true, color: WHITE, size: 22, font: "Calibri" })] })],
shading: { type: ShadingType.SOLID, color: BLUE },
margins: { top: 100, bottom: 100, left: 150, right: 150 },
}),
new TableCell({
children: [new Paragraph({ children: [new TextRun({ text: header2, bold: true, color: WHITE, size: 22, font: "Calibri" })] })],
shading: { type: ShadingType.SOLID, color: BLUE },
margins: { top: 100, bottom: 100, left: 150, right: 150 },
}),
],
})
);
}
rows.forEach(([col1, col2], idx) => {
const bg = idx % 2 === 0 ? LIGHT_BLUE : WHITE;
tableRows.push(
new TableRow({
children: [
new TableCell({
children: [new Paragraph({ children: [new TextRun({ text: col1, bold: true, size: 22, font: "Calibri", color: DARK })] })],
shading: { type: ShadingType.SOLID, color: bg },
margins: { top: 80, bottom: 80, left: 150, right: 150 },
}),
new TableCell({
children: [new Paragraph({ children: [new TextRun({ text: col2, size: 22, font: "Calibri", color: DARK })] })],
shading: { type: ShadingType.SOLID, color: bg },
margins: { top: 80, bottom: 80, left: 150, right: 150 },
}),
],
})
);
});
return new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: tableRows,
});
}
// Spacer
function spacer(before = 80) {
return new Paragraph({ children: [], spacing: { before, after: 0 } });
}
const doc = new Document({
creator: "Orris Health",
title: "Type 2 Diabetes in Children – Patient Information Leaflet",
description: "Information for parents and guardians of children diagnosed with Type 2 Diabetes",
sections: [
{
headers: {
default: new Header({
children: [
new Paragraph({
children: [
new TextRun({ text: "Type 2 Diabetes in Children | Patient & Family Information", color: GRAY, size: 18, font: "Calibri", italics: true }),
],
alignment: AlignmentType.RIGHT,
border: { bottom: { style: BorderStyle.SINGLE, size: 4, color: GRAY } },
}),
],
}),
},
footers: {
default: new Footer({
children: [
new Paragraph({
children: [
new TextRun({ text: "This leaflet is for general information only and does not replace advice from your child's healthcare team. | Page ", color: GRAY, size: 16, font: "Calibri" }),
new TextRun({ children: [PageNumber.CURRENT], color: GRAY, size: 16, font: "Calibri" }),
],
alignment: AlignmentType.CENTER,
border: { top: { style: BorderStyle.SINGLE, size: 4, color: GRAY } },
}),
],
}),
},
children: [
// ─── TITLE BANNER ───────────────────────────────────────────────
banner("TYPE 2 DIABETES IN CHILDREN", BLUE, WHITE, 36),
new Paragraph({
children: [new TextRun({ text: "A Guide for Parents and Guardians", bold: false, color: WHITE, size: 24, font: "Calibri", italics: true })],
alignment: AlignmentType.CENTER,
shading: { type: ShadingType.SOLID, color: "2471A3" },
spacing: { before: 0, after: 200 },
indent: { left: 200, right: 200 },
}),
spacer(200),
// ─── WHAT IS TYPE 2 DIABETES ──────────────────────────────────
sectionHeading("🔎 What is Type 2 Diabetes?"),
body("Type 2 diabetes is a condition in which the body does not use insulin properly. Insulin is a hormone made by the pancreas that helps glucose (sugar) from food enter the body's cells to be used for energy."),
body("In Type 2 diabetes, the body's cells become resistant to insulin. Over time, the pancreas may not make enough insulin to overcome this resistance, and blood sugar levels rise too high."),
body("Although Type 2 diabetes used to be called 'adult-onset diabetes', it is now increasingly seen in children and teenagers, especially those who are overweight. It accounts for up to 15–20% of new diabetes diagnoses in children.", false, "555555"),
spacer(),
infoBox("Type 2 diabetes is NOT the same as Type 1 diabetes", [
"Type 1 diabetes is an autoimmune condition where the immune system destroys insulin-producing cells.",
"Type 2 diabetes is linked to lifestyle factors and insulin resistance.",
"Both types need careful management — your diabetes team will advise on the right approach for your child.",
], LIGHT_ORANGE, ORANGE),
spacer(200),
// ─── CAUSES & RISK FACTORS ────────────────────────────────────
sectionHeading("⚠️ Causes and Risk Factors"),
body("Type 2 diabetes in children is strongly associated with obesity. Other risk factors include:"),
bullet("Being overweight or obese, particularly around the abdomen"),
bullet("A family history of Type 2 diabetes (parents, siblings, grandparents)"),
bullet("Low levels of physical activity"),
bullet("Certain ethnic backgrounds — higher rates are seen in South Asian, Black, African–Caribbean, and Latino communities"),
bullet("Exposure to diabetes in the womb (mother had gestational diabetes)"),
bullet("Hormonal changes during puberty, which can increase insulin resistance"),
spacer(200),
// ─── SYMPTOMS ────────────────────────────────────────────────
sectionHeading("🩺 Signs and Symptoms"),
body("The onset of Type 2 diabetes in children is usually gradual. Many children have no obvious symptoms at first. When symptoms do appear, they may include:"),
spacer(60),
twoColTable(
[
["Increased thirst (polydipsia)", "Your child may want to drink much more than usual"],
["Passing urine frequently (polyuria)", "Needing the toilet more often, including at night"],
["Tiredness and low energy", "Feeling unusually tired, even after rest"],
["Blurred vision", "Difficulty focusing — caused by fluid changes in the eye"],
["Slow-healing wounds", "Cuts or grazes that take longer than normal to heal"],
["Darkened skin patches", "Dark, velvety patches in skin folds (acanthosis nigricans) — a sign of insulin resistance"],
["Recurrent infections", "Frequent thrush or skin infections"],
["Weight changes", "Unexplained weight loss (less common than in Type 1)"],
],
"Symptom", "What it looks like"
),
spacer(100),
body("⚡ If your child has sudden severe symptoms — such as vomiting, confusion, or difficulty breathing — seek emergency medical care immediately.", true, "C0392B"),
spacer(200),
// ─── DIAGNOSIS ───────────────────────────────────────────────
sectionHeading("🔬 How is it Diagnosed?"),
body("Diagnosis is made through blood tests. Your child's doctor may use one or more of the following:"),
bullet("HbA1c (glycated haemoglobin) — shows average blood sugar over 2–3 months"),
bullet("Fasting blood glucose — blood sugar after not eating for at least 8 hours"),
bullet("Random blood glucose — a blood sugar test at any time of day"),
bullet("Oral glucose tolerance test (OGTT) — blood sugar measured before and after a glucose drink"),
body("The doctor will also want to rule out Type 1 diabetes and other conditions before making the diagnosis."),
spacer(200),
// ─── MANAGEMENT ──────────────────────────────────────────────
sectionHeading("💊 Management and Treatment"),
body("Good management of Type 2 diabetes can help your child live a full, healthy life. Treatment usually involves a combination of lifestyle changes and, if needed, medication."),
spacer(80),
sectionHeading("1. Healthy Lifestyle — The First Step", ORANGE),
body("Lifestyle management is the recommended first step for children with Type 2 diabetes."),
bullet("Healthy eating: a balanced diet low in sugary drinks, processed foods and saturated fat; rich in vegetables, wholegrains, and lean protein"),
bullet("Regular physical activity: aim for at least 60 minutes of moderate activity per day (e.g. walking, cycling, swimming, sport)"),
bullet("Achieving and maintaining a healthy weight — even modest weight loss can significantly improve blood sugar control"),
bullet("Limiting screen time and reducing sedentary behaviour"),
spacer(80),
sectionHeading("2. Medication", ORANGE),
body("If lifestyle changes alone are not enough to control blood sugar levels, medication may be needed:"),
bullet("Metformin — the only medication currently specifically approved for Type 2 diabetes in children (from age 10). It is available as tablets or liquid (100 mg/mL). It works by reducing glucose production in the liver and improving insulin sensitivity."),
bullet("Insulin — may be added if metformin does not achieve good blood sugar control. Basal (long-acting) insulin is usually tried first. Multiple daily injections may be needed in some cases."),
body("Your child's diabetes team will review medication regularly. Do not stop or change doses without speaking to them first.", true, GRAY),
spacer(80),
sectionHeading("3. Blood Sugar Monitoring", ORANGE),
body("Regular monitoring helps you and your child understand how food, activity, and medicine affect blood sugar levels. The team will advise on:"),
bullet("How often to check blood sugar at home"),
bullet("Target blood sugar ranges"),
bullet("How to use a blood glucose monitor or continuous glucose monitor (CGM)"),
bullet("Recording readings and bringing them to clinic appointments"),
spacer(200),
// ─── COMPLICATIONS ───────────────────────────────────────────
sectionHeading("⚠️ Long-Term Complications"),
body("Poorly controlled diabetes over time can affect many parts of the body. The good news is that good blood sugar control greatly reduces these risks."),
spacer(60),
infoBox("Potential long-term complications if diabetes is not well controlled", [
"Eyes (retinopathy) — damage to blood vessels in the retina, which can affect vision",
"Kidneys (nephropathy) — reduced kidney function over time",
"Nerves (neuropathy) — tingling, numbness, or pain, often in hands and feet",
"Heart and blood vessels — increased risk of heart disease and stroke",
"High blood pressure and high cholesterol are common alongside diabetes",
], LIGHT_ORANGE, ORANGE),
spacer(200),
// ─── HBA1C & MONITORING ──────────────────────────────────────
sectionHeading("📋 Regular Check-ups"),
body("Your child will need regular appointments with the diabetes team. These will include:"),
bullet("HbA1c blood test — usually every 3 months at first, then every 3–6 months once stable. Target is usually below 7% (53 mmol/mol)."),
bullet("Blood pressure and weight checks"),
bullet("Eye screening (annual) to check for retinopathy"),
bullet("Urine test to check kidney function"),
bullet("Foot examination"),
bullet("Cholesterol and liver function blood tests"),
bullet("Review of diet, physical activity, and emotional wellbeing"),
body("Keep a record of your child's readings and bring it to every appointment."),
spacer(200),
// ─── HYPOGLYCAEMIA ───────────────────────────────────────────
sectionHeading("🚨 Hypoglycaemia (Low Blood Sugar)"),
body("Hypoglycaemia ('hypo') occurs when blood sugar drops too low. This is more common if your child takes insulin. Signs include:"),
bullet("Shakiness or trembling"),
bullet("Sweating"),
bullet("Feeling dizzy or light-headed"),
bullet("Pale skin"),
bullet("Irritability or unusual behaviour"),
bullet("Confusion or difficulty concentrating"),
spacer(80),
infoBox("What to do during a hypo (if your child is conscious)", [
"Give a fast-acting sugary food or drink — e.g. 4–5 glucose tablets, a small glass of fruit juice, or 3–4 sugary sweets.",
"Wait 10–15 minutes and re-check blood sugar.",
"Once blood sugar is back to normal, give a longer-acting snack (e.g. a small sandwich or crackers with cheese).",
"If your child is unconscious or cannot swallow, call 999 immediately — do not give anything by mouth.",
], LIGHT_ORANGE, "C0392B"),
spacer(200),
// ─── SCHOOL & DAILY LIFE ─────────────────────────────────────
sectionHeading("🏫 School and Daily Life"),
body("Your child can — and should — lead a full, active life. To support them:"),
bullet("Inform the school nurse, teachers, and sports coaches about your child's diabetes"),
bullet("Provide the school with a care plan, emergency hypo kit, and glucose meter"),
bullet("Encourage your child to tell trusted friends so they can help in an emergency"),
bullet("Your child can participate in all sports and physical education — activity is encouraged"),
bullet("Bring snacks and glucose tablets on outings, trips, and sports days"),
bullet("Medical ID bracelets or cards can be helpful in emergencies"),
spacer(200),
// ─── EMOTIONAL WELLBEING ─────────────────────────────────────
sectionHeading("💛 Emotional Wellbeing"),
body("A diagnosis of Type 2 diabetes can feel overwhelming for children and families. Feelings of worry, frustration, or sadness are completely normal."),
bullet("Talk openly with your child about their feelings"),
bullet("Reassure them that diabetes can be managed and that they are not alone"),
bullet("Ask the diabetes team about access to a psychologist or counsellor if needed"),
bullet("Join a diabetes support group — connecting with other families can be very helpful"),
bullet("Avoid using food as a reward or punishment — it can create unhealthy associations"),
spacer(200),
// ─── WHEN TO SEEK HELP ───────────────────────────────────────
sectionHeading("📞 When to Seek Medical Help"),
body("Contact your diabetes team or seek urgent medical attention if your child has:"),
bullet("Blood sugar consistently above or below their target range"),
bullet("Signs of diabetic ketoacidosis (DKA): vomiting, abdominal pain, fruity-smelling breath, rapid breathing, or confusion — CALL 999"),
bullet("A severe hypo (unconscious, fitting, or unable to swallow)"),
bullet("A new illness, infection, or injury that affects blood sugar control"),
bullet("Significant weight loss"),
spacer(200),
// ─── USEFUL CONTACTS ─────────────────────────────────────────
sectionHeading("📌 Useful Contacts and Resources"),
twoColTable(
[
["Your Diabetes Team", "Contact number noted by your clinic"],
["Diabetes UK", "www.diabetes.org.uk | 0345 123 2399"],
["NHS Diabetes", "www.nhs.uk/conditions/type-2-diabetes"],
["JDRF (Type 1 & Type 2)", "www.jdrf.org.uk"],
["School Diabetes Support", "Speak to your school nurse or SENCO"],
],
"Organisation", "Contact / Website"
),
spacer(200),
// ─── FOOTER NOTE ─────────────────────────────────────────────
new Paragraph({
children: [
new TextRun({ text: "This leaflet was prepared using evidence from authoritative medical textbooks including Goodman & Gilman's Pharmacological Basis of Therapeutics and Tintinalli's Emergency Medicine. It is for informational purposes only. Always follow the specific advice of your child's healthcare team.", italics: true, size: 18, color: GRAY, font: "Calibri" }),
],
alignment: AlignmentType.CENTER,
spacing: { before: 200, after: 100 },
border: {
top: { style: BorderStyle.SINGLE, size: 4, color: GRAY },
},
}),
],
},
],
});
Packer.toBuffer(doc).then(buffer => {
fs.writeFileSync("/home/daytona/workspace/t2d-leaflet/Type2_Diabetes_Children_Leaflet.docx", buffer);
console.log("Leaflet created successfully.");
});
cd /home/daytona/workspace/t2d-leaflet && node create_leaflet.js
python /home/daytona/skills/docx/scripts/office/validate.py /home/daytona/workspace/t2d-leaflet/Type2_Diabetes_Children_Leaflet.docx
python -c "import zipfile; z = zipfile.ZipFile('/home/daytona/workspace/t2d-leaflet/Type2_Diabetes_Children_Leaflet.docx'); print('Files:', z.namelist()[:10]); print('Size:', len(z.read('word/document.xml')), 'bytes')"
Type2 Diabetes Children Leaflet
Word Document · DOCX
| Section | Content |
|---|---|
| What is Type 2 Diabetes? | Plain-language explanation + how it differs from Type 1 |
| Causes & Risk Factors | Obesity, family history, ethnicity, puberty, gestational exposure |
| Signs & Symptoms | Formatted two-column table covering all key symptoms |
| Diagnosis | Blood tests explained (HbA1c, fasting glucose, OGTT) |
| Management | Lifestyle first → Metformin → Insulin, with clear explanation of each |
| Blood Sugar Monitoring | Guidance on home monitoring and targets |
| Long-term Complications | Eyes, kidneys, nerves, heart — in a highlighted info box |
| Regular Check-ups | Full list of recommended screening intervals |
| Hypoglycaemia | What to do step-by-step, including emergency guidance |
| School & Daily Life | Practical tips for school, sports, and outings |
| Emotional Wellbeing | Family and child psychological support guidance |
| When to Seek Help | Emergency warning signs including DKA |
| Useful Contacts | Diabetes UK, NHS, JDRF with links |