Interpret the case and provide differential along with management and prognosis
focal epilepsy children centroparietal EEG valproate
focal childhood epilepsy centroparietal valproate prognosis
| Diagnosis | Supporting Features | Against |
|---|---|---|
| Childhood Epilepsy with Centroparietal/Rolandic spikes (BECTS variant) | Age 12F, focal centro-parietal spikes on EEG, seizure-free on valproate, normal background EEG | Classic BECTS has centrotemporal (C3/C4) spikes; here phase reversal at P3 (parietal) is slightly posterior; typically self-limiting by ~16 years |
| Structural focal epilepsy (e.g., cortical dysplasia, low-grade tumor, prior encephalitis) | Focal EEG, persistent discharges despite treatment | No structural lesion mentioned; no MRI documented |
| Self-limited childhood occipital epilepsy (Panayiotopoulos type) | Age-appropriate, focal posterior EEG changes | This syndrome shows occipital/posterior temporal spikes; seizures are usually nocturnal with autonomic features |
| Symptomatic focal epilepsy (vascular/inflammatory etiology) | Persistent EEG changes | No neurological deficit, normal development implied |
Generate a clinical summary document for the patient's family and follow-up referral
mkdir -p /home/daytona/workspace/manvitha-clinical-docs && ls /home/daytona/workspace/manvitha-clinical-docs/
~/manvitha-clinical-docs/generate_docs.js
const {
Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
Header, Footer, AlignmentType, HeadingLevel, BorderStyle, WidthType,
VerticalAlign, PageNumber, ShadingType, UnderlineType, PageBreak
} = require('docx');
const fs = require('fs');
// ─── Helpers ────────────────────────────────────────────────────────────────
const bold = (text, size = 22) => new TextRun({ text, bold: true, size });
const normal = (text, size = 20) => new TextRun({ text, size });
const italic = (text, size = 20) => new TextRun({ text, italics: true, size });
const small = (text, size = 18) => new TextRun({ text, size, color: '444444' });
const h1 = (text) => new Paragraph({
heading: HeadingLevel.HEADING_1,
children: [new TextRun({ text, bold: true, size: 28, color: '1F3864' })],
spacing: { before: 280, after: 120 },
});
const h2 = (text) => new Paragraph({
heading: HeadingLevel.HEADING_2,
children: [new TextRun({ text, bold: true, size: 22, color: '2E4D7B' })],
spacing: { before: 200, after: 80 },
border: { bottom: { style: BorderStyle.SINGLE, size: 4, color: '2E4D7B' } },
});
const h3 = (text) => new Paragraph({
heading: HeadingLevel.HEADING_3,
children: [new TextRun({ text, bold: true, size: 21, color: '154360' })],
spacing: { before: 160, after: 60 },
});
const p = (text, center = false) => new Paragraph({
alignment: center ? AlignmentType.CENTER : AlignmentType.LEFT,
children: [new TextRun({ text, size: 20 })],
spacing: { after: 60 },
});
const bullet = (text) => new Paragraph({
bullet: { level: 0 },
children: [new TextRun({ text, size: 20 })],
spacing: { after: 40 },
});
const subbullet = (text) => new Paragraph({
bullet: { level: 1 },
children: [new TextRun({ text, size: 19, color: '333333' })],
spacing: { after: 30 },
});
const keyval = (key, value) => new Paragraph({
children: [
new TextRun({ text: `${key}: `, bold: true, size: 20 }),
new TextRun({ text: value, size: 20 }),
],
spacing: { after: 50 },
});
const divider = () => new Paragraph({
border: { bottom: { style: BorderStyle.SINGLE, size: 6, color: 'AAAAAA' } },
spacing: { before: 160, after: 160 },
children: [],
});
const space = (lines = 1) => new Paragraph({
children: [new TextRun({ text: '', size: 20 })],
spacing: { after: lines * 80 },
});
// Shaded info box paragraph
const infoBox = (text, bgColor = 'EBF5FB') => new Paragraph({
children: [new TextRun({ text, size: 20, color: '154360' })],
shading: { type: ShadingType.CLEAR, fill: bgColor },
spacing: { before: 80, after: 80 },
indent: { left: 200, right: 200 },
});
// Two-column table row helper
const twoCol = (label, value, shade = false) => new TableRow({
children: [
new TableCell({
width: { size: 3500, type: WidthType.DXA },
shading: shade ? { type: ShadingType.CLEAR, fill: 'EBF5FB' } : undefined,
children: [new Paragraph({ children: [bold(label, 19)], spacing: { before: 60, after: 60 }, indent: { left: 100 } })],
}),
new TableCell({
width: { size: 6000, type: WidthType.DXA },
shading: shade ? { type: ShadingType.CLEAR, fill: 'FFFFFF' } : undefined,
children: [new Paragraph({ children: [normal(value, 19)], spacing: { before: 60, after: 60 }, indent: { left: 100 } })],
}),
],
});
const tableHeader = (col1, col2) => new TableRow({
tableHeader: true,
children: [
new TableCell({
width: { size: 3500, type: WidthType.DXA },
shading: { type: ShadingType.CLEAR, fill: '1F3864' },
verticalAlign: VerticalAlign.CENTER,
children: [new Paragraph({ children: [new TextRun({ text: col1, bold: true, size: 19, color: 'FFFFFF' })], spacing: { before: 60, after: 60 }, indent: { left: 100 } })],
}),
new TableCell({
width: { size: 6000, type: WidthType.DXA },
shading: { type: ShadingType.CLEAR, fill: '1F3864' },
verticalAlign: VerticalAlign.CENTER,
children: [new Paragraph({ children: [new TextRun({ text: col2, bold: true, size: 19, color: 'FFFFFF' })], spacing: { before: 60, after: 60 }, indent: { left: 100 } })],
}),
],
});
const dataTable = (rows) => new Table({
width: { size: 9500, type: WidthType.DXA },
rows,
borders: {
top: { style: BorderStyle.SINGLE, size: 4, color: '2E4D7B' },
bottom: { style: BorderStyle.SINGLE, size: 4, color: '2E4D7B' },
left: { style: BorderStyle.SINGLE, size: 4, color: '2E4D7B' },
right: { style: BorderStyle.SINGLE, size: 4, color: '2E4D7B' },
insideH: { style: BorderStyle.SINGLE, size: 2, color: 'CCCCCC' },
insideV: { style: BorderStyle.SINGLE, size: 2, color: 'CCCCCC' },
},
});
// ─── HEADER / FOOTER ────────────────────────────────────────────────────────
const docHeader = new Header({
children: [
new Paragraph({
alignment: AlignmentType.CENTER,
children: [
new TextRun({ text: 'KASTURBA HOSPITAL, MANIPAL', bold: true, size: 22, color: '1F3864' }),
],
}),
new Paragraph({
alignment: AlignmentType.CENTER,
children: [new TextRun({ text: 'Department of Paediatrics & Neurology | Udupi District, Karnataka - 576 104', size: 18, color: '555555' })],
border: { bottom: { style: BorderStyle.SINGLE, size: 4, color: '2E4D7B' } },
spacing: { after: 100 },
}),
],
});
const docFooter = new Footer({
children: [
new Paragraph({
alignment: AlignmentType.CENTER,
border: { top: { style: BorderStyle.SINGLE, size: 4, color: 'AAAAAA' } },
spacing: { before: 80 },
children: [
new TextRun({ text: 'CONFIDENTIAL - FOR PATIENT/FAMILY USE AND REFERRAL ONLY | Page ', size: 17, color: '777777' }),
new TextRun({ children: [PageNumber.CURRENT], size: 17, color: '777777' }),
new TextRun({ text: ' of ', size: 17, color: '777777' }),
new TextRun({ children: [PageNumber.TOTAL_PAGES], size: 17, color: '777777' }),
],
}),
],
});
// ═══════════════════════════════════════════════════════════════════════════
// SECTION 1 — PATIENT FAMILY SUMMARY
// ═══════════════════════════════════════════════════════════════════════════
const section1 = [
// Title block
new Paragraph({
alignment: AlignmentType.CENTER,
children: [new TextRun({ text: 'CLINICAL SUMMARY & PATIENT CARE GUIDE', bold: true, size: 32, color: '1F3864' })],
spacing: { before: 200, after: 60 },
}),
new Paragraph({
alignment: AlignmentType.CENTER,
children: [new TextRun({ text: 'For Patient and Family', italics: true, size: 22, color: '2E4D7B' })],
spacing: { after: 60 },
}),
new Paragraph({
alignment: AlignmentType.CENTER,
children: [new TextRun({ text: 'Date of Visit: 01 July 2026 | Prepared: 02 July 2026', size: 19, color: '555555' })],
spacing: { after: 200 },
}),
divider(),
// Patient details
h2('PATIENT IDENTIFICATION'),
dataTable([
twoCol('Full Name', 'Miss Manvitha L', true),
twoCol('Date of Birth', '10 October 2015 (Age 12 years)', false),
twoCol('Gender', 'Female', true),
twoCol('Hospital Number', '03788276', false),
twoCol('Address', 'Kurki Post, Davanagere Talq, Davanagere Dist., Karnataka', true),
twoCol('Team / Speciality', 'PED002 - Paediatrics, Kasturba Hospital Manipal', false),
twoCol('Consultant', 'Dr. Sharath Adiga M, Dept. of Neurology', true),
]),
space(),
// Diagnosis banner
h2('ESTABLISHED DIAGNOSES'),
infoBox('Primary Diagnosis: Focal Epilepsy — Left > Right Centro-Parietal Region (on Sodium Valproate, seizure-free since June 2023)', 'D6EAF8'),
infoBox('Secondary Diagnosis: Mitral Valve Prolapse (MVP) with mild Mitral Regurgitation — Myxomatous leaflets, Grade 2 AML (Echocardiogram June 2023)', 'D5F5E3'),
space(),
// Clinical history
h2('CLINICAL HISTORY'),
p('Manvitha was diagnosed with a seizure disorder after her first generalized tonic-clonic seizure in June 2023. She has been on Sodium Valproate (Valparin) since then and has had NO further seizures.'),
p('Her EEG in 2023 showed focal electrical disturbance over the left > right parieto-temporal region. Her ECHO in June 2023 revealed mitral valve prolapse (MVP), a structural variation of the heart valve, with only mild leakage — this is currently non-significant.'),
p('She presented for routine follow-up on 01 July 2026, reporting no new seizures, no chest pain, no palpitations, and no fatigability. She does experience occasional episodic abdominal pain lasting 15-30 minutes once every two weeks, which settles on its own.'),
space(),
// Vitals
h2('VITALS ON VISIT (01 July 2026)'),
dataTable([
tableHeader('Parameter', 'Value / Findings'),
twoCol('Height', '147 cm', true),
twoCol('Weight', '33.48 kg', false),
twoCol('Heart Rate', '112 beats/min', true),
twoCol('Respiratory Rate', '18 breaths/min (normal)', false),
twoCol('Blood Pressure', '108/66 mmHg (normal for age)', true),
twoCol('SpO2 (Oxygen saturation)', '98% on room air (normal)', false),
twoCol('Chest Auscultation', 'Normal breath sounds bilaterally', true),
twoCol('Heart Sounds', 'S1 S2 — normal split, no significant murmur noted clinically', false),
twoCol('Abdomen', 'Soft, non-tender', true),
]),
space(),
// EEG findings
h2('EEG REPORT — 01 July 2026'),
p('An EEG (brain electrical activity recording) was performed at Kasturba Medical College, Manipal. The findings are described below in simple terms:'),
bullet('Background brain activity was normal (8 Hz posterior rhythm, symmetric, responsive to eye opening — this is reassuring).'),
bullet('Abnormal electrical "spikes" were detected over the left side of the brain (centro-parietal area — C3/P3 region), more on the left than right.'),
bullet('These spikes occurred at 1 Hz (once per second in bursts) — this indicates there is still electrical irritability in that region of the brain even though she has no seizures clinically.'),
bullet('Hyperventilation (deep breathing) and flashing lights did NOT trigger additional abnormalities — this is a reassuring finding.'),
bullet('No sleep recording was available during this session.'),
space(),
infoBox('EEG Conclusion: Focal epileptiform abnormalities over the LEFT > RIGHT centro-parietal region. Clinical seizures are well-controlled.', 'FDEBD0'),
space(),
// Medications
h2('CURRENT MEDICATIONS'),
dataTable([
tableHeader('Medicine', 'Dose / Instructions'),
twoCol('Tab. Valparin Chrono 800 mg', '1 tablet in morning — 0 at noon — 1 tablet at night (twice daily)', true),
twoCol('Duration', 'Continue for 2 more years (until ~2027), then review with neurologist', false),
]),
space(),
infoBox('IMPORTANT: Do NOT stop or reduce the medicine on your own. Stopping suddenly can trigger seizures. Always consult the doctor before any changes.', 'FADBD8'),
space(),
// Medication safety monitoring
h2('WHY BLOOD TESTS WERE ORDERED'),
p('Sodium Valproate (Valparin) is a safe and effective medicine for seizures. However, it can rarely affect the liver. The following blood tests have been ordered to make sure the liver is working normally:'),
bullet('ALT (Liver enzyme test)'),
bullet('AST (Liver enzyme test)'),
bullet('Albumin (protein made by the liver)'),
p('These are routine safety checks — not because anything is wrong, but to monitor long-term health on this medication.'),
space(),
// What to watch for
h2('WARNING SIGNS — WHEN TO SEEK IMMEDIATE CARE'),
infoBox('Go to the Emergency Room immediately if any of the following occur:', 'FADBD8'),
bullet('A seizure (shaking, jerking, loss of consciousness, staring spell, or any unusual episode)'),
bullet('Severe vomiting, abdominal pain, or jaundice (yellow skin/eyes) — may indicate liver side effects'),
bullet('Unusual bruising or bleeding without injury'),
bullet('Sudden severe headache'),
bullet('Chest pain or fainting'),
bullet('Extreme drowsiness or difficulty waking up'),
space(),
// MVP information
h2('ABOUT MITRAL VALVE PROLAPSE (MVP)'),
p('Manvitha has a condition called Mitral Valve Prolapse (MVP). This means one of her heart valves is slightly floppy. Here is what this means for her:'),
bullet('In most children with MVP, the condition is benign (not dangerous) and does not affect daily life.'),
bullet('There is a small amount of backward blood leakage (mild Mitral Regurgitation) — this is currently minor and does not need treatment.'),
bullet('She does NOT need to restrict her physical activity or sports at this stage.'),
bullet('She does NOT need any special heart medicines currently.'),
bullet('A repeat heart scan (ECHO) should be done every 12 months to monitor the valve.'),
space(),
// Upcoming follow-up plan
h2('FOLLOW-UP PLAN'),
dataTable([
tableHeader('Investigation / Action', 'Due / Details'),
twoCol('Blood tests (ALT, AST, Albumin)', 'Ordered this visit — complete as soon as possible', true),
twoCol('Repeat EEG', 'In 6-12 months, or earlier if seizures return', false),
twoCol('MRI Brain (STRONGLY RECOMMENDED)', 'Not yet done — please arrange with neurologist urgently to rule out structural causes', true),
twoCol('Repeat ECHO (Heart Scan)', 'In 12 months to monitor mitral valve', false),
twoCol('Paediatric Neurology Review', 'Next visit as advised (with EEG report)', true),
twoCol('Cardiology Review', 'Annual follow-up', false),
twoCol('Skin assessment', 'Hyperpigmented macule noted on eye/shoulder — dermatology or ophthalmology evaluation advised', true),
]),
space(),
// Lifestyle
h2('LIFESTYLE & DAILY CARE ADVICE'),
bullet('Maintain regular sleep schedule — sleep deprivation can lower seizure threshold.'),
bullet('No prolonged unsupervised swimming or bathing alone (precaution for seizure safety).'),
bullet('Helmet recommended for cycling.'),
bullet('School: Inform class teacher/school nurse about her condition confidentially.'),
bullet('Continue normal schooling and activities — no restrictions unless seizures return.'),
bullet('Avoid known seizure triggers: excessive screen time, sleep deprivation, missed doses.'),
bullet('Ensure she takes medicine at the SAME TIME every day.'),
bullet('Balanced nutritious diet; adequate hydration.'),
space(),
infoBox('For appointments: Kasturba Hospital Manipal — Phone: 0820-2571967 | Email: helpdesk.kh@manipal.edu', 'EBF5FB'),
space(2),
];
// ═══════════════════════════════════════════════════════════════════════════
// PAGE BREAK before referral letter
// ═══════════════════════════════════════════════════════════════════════════
const pageBreakPara = new Paragraph({ children: [new PageBreak()] });
// ═══════════════════════════════════════════════════════════════════════════
// SECTION 2 — REFERRAL LETTER
// ═══════════════════════════════════════════════════════════════════════════
const section2 = [
new Paragraph({
alignment: AlignmentType.CENTER,
children: [new TextRun({ text: 'REFERRAL LETTER', bold: true, size: 32, color: '1F3864' })],
spacing: { before: 200, after: 60 },
}),
new Paragraph({
alignment: AlignmentType.CENTER,
children: [new TextRun({ text: 'For Specialist Review — Neurology / Paediatric Neurology', italics: true, size: 22, color: '2E4D7B' })],
spacing: { after: 200 },
}),
divider(),
// From / To
dataTable([
tableHeader('Referring Details', 'Receiving Details'),
new TableRow({
children: [
new TableCell({
width: { size: 4750, type: WidthType.DXA },
shading: { type: ShadingType.CLEAR, fill: 'EBF5FB' },
children: [
new Paragraph({ children: [bold('From:', 19)], spacing: { before: 60 }, indent: { left: 100 } }),
new Paragraph({ children: [normal('Dept. of Paediatrics (PED002)', 19)], indent: { left: 100 } }),
new Paragraph({ children: [normal('Kasturba Hospital, Manipal', 19)], indent: { left: 100 } }),
new Paragraph({ children: [normal('Manipal - 576 104, Karnataka', 19)], indent: { left: 100 } }),
new Paragraph({ children: [normal('Date: 02 July 2026', 19)], spacing: { after: 60 }, indent: { left: 100 } }),
],
}),
new TableCell({
width: { size: 4750, type: WidthType.DXA },
shading: { type: ShadingType.CLEAR, fill: 'F9F9F9' },
children: [
new Paragraph({ children: [bold('To:', 19)], spacing: { before: 60 }, indent: { left: 100 } }),
new Paragraph({ children: [normal('The Consultant', 19)], indent: { left: 100 } }),
new Paragraph({ children: [italic('Dept. of Paediatric Neurology / Neurology', 19)], indent: { left: 100 } }),
new Paragraph({ children: [normal('(Nearest Tertiary Centre)', 19)], indent: { left: 100 } }),
new Paragraph({ children: [normal('RE: Manvitha L, 12F, MRD 03788276', 19)], spacing: { after: 60 }, indent: { left: 100 } }),
],
}),
],
}),
]),
space(2),
// Salutation
p('Dear Colleague,'),
space(),
p('I am writing to refer Miss Manvitha L, a 12-year-old female, for further specialist evaluation and ongoing neurological management. Details of her clinical status are summarised below.'),
space(),
h2('REASON FOR REFERRAL'),
bullet('Ongoing management of focal epilepsy with persistent EEG abnormalities (focal epileptiform discharges, left > right centro-parietal) despite clinical seizure freedom for >3 years.'),
bullet('MRI brain has not been performed — urgent neuroimaging is required to exclude structural etiology (cortical dysplasia, focal lesion, low-grade neoplasm).'),
bullet('Atypical centro-PARIETAL (rather than purely centrotemporal) spike localization — this warrants expert re-evaluation of the epilepsy syndrome classification.'),
bullet('Evaluation of episodic abdominal pain (possible autonomic aura vs. valproate side effect).'),
bullet('Guidance on long-term AED management, planned valproate taper (target 2027), and transition to adolescent care.'),
space(),
h2('CLINICAL SUMMARY'),
h3('Demographics'),
keyval('Name', 'Miss Manvitha L'),
keyval('DOB', '10 October 2015 (Age 12Y)'),
keyval('Gender', 'Female'),
keyval('MRD No.', '03788276'),
keyval('Address', 'Kurki Post, Davanagere Talq, Davanagere Dist., Karnataka'),
keyval('Contact', '9035120469'),
space(),
h3('Presenting History'),
p('Manvitha first presented with generalized tonic-clonic seizures in June 2023. She has been maintained on Sodium Valproate since then and has achieved complete clinical seizure freedom. She currently reports no seizure recurrence, but has episodic abdominal pain lasting 15-30 minutes, occurring approximately once every 15 days, self-resolving, with no associated vomiting, diarrhea, or urinary symptoms.'),
space(),
h3('Past Medical & Investigative History'),
dataTable([
tableHeader('Investigation / Event', 'Date & Findings'),
twoCol('First Seizure (GTCS)', 'June 2023', true),
twoCol('EEG (Jun 2023)', 'Focal disturbance of electrical function, left > right parieto-temporal region; epileptiform abnormalities', false),
twoCol('ECHO (28 Jun 2023)', 'MVP, myxomatous mitral leaflets, Grade 2 AML, mild MR, trace TVR, mild prolapse; no significant hemodynamic compromise', true),
twoCol('EEG (01 Jul 2026 — current)', 'Posterior activity 8 Hz, symmetric. Frequent spike-wave discharges 1 Hz, left > right centro-parietal (C3, phase reversal at P3). No response to hyperventilation/photic stimulation. INTERPRETATION: Focal epileptiform abnormalities, left > right centro-parietal.', false),
twoCol('MRI Brain', 'NOT YET PERFORMED', true),
]),
space(),
h3('Current Medications'),
p('Tab. Valparin Chrono 800 mg — 1-0-1 (twice daily) | ~24 mg/kg/day | to be continued until 2027'),
space(),
h3('Examination Findings (01 Jul 2026)'),
dataTable([
tableHeader('System', 'Findings'),
twoCol('Vitals', 'HR 112/min, RR 18/min, BP 108/66 mmHg, SpO2 98% RA', true),
twoCol('Anthropometry', 'Ht 147 cm, Wt 33.48 kg', false),
twoCol('Respiratory', 'B/L AE equal, NVBS', true),
twoCol('CVS', 'Apex beat 4th ICS medial to MCL, S1 S2 split normal, no significant murmur', false),
twoCol('Abdomen', 'Soft, non-tender', true),
twoCol('Skin', 'Hyperpigmented macule noted on eye and shoulder region (significance unknown — please evaluate)', false),
twoCol('Neurology', 'No focal neurological deficit documented', true),
]),
space(),
h2('DIFFERENTIAL DIAGNOSIS (FOR YOUR CONSIDERATION)'),
bullet('Benign Childhood Epilepsy with Centrotemporal/Centroparietal Spikes (BECTS/Rolandic variant) — most likely given age and EEG pattern; however, parietal predominance is atypical'),
bullet('Structural focal epilepsy — cortical dysplasia, low-grade glioma, prior encephalomalacia (MRI brain mandatory to exclude)'),
bullet('Panayiotopoulos syndrome / childhood occipital epilepsy — possible given posterior EEG involvement'),
bullet('Symptomatic focal epilepsy secondary to prior CNS insult'),
bullet('Neurocutaneous syndrome (NF1 / other) — given hyperpigmented skin lesions + epilepsy; requires evaluation'),
space(),
h2('SPECIFIC REQUESTS FROM REFERRING TEAM'),
bullet('MRI Brain (with FLAIR, T2, DWI, Gadolinium contrast sequences) — to exclude structural epilepsy'),
bullet('Sleep EEG (absent in current study) — to better characterise epileptiform discharges'),
bullet('Evaluation of hyperpigmented macule (Wood\'s lamp, ophthalmology referral for Lisch nodules if NF1 suspected)'),
bullet('Evaluation and classification of episodic abdominal pain — abdominal aura vs. functional vs. valproate GI side effect'),
bullet('Assessment of valproate — ongoing monitoring (LFTs, CBC, valproate levels), and guidance on planned 2027 taper'),
bullet('Consideration of alternative AED (lamotrigine, levetiracetam, oxcarbazepine) in view of valproate risks in adolescent female (PCOS, weight gain, teratogenicity)'),
bullet('Cardiology liaison for MVP/MR follow-up (annual ECHO recommended)'),
space(),
h2('SUMMARY IMPRESSION'),
infoBox('A 12-year-old girl with focal epilepsy (left > right centro-parietal EEG focus), clinically seizure-free for >3 years on Sodium Valproate, with co-existing mild MVP. Persistent focal epileptiform discharges on recent EEG. MRI brain is outstanding and must be performed. Skin lesions require evaluation for neurocutaneous syndrome. Long-term AED planning and safe transition of care to adolescent/adult neurology needed.', 'D6EAF8'),
space(2),
// Sign-off
new Paragraph({
children: [normal('Yours sincerely,', 20)],
spacing: { after: 200 },
}),
new Paragraph({
children: [normal('_______________________________', 20)],
spacing: { after: 60 },
}),
keyval('Department', 'Paediatrics (PED002), Kasturba Hospital, Manipal'),
keyval('Consultant', 'Dr. Sharath Adiga M, Dept. of Neurology'),
keyval('Date', '02 July 2026'),
keyval('Hospital Contact', '0820-2571967 | helpdesk.kh@manipal.edu'),
space(),
infoBox('This document is prepared based on clinical records dated 01 July 2026. For queries, contact the issuing department. All clinical decisions should be made by a qualified medical professional after direct patient assessment.', 'F5F5F5'),
];
// ═══════════════════════════════════════════════════════════════════════════
// BUILD DOCUMENT
// ═══════════════════════════════════════════════════════════════════════════
const doc = new Document({
title: 'Clinical Summary - Manvitha L',
description: 'Focal Epilepsy - Patient Summary and Referral Letter',
styles: {
default: {
document: {
run: { font: 'Calibri', size: 20 },
},
},
},
sections: [
{
properties: {
page: {
margin: { top: 900, bottom: 900, left: 1000, right: 900 },
},
},
headers: { default: docHeader },
footers: { default: docFooter },
children: [
...section1,
pageBreakPara,
...section2,
],
},
],
});
Packer.toBuffer(doc).then(buffer => {
fs.writeFileSync('/home/daytona/workspace/manvitha-clinical-docs/Manvitha_Clinical_Summary_Referral.docx', buffer);
console.log('SUCCESS: Document written.');
}).catch(err => {
console.error('ERROR:', err);
process.exit(1);
});
cd /home/daytona/workspace/manvitha-clinical-docs && node generate_docs.js 2>&1
python /home/daytona/skills/docx/scripts/office/validate.py /home/daytona/workspace/manvitha-clinical-docs/Manvitha_Clinical_Summary_Referral.docx 2>&1
cd /home/daytona/workspace/manvitha-clinical-docs && python3 -c " import zipfile, os fname = 'Manvitha_Clinical_Summary_Referral.docx' size = os.path.getsize(fname) print(f'File size: {size} bytes ({size/1024:.1f} KB)') with zipfile.ZipFile(fname) as z: names = z.namelist() print('ZIP contents:', names) # Check document.xml is valid XML import xml.etree.ElementTree as ET xml_data = z.read('word/document.xml') ET.fromstring(xml_data) print('document.xml: valid XML') print('DOCX structure looks good.') "
Manvitha Clinical Summary Referral
Word Document · DOCX