Create a performa for thalassemia examination ( physical and systemic) along with symptoms seen
ls /home/daytona/workspace/ && ls /home/daytona/skills/docx/
mkdir -p /home/daytona/workspace/thalassemia-proforma && ls /home/daytona/skills/docx/
~/thalassemia-proforma/create_proforma.js
const {
Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
HeadingLevel, AlignmentType, BorderStyle, WidthType, VerticalAlign,
ShadingType, PageOrientation, Header, Footer, PageNumber, NumberFormat
} = require('docx');
const fs = require('fs');
// Helper: shaded header row cell
function headerCell(text, options = {}) {
return new TableCell({
shading: { type: ShadingType.SOLID, color: "1F4E79" },
verticalAlign: VerticalAlign.CENTER,
margins: { top: 80, bottom: 80, left: 120, right: 120 },
columnSpan: options.columnSpan || 1,
children: [
new Paragraph({
alignment: AlignmentType.CENTER,
children: [new TextRun({ text, bold: true, color: "FFFFFF", size: 20, font: "Calibri" })]
})
]
});
}
// Helper: light subheader cell
function subHeaderCell(text, options = {}) {
return new TableCell({
shading: { type: ShadingType.SOLID, color: "BDD7EE" },
verticalAlign: VerticalAlign.CENTER,
margins: { top: 60, bottom: 60, left: 120, right: 120 },
columnSpan: options.columnSpan || 1,
children: [
new Paragraph({
children: [new TextRun({ text, bold: true, size: 19, font: "Calibri", color: "1F4E79" })]
})
]
});
}
// Helper: data cell
function dataCell(text, options = {}) {
return new TableCell({
verticalAlign: VerticalAlign.CENTER,
margins: { top: 60, bottom: 60, left: 120, right: 120 },
columnSpan: options.columnSpan || 1,
children: [
new Paragraph({
children: [new TextRun({ text, size: 18, font: "Calibri" })]
})
]
});
}
// Helper: write field cell (label | blank)
function fieldCell(label, options = {}) {
return new TableCell({
verticalAlign: VerticalAlign.CENTER,
margins: { top: 60, bottom: 60, left: 120, right: 120 },
columnSpan: options.columnSpan || 1,
children: [
new Paragraph({
children: [
new TextRun({ text: label + ": ", bold: true, size: 18, font: "Calibri" }),
new TextRun({ text: "_".repeat(options.lineLen || 30), size: 18, font: "Calibri", color: "AAAAAA" })
]
})
]
});
}
// Helper: checkbox cell
function checkCell(label) {
return new TableCell({
verticalAlign: VerticalAlign.CENTER,
margins: { top: 60, bottom: 60, left: 120, right: 120 },
children: [
new Paragraph({
children: [new TextRun({ text: "☐ " + label, size: 18, font: "Calibri" })]
})
]
});
}
// Helper: empty cell for findings
function findingRow(label) {
return new TableRow({
children: [
new TableCell({
width: { size: 35, type: WidthType.PERCENTAGE },
shading: { type: ShadingType.SOLID, color: "F2F7FB" },
margins: { top: 60, bottom: 60, left: 120, right: 120 },
children: [new Paragraph({ children: [new TextRun({ text: label, bold: true, size: 18, font: "Calibri" })] })]
}),
new TableCell({
width: { size: 65, type: WidthType.PERCENTAGE },
margins: { top: 60, bottom: 60, left: 120, right: 120 },
children: [new Paragraph({ children: [new TextRun({ text: "_".repeat(60), size: 18, font: "Calibri", color: "BBBBBB" })] })]
})
]
});
}
function sectionHeading(text) {
return new Paragraph({
spacing: { before: 280, after: 100 },
children: [
new TextRun({
text: text,
bold: true,
size: 24,
font: "Calibri",
color: "1F4E79",
underline: { type: "single" }
})
]
});
}
function subHeading(text) {
return new Paragraph({
spacing: { before: 160, after: 80 },
children: [
new TextRun({ text: text, bold: true, size: 21, font: "Calibri", color: "2E75B6" })
]
});
}
function note(text) {
return new Paragraph({
spacing: { before: 60, after: 60 },
children: [new TextRun({ text: " ▸ " + text, italics: true, size: 17, font: "Calibri", color: "555555" })]
});
}
function blankLine() {
return new Paragraph({ children: [new TextRun({ text: "" })] });
}
// ─── DOCUMENT ──────────────────────────────────────────────────────────────
const doc = new Document({
styles: {
default: {
document: {
run: { font: "Calibri", size: 20 }
}
}
},
sections: [
{
properties: {
page: {
size: { width: 12240, height: 15840 }, // Letter size
margin: { top: 720, bottom: 720, left: 900, right: 900 }
}
},
children: [
// ══════════════════════════════════════════════════════════
// TITLE BLOCK
// ══════════════════════════════════════════════════════════
new Paragraph({
alignment: AlignmentType.CENTER,
spacing: { before: 0, after: 60 },
children: [new TextRun({ text: "THALASSEMIA EXAMINATION PROFORMA", bold: true, size: 36, font: "Calibri", color: "1F4E79" })]
}),
new Paragraph({
alignment: AlignmentType.CENTER,
spacing: { before: 0, after: 240 },
children: [new TextRun({ text: "Comprehensive Clinical Assessment Sheet", size: 24, font: "Calibri", color: "2E75B6", italics: true })]
}),
// ══════════════════════════════════════════════════════════
// SECTION 1: PATIENT DEMOGRAPHICS
// ══════════════════════════════════════════════════════════
sectionHeading("SECTION 1: PATIENT IDENTIFICATION"),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({
children: [
new TableCell({ width: { size: 25, type: WidthType.PERCENTAGE }, margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "Patient Name:", bold: true, size: 18, font: "Calibri" })] })] }),
new TableCell({ width: { size: 75, type: WidthType.PERCENTAGE }, margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "_".repeat(80), size: 18, font: "Calibri", color: "AAAAAA" })] })] }),
]
}),
new TableRow({
children: [
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "Age / Date of Birth:", bold: true, size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "_".repeat(30) + " Gender: ☐ Male ☐ Female ☐ Other", size: 18, font: "Calibri", color: "444444" })] })] }),
]
}),
new TableRow({
children: [
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "Hospital / MRN:", bold: true, size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "_".repeat(40) + " Date of Assessment: " + "_".repeat(20), size: 18, font: "Calibri", color: "444444" })] })] }),
]
}),
new TableRow({
children: [
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "Ethnicity / Origin:", bold: true, size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "☐ Mediterranean ☐ South Asian ☐ Southeast Asian ☐ African ☐ Middle Eastern ☐ Other: " + "_".repeat(15), size: 18, font: "Calibri" })] })] }),
]
}),
new TableRow({
children: [
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "Diagnosis Type:", bold: true, size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "☐ β-Thal Major ☐ β-Thal Intermedia ☐ β-Thal Minor/Trait ☐ α-Thal (HbH) ☐ α-Thal Trait ☐ Hb Bart's ☐ Unknown", size: 18, font: "Calibri" })] })] }),
]
}),
new TableRow({
children: [
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "Examiner Name:", bold: true, size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "_".repeat(40) + " Designation: " + "_".repeat(25), size: 18, font: "Calibri", color: "444444" })] })] }),
]
}),
]
}),
blankLine(),
// ══════════════════════════════════════════════════════════
// SECTION 2: PRESENTING SYMPTOMS
// ══════════════════════════════════════════════════════════
sectionHeading("SECTION 2: PRESENTING SYMPTOMS"),
note("Tick all that apply. Indicate duration / severity in 'Remarks'."),
// 2A Anemia-related
subHeading("2A. Symptoms of Anemia & Hemolysis"),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({
children: [
new TableCell({ columnSpan: 4, shading: { type: ShadingType.SOLID, color: "BDD7EE" }, margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "Anemia / Hemolysis Symptoms", bold: true, size: 19, font: "Calibri", color: "1F4E79" })] })] })
]
}),
new TableRow({
children: [
checkCell("Pallor / Fatigue"),
checkCell("Dyspnea on exertion"),
checkCell("Palpitations"),
checkCell("Dizziness / Syncope"),
]
}),
new TableRow({
children: [
checkCell("Jaundice (icterus)"),
checkCell("Dark-colored urine"),
checkCell("Poor exercise tolerance"),
checkCell("Weakness / Lethargy"),
]
}),
]
}),
blankLine(),
subHeading("2B. Growth & Development Symptoms"),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({
children: [
checkCell("Short stature / Growth retardation"),
checkCell("Delayed puberty"),
checkCell("Delayed dentition"),
checkCell("Poor weight gain"),
]
}),
new TableRow({
children: [
checkCell("Delayed milestones"),
checkCell("Secondary amenorrhea"),
checkCell("Infertility"),
checkCell("Reduced bone density / fractures"),
]
}),
]
}),
blankLine(),
subHeading("2C. Facial / Skeletal Symptoms"),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({
children: [
checkCell("Frontal bossing"),
checkCell("Prominent malar eminences"),
checkCell("Dental malocclusion"),
checkCell("Bone pain"),
]
}),
new TableRow({
children: [
checkCell("Pathological fractures"),
checkCell("Nasal bridge depression"),
checkCell("Puffiness of face"),
checkCell("Leg pains"),
]
}),
]
}),
blankLine(),
subHeading("2D. Abdominal & Hepatosplenic Symptoms"),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({
children: [
checkCell("Abdominal distension"),
checkCell("Left upper quadrant pain/heaviness"),
checkCell("Early satiety"),
checkCell("Right upper quadrant pain"),
]
}),
]
}),
blankLine(),
subHeading("2E. Endocrine & Metabolic Symptoms (Iron Overload)"),
note("Especially relevant in transfusion-dependent thalassemia. Source: Harrison's Table 103-5"),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({
children: [
checkCell("Polyuria / polydipsia (Diabetes)"),
checkCell("Cold intolerance (Hypothyroidism)"),
checkCell("Tetany / carpopedal spasm (Hypoparathyroidism)"),
checkCell("Adrenal insufficiency symptoms"),
]
}),
]
}),
blankLine(),
subHeading("2F. Cardiac Symptoms"),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({
children: [
checkCell("Chest pain"),
checkCell("Palpitations / arrhythmia"),
checkCell("Breathlessness at rest"),
checkCell("Pedal edema"),
]
}),
new TableRow({
children: [
checkCell("Paroxysmal nocturnal dyspnea"),
checkCell("Orthopnea"),
checkCell("Reduced exercise capacity"),
checkCell("Syncope"),
]
}),
]
}),
blankLine(),
subHeading("2G. Other Symptoms"),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({
children: [
checkCell("Leg ulcers"),
checkCell("Recurrent infections"),
checkCell("Headaches"),
checkCell("Visual disturbances"),
]
}),
new TableRow({
children: [
checkCell("Thromboembolic events (DVT/PE)"),
checkCell("Pulmonary hypertension symptoms"),
checkCell("Abdominal pain (splenomegaly)"),
checkCell("Neurological symptoms"),
]
}),
]
}),
blankLine(),
new Paragraph({ children: [new TextRun({ text: "Additional Symptom Remarks: " + "_".repeat(100), size: 18, font: "Calibri" })] }),
blankLine(),
// ══════════════════════════════════════════════════════════
// SECTION 3: GENERAL PHYSICAL EXAMINATION
// ══════════════════════════════════════════════════════════
sectionHeading("SECTION 3: GENERAL PHYSICAL EXAMINATION"),
subHeading("3A. Vital Signs"),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({
children: [
headerCell("Parameter"),
headerCell("Value"),
headerCell("Parameter"),
headerCell("Value"),
]
}),
new TableRow({
children: [
dataCell("Heart Rate (bpm)", {}),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "_".repeat(25), size: 18, font: "Calibri", color: "AAAAAA" })] })] }),
dataCell("Blood Pressure (mmHg)", {}),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "_____/_____", size: 18, font: "Calibri", color: "AAAAAA" })] })] }),
]
}),
new TableRow({
children: [
dataCell("Respiratory Rate (/min)", {}),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "_".repeat(25), size: 18, font: "Calibri", color: "AAAAAA" })] })] }),
dataCell("Temperature (°C)", {}),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "_".repeat(25), size: 18, font: "Calibri", color: "AAAAAA" })] })] }),
]
}),
new TableRow({
children: [
dataCell("SpO₂ (%)", {}),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "_".repeat(25), size: 18, font: "Calibri", color: "AAAAAA" })] })] }),
dataCell("Weight (kg) / Height (cm)", {}),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "_____ / _____", size: 18, font: "Calibri", color: "AAAAAA" })] })] }),
]
}),
new TableRow({
children: [
dataCell("BMI (kg/m²)", {}),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "_".repeat(25), size: 18, font: "Calibri", color: "AAAAAA" })] })] }),
dataCell("Head Circumference (pediatric)", {}),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "_".repeat(25), size: 18, font: "Calibri", color: "AAAAAA" })] })] }),
]
}),
]
}),
blankLine(),
subHeading("3B. General Appearance & Build"),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({
children: [
checkCell("Well-nourished"),
checkCell("Malnourished"),
checkCell("Short stature for age"),
checkCell("Cachexic appearance"),
]
}),
new TableRow({
children: [
checkCell("Distressed / Irritable"),
checkCell("Lethargic"),
checkCell("Well-oriented / Alert"),
checkCell("Chronic illness facies"),
]
}),
]
}),
blankLine(),
subHeading("3C. Skin & Mucous Membrane"),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({
children: [
headerCell("Sign", { columnSpan: 1 }),
headerCell("Present / Absent", { columnSpan: 1 }),
headerCell("Severity / Remarks", { columnSpan: 2 }),
]
}),
...([
["Pallor (conjunctival / palmar / nail bed)", ""],
["Jaundice / Icterus (sclerae, skin)", ""],
["Skin bronzing / slate-grey pigmentation (iron overload)", ""],
["Leg ulcers (lower limb)", ""],
["Petechiae / purpura", ""],
["Cyanosis (peripheral / central)", ""],
].map(([label]) => new TableRow({
children: [
new TableCell({ width: { size: 35, type: WidthType.PERCENTAGE }, shading: { type: ShadingType.SOLID, color: "F2F7FB" }, margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: label, size: 18, font: "Calibri" })] })] }),
new TableCell({ width: { size: 20, type: WidthType.PERCENTAGE }, margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "☐ Present ☐ Absent", size: 18, font: "Calibri" })] })] }),
new TableCell({ width: { size: 45, type: WidthType.PERCENTAGE }, columnSpan: 2, margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "_".repeat(55), size: 18, font: "Calibri", color: "AAAAAA" })] })] }),
]
}))),
]
}),
blankLine(),
subHeading("3D. Lymphadenopathy"),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({
children: [
checkCell("Cervical nodes"),
checkCell("Axillary nodes"),
checkCell("Inguinal nodes"),
checkCell("None palpable"),
]
}),
new TableRow({
children: [
new TableCell({ columnSpan: 4, margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "Remarks: " + "_".repeat(90), size: 18, font: "Calibri", color: "444444" })] })] })
]
}),
]
}),
blankLine(),
// ══════════════════════════════════════════════════════════
// SECTION 4: HEAD & FACE
// ══════════════════════════════════════════════════════════
sectionHeading("SECTION 4: HEAD, FACE & SKULL EXAMINATION"),
note("Bone marrow expansion causes characteristic skeletal deformities — Robbins & Kumar Pathologic Basis of Disease"),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({ children: [headerCell("Finding"), headerCell("Present / Absent"), headerCell("Severity / Remarks")] }),
...([
"Frontal bossing (prominent forehead)",
"Parietal bossing",
'Crew-cut appearance on skull X-ray (hair-on-end pattern)',
"Prominent malar / zygomatic eminences (chipmunk facies)",
"Depression of nasal bridge",
"Maxillary hypertrophy (protruding teeth / malocclusion)",
"Skull bossing (generalized enlargement)",
"Prominent eyes (pseudo-proptosis)",
"Dental crowding / malocclusion",
].map((label) => new TableRow({
children: [
new TableCell({ width: { size: 40, type: WidthType.PERCENTAGE }, shading: { type: ShadingType.SOLID, color: "F2F7FB" }, margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: label, size: 18, font: "Calibri" })] })] }),
new TableCell({ width: { size: 20, type: WidthType.PERCENTAGE }, margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "☐ Present ☐ Absent", size: 18, font: "Calibri" })] })] }),
new TableCell({ width: { size: 40, type: WidthType.PERCENTAGE }, margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "_".repeat(45), size: 18, font: "Calibri", color: "AAAAAA" })] })] }),
]
})))
]
}),
blankLine(),
// ══════════════════════════════════════════════════════════
// SECTION 5: SYSTEMIC EXAMINATION
// ══════════════════════════════════════════════════════════
sectionHeading("SECTION 5: SYSTEMIC EXAMINATION"),
// 5A Cardiovascular
subHeading("5A. Cardiovascular System"),
note("Iron overload causes cardiomyopathy, arrhythmias, and congestive heart failure — Harrison's 22E, Table 103-5"),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({ children: [headerCell("Finding"), headerCell("Finding"), headerCell("Remarks")] }),
new TableRow({
children: [
new TableCell({ shading: { type: ShadingType.SOLID, color: "F2F7FB" }, margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "Apex beat position", bold: true, size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "ICS: ___ Lat: MCL / Lateral to MCL / Medial to MCL", size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "_".repeat(35), size: 18, font: "Calibri", color: "AAAAAA" })] })] }),
]
}),
new TableRow({
children: [
new TableCell({ shading: { type: ShadingType.SOLID, color: "F2F7FB" }, margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "Heart sounds", bold: true, size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "☐ S1+S2 normal ☐ S3 gallop ☐ S4 ☐ Murmur present", size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "_".repeat(35), size: 18, font: "Calibri", color: "AAAAAA" })] })] }),
]
}),
new TableRow({
children: [
new TableCell({ shading: { type: ShadingType.SOLID, color: "F2F7FB" }, margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "Murmur (if present)", bold: true, size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "☐ Systolic ejection (flow) ☐ Pansystolic ☐ Diastolic Location: ______", size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "_".repeat(35), size: 18, font: "Calibri", color: "AAAAAA" })] })] }),
]
}),
...([
["Cardiomegaly", "☐ Present ☐ Absent"],
["JVP elevation", "☐ Normal ☐ Raised cm above sternal angle: ___"],
["Peripheral edema (pedal)", "☐ None ☐ Pitting ☐ Non-pitting Grade: ___"],
["Pulsus alternans / irregular pulse", "☐ Present ☐ Absent"],
["Signs of cardiac failure", "☐ None ☐ Right ☐ Left ☐ Biventricular"],
].map(([label, value]) => new TableRow({
children: [
new TableCell({ shading: { type: ShadingType.SOLID, color: "F2F7FB" }, margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: label, bold: true, size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: value, size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "_".repeat(35), size: 18, font: "Calibri", color: "AAAAAA" })] })] }),
]
}))),
]
}),
blankLine(),
// 5B Respiratory
subHeading("5B. Respiratory System"),
note("Pulmonary fibrosis, pulmonary hypertension, and restrictive disease occur in thalassemia — Harrison's 22E"),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({ children: [headerCell("Finding"), headerCell("Result"), headerCell("Remarks")] }),
...([
["Chest shape / expansion", "☐ Normal ☐ Barrel-shaped ☐ Asymmetric"],
["Trachea position", "☐ Central ☐ Deviated (L/R)"],
["Percussion note", "☐ Resonant ☐ Dull (basal) ☐ Stony dull"],
["Air entry (auscultation)", "☐ Equal bilateral ☐ Reduced (L) ☐ Reduced (R)"],
["Adventitious sounds", "☐ None ☐ Crackles (basal) ☐ Wheeze ☐ Pleural rub"],
["Signs of pulmonary hypertension", "☐ None ☐ Loud P2 ☐ Right ventricular heave"],
].map(([label, value]) => new TableRow({
children: [
new TableCell({ shading: { type: ShadingType.SOLID, color: "F2F7FB" }, margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: label, bold: true, size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: value, size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "_".repeat(35), size: 18, font: "Calibri", color: "AAAAAA" })] })] }),
]
}))),
]
}),
blankLine(),
// 5C Gastrointestinal / Abdominal
subHeading("5C. Gastrointestinal / Abdominal System"),
note("Splenomegaly (up to 1500 g), hepatomegaly due to extramedullary hematopoiesis and iron deposition — Robbins & Kumar"),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({ children: [headerCell("Finding"), headerCell("Result"), headerCell("Remarks")] }),
new TableRow({
children: [
new TableCell({ shading: { type: ShadingType.SOLID, color: "F2F7FB" }, margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "Abdominal shape", bold: true, size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "☐ Flat ☐ Scaphoid ☐ Distended (↑ liver/spleen) ☐ Obese", size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "_".repeat(35), size: 18, font: "Calibri", color: "AAAAAA" })] })] }),
]
}),
new TableRow({
children: [
new TableCell({ shading: { type: ShadingType.SOLID, color: "F2F7FB" }, margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "Splenomegaly", bold: true, size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "☐ Absent ☐ Just palpable ☐ Mild (<5 cm BCM) ☐ Moderate (5-10 cm) ☐ Massive (>10 cm)", size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "_____ cm BCM", size: 18, font: "Calibri", color: "444444" })] })] }),
]
}),
new TableRow({
children: [
new TableCell({ shading: { type: ShadingType.SOLID, color: "F2F7FB" }, margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "Hepatomegaly", bold: true, size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "☐ Absent ☐ Just palpable ☐ Mild (<3 cm BCM) ☐ Moderate ☐ Severe", size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "_____ cm BCM", size: 18, font: "Calibri", color: "444444" })] })] }),
]
}),
...([
["Liver consistency", "☐ Normal ☐ Firm / Enlarged (iron overload) ☐ Tender"],
["Spleen consistency", "☐ Firm ☐ Hard ☐ Tender on palpation"],
["Ascites", "☐ Absent ☐ Shifting dullness ☐ Fluid thrill"],
["Hepatic bruit / rub", "☐ Absent ☐ Bruit ☐ Friction rub"],
["Evidence of portal hypertension", "☐ None ☐ Caput medusae ☐ Varices history"],
["Abdominal collaterals", "☐ None ☐ Visible"],
].map(([label, value]) => new TableRow({
children: [
new TableCell({ shading: { type: ShadingType.SOLID, color: "F2F7FB" }, margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: label, bold: true, size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: value, size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "_".repeat(35), size: 18, font: "Calibri", color: "AAAAAA" })] })] }),
]
}))),
]
}),
blankLine(),
// 5D Musculoskeletal
subHeading("5D. Musculoskeletal System"),
note("Bone marrow expansion erodes cortical bone; osteoporosis in ~50% of patients — Harrison's 22E"),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({ children: [headerCell("Finding"), headerCell("Result"), headerCell("Remarks")] }),
...([
["Long bone deformities", "☐ None ☐ Bowing (femur/tibia) ☐ Fracture"],
["Spinal deformity", "☐ None ☐ Kyphosis ☐ Scoliosis ☐ Loss of lumbar lordosis"],
["Joint swelling / tenderness", "☐ None ☐ Present — specify: _______"],
["Muscle wasting", "☐ None ☐ Mild ☐ Moderate ☐ Severe"],
["Osteoporosis / fracture sites", "☐ None ☐ Vertebrae ☐ Rib ☐ Long bone"],
["Extramedullary hematopoietic masses", "☐ None ☐ Paraspinal ☐ Other: ________"],
].map(([label, value]) => new TableRow({
children: [
new TableCell({ shading: { type: ShadingType.SOLID, color: "F2F7FB" }, margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: label, bold: true, size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: value, size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "_".repeat(35), size: 18, font: "Calibri", color: "AAAAAA" })] })] }),
]
}))),
]
}),
blankLine(),
// 5E Endocrine
subHeading("5E. Endocrine System (Iron Overload Assessment)"),
note("Hypothalamic-pituitary axis especially sensitive to iron — Harrison's 22E; endocrinopathies include DM, hypothyroidism, hypoparathyroidism"),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({ children: [headerCell("Finding"), headerCell("Result"), headerCell("Remarks")] }),
...([
["Tanner staging (puberty)", "Stage: ___ (expected for age?)"],
["Thyroid gland (palpation)", "☐ Normal ☐ Enlarged ☐ Nodular"],
["Pubertal development", "☐ Age-appropriate ☐ Delayed"],
["Features of hypogonadism", "☐ None ☐ Sparse hair ☐ Small testes ☐ Amenorrhea"],
["Features of diabetes mellitus", "☐ None ☐ Acanthosis ☐ Injection sites visible"],
["Features of hypothyroidism", "☐ None ☐ Dry skin ☐ Bradycardia ☐ Edema"],
["Signs of hypoparathyroidism", "☐ None ☐ Chvostek sign +ve ☐ Trousseau sign +ve"],
].map(([label, value]) => new TableRow({
children: [
new TableCell({ shading: { type: ShadingType.SOLID, color: "F2F7FB" }, margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: label, bold: true, size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: value, size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "_".repeat(35), size: 18, font: "Calibri", color: "AAAAAA" })] })] }),
]
}))),
]
}),
blankLine(),
// 5F Neurological
subHeading("5F. Neurological System"),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({ children: [headerCell("Finding"), headerCell("Result"), headerCell("Remarks")] }),
...([
["Higher mental functions", "☐ Intact ☐ Impaired (Note: ATR-X syndrome — intellectual disability)"],
["Cranial nerves", "☐ Intact ☐ Abnormal — specify: _______"],
["Motor examination", "☐ Normal power ☐ Weakness ☐ Spasticity"],
["Sensory examination", "☐ Normal ☐ Peripheral neuropathy features"],
["Signs of spinal cord compression (extramedullary masses)", "☐ None ☐ Present — level: ______"],
["Stroke / hemiplegia (thromboembolic)", "☐ None ☐ History ☐ Residual deficit"],
].map(([label, value]) => new TableRow({
children: [
new TableCell({ shading: { type: ShadingType.SOLID, color: "F2F7FB" }, margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: label, bold: true, size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: value, size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "_".repeat(35), size: 18, font: "Calibri", color: "AAAAAA" })] })] }),
]
}))),
]
}),
blankLine(),
// ══════════════════════════════════════════════════════════
// SECTION 6: TRANSFUSION HISTORY & IRON CHELATION
// ══════════════════════════════════════════════════════════
sectionHeading("SECTION 6: TRANSFUSION & TREATMENT HISTORY"),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({ children: [headerCell("Parameter"), headerCell("Details")] }),
new TableRow({
children: [
new TableCell({ width: { size: 35, type: WidthType.PERCENTAGE }, shading: { type: ShadingType.SOLID, color: "F2F7FB" }, margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "Transfusion-dependent?", bold: true, size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "☐ Yes ☐ No Frequency: _________ Last transfusion: _________", size: 18, font: "Calibri" })] })] }),
]
}),
new TableRow({
children: [
new TableCell({ shading: { type: ShadingType.SOLID, color: "F2F7FB" }, margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "Pre-transfusion Hb target", bold: true, size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "Target: 9-10.5 g/dL. Last pre-transfusion Hb: _______ g/dL", size: 18, font: "Calibri" })] })] }),
]
}),
new TableRow({
children: [
new TableCell({ shading: { type: ShadingType.SOLID, color: "F2F7FB" }, margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "Iron chelation therapy", bold: true, size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "☐ Deferoxamine ☐ Deferasirox ☐ Deferiprone ☐ None Dose: _______", size: 18, font: "Calibri" })] })] }),
]
}),
new TableRow({
children: [
new TableCell({ shading: { type: ShadingType.SOLID, color: "F2F7FB" }, margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "Splenectomy", bold: true, size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "☐ Yes (date: ________) ☐ No ☐ Partial On prophylactic penicillin: ☐ Yes ☐ No", size: 18, font: "Calibri" })] })] }),
]
}),
new TableRow({
children: [
new TableCell({ shading: { type: ShadingType.SOLID, color: "F2F7FB" }, margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "HSCT / Gene therapy", bold: true, size: 18, font: "Calibri" })] })] }),
new TableCell({ margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "☐ Underwent HSCT (date: ________) ☐ Gene therapy ☐ None planned ☐ Planned", size: 18, font: "Calibri" })] })] }),
]
}),
]
}),
blankLine(),
// ══════════════════════════════════════════════════════════
// SECTION 7: INVESTIGATIONS SUMMARY
// ══════════════════════════════════════════════════════════
sectionHeading("SECTION 7: KEY INVESTIGATIONS SUMMARY"),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({
children: [
headerCell("Investigation"),
headerCell("Result"),
headerCell("Reference / Expected in Thal Major"),
]
}),
...([
["Hb (g/dL)", "___", "Thal Major: 2-4 g/dL (untransfused); Thal Minor: 10-14 g/dL"],
["MCV (fL)", "___", "↓↓ (50-80 fL in major; 55-70 fL in minor)"],
["MCH (pg)", "___", "↓ (<22 pg in minor); markedly ↓ in major"],
["MCHC (g/dL)", "___", "Normal or ↓"],
["RBC count (×10⁶/µL)", "___", "↑ in minor (5-7 M/µL)"],
["Reticulocyte count (%)", "___", "↑ (ineffective erythropoiesis)"],
["Serum ferritin (ng/mL)", "___", "↑↑ in iron overload; monitor for chelation"],
["Serum iron / TIBC", "___", "↑ iron; ↑ saturation"],
["Peripheral blood smear", "___", "Target cells, microcytosis, hypochromia, anisocytosis, nucleated RBCs"],
["HbA₂ (%) — HPLC", "___", "↑ 3.5-7% in β-thal minor (diagnostic)"],
["HbF (%) — HPLC", "___", "↑↑ in thal major (90-100%); mild ↑ in minor"],
["Serum bilirubin (Total/Indirect)", "___", "↑ indirect (hemolysis)"],
["LFT (ALT, AST)", "___", "↑ in iron overload / hepatitis"],
["Blood glucose / HbA1c", "___", "DM screen (iron overload)"],
["Thyroid function (TSH, T4)", "___", "Hypothyroidism screening"],
["Serum calcium / PTH", "___", "Hypoparathyroidism screening"],
["Cardiac MRI (T2*)", "___", "Iron deposition assessment"],
["Echocardiogram", "___", "Cardiomyopathy / pulmonary hypertension"],
["Skull / long bone X-ray", "___", "Crew-cut pattern; thinned cortex"],
["Genetic mutation analysis", "___", "β-globin mutation characterization"],
].map(([inv, res, ref]) => new TableRow({
children: [
new TableCell({ width: { size: 30, type: WidthType.PERCENTAGE }, shading: { type: ShadingType.SOLID, color: "F2F7FB" }, margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: inv, size: 18, font: "Calibri" })] })] }),
new TableCell({ width: { size: 15, type: WidthType.PERCENTAGE }, margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: res, size: 18, font: "Calibri", color: "AAAAAA" })] })] }),
new TableCell({ width: { size: 55, type: WidthType.PERCENTAGE }, margins: { top: 80, bottom: 80, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: ref, size: 17, font: "Calibri", italics: true, color: "444444" })] })] }),
]
}))),
]
}),
blankLine(),
// ══════════════════════════════════════════════════════════
// SECTION 8: CLINICIAN SUMMARY
// ══════════════════════════════════════════════════════════
sectionHeading("SECTION 8: CLINICAL SUMMARY & IMPRESSION"),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
findingRow("Diagnosis (type & severity)"),
findingRow("Key physical findings"),
findingRow("Complications identified"),
findingRow("Transfusion / Chelation adequacy"),
findingRow("Plan / Next steps"),
findingRow("Referrals needed"),
]
}),
blankLine(),
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({
children: [
new TableCell({ width: { size: 50, type: WidthType.PERCENTAGE }, margins: { top: 100, bottom: 100, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "Examiner Signature: " + "_".repeat(35), size: 18, font: "Calibri" })] })] }),
new TableCell({ width: { size: 50, type: WidthType.PERCENTAGE }, margins: { top: 100, bottom: 100, left: 120, right: 120 }, children: [new Paragraph({ children: [new TextRun({ text: "Date & Time: " + "_".repeat(40), size: 18, font: "Calibri" })] })] }),
]
}),
]
}),
blankLine(),
new Paragraph({
alignment: AlignmentType.CENTER,
spacing: { before: 200 },
children: [
new TextRun({ text: "Sources: Robbins, Cotran & Kumar Pathologic Basis of Disease 10e | Harrison's Principles of Internal Medicine 22E | Henry's Clinical Diagnosis and Management", size: 16, font: "Calibri", italics: true, color: "666666" })
]
}),
]
}
]
});
Packer.toBuffer(doc).then(buffer => {
fs.writeFileSync('/home/daytona/workspace/thalassemia-proforma/Thalassemia_Examination_Proforma.docx', buffer);
console.log('SUCCESS: Thalassemia_Examination_Proforma.docx created');
}).catch(err => {
console.error('ERROR:', err);
process.exit(1);
});
cd /home/daytona/workspace/thalassemia-proforma && node create_proforma.js 2>&1