Cvs respi cns git in which all disease list in which use drug with all route dose sideeffect contraindication
Create a downloadable Word/PDF reference guide of this entire pharmacology table
mkdir -p /home/daytona/workspace/pharma-reference && ls /home/daytona/skills/docx/
~/pharma-reference/generate.js
const {
Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
HeadingLevel, AlignmentType, WidthType, BorderStyle, ShadingType,
VerticalAlign, PageOrientation, Header, Footer, PageNumber,
NumberFormat, TableOfContents
} = require('docx');
const fs = require('fs');
// ─── Colour palette ──────────────────────────────────────────────────────────
const COLOURS = {
cvs: "1A3A5C", // dark navy
resp: "1A5C3A", // dark green
cns: "5C1A3A", // dark plum
git: "5C3A1A", // dark amber
hdr: "2C2C2C", // near-black header text
white: "FFFFFF",
light: "F2F6FC", // very light blue tint for alt rows
alert: "5C1A1A", // dark red for key interaction table
};
const SYSTEM_COLOURS = {
CVS: { bg: "D6E4F0", accent: "1A5276", label: "CARDIOVASCULAR SYSTEM (CVS)" },
RESP: { bg: "D5F5E3", accent: "1E8449", label: "RESPIRATORY SYSTEM" },
CNS: { bg: "E8DAEF", accent: "6C3483", label: "CENTRAL NERVOUS SYSTEM (CNS)" },
GIT: { bg: "FDEBD0", accent: "935116", label: "GASTROINTESTINAL SYSTEM (GIT)" },
INT: { bg: "FADBD8", accent: "922B21", label: "KEY DRUG INTERACTION ALERTS" },
};
// ─── Helpers ─────────────────────────────────────────────────────────────────
function noBorder() {
return { style: BorderStyle.NONE, size: 0, color: "FFFFFF" };
}
function cellBorders(color = "CCCCCC") {
const s = { style: BorderStyle.SINGLE, size: 4, color };
return { top: s, bottom: s, left: s, right: s };
}
function shading(fill) {
return { fill, type: ShadingType.CLEAR, color: "auto" };
}
function bold(text, size = 18, color = "000000") {
return new TextRun({ text, bold: true, size, color, font: "Calibri" });
}
function normal(text, size = 17, color = "111111") {
return new TextRun({ text, size, color, font: "Calibri" });
}
function makePara(runs, alignment = AlignmentType.LEFT, spacing = { before: 0, after: 0 }) {
return new Paragraph({ children: Array.isArray(runs) ? runs : [runs], alignment, spacing });
}
// System banner (coloured heading block)
function systemBanner(systemKey) {
const s = SYSTEM_COLOURS[systemKey];
return new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({
children: [
new TableCell({
children: [makePara(
[new TextRun({ text: s.label, bold: true, size: 28, color: COLOURS.white, font: "Calibri" })],
AlignmentType.CENTER, { before: 80, after: 80 }
)],
shading: shading(s.accent),
borders: { top: noBorder(), bottom: noBorder(), left: noBorder(), right: noBorder() },
})
]
})
],
margins: { top: 100, bottom: 0 }
});
}
// Disease sub-heading
function diseaseHeading(num, title, systemKey) {
const s = SYSTEM_COLOURS[systemKey];
return new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({
children: [
new TableCell({
children: [makePara(
[new TextRun({ text: `${num}. ${title}`, bold: true, size: 22, color: s.accent, font: "Calibri" })],
AlignmentType.LEFT, { before: 60, after: 60 }
)],
shading: shading(s.bg),
columnSpan: 1,
borders: {
top: { style: BorderStyle.SINGLE, size: 8, color: s.accent },
bottom: { style: BorderStyle.SINGLE, size: 8, color: s.accent },
left: { style: BorderStyle.SINGLE, size: 8, color: s.accent },
right: { style: BorderStyle.SINGLE, size: 8, color: s.accent },
}
})
]
})
],
margins: { top: 120 }
});
}
// Drug table
// headers: string[]
// rows: string[][]
// colWidths: number[] (percentages, must sum ~100)
function drugTable(headers, rows, systemKey) {
const s = SYSTEM_COLOURS[systemKey];
const pct = WidthType.PERCENTAGE;
const colCount = headers.length;
const widths = colWidthsFor(colCount);
const headerRow = new TableRow({
tableHeader: true,
children: headers.map((h, i) =>
new TableCell({
children: [makePara([bold(h, 17, COLOURS.white)], AlignmentType.CENTER, { before: 60, after: 60 })],
shading: shading(s.accent),
width: { size: widths[i], type: pct },
borders: cellBorders(s.accent),
verticalAlign: VerticalAlign.CENTER,
})
)
});
const dataRows = rows.map((row, ri) =>
new TableRow({
children: row.map((cell, ci) =>
new TableCell({
children: [makePara([normal(cell, 16)], AlignmentType.LEFT, { before: 40, after: 40 })],
shading: ri % 2 === 0 ? shading("FFFFFF") : shading("F8F9FA"),
width: { size: widths[ci], type: pct },
borders: cellBorders("CCCCCC"),
verticalAlign: VerticalAlign.TOP,
})
)
})
);
return new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [headerRow, ...dataRows],
margins: { top: 60, bottom: 60 }
});
}
function colWidthsFor(n) {
// Distribute sensibly based on column count
if (n === 5) return [14, 10, 10, 33, 33];
if (n === 6) return [14, 10, 10, 10, 28, 28];
if (n === 7) return [10, 10, 8, 8, 10, 27, 27];
// default equal
const w = Math.floor(100 / n);
return Array(n).fill(w);
}
function spacer(pts = 60) {
return new Paragraph({ text: "", spacing: { before: pts, after: pts } });
}
function noteBox(text) {
return new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({
children: [
new TableCell({
children: [makePara([new TextRun({ text, size: 15, italics: true, color: "444444", font: "Calibri" })],
AlignmentType.LEFT, { before: 60, after: 60 })],
shading: shading("FFF9C4"),
borders: {
top: { style: BorderStyle.SINGLE, size: 8, color: "F9A825" },
bottom: { style: BorderStyle.SINGLE, size: 8, color: "F9A825" },
left: { style: BorderStyle.SINGLE, size: 16, color: "F9A825" },
right: { style: BorderStyle.SINGLE, size: 8, color: "F9A825" },
}
})
]
})
],
margins: { top: 120 }
});
}
// ─── DATA ────────────────────────────────────────────────────────────────────
const DRUG_DATA = [
// ══════════════════════════════════════════════════════════
// CVS
// ══════════════════════════════════════════════════════════
{
system: "CVS",
num: 1,
title: "Hypertension",
headers: ["Drug Class / Drug", "Route", "Adult Dose", "Side Effects", "Contraindications"],
rows: [
["ACE Inhibitors\nEnalapril, Ramipril, Lisinopril", "Oral", "Enalapril: 5–40 mg/day\nRamipril: 2.5–10 mg/day", "Dry cough, hyperkalemia, angioedema, first-dose hypotension, renal impairment", "Bilateral renal artery stenosis, pregnancy, history of angioedema, hyperkalemia"],
["ARBs\nLosartan, Valsartan, Telmisartan", "Oral", "Losartan: 50–100 mg/day\nValsartan: 80–320 mg/day", "Dizziness, hyperkalemia, renal impairment (less cough than ACEi)", "Pregnancy, bilateral renal artery stenosis"],
["Beta-Blockers\nAtenolol, Metoprolol, Carvedilol", "Oral", "Atenolol: 25–100 mg/day\nMetoprolol: 25–200 mg/day", "Bradycardia, fatigue, cold extremities, erectile dysfunction, bronchospasm", "Asthma/COPD (non-selective), 2nd/3rd degree AV block, cardiogenic shock"],
["CCBs (DHP)\nAmlodipine, Nifedipine", "Oral", "Amlodipine: 5–10 mg/day\nNifedipine SR: 30–90 mg/day", "Peripheral edema, headache, flushing, reflex tachycardia", "HFrEF (caution), severe aortic stenosis"],
["CCBs (non-DHP)\nVerapamil, Diltiazem", "Oral / IV", "Verapamil: 80–480 mg/day oral\nIV bolus: 5–10 mg", "Constipation (verapamil), bradycardia, heart block, negative inotropy", "AV block, sick sinus syndrome, HFrEF, concurrent beta-blockers"],
["Thiazide Diuretics\nHCTZ, Chlorthalidone", "Oral", "HCTZ: 12.5–25 mg/day", "Hypokalemia, hyponatremia, hyperuricemia, hyperglycemia, hyperlipidemia", "Gout (relative), sulfa allergy, anuria"],
["Loop Diuretics\nFurosemide, Bumetanide", "Oral / IV", "Furosemide: 20–80 mg/dose", "Hypokalemia, dehydration, ototoxicity, hypomagnesemia", "Anuria, hepatic coma, hypovolemia"],
["Alpha-2 Agonists\nClonidine, Methyldopa", "Oral", "Clonidine: 0.1–0.3 mg BD\nMethyldopa: 250–1000 mg BD–TDS", "Dry mouth, sedation, rebound HTN (clonidine), hemolytic anemia (methyldopa)", "Methyldopa: liver disease; Clonidine: never abruptly discontinue"],
["Vasodilators\nHydralazine, Minoxidil", "Oral / IV", "Hydralazine: 25–100 mg QID\nIV: 5–20 mg bolus", "Reflex tachycardia, lupus-like syndrome (hydralazine), hypertrichosis (minoxidil)", "CAD, lupus (hydralazine)"],
["Sodium Nitroprusside", "IV infusion", "0.3–10 mcg/kg/min", "Hypotension, cyanide toxicity (prolonged), methemoglobinemia", "Compensatory hypertension, hepatic/renal insufficiency (prolonged)"],
]
},
{
system: "CVS",
num: 2,
title: "Heart Failure",
headers: ["Drug", "Route", "Adult Dose", "Side Effects", "Contraindications"],
rows: [
["Furosemide", "Oral / IV", "20–80 mg/day (titrated)", "Hypokalemia, hypotension, ototoxicity", "Anuria"],
["ACE Inhibitors\n(Enalapril, Ramipril)", "Oral", "As per hypertension", "Cough, angioedema, hyperkalemia", "Bilateral RAS, pregnancy"],
["Beta-Blockers\nCarvedilol, Metoprolol succinate", "Oral", "Carvedilol: 3.125 mg BD → titrate to 25 mg BD", "Bradycardia, fatigue, fluid retention (on initiation)", "Acute decompensated HF, severe bradycardia"],
["Sacubitril/Valsartan (ARNI)", "Oral", "24/26 mg BD → 97/103 mg BD", "Hypotension, hyperkalemia, angioedema", "Concurrent ACEi (within 36 hrs), pregnancy, angioedema history"],
["Spironolactone / Eplerenone (MRA)", "Oral", "Spironolactone: 25–50 mg/day", "Hyperkalemia, gynecomastia (spironolactone), renal impairment", "K+ >5 mEq/L, GFR <30 mL/min"],
["Digoxin", "Oral / IV", "0.125–0.25 mg/day oral", "Nausea, yellow-green visual changes, arrhythmias, bradycardia", "AV block, hypertrophic cardiomyopathy, VT"],
["Ivabradine", "Oral", "5–7.5 mg BD", "Bradycardia, visual phosphenes", "AF, resting HR <70, severe hepatic impairment"],
["Dobutamine", "IV infusion", "2–20 mcg/kg/min", "Tachycardia, arrhythmias, hypertension", "Hypertrophic obstructive cardiomyopathy, severe hypovolemia"],
]
},
{
system: "CVS",
num: 3,
title: "Angina Pectoris",
headers: ["Drug", "Route", "Adult Dose", "Side Effects", "Contraindications"],
rows: [
["Glyceryl Trinitrate (GTN)", "SL / Patch / IV", "SL: 0.3–0.6 mg PRN\nPatch: 0.2–0.8 mg/hr\nIV: 5–200 mcg/min", "Headache, hypotension, reflex tachycardia, methemoglobinemia", "PDE5 inhibitor use (sildenafil), severe hypotension, hypertrophic cardiomyopathy"],
["Isosorbide Mononitrate", "Oral", "20–60 mg OD (SR)", "Headache, flushing, hypotension, nitrate tolerance", "Same as GTN; avoid continuous use to prevent tolerance"],
["Metoprolol / Atenolol", "Oral", "Metoprolol: 25–200 mg/day", "Bradycardia, bronchospasm, fatigue", "Vasospastic (Prinzmetal) angina, severe bradycardia, asthma"],
["Amlodipine / Nifedipine", "Oral", "Amlodipine: 5–10 mg/day", "Edema, headache, flushing", "Severe aortic stenosis"],
["Ranolazine", "Oral", "500–1000 mg BD", "QT prolongation, dizziness, constipation", "QT prolongation, CYP3A4 inhibitors, severe hepatic impairment"],
]
},
{
system: "CVS",
num: 4,
title: "Arrhythmias (Vaughan Williams Classification)",
headers: ["Class / Drug", "Route", "Adult Dose", "Side Effects", "Contraindications"],
rows: [
["Class Ia\nQuinidine, Procainamide", "Oral / IV", "Quinidine: 200–400 mg TDS", "Cinchonism, QT prolongation, lupus-like (procainamide)", "QT prolongation, heart block"],
["Class Ib\nLidocaine, Mexiletine", "IV / Oral", "Lidocaine: 1–1.5 mg/kg IV bolus", "Neurological (tremor, seizure), bradycardia", "Sinus arrest, Stokes-Adams syndrome"],
["Class Ic\nFlecainide, Propafenone", "Oral", "Flecainide: 50–200 mg BD", "Pro-arrhythmic, blurred vision, dizziness", "Post-MI, structural heart disease"],
["Class II (Beta-blockers)\nAtenolol, Metoprolol, Esmolol", "Oral / IV", "Esmolol: 500 mcg/kg loading IV", "Bradycardia, hypotension, bronchospasm", "Asthma, AV block, cardiogenic shock"],
["Class III\nAmiodarone", "Oral / IV", "Oral: 200 mg TDS (loading) → 200 mg OD\nIV: 150 mg over 10 min", "Pulmonary toxicity, thyroid dysfunction, corneal deposits, photosensitivity, hepatotoxicity", "Thyroid disease, iodine allergy, severe bradycardia, AV block"],
["Class III\nSotalol", "Oral", "80–160 mg BD", "QT prolongation, Torsades de Pointes, bradycardia", "QT prolongation, asthma, renal failure"],
["Class IV\nVerapamil, Diltiazem", "Oral / IV", "IV verapamil: 5–10 mg", "Bradycardia, hypotension, constipation, heart block", "AV block, HF, WPW syndrome"],
["Adenosine", "IV rapid bolus", "6 mg; 12 mg if no effect", "Transient AV block, flushing, chest tightness, bronchospasm", "Asthma, 2nd/3rd degree AV block, sick sinus syndrome"],
["Digoxin", "Oral / IV", "0.125–0.25 mg/day", "Bradycardia, arrhythmias, GI upset, visual changes", "AV block, hypertrophic cardiomyopathy, VT"],
]
},
{
system: "CVS",
num: 5,
title: "Dyslipidemia",
headers: ["Drug Class / Drug", "Route", "Adult Dose", "Side Effects", "Contraindications"],
rows: [
["Statins\nAtorvastatin, Rosuvastatin", "Oral", "Atorvastatin: 10–80 mg OD\nRosuvastatin: 5–40 mg OD", "Myopathy/rhabdomyolysis, elevated LFTs, headache", "Active liver disease, pregnancy, breast-feeding"],
["Ezetimibe", "Oral", "10 mg OD", "Well tolerated; mild GI symptoms", "Moderate–severe hepatic impairment (with statin)"],
["Fibrates\nFenofibrate, Gemfibrozil", "Oral", "Fenofibrate: 145 mg OD", "Myopathy (esp. with statins), gallstones, elevated creatinine", "Severe renal/hepatic disease, gallbladder disease"],
["Niacin", "Oral", "500–2000 mg/day", "Flushing, hyperuricemia, hyperglycemia, hepatotoxicity", "Active peptic ulcer, hepatic disease, gout"],
["Bile Acid Sequestrants\nCholestyramine", "Oral", "4–16 g/day", "Constipation, bloating, drug malabsorption", "Complete biliary obstruction, hypertriglyceridemia"],
["PCSK9 Inhibitors\nEvolocumab, Alirocumab", "SC injection", "Evolocumab: 140 mg Q2W or 420 mg monthly", "Injection site reactions, nasopharyngitis", "Hypersensitivity"],
]
},
{
system: "CVS",
num: 6,
title: "ACS / Antiplatelet / Anticoagulants",
headers: ["Drug", "Route", "Adult Dose", "Side Effects", "Contraindications"],
rows: [
["Aspirin", "Oral", "75–325 mg/day", "GI bleeding, peptic ulceration, Reye syndrome (children)", "Active bleeding, aspirin allergy, severe hepatic disease"],
["Clopidogrel\n(P2Y12 inhibitor)", "Oral", "75 mg/day (loading: 300–600 mg)", "Bleeding, TTP (rare)", "Active bleeding"],
["Ticagrelor\n(P2Y12 inhibitor)", "Oral", "90 mg BD (loading: 180 mg)", "Bleeding, dyspnea", "Active bleeding, ICH history, severe hepatic impairment"],
["Heparin (UFH)", "IV / SC", "IV: 80 units/kg bolus + 18 units/kg/hr\nSC: 5000 units BD (prophylaxis)", "Bleeding, HIT, osteoporosis", "Active bleeding, HIT, thrombocytopenia"],
["LMWH\nEnoxaparin", "SC", "1 mg/kg BD or 1.5 mg/kg OD", "Bleeding, HIT (less than UFH), elevated LFTs", "Active major bleeding, allergy, severe renal impairment"],
["Warfarin", "Oral", "Individualized (target INR 2–3)", "Bleeding, teratogenic, skin necrosis", "Pregnancy, active bleeding, non-compliant patients"],
["DOACs\nApixaban, Rivaroxaban", "Oral", "Apixaban: 5 mg BD\nRivaroxaban: 20 mg OD", "Bleeding", "Significant renal/hepatic impairment, pregnancy"],
["Alteplase (tPA)", "IV", "0.9 mg/kg (max 90 mg) over 60 min", "Major hemorrhage, intracranial bleed", "Active bleeding, recent surgery, prior ICH, BP >185/110"],
]
},
// ══════════════════════════════════════════════════════════
// RESPIRATORY
// ══════════════════════════════════════════════════════════
{
system: "RESP",
num: 7,
title: "Asthma",
headers: ["Drug Class / Drug", "Route", "Adult Dose", "Side Effects", "Contraindications"],
rows: [
["SABAs\nSalbutamol (Albuterol), Terbutaline", "Inhaler (MDI/DPI) / Nebulizer / IV", "MDI: 100–200 mcg (1–2 puffs) PRN\nNebulizer: 2.5 mg in 3 mL NS", "Tremor, tachycardia, hypokalemia, palpitations", "Hypersensitivity"],
["LABAs\nSalmeterol, Formoterol", "Inhaled (with ICS only)", "Salmeterol: 50 mcg BD", "Tachycardia, tremor — NEVER as monotherapy in asthma", "Monotherapy in asthma (must always combine with ICS)"],
["Inhaled Corticosteroids (ICS)\nBeclomethasone, Budesonide, Fluticasone", "Inhaled", "Beclomethasone: 100–400 mcg BD\nFluticasone: 100–500 mcg BD", "Oral candidiasis, hoarseness, HPA suppression (high dose)", "Active TB (relative), untreated fungal infection"],
["Systemic Corticosteroids\nPrednisolone, Hydrocortisone", "Oral / IV", "Prednisolone: 40–60 mg/day\nHydrocortisone: 100–200 mg IV", "Hyperglycemia, osteoporosis, immunosuppression, Cushing's syndrome", "Active peptic ulcer (relative), uncontrolled DM"],
["Anti-muscarinics\nIpratropium (SAMA), Tiotropium (LAMA)", "Inhaled", "Ipratropium: 20–40 mcg QID\nTiotropium: 18 mcg OD", "Dry mouth, blurred vision, urinary retention, constipation", "Narrow-angle glaucoma, BPH (relative)"],
["Methylxanthines\nTheophylline, Aminophylline", "Oral / IV", "Theophylline: 5 mg/kg loading, then 0.5 mg/kg/hr\nAminophylline IV: 5 mg/kg over 20 min", "Nausea, vomiting, seizures, arrhythmias (narrow therapeutic index)", "Arrhythmias, peptic ulcer, concurrent CYP1A2 inhibitors"],
["Leukotriene Receptor Antagonists\nMontelukast, Zafirlukast", "Oral", "Montelukast: 10 mg OD (at night)", "Headache, GI upset, neuropsychiatric effects (rare)", "Hypersensitivity"],
["Mast Cell Stabilizers\nSodium Cromoglycate, Nedocromil", "Inhaled", "Sodium cromoglycate: 20 mg QID", "Throat irritation, cough, paradoxical bronchospasm (rare)", "Prophylaxis only — NOT for acute attacks"],
["Anti-IgE\nOmalizumab", "SC injection", "150–375 mg SC Q2–4W (weight/IgE-based)", "Injection site reactions, anaphylaxis (rare)", "Non-IgE mediated asthma, hypersensitivity"],
["Anti-IL5/IL4 Biologics\nMepolizumab, Benralizumab, Dupilumab", "SC injection", "Mepolizumab: 100 mg SC Q4W", "Injection site reactions, nasopharyngitis, headache", "Hypersensitivity"],
]
},
{
system: "RESP",
num: 8,
title: "COPD",
headers: ["Drug", "Route", "Adult Dose", "Side Effects", "Contraindications"],
rows: [
["Tiotropium (LAMA)", "Inhaled", "18 mcg OD", "Dry mouth, urinary retention, constipation", "Narrow-angle glaucoma, BPH (relative)"],
["Salmeterol / Formoterol (LABA)", "Inhaled", "Salmeterol 50 mcg BD", "Tachycardia, tremor", "Cardiac arrhythmias (caution)"],
["Umeclidinium/Vilanterol (LABA+LAMA)", "Inhaled", "55/22 mcg OD", "Combined side effects of each component", "Same as individual components"],
["Fluticasone/Salmeterol (ICS+LABA)", "Inhaled", "250/50 mcg BD", "Pneumonia (increased risk with ICS in COPD), oral candidiasis", "Active TB"],
["Roflumilast (PDE4 inhibitor)", "Oral", "500 mcg OD", "Nausea, diarrhea, weight loss, depression", "Moderate–severe hepatic impairment, depression/suicidal history"],
["Oxygen therapy", "Inhalation", "1–3 L/min (maintain SaO2 88–92% in COPD)", "CO2 retention if uncontrolled high-flow O2", "High-flow O2 in type 2 respiratory failure"],
]
},
{
system: "RESP",
num: 9,
title: "Pneumonia / Respiratory Infections",
headers: ["Drug", "Route", "Adult Dose", "Side Effects", "Contraindications"],
rows: [
["Amoxicillin", "Oral", "500 mg TDS or 1 g BD", "Diarrhea, rash, allergy", "Penicillin allergy"],
["Amoxicillin-Clavulanate", "Oral", "625 mg TDS or 1 g BD", "GI upset, cholestatic jaundice (esp. clavulanate)", "Penicillin allergy, jaundice from prior use"],
["Azithromycin", "Oral / IV", "500 mg OD (3–5 days)", "QT prolongation, GI upset, hearing loss", "QT-prolonging drugs, hepatic impairment"],
["Doxycycline", "Oral", "100 mg BD", "Photosensitivity, GI upset, esophagitis, tooth discoloration", "Pregnancy, children <8 years"],
["Levofloxacin / Moxifloxacin", "Oral / IV", "Levofloxacin: 500–750 mg OD", "Tendinopathy, QT prolongation, CNS effects, photosensitivity", "Tendon disorders, QT prolongation, pregnancy"],
["Piperacillin-Tazobactam", "IV", "4.5 g Q6–8H", "Diarrhea, C. difficile, hypokalemia", "Penicillin allergy"],
]
},
{
system: "RESP",
num: 10,
title: "Tuberculosis (Standard First-Line HRZE)",
headers: ["Drug", "Route", "Adult Dose", "Side Effects", "Contraindications"],
rows: [
["Isoniazid (H)", "Oral / IM", "5 mg/kg/day (max 300 mg)", "Peripheral neuropathy (prevented by pyridoxine), hepatotoxicity, lupus-like syndrome", "Hepatic disease, alcoholism (caution)"],
["Rifampicin (R)", "Oral / IV", "10 mg/kg/day (max 600 mg)", "Hepatotoxicity, orange discoloration of body fluids, CYP450 inducer — many drug interactions", "Hepatic disease, hypersensitivity"],
["Pyrazinamide (Z)", "Oral", "15–30 mg/kg/day (max 2 g)", "Hepatotoxicity, hyperuricemia, arthralgia", "Severe hepatic disease, gout"],
["Ethambutol (E)", "Oral", "15–25 mg/kg/day", "Optic neuritis (dose-related, reversible), color blindness", "Children <5 years (cannot monitor vision), optic neuritis"],
["Streptomycin (S)", "IM / IV", "15 mg/kg/day (max 1 g)", "Ototoxicity, nephrotoxicity, neuromuscular blockade", "Pregnancy (vestibular damage to fetus), renal failure"],
]
},
// ══════════════════════════════════════════════════════════
// CNS
// ══════════════════════════════════════════════════════════
{
system: "CNS",
num: 11,
title: "Epilepsy / Seizures",
headers: ["Drug", "Route", "Adult Dose", "Side Effects", "Contraindications"],
rows: [
["Phenytoin", "Oral / IV", "Oral: 300–400 mg/day\nIV loading: 15–20 mg/kg (max 50 mg/min)", "Nystagmus, ataxia, gingival hyperplasia, hirsutism, teratogenic, zero-order kinetics", "Pregnancy, SA/AV block, bradycardia"],
["Valproate (Sodium Valproate)", "Oral / IV", "20–30 mg/kg/day", "Hepatotoxicity, teratogenic (neural tube defects), weight gain, tremor, pancreatitis, thrombocytopenia", "Pregnancy, liver disease, mitochondrial disorders"],
["Carbamazepine", "Oral", "200–1200 mg/day in divided doses", "Diplopia, ataxia, SIADH, Stevens-Johnson syndrome, aplastic anemia", "Bone marrow depression, AV block, MAO inhibitor use"],
["Lamotrigine", "Oral", "25–200 mg BD (slow titration required)", "Stevens-Johnson syndrome (if rapid titration), rash, dizziness", "Hypersensitivity; caution with valproate (dose reduction needed)"],
["Levetiracetam", "Oral / IV", "500–1500 mg BD", "Behavioral changes, somnolence, irritability", "Hypersensitivity"],
["Phenobarbital", "Oral / IV / IM", "60–180 mg/day oral\nIV: 20 mg/kg loading", "Sedation, tolerance/dependence, respiratory depression, cognitive impairment", "Severe respiratory disease, porphyria, alcohol dependence"],
["Diazepam (status epilepticus)", "IV / Rectal", "10 mg IV (0.15–0.2 mg/kg); rectal: 10 mg", "Sedation, respiratory depression, hypotension, dependence", "Respiratory depression, severe hepatic impairment"],
["Lorazepam (status epilepticus)", "IV", "4 mg IV over 2 min", "Same as diazepam", "Same as diazepam"],
["Ethosuximide", "Oral", "500–1500 mg/day", "GI upset, drowsiness, hiccups", "Use ONLY for absence seizures — not for tonic-clonic"],
["Topiramate", "Oral", "25–400 mg/day", "Kidney stones, cognitive slowing, weight loss, metabolic acidosis, paresthesia", "Metabolic acidosis, renal stones (relative)"],
]
},
{
system: "CNS",
num: 12,
title: "Parkinson's Disease",
headers: ["Drug", "Route", "Adult Dose", "Side Effects", "Contraindications"],
rows: [
["Levodopa + Carbidopa\n(Co-careldopa)", "Oral", "100/25 mg TDS → 250/25 mg QID", "Dyskinesia, on-off fluctuations, nausea, orthostatic hypotension, hallucinations", "MAO-A inhibitors, narrow-angle glaucoma"],
["Dopamine Agonists\nPramipexole, Ropinirole", "Oral", "Pramipexole: 0.125–4.5 mg TDS", "Impulse control disorders, somnolence, nausea, hallucinations, orthostatic hypotension", "Psychosis (caution)"],
["MAO-B Inhibitors\nSelegiline, Rasagiline", "Oral", "Selegiline: 5 mg BD (morning + midday)", "Insomnia (selegiline has amphetamine metabolite), nausea", "Pethidine/opioids, SSRIs/SNRIs (serotonin syndrome risk)"],
["COMT Inhibitors\nEntacapone, Tolcapone", "Oral", "Entacapone: 200 mg with each L-dopa dose", "Orange urine, diarrhea, dyskinesia; Tolcapone: hepatotoxicity", "Tolcapone: liver disease; concurrent MAOIs"],
["Amantadine", "Oral", "100 mg BD", "Livedo reticularis, ankle edema, confusion, hallucinations", "Renal failure, epilepsy, severe hepatic disease"],
["Trihexyphenidyl\n(Anticholinergic)", "Oral", "2–5 mg TDS", "Dry mouth, blurred vision, urinary retention, cognitive impairment", "Dementia, glaucoma, BPH, tachycardia"],
]
},
{
system: "CNS",
num: 13,
title: "Depression",
headers: ["Drug Class / Drug", "Route", "Adult Dose", "Side Effects", "Contraindications"],
rows: [
["SSRIs\nFluoxetine, Sertraline, Escitalopram", "Oral", "Fluoxetine: 20–80 mg OD\nSertraline: 50–200 mg OD", "GI upset, sexual dysfunction, insomnia, weight changes, SIADH, serotonin syndrome", "MAO inhibitors (14-day washout), uncontrolled epilepsy"],
["SNRIs\nVenlafaxine, Duloxetine", "Oral", "Venlafaxine: 75–225 mg/day\nDuloxetine: 30–120 mg/day", "Hypertension, nausea, dizziness, sweating, sexual dysfunction", "MAO inhibitors, uncontrolled hypertension (venlafaxine)"],
["TCAs\nAmitriptyline, Imipramine, Nortriptyline", "Oral", "Amitriptyline: 25–150 mg OD (at night)", "Anticholinergic effects, QT prolongation, arrhythmias, sedation, orthostatic hypotension, lethal in overdose", "MAO inhibitors, recent MI, arrhythmias, BPH, glaucoma"],
["MAOIs\nPhenelzine, Tranylcypromine", "Oral", "Phenelzine: 15–30 mg TDS", "Hypertensive crisis (cheese/tyramine reaction), serotonin syndrome, hepatotoxicity, orthostatic hypotension", "Tyramine-rich foods, SSRIs, sympathomimetics, pethidine, stroke"],
["Mirtazapine", "Oral", "15–45 mg OD (at night)", "Weight gain, sedation, increased appetite, rare agranulocytosis", "MAO inhibitors"],
["Bupropion", "Oral", "150–300 mg/day", "Seizures (dose-dependent), dry mouth, insomnia", "Epilepsy, eating disorders (bulimia/anorexia), MAO inhibitors"],
]
},
{
system: "CNS",
num: 14,
title: "Psychosis / Schizophrenia",
headers: ["Drug", "Route", "Adult Dose", "Side Effects", "Contraindications"],
rows: [
["Typical Antipsychotics\nHaloperidol, Chlorpromazine", "Oral / IM / IV", "Haloperidol: 2–20 mg/day\nChlorpromazine: 75–300 mg/day", "EPS (dystonia, akathisia, parkinsonism, tardive dyskinesia), NMS, QT prolongation, sedation, hyperprolactinemia", "Comatose states, Parkinson's disease"],
["Olanzapine (Atypical)", "Oral / IM", "5–20 mg/day", "Metabolic syndrome (weight gain, hyperglycemia, dyslipidemia), sedation, QT prolongation", "Active hepatic disease"],
["Risperidone (Atypical)", "Oral / IM depot", "2–8 mg/day", "EPS (high doses), hyperprolactinemia, metabolic effects", "Hypersensitivity, QT prolongation"],
["Clozapine (Atypical)", "Oral", "12.5–900 mg/day (slow titration)", "Agranulocytosis (mandatory neutrophil monitoring), seizures, myocarditis, hypersalivation, metabolic syndrome", "Bone marrow suppression, uncontrolled epilepsy, severe cardiac disease"],
["Quetiapine (Atypical)", "Oral", "50–750 mg/day", "Sedation, orthostatic hypotension, metabolic effects, cataracts", "Long-term: regular cataract monitoring required"],
]
},
{
system: "CNS",
num: 15,
title: "Anxiety / Sleep Disorders",
headers: ["Drug", "Route", "Adult Dose", "Side Effects", "Contraindications"],
rows: [
["Benzodiazepines\nDiazepam, Lorazepam, Alprazolam", "Oral / IV / IM", "Diazepam: 2–10 mg BD–TDS\nAlprazolam: 0.25–1 mg TDS", "Sedation, dependence, respiratory depression, cognitive impairment, withdrawal syndrome", "Respiratory failure, sleep apnea, myasthenia gravis, pregnancy (1st trimester)"],
["Buspirone", "Oral", "5–30 mg BD", "Dizziness, nausea; no sedation or dependence", "MAO inhibitors"],
["Z-drugs\nZolpidem, Zopiclone", "Oral", "Zolpidem: 5–10 mg at bedtime", "Amnesia, sleepwalking, complex behaviors, rebound insomnia", "Respiratory failure, sleep apnea, severe hepatic disease"],
["Suvorexant (Orexin antagonist)", "Oral", "10–20 mg at bedtime", "Somnolence, sleep paralysis", "Narcolepsy"],
]
},
{
system: "CNS",
num: 16,
title: "Dementia (Alzheimer's Disease)",
headers: ["Drug", "Route", "Adult Dose", "Side Effects", "Contraindications"],
rows: [
["AChE Inhibitors\nDonepezil, Rivastigmine, Galantamine", "Oral / Transdermal patch", "Donepezil: 5–10 mg OD\nRivastigmine patch: 4.6–13.3 mg/24hr", "Nausea, vomiting, diarrhea, bradycardia, vivid dreams", "Severe bradycardia, peptic ulcer (relative), asthma/COPD (relative)"],
["Memantine (NMDA antagonist)", "Oral", "5–20 mg/day (titrated)", "Dizziness, headache, constipation, confusion", "Severe renal impairment (dose reduction), epilepsy"],
]
},
{
system: "CNS",
num: 17,
title: "Opioid Analgesics",
headers: ["Drug", "Route", "Adult Dose", "Side Effects", "Contraindications"],
rows: [
["Morphine", "Oral / IV / SC / IM", "Oral: 5–30 mg Q4H\nIV: 2–10 mg Q4H", "Respiratory depression, constipation, nausea, sedation, miosis, physical dependence", "Respiratory depression, paralytic ileus, head injury (raised ICP), MAO inhibitors"],
["Codeine", "Oral", "30–60 mg Q4–6H", "Constipation, nausea, drowsiness", "Children <12 yrs (post-tonsillectomy), ultra-rapid CYP2D6 metabolizers"],
["Tramadol", "Oral / IV", "50–100 mg Q4–6H (max 400 mg/day)", "Seizures, serotonin syndrome, nausea, dizziness", "Epilepsy, MAO inhibitors, severe renal/hepatic disease"],
["Naloxone (antidote)", "IV / IM / SC / Intranasal", "0.4–2 mg IV, repeat Q2–3 min PRN", "Opioid withdrawal (agitation, tachycardia, hypertension)", "Hypersensitivity"],
]
},
// ══════════════════════════════════════════════════════════
// GIT
// ══════════════════════════════════════════════════════════
{
system: "GIT",
num: 18,
title: "Peptic Ulcer Disease / GERD / H. pylori",
headers: ["Drug Class / Drug", "Route", "Adult Dose", "Side Effects", "Contraindications"],
rows: [
["PPIs\nOmeprazole, Pantoprazole, Lansoprazole, Esomeprazole", "Oral / IV", "Omeprazole: 20–40 mg OD (before meal)\nIV pantoprazole: 40–80 mg OD", "Hypomagnesemia (long-term), C. diff risk, osteoporosis (long-term), B12 deficiency, headache", "Hypersensitivity; Omeprazole/Esomeprazole reduce clopidogrel effect"],
["H2 Receptor Antagonists\nFamotidine, Ranitidine, Cimetidine", "Oral / IV", "Famotidine: 20–40 mg BD\nCimetidine: 400 mg QID", "Headache, dizziness; Cimetidine: gynecomastia, impotence, CYP450 inhibitor (many interactions)", "Renal impairment (dose reduction); Cimetidine: multiple drug interactions"],
["Antacids\nMg hydroxide, Al hydroxide, CaCO3", "Oral", "10–20 mL or 1–2 tablets QID (1–3 hrs after meals + bedtime)", "Mg salts: diarrhea, hypermagnesemia\nAl salts: constipation, aluminum toxicity (renal failure)", "Renal failure (Mg-containing), hypercalcemia (calcium carbonate)"],
["Sucralfate", "Oral", "1 g QID (1 hr before meals + bedtime)", "Constipation, aluminum absorption", "Renal failure; interferes with drug absorption — space other drugs 2 hrs apart"],
["Bismuth subsalicylate", "Oral", "524 mg QID", "Black stool/tongue, salicylate toxicity", "Aspirin allergy, Reye syndrome risk (children), renal impairment"],
["Misoprostol (PGE1 analogue)", "Oral", "200 mcg QID with NSAIDs", "Diarrhea, cramping, uterine contractions", "PREGNANCY (causes abortion), IBD, hypersensitivity"],
["H. pylori Triple Therapy\nPPI + Clarithromycin 500 mg BD + Amoxicillin 1 g BD", "Oral", "7–14 days course", "See individual drugs above", "Penicillin allergy (substitute metronidazole 400 mg BD)"],
]
},
{
system: "GIT",
num: 19,
title: "Nausea and Vomiting",
headers: ["Drug", "Route", "Adult Dose", "Side Effects", "Contraindications"],
rows: [
["Metoclopramide\n(D2 / 5-HT4 antagonist)", "Oral / IV / IM", "10 mg TDS; IV: 10 mg over 2 min", "Tardive dyskinesia (long-term), EPS, hyperprolactinemia, drowsiness", "Epilepsy, Parkinson's, GI obstruction/perforation, pheochromocytoma"],
["Ondansetron\n(5-HT3 antagonist)", "Oral / IV / IM", "4–8 mg TDS; IV: 4–8 mg", "Constipation, headache, QT prolongation", "QT prolongation, apomorphine use"],
["Domperidone\n(D2 peripheral)", "Oral", "10 mg TDS (before meals)", "QT prolongation, hyperprolactinemia, galactorrhea", "Cardiac conduction disorders, hepatic impairment, QT prolongation"],
["Prochlorperazine\n(Phenothiazine)", "Oral / IM / PR", "5–10 mg TDS oral; IM: 12.5 mg", "EPS, sedation, tardive dyskinesia", "Parkinson's disease, bone marrow suppression, children <10 yrs"],
["Cyclizine\n(Antihistamine)", "Oral / IV / IM", "50 mg TDS", "Dry mouth, drowsiness, urinary retention", "Heart failure (IV form), porphyria"],
["Promethazine\n(H1 + muscarinic)", "Oral / IM / IV", "25 mg BD–TDS", "Sedation, anticholinergic effects, EPS (rare)", "Children <2 years (respiratory depression risk)"],
]
},
{
system: "GIT",
num: 20,
title: "Inflammatory Bowel Disease (IBD)",
headers: ["Drug", "Route", "Adult Dose", "Side Effects", "Contraindications"],
rows: [
["Mesalazine (5-ASA)", "Oral / Rectal\n(enema/suppository)", "Oral: 2.4–4.8 g/day\nRectal: 1–4 g/day", "Headache, nausea, diarrhea, nephrotoxicity (rare), pericarditis", "Severe renal impairment, salicylate hypersensitivity"],
["Sulfasalazine", "Oral", "2–4 g/day in divided doses", "GI upset, headache, oligospermia (reversible), hemolytic anemia, folate deficiency", "G6PD deficiency, sulfa allergy, renal failure"],
["Prednisolone (systemic)", "Oral / IV", "40–60 mg/day tapering", "Cushingoid features, hyperglycemia, osteoporosis, adrenal suppression, infection risk", "Active infection, uncontrolled DM (relative)"],
["Budesonide (topical steroid)", "Oral (ileal release) / Rectal", "9 mg OD (ileocolonic Crohn's)", "Less systemic effects than prednisolone; local candidiasis", "Active infection"],
["Azathioprine / 6-MP", "Oral", "Azathioprine: 2–2.5 mg/kg/day", "Bone marrow suppression, hepatotoxicity, pancreatitis, lymphoma risk; TPMT testing needed", "TPMT deficiency, active infection, pregnancy (relative)"],
["Methotrexate", "IM / SC / Oral", "25 mg IM/SC weekly (induction)", "Hepatotoxicity, bone marrow suppression, pneumonitis, teratogenic", "Pregnancy, renal failure, hepatic disease, immunodeficiency"],
["Anti-TNF agents\nInfliximab, Adalimumab", "IV / SC", "Infliximab: 5 mg/kg at 0, 2, 6 wks then Q8W", "Infection risk (TB reactivation — screen first), infusion reactions, demyelination, lymphoma, HF worsening", "Active infection/TB, moderate–severe HF, demyelinating disease"],
["Vedolizumab (anti-integrin)", "IV", "300 mg IV at 0, 2, 6 wks then Q8W", "Nasopharyngitis, headache, arthralgia, infusion reactions", "Active infection, hypersensitivity"],
]
},
{
system: "GIT",
num: 21,
title: "Constipation (Laxatives)",
headers: ["Drug Class / Drug", "Route", "Adult Dose", "Side Effects", "Contraindications"],
rows: [
["Bulk-forming\nIspaghula (Psyllium)", "Oral", "3.5 g OD–BD with adequate water", "Bloating, flatulence, obstruction (if insufficient fluid)", "Intestinal obstruction, dysphagia"],
["Stimulant\nSenna, Bisacodyl", "Oral / PR", "Senna: 2–4 tablets at bedtime\nBisacodyl PR: 10 mg", "Abdominal cramps, electrolyte disturbances, melanosis coli (long-term senna), dependence", "Intestinal obstruction, IBD (acute)"],
["Osmotic\nLactulose, Macrogol/PEG", "Oral", "Lactulose: 15–30 mL BD\nMacrogol: 1–2 sachets OD", "Bloating, flatulence, diarrhea (lactulose); nausea (macrogol)", "Intestinal obstruction, perforation; galactosemia (lactulose)"],
["Stool Softener\nDocusate sodium", "Oral", "100–200 mg BD", "Nausea, abdominal cramps", "Intestinal obstruction"],
["Glycerol suppository", "PR", "1 suppository PRN", "Local irritation", "Intestinal obstruction"],
]
},
{
system: "GIT",
num: 22,
title: "Diarrhea",
headers: ["Drug", "Route", "Adult Dose", "Side Effects", "Contraindications"],
rows: [
["Loperamide", "Oral", "4 mg initially, then 2 mg after each loose stool (max 16 mg/day)", "Constipation, abdominal cramps, toxic megacolon risk", "Bloody/infectious diarrhea with fever, inflammatory colitis, children <2 years"],
["ORS (Oral Rehydration Salts)", "Oral", "Per WHO formula (per labeling)", "Hypernatremia if overdosed in infants", "None — first-line for dehydration"],
["Codeine phosphate", "Oral", "30 mg TDS", "Constipation, dependence, drowsiness", "Dependency risk; see opioid contraindications"],
]
},
{
system: "GIT",
num: 23,
title: "Hepatic Encephalopathy",
headers: ["Drug", "Route", "Adult Dose", "Side Effects", "Contraindications"],
rows: [
["Lactulose", "Oral", "30–45 mL TDS (titrate to 2–3 soft stools/day)", "Flatulence, diarrhea, electrolyte disturbances", "Galactosemia, intestinal obstruction"],
["Rifaximin", "Oral", "550 mg BD", "Well tolerated; rare GI discomfort, C. difficile", "Intestinal obstruction, hypersensitivity"],
]
},
];
// ─── Key Interactions Table ───────────────────────────────────────────────────
const INTERACTIONS = [
["Warfarin + NSAIDs", "Increased bleeding risk — avoid or use gastroprotection"],
["ACEi + ARB + Spironolactone (triple combo)", "Dangerous hyperkalemia and renal failure — avoid triple blockade"],
["SSRIs + MAOIs", "Serotonin syndrome — potentially fatal; 14-day washout required"],
["Amiodarone + Warfarin", "Markedly elevated INR — reduce warfarin dose, monitor closely"],
["Clopidogrel + Omeprazole/Esomeprazole", "Reduced antiplatelet effect via CYP2C19 inhibition — use pantoprazole instead"],
["Theophylline + Fluoroquinolones (Ciprofloxacin)", "Theophylline toxicity (CYP1A2 inhibition raises levels)"],
["Methotrexate + NSAIDs", "Methotrexate toxicity — NSAIDs reduce renal clearance"],
["Statins + Fibrates", "Increased myopathy / rhabdomyolysis risk"],
["Benzodiazepines + Opioids + Alcohol", "Additive CNS / respiratory depression — potentially fatal combination"],
["Levodopa + Antipsychotics (D2 blockers)", "Reduced levodopa efficacy; worsened Parkinsonism"],
["Beta-blockers + Verapamil/Diltiazem", "Severe bradycardia, heart block, cardiac arrest"],
["Rifampicin + OCP/Warfarin/many drugs", "CYP450 inducer — reduces plasma levels of many drugs (OCP failure, subtherapeutic anticoagulation)"],
["TCAs + MAOIs", "Hypertensive crisis, hyperpyrexia, convulsions — absolutely contraindicated"],
["Lithium + NSAIDs/Thiazides", "Lithium toxicity — NSAIDs and thiazides increase lithium levels"],
];
// ─── Build document ───────────────────────────────────────────────────────────
function buildDocument() {
const children = [];
// ─ Cover page ─
children.push(
spacer(200),
makePara([new TextRun({ text: "PHARMACOLOGY REFERENCE GUIDE", bold: true, size: 52, color: "1A3A5C", font: "Calibri" })], AlignmentType.CENTER, { before: 0, after: 60 }),
makePara([new TextRun({ text: "CVS | Respiratory | CNS | Gastrointestinal", size: 32, color: "444444", font: "Calibri" })], AlignmentType.CENTER, { before: 0, after: 60 }),
makePara([new TextRun({ text: "Diseases • Drugs • Routes • Doses • Side Effects • Contraindications", size: 24, italics: true, color: "666666", font: "Calibri" })], AlignmentType.CENTER, { before: 0, after: 200 }),
new Paragraph({ children: [new TextRun({ text: "" })], pageBreakBefore: true }),
);
// ─ Disclaimer ─
children.push(
noteBox("IMPORTANT: All doses listed are standard adult doses for reference only. Actual dosing must be individualized based on patient weight, renal/hepatic function, age, comorbidities, and clinical response. Always consult current prescribing guidelines or a clinical pharmacologist. Pediatric doses differ significantly. Sources: Katzung's Basic and Clinical Pharmacology 16e, Textbook of Family Medicine 9e, Sleisenger & Fordtran's GI & Liver Disease, Adams & Victor's Principles of Neurology 12e."),
spacer(120),
);
let currentSystem = null;
for (const section of DRUG_DATA) {
// Print system banner when system changes
if (section.system !== currentSystem) {
if (currentSystem !== null) children.push(spacer(100));
children.push(systemBanner(section.system));
currentSystem = section.system;
}
children.push(
spacer(80),
diseaseHeading(section.num, section.title, section.system),
spacer(40),
drugTable(section.headers, section.rows, section.system),
);
}
// ─ Key Drug Interactions ─
children.push(spacer(100));
children.push(systemBanner("INT"));
children.push(spacer(60));
children.push(
new Table({
width: { size: 100, type: WidthType.PERCENTAGE },
rows: [
new TableRow({
tableHeader: true,
children: [
new TableCell({ children: [makePara([bold("Drug Combination", 17, COLOURS.white)], AlignmentType.CENTER, { before: 60, after: 60 })], shading: shading("922B21"), borders: cellBorders("922B21"), width: { size: 40, type: WidthType.PERCENTAGE } }),
new TableCell({ children: [makePara([bold("Risk / Management", 17, COLOURS.white)], AlignmentType.CENTER, { before: 60, after: 60 })], shading: shading("922B21"), borders: cellBorders("922B21"), width: { size: 60, type: WidthType.PERCENTAGE } }),
]
}),
...INTERACTIONS.map((row, ri) =>
new TableRow({
children: [
new TableCell({ children: [makePara([bold(row[0], 16, "222222")], AlignmentType.LEFT, { before: 40, after: 40 })], shading: ri % 2 === 0 ? shading("FFFFFF") : shading("FDEDEC"), borders: cellBorders("E59866"), width: { size: 40, type: WidthType.PERCENTAGE } }),
new TableCell({ children: [makePara([normal(row[1], 16)], AlignmentType.LEFT, { before: 40, after: 40 })], shading: ri % 2 === 0 ? shading("FFFFFF") : shading("FDEDEC"), borders: cellBorders("E59866"), width: { size: 60, type: WidthType.PERCENTAGE } }),
]
})
)
]
})
);
children.push(spacer(160));
children.push(makePara([new TextRun({ text: "End of Pharmacology Reference Guide", italics: true, size: 18, color: "888888", font: "Calibri" })], AlignmentType.CENTER));
return new Document({
styles: {
default: {
document: {
run: { font: "Calibri", size: 18 }
}
}
},
sections: [
{
properties: {
page: {
size: { orientation: PageOrientation.LANDSCAPE, width: 16838, height: 11906 },
margin: { top: 720, bottom: 720, left: 720, right: 720 },
}
},
headers: {
default: new Header({
children: [
makePara([
new TextRun({ text: "Pharmacology Reference Guide | CVS | Respiratory | CNS | GIT", size: 16, color: "777777", font: "Calibri" }),
], AlignmentType.RIGHT)
]
})
},
footers: {
default: new Footer({
children: [
new Paragraph({
children: [
new TextRun({ text: "Page ", size: 16, color: "777777", font: "Calibri" }),
new TextRun({ children: [PageNumber.CURRENT], size: 16, color: "777777", font: "Calibri" }),
new TextRun({ text: " of ", size: 16, color: "777777", font: "Calibri" }),
new TextRun({ children: [PageNumber.TOTAL_PAGES], size: 16, color: "777777", font: "Calibri" }),
new TextRun({ text: " | For educational use only. Verify all clinical doses before use.", italics: true, size: 15, color: "AAAAAA", font: "Calibri" }),
],
alignment: AlignmentType.CENTER,
})
]
})
},
children,
}
]
});
}
const doc = buildDocument();
Packer.toBuffer(doc).then(buffer => {
fs.writeFileSync("/home/daytona/workspace/pharma-reference/Pharmacology_Reference_Guide.docx", buffer);
console.log("Done: Pharmacology_Reference_Guide.docx");
});