~/atin-pptx/build_pptx.js
const pptxgen = require("pptxgenjs");
const { execSync } = require("child_process");
// Fetch images as base64
const imgData = JSON.parse(
execSync(
`node /home/daytona/skills/shared/scripts/fetch_images.js "https://cdn.orris.care/cdss_images/Pathology_1760048467296_b4f6b1fe-e530-40be-b660-092dc3a87edf.jpg" "https://cdn.orris.care/cdss_images/d25b69bb712059d660176f3c20337aad47f54cb1d93fd33657d349a7b6413efb.png"`
).toString()
);
const biopsyImg = imgData[0].base64;
const etiologyImg = imgData[1].base64;
// βββ COLOR PALETTE ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
const DARK_NAVY = "0D1B2A"; // dominant background
const TEAL = "00A896"; // accent / headings
const LIGHT_SLATE = "E8EEF4"; // body text on dark
const WHITE = "FFFFFF";
const MID_GREY = "90A4AE"; // sub-labels
const AMBER = "F59E0B"; // highlight / callout
const RED_ALERT = "E53935"; // abnormal values
const CARD_BG = "132338"; // card / box fill
// βββ PPTX SETUP ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
let pres = new pptxgen();
pres.layout = "LAYOUT_WIDE"; // 13.3 Γ 7.5 inches
pres.author = "Medical Education";
pres.title = "Acute Tubulointerstitial Nephritis β Clinical Case";
pres.subject = "Nephrology Case Study";
// βββ HELPERS βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
function setBackground(slide, color) {
slide.background = { color: color || DARK_NAVY };
}
function addTitle(slide, text, y, color) {
slide.addText(text, {
x: 0.4, y: y || 0.18, w: 12.5, h: 0.55,
fontSize: 26, bold: true, color: color || TEAL,
fontFace: "Calibri", align: "left", margin: 0,
});
}
function addLine(slide, y) {
slide.addShape(pres.shapes.RECTANGLE, {
x: 0.4, y: y || 0.78, w: 12.5, h: 0.03,
fill: { color: TEAL }, line: { color: TEAL, width: 0 },
});
}
function card(slide, x, y, w, h, opts) {
slide.addShape(pres.shapes.RECTANGLE, {
x, y, w, h,
fill: { color: CARD_BG },
shadow: { type: "outer", color: "000000", blur: 8, offset: 3, angle: 135, opacity: 0.25 },
...opts,
});
}
function labelValue(slide, label, value, x, y, color) {
slide.addText([
{ text: label + " ", options: { color: MID_GREY, fontSize: 11, bold: false } },
{ text: value, options: { color: color || LIGHT_SLATE, fontSize: 12, bold: true } },
], { x, y, w: 4.0, h: 0.30, fontFace: "Calibri", margin: 0 });
}
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
// SLIDE 1 β TITLE
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
{
let s = pres.addSlide();
setBackground(s);
// accent bar left
s.addShape(pres.shapes.RECTANGLE, {
x: 0, y: 0, w: 0.22, h: 7.5,
fill: { color: TEAL }, line: { color: TEAL, width: 0 },
});
s.addText("CLINICAL CASE", {
x: 0.5, y: 1.6, w: 12.0, h: 0.55,
fontSize: 16, color: TEAL, bold: true, charSpacing: 6, fontFace: "Calibri",
});
s.addText("Acute Tubulointerstitial\nNephritis", {
x: 0.5, y: 2.2, w: 12.0, h: 1.8,
fontSize: 46, bold: true, color: WHITE, fontFace: "Calibri",
});
s.addText("Drug-Induced (Omeprazole / PPI) | Nephrology Case Study", {
x: 0.5, y: 4.15, w: 12.0, h: 0.45,
fontSize: 14, color: MID_GREY, fontFace: "Calibri",
});
s.addShape(pres.shapes.RECTANGLE, {
x: 0.5, y: 4.7, w: 2.8, h: 0.06,
fill: { color: AMBER }, line: { color: AMBER, width: 0 },
});
s.addText("Sources: Harrison's 22e Β· Brenner & Rector's The Kidney Β· Robbins Basic Pathology", {
x: 0.5, y: 6.8, w: 12.0, h: 0.35,
fontSize: 10, color: MID_GREY, fontFace: "Calibri",
});
}
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
// SLIDE 2 β PATIENT PRESENTATION
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
{
let s = pres.addSlide();
setBackground(s);
addTitle(s, "Patient Presentation");
addLine(s);
// Left card β demographics
card(s, 0.35, 0.95, 5.8, 2.6);
s.addText("Demographics & Chief Complaint", {
x: 0.55, y: 1.0, w: 5.4, h: 0.35,
fontSize: 13, bold: true, color: TEAL, fontFace: "Calibri",
});
const demoBullets = [
"67-year-old male, retired mechanic",
"Chief Complaint: Fatigue, decreased urine output,\n bilateral flank discomfort for 10 days",
"Setting: Emergency Department referral",
];
demoBullets.forEach((b, i) => {
s.addText("βΈ " + b, {
x: 0.6, y: 1.45 + i * 0.55, w: 5.3, h: 0.50,
fontSize: 11.5, color: LIGHT_SLATE, fontFace: "Calibri",
});
});
// Right card β medications / offender
card(s, 6.5, 0.95, 6.4, 2.6);
s.addText("Medications β Offending Drug", {
x: 6.7, y: 1.0, w: 6.0, h: 0.35,
fontSize: 13, bold: true, color: TEAL, fontFace: "Calibri",
});
const meds = [
{ label: "β Omeprazole 40 mg PO BID", val: "Started 4 WEEKS ago β offending agent", col: AMBER },
{ label: " Losartan 50 mg/day", val: "Hypertension (3 yrs)", col: LIGHT_SLATE },
{ label: " Rosuvastatin 10 mg/night", val: "Dyslipidemia", col: LIGHT_SLATE },
];
meds.forEach((m, i) => {
s.addText(m.label, {
x: 6.7, y: 1.45 + i * 0.58, w: 4.0, h: 0.28,
fontSize: 11, bold: (i === 0), color: m.col, fontFace: "Calibri",
});
s.addText(m.val, {
x: 6.7, y: 1.73 + i * 0.58, w: 5.9, h: 0.24,
fontSize: 10, color: MID_GREY, fontFace: "Calibri",
});
});
// Bottom card β HPI
card(s, 0.35, 3.72, 12.6, 2.85);
s.addText("History of Present Illness", {
x: 0.55, y: 3.78, w: 12.0, h: 0.35,
fontSize: 13, bold: true, color: TEAL, fontFace: "Calibri",
});
const hpi = [
"H. pylori diagnosed 4 weeks ago β triple therapy (omeprazole + amoxicillin + clarithromycin).",
"Antibiotics completed 2 weeks ago; omeprazole continued.",
"~12 days ago: fatigue, bilateral flank aching, reduced urine output, nocturia (3-4Γ/night).",
"Low-grade fever (~37.9 Β°C at home) + pruritic maculopapular rash on trunk & arms.",
"Denies dysuria, gross hematuria, recent NSAID/contrast use, prior kidney disease.",
];
hpi.forEach((h, i) => {
s.addText("β’ " + h, {
x: 0.6, y: 4.22 + i * 0.45, w: 12.0, h: 0.40,
fontSize: 11, color: LIGHT_SLATE, fontFace: "Calibri",
});
});
}
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
// SLIDE 3 β PHYSICAL EXAMINATION
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
{
let s = pres.addSlide();
setBackground(s);
addTitle(s, "Physical Examination");
addLine(s);
// Vitals row
const vitals = [
{ label: "Temperature", val: "38.3 Β°C", color: RED_ALERT },
{ label: "Blood Pressure",val: "148/90 mmHg", color: AMBER },
{ label: "Heart Rate", val: "94 bpm", color: LIGHT_SLATE },
{ label: "SpOβ", val: "97% RA", color: LIGHT_SLATE },
{ label: "Weight", val: "81 kg", color: LIGHT_SLATE },
];
vitals.forEach((v, i) => {
card(s, 0.35 + i * 2.52, 0.92, 2.35, 1.0);
s.addText(v.label, {
x: 0.5 + i * 2.52, y: 1.0, w: 2.1, h: 0.30,
fontSize: 10, color: MID_GREY, fontFace: "Calibri", align: "center",
});
s.addText(v.val, {
x: 0.5 + i * 2.52, y: 1.3, w: 2.1, h: 0.45,
fontSize: 17, bold: true, color: v.color, fontFace: "Calibri", align: "center",
});
});
// Findings
const findings = [
{ head: "General", body: "Mildly ill-appearing, alert & oriented Γ3" },
{ head: "Skin", body: "Diffuse maculopapular erythematous rash β trunk & upper arms; pruritic, non-vesicular" },
{ head: "Abdomen", body: "Soft; bilateral CVA tenderness on deep palpation; no peritoneal signs" },
{ head: "Eyes", body: "Clear; no photophobia, no conjunctival injection" },
{ head: "Cardio / Resp", body: "Normal heart sounds; clear lung fields; no JVP elevation; no peripheral edema" },
];
findings.forEach((f, i) => {
card(s, 0.35, 2.1 + i * 0.99, 12.6, 0.88);
s.addText(f.head + " | ", {
x: 0.55, y: 2.2 + i * 0.99, w: 1.8, h: 0.6,
fontSize: 11.5, bold: true, color: TEAL, fontFace: "Calibri", valign: "middle",
});
s.addText(f.body, {
x: 2.2, y: 2.2 + i * 0.99, w: 10.5, h: 0.6,
fontSize: 11.5, color: LIGHT_SLATE, fontFace: "Calibri", valign: "middle",
});
});
}
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
// SLIDE 4 β LABORATORY RESULTS (CBC + METABOLIC)
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
{
let s = pres.addSlide();
setBackground(s);
addTitle(s, "Laboratory Results");
addLine(s);
// CBC card
card(s, 0.35, 0.92, 6.0, 2.95);
s.addText("Complete Blood Count", {
x: 0.55, y: 0.98, w: 5.6, h: 0.32,
fontSize: 13, bold: true, color: TEAL, fontFace: "Calibri",
});
const cbc = [
{ t: "WBC", v: "10.2 Γ 10Β³/Β΅L", ref: "4.5β11.0", col: LIGHT_SLATE },
{ t: "Eosinophils", v: "14% β 1.43Γ10Β³/Β΅L β", ref: "< 0.5 Γ 10Β³/Β΅L", col: RED_ALERT },
{ t: "Hemoglobin", v: "11.8 g/dL β", ref: "13.5β17.5", col: AMBER },
{ t: "Platelets", v: "214 Γ 10Β³/Β΅L", ref: "150β400", col: LIGHT_SLATE },
];
cbc.forEach((r, i) => {
s.addText(r.t, {
x: 0.55, y: 1.36 + i * 0.58, w: 2.2, h: 0.28, fontSize: 11, color: MID_GREY, fontFace: "Calibri",
});
s.addText(r.v, {
x: 2.8, y: 1.36 + i * 0.58, w: 2.3, h: 0.28, fontSize: 11, bold: true, color: r.col, fontFace: "Calibri",
});
s.addText("Ref: " + r.ref, {
x: 0.55, y: 1.62 + i * 0.58, w: 4.8, h: 0.22, fontSize: 9, color: MID_GREY, fontFace: "Calibri",
});
});
// Metabolic card
card(s, 6.65, 0.92, 6.3, 4.65);
s.addText("Comprehensive Metabolic Panel", {
x: 6.85, y: 0.98, w: 5.9, h: 0.32,
fontSize: 13, bold: true, color: TEAL, fontFace: "Calibri",
});
const cmp = [
{ t: "Serum Creatinine", v: "4.2 mg/dL ββ", ref: "0.7β1.3", col: RED_ALERT },
{ t: "BUN", v: "52 mg/dL ββ", ref: "7β20", col: RED_ALERT },
{ t: "eGFR (CKD-EPI)", v: "14 mL/min ββ", ref: "> 60", col: RED_ALERT },
{ t: "Potassium", v: "5.6 mEq/L β", ref: "3.5β5.0", col: AMBER },
{ t: "Bicarbonate", v: "14 mEq/L β", ref: "22β29", col: AMBER },
{ t: "Chloride", v: "110 mEq/L β", ref: "98β107", col: AMBER },
{ t: "Anion Gap", v: "12 mEq/L (normal)", ref: "8β12", col: LIGHT_SLATE },
];
cmp.forEach((r, i) => {
s.addText(r.t, {
x: 6.85, y: 1.36 + i * 0.5, w: 2.6, h: 0.28, fontSize: 11, color: MID_GREY, fontFace: "Calibri",
});
s.addText(r.v, {
x: 9.5, y: 1.36 + i * 0.5, w: 3.3, h: 0.28, fontSize: 11, bold: true, color: r.col, fontFace: "Calibri",
});
});
// Acid-base callout
card(s, 0.35, 4.02, 6.0, 1.48);
s.addText("Acid-Base Interpretation", {
x: 0.55, y: 4.08, w: 5.6, h: 0.30,
fontSize: 12, bold: true, color: AMBER, fontFace: "Calibri",
});
s.addText(
"Hyperchloremic NORMAL ANION GAP metabolic acidosis\n" +
"AG = 136 β 110 β 14 = 12 mEq/L β Non-AG pattern\n" +
"Reflects TUBULAR DYSFUNCTION: impaired HβΊ / NHββΊ secretion",
{
x: 0.55, y: 4.42, w: 5.7, h: 1.0,
fontSize: 10.5, color: LIGHT_SLATE, fontFace: "Calibri",
}
);
// Source
s.addText("Source: Harrison's Principles of Internal Medicine, 22e", {
x: 0.35, y: 7.1, w: 12.6, h: 0.25,
fontSize: 9, color: MID_GREY, fontFace: "Calibri", align: "right",
});
}
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
// SLIDE 5 β URINALYSIS & TUBULAR FUNCTION
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
{
let s = pres.addSlide();
setBackground(s);
addTitle(s, "Urinalysis & Tubular Function Studies");
addLine(s);
// Urinalysis card
card(s, 0.35, 0.92, 6.0, 4.0);
s.addText("Urinalysis (+ Urine Microscopy)", {
x: 0.55, y: 0.98, w: 5.6, h: 0.32,
fontSize: 13, bold: true, color: TEAL, fontFace: "Calibri",
});
const ua = [
{ t: "Specific Gravity", v: "1.007 β", col: AMBER },
{ t: "Protein", v: "2+", col: AMBER },
{ t: "Leukocyte Esterase", v: "3+", col: RED_ALERT },
{ t: "Nitrites", v: "Negative β", col: LIGHT_SLATE },
{ t: "WBC Casts", v: "Present β", col: RED_ALERT },
{ t: "Eosinophiluria (Hansel)", v: "Present β", col: RED_ALERT },
{ t: "Bacteria", v: "Absent", col: LIGHT_SLATE },
{ t: "Urine Culture", v: "No growth", col: LIGHT_SLATE },
];
ua.forEach((r, i) => {
s.addText(r.t + ":", {
x: 0.55, y: 1.38 + i * 0.44, w: 3.1, h: 0.28, fontSize: 11, color: MID_GREY, fontFace: "Calibri",
});
s.addText(r.v, {
x: 3.7, y: 1.38 + i * 0.44, w: 2.4, h: 0.28, fontSize: 11, bold: true, color: r.col, fontFace: "Calibri",
});
});
// Tubular function card
card(s, 6.65, 0.92, 6.3, 4.0);
s.addText("Tubular Function Tests", {
x: 6.85, y: 0.98, w: 5.9, h: 0.32,
fontSize: 13, bold: true, color: TEAL, fontFace: "Calibri",
});
const tub = [
{ t: "FeNa", v: "2.8% β intrinsic renal", col: RED_ALERT },
{ t: "Urine Ξ²β-microglobulin", v: "ELEVATED β proximal dysfunction", col: RED_ALERT },
{ t: "Urine Anion Gap", v: "+ (positive) β β NHββΊ excretion", col: AMBER },
{ t: "Serum IgE", v: "3Γ ULN β (Type I hypersens.)", col: AMBER },
{ t: "ANCA / ANA / Anti-GBM", v: "All NEGATIVE β", col: LIGHT_SLATE },
{ t: "Blood Cultures Γ2", v: "Negative β", col: LIGHT_SLATE },
{ t: "Complement (C3/C4)", v: "Normal β", col: LIGHT_SLATE },
];
tub.forEach((r, i) => {
s.addText(r.t + ":", {
x: 6.85, y: 1.38 + i * 0.44, w: 3.5, h: 0.28, fontSize: 11, color: MID_GREY, fontFace: "Calibri",
});
s.addText(r.v, {
x: 10.4, y: 1.38 + i * 0.44, w: 2.4, h: 0.28, fontSize: 10.5, bold: true, color: r.col, fontFace: "Calibri",
});
});
// Giemsa note
card(s, 0.35, 5.1, 12.6, 1.4);
s.addText(
"Giemsa-stained cytocentrifuged urine preparation β the gold standard for demonstrating the most characteristic cell types in ATIN: " +
"activated T lymphocytes, eosinophils, and plasma cells, along with white blood cell casts.\n" +
"β Harrison's Principles of Internal Medicine, 22e, Chapter 319",
{
x: 0.55, y: 5.2, w: 12.3, h: 1.2,
fontSize: 10.5, color: LIGHT_SLATE, fontFace: "Calibri", italic: true,
}
);
}
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
// SLIDE 6 β IMAGING
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
{
let s = pres.addSlide();
setBackground(s);
addTitle(s, "Imaging β Renal Ultrasound");
addLine(s);
card(s, 0.35, 0.92, 12.6, 5.55);
const findings = [
{ icon: "β", head: "Kidney Sizes", body: "Right 11.4 cm | Left 11.1 cm β Mildly ENLARGED (renal volume may increase β€100% in ATIN)" },
{ icon: "β", head: "Cortical Echo", body: "INCREASED bilateral cortical echogenicity β consistent with interstitial edema & inflammation" },
{ icon: "β", head: "No Obstruction", body: "No hydronephrosis, no nephrolithiasis, no renal masses identified" },
{ icon: "β", head: "Vasculature", body: "Normal Doppler waveforms; resistive index mildly elevated (0.74)" },
{ icon: "β", head: "Specificity", body: "Findings NOT specific for ATIN β also seen in ATN, glomerulonephritis, infiltrative disease" },
{ icon: "β", head: "Role", body: "Primary utility: EXCLUDE obstruction / structural causes of AKI" },
];
findings.forEach((f, i) => {
const y = 1.08 + i * 0.79;
s.addText(f.icon, {
x: 0.55, y: y, w: 0.35, h: 0.36,
fontSize: 14, bold: true,
color: (f.icon === "β") ? TEAL : AMBER,
fontFace: "Calibri",
});
s.addText(f.head + " | " + f.body, {
x: 0.95, y: y, w: 11.8, h: 0.55,
fontSize: 11.5, color: LIGHT_SLATE, fontFace: "Calibri",
});
if (i < findings.length - 1) {
s.addShape(pres.shapes.RECTANGLE, {
x: 0.55, y: y + 0.64, w: 12.2, h: 0.01,
fill: { color: "1E3552" }, line: { color: "1E3552", width: 0 },
});
}
});
// Source
s.addText("Source: Brenner and Rector's The Kidney, Chapter 35", {
x: 0.35, y: 7.1, w: 12.6, h: 0.25,
fontSize: 9, color: MID_GREY, fontFace: "Calibri", align: "right",
});
}
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
// SLIDE 7 β RENAL BIOPSY (with biopsy image)
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
{
let s = pres.addSlide();
setBackground(s);
addTitle(s, "Renal Biopsy β Light Microscopy (H&E)");
addLine(s);
// Biopsy image
s.addImage({ data: biopsyImg, x: 0.35, y: 0.92, w: 5.8, h: 4.35, altText: "Renal biopsy H&E showing acute TIN" });
s.addText(
"H&E: interstitial edema, mononuclear infiltrate (lymphocytes, plasma cells, macrophages),\nscattered eosinophils, tubulitis. Glomeruli preserved. IF: negative.",
{ x: 0.35, y: 5.32, w: 5.8, h: 0.6, fontSize: 9.5, color: MID_GREY, fontFace: "Calibri", align: "center" }
);
// Findings card
card(s, 6.45, 0.92, 6.5, 4.35);
s.addText("Histological Findings", {
x: 6.65, y: 0.98, w: 6.1, h: 0.32,
fontSize: 13, bold: true, color: TEAL, fontFace: "Calibri",
});
const histo = [
{ c: "Interstitium", v: "Diffuse edema; dense mononuclear infiltrate (lymphocytes, macrophages, plasma cells)" },
{ c: "Eosinophils", v: "Scattered within interstitium β" },
{ c: "Tubulitis", v: "Lymphocytes infiltrating & disrupting tubular epithelium β" },
{ c: "Glomeruli", v: "NORMAL β no crescents, no necrosis, no immune complex" },
{ c: "Immunofluorescence", v: "NEGATIVE for IgG, IgA, IgM, C3, C1q β no immune deposits" },
{ c: "Electron Microscopy", v: "No dense deposits; no foot process effacement" },
];
histo.forEach((r, i) => {
s.addText(r.c + ":", {
x: 6.65, y: 1.40 + i * 0.52, w: 2.5, h: 0.28,
fontSize: 11, bold: true, color: TEAL, fontFace: "Calibri",
});
s.addText(r.v, {
x: 6.65, y: 1.66 + i * 0.52, w: 6.1, h: 0.30,
fontSize: 10.5, color: LIGHT_SLATE, fontFace: "Calibri",
});
});
// Indication callout
card(s, 6.45, 5.45, 6.5, 1.08);
s.addText(
"Indication: Unexplained AKI (eGFR 14) + no spontaneous improvement at 5 days after drug withdrawal.\n" +
"Biopsy confirms diagnosis and guides decision to initiate corticosteroids.",
{
x: 6.65, y: 5.52, w: 6.2, h: 0.95,
fontSize: 10.5, color: LIGHT_SLATE, fontFace: "Calibri",
}
);
}
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
// SLIDE 8 β ETIOLOGY DIAGRAM + DIAGNOSIS
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
{
let s = pres.addSlide();
setBackground(s);
addTitle(s, "Etiology Classification & Final Diagnosis");
addLine(s);
// Etiology image (right side)
s.addImage({ data: etiologyImg, x: 7.25, y: 0.92, w: 5.7, h: 5.5, altText: "ATIN etiology diagram" });
s.addText("Figure 319-2 β Harrison's Internal Medicine, 22e", {
x: 7.25, y: 6.47, w: 5.7, h: 0.25,
fontSize: 9, color: MID_GREY, fontFace: "Calibri", align: "center",
});
// Diagnosis card
card(s, 0.35, 0.92, 6.6, 2.1);
s.addText("β Final Diagnosis", {
x: 0.55, y: 0.98, w: 6.2, h: 0.35,
fontSize: 13, bold: true, color: TEAL, fontFace: "Calibri",
});
s.addText("Acute Allergic Tubulointerstitial Nephritis (ATIN)", {
x: 0.55, y: 1.36, w: 6.2, h: 0.42,
fontSize: 15, bold: true, color: WHITE, fontFace: "Calibri",
});
s.addText("Drug-Induced β Omeprazole (Proton Pump Inhibitor)", {
x: 0.55, y: 1.78, w: 6.2, h: 0.35,
fontSize: 12, color: AMBER, fontFace: "Calibri",
});
s.addText("Category: Allergic hypersensitivity (Type I + IV)", {
x: 0.55, y: 2.13, w: 6.2, h: 0.30,
fontSize: 10.5, color: MID_GREY, fontFace: "Calibri",
});
// Triad callout
card(s, 0.35, 3.22, 6.6, 1.42);
s.addText("β The Classic Triad β Often Absent!", {
x: 0.55, y: 3.28, w: 6.2, h: 0.32,
fontSize: 12, bold: true, color: AMBER, fontFace: "Calibri",
});
s.addText(
"Fever + Rash + Eosinophilia is present in only ~5β10% of\n" +
"unselected ATIN cases. Do NOT rely on it for diagnosis.\n" +
"β Brenner and Rector's The Kidney, Chapter 35",
{
x: 0.55, y: 3.62, w: 6.2, h: 0.94,
fontSize: 10.5, color: LIGHT_SLATE, fontFace: "Calibri",
}
);
// PPIs callout
card(s, 0.35, 4.83, 6.6, 1.35);
s.addText("PPIs & Drug-Induced ATIN", {
x: 0.55, y: 4.89, w: 6.2, h: 0.32,
fontSize: 12, bold: true, color: TEAL, fontFace: "Calibri",
});
s.addText(
"PPIs are now among the MOST COMMON causes of drug-induced ATIN,\n" +
"alongside NSAIDs, synthetic penicillins, fluoroquinolones, and cephalosporins.\n" +
"β Harrison's Principles of Internal Medicine, 22e",
{
x: 0.55, y: 5.23, w: 6.2, h: 0.88,
fontSize: 10.5, color: LIGHT_SLATE, fontFace: "Calibri",
}
);
}
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
// SLIDE 9 β DIFFERENTIAL DIAGNOSIS
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
{
let s = pres.addSlide();
setBackground(s);
addTitle(s, "Differential Diagnosis");
addLine(s);
const rows = [
["DIAGNOSIS", "EVIDENCE FOR", "EVIDENCE AGAINST", "VERDICT"],
["Drug-Induced ATIN (PPI) β", "Temporal drug exposure, fever, rash, eosinophilia,\nWBC casts, eosinophiluria, biopsy findings, βIgE", "β", "PRIMARY Dx"],
["Acute Pyelonephritis", "Fever, pyuria, CVA tenderness", "Negative urine/blood cultures, no bacteria\non biopsy, non-purulent infiltrate", "Excluded"],
["Acute Tubular Necrosis", "AKI, FeNa > 1%", "No hemodynamic insult, no granular casts,\neosinophiluria & rash present, biopsy β ATN", "Excluded"],
["ANCA-Associated Nephritis", "AKI, hematuria", "ANCA negative, no crescents on biopsy", "Excluded"],
["Lupus Nephritis", "AKI, hematuria", "ANA/anti-dsDNA negative, IF negative,\ncomplement normal", "Excluded"],
["Prerenal AKI", "Oliguria", "FeNa 2.8%, no volume depletion, BUN/Cr 12.4", "Excluded"],
];
const colW = [2.55, 3.8, 4.1, 1.95];
const colX = [0.35, 2.92, 6.74, 10.86];
const rowH = [0.42, 0.72, 0.72, 0.72, 0.62, 0.72, 0.52];
const rowY = [0.92];
rowH.slice(0, 6).forEach((h, i) => rowY.push(rowY[i] + rowH[i]));
rows.forEach((row, ri) => {
row.forEach((cell, ci) => {
const isHeader = (ri === 0);
const isPrimary = (ri === 1);
const bg = isHeader ? TEAL : (isPrimary ? "132338" : CARD_BG);
const textColor = isHeader ? WHITE : (ci === 3 ? (isPrimary ? AMBER : RED_ALERT) : LIGHT_SLATE);
s.addShape(pres.shapes.RECTANGLE, {
x: colX[ci], y: rowY[ri], w: colW[ci], h: rowH[ri],
fill: { color: bg },
line: { color: DARK_NAVY, width: 1 },
});
s.addText(cell, {
x: colX[ci] + 0.1, y: rowY[ri] + 0.04, w: colW[ci] - 0.2, h: rowH[ri] - 0.08,
fontSize: isHeader ? 10.5 : 10,
bold: isHeader || isPrimary,
color: textColor,
fontFace: "Calibri",
valign: "middle",
});
});
});
}
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
// SLIDE 10 β PATHOPHYSIOLOGY
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
{
let s = pres.addSlide();
setBackground(s);
addTitle(s, "Pathophysiology of Drug-Induced ATIN");
addLine(s);
// Steps
const steps = [
{ num: "1", title: "Tubular Secretion", body: "Drug (omeprazole) secreted into tubular lumen by proximal tubular cells" },
{ num: "2", title: "Neoantigen Formation", body: "Drug covalently binds to tubular cell components β creates IMMUNOGENIC NEOANTIGENS" },
{ num: "3", title: "Type I (IgE-Mediated)", body: "IgE-mediated response β eosinophilia, βserum IgE, mast cell activation β rash, fever" },
{ num: "4", title: "Type IV (T-CellβMediated)", body: "T lymphocytes target neoantigens β mononuclear interstitial infiltrate, tubulitis, tubular injury" },
{ num: "5", title: "Tubular Dysfunction", body: "Impaired HβΊ/NHββΊ secretion β non-AG metabolic acidosis; impaired concentration β low SpGr; Ξ²β-microglobulinuria" },
];
steps.forEach((st, i) => {
card(s, 0.35, 0.95 + i * 1.17, 12.6, 1.05);
// Number badge
s.addShape(pres.shapes.ELLIPSE, {
x: 0.55, y: 1.07 + i * 1.17, w: 0.55, h: 0.55,
fill: { color: TEAL }, line: { color: TEAL, width: 0 },
});
s.addText(st.num, {
x: 0.55, y: 1.07 + i * 1.17, w: 0.55, h: 0.55,
fontSize: 14, bold: true, color: WHITE, fontFace: "Calibri", align: "center", valign: "middle",
});
s.addText(st.title + " β " + st.body, {
x: 1.25, y: 1.0 + i * 1.17, w: 11.4, h: 0.95,
fontSize: 11.5, color: LIGHT_SLATE, fontFace: "Calibri", valign: "middle",
});
});
// Idiosyncratic note
s.addText("Key: The reaction is IDIOSYNCRATIC (not dose-dependent) with a latent period of 1β4 weeks. Recurs on re-exposure. β Robbins & Kumar Basic Pathology, Ch 12", {
x: 0.35, y: 6.98, w: 12.6, h: 0.3,
fontSize: 9.5, color: MID_GREY, fontFace: "Calibri", align: "center",
});
}
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
// SLIDE 11 β MANAGEMENT
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
{
let s = pres.addSlide();
setBackground(s);
addTitle(s, "Management");
addLine(s);
// Step 1
card(s, 0.35, 0.92, 6.0, 2.25);
s.addText("STEP 1 β Remove Offending Drug", {
x: 0.55, y: 0.98, w: 5.7, h: 0.32, fontSize: 13, bold: true, color: TEAL, fontFace: "Calibri",
});
const s1 = [
"DISCONTINUE omeprazole immediately (cornerstone of treatment)",
"Switch to famotidine (Hβ-blocker) β different class, no cross-reactivity",
"Document as ADR in medical record; avoid ALL PPIs permanently",
];
s1.forEach((b, i) => {
s.addText("βΈ " + b, {
x: 0.6, y: 1.36 + i * 0.55, w: 5.5, h: 0.48, fontSize: 11, color: LIGHT_SLATE, fontFace: "Calibri",
});
});
// Step 2
card(s, 6.65, 0.92, 6.3, 2.25);
s.addText("STEP 2 β Corticosteroid Therapy", {
x: 6.85, y: 0.98, w: 5.9, h: 0.32, fontSize: 13, bold: true, color: TEAL, fontFace: "Calibri",
});
const s2 = [
"Prednisone 1 mg/kg/day (max 60 mg/day) Γ 4 weeks",
"Taper over additional 4 weeks (total 8-week course)",
"Rationale: T-cell interstitial infiltrate on biopsy warrants immunosuppression",
];
s2.forEach((b, i) => {
s.addText("βΈ " + b, {
x: 6.85, y: 1.36 + i * 0.55, w: 5.9, h: 0.48, fontSize: 11, color: LIGHT_SLATE, fontFace: "Calibri",
});
});
// Step 3 β Supportive care table
card(s, 0.35, 3.35, 8.5, 2.9);
s.addText("STEP 3 β Supportive Care", {
x: 0.55, y: 3.41, w: 8.1, h: 0.32, fontSize: 13, bold: true, color: TEAL, fontFace: "Calibri",
});
const sup = [
{ prob: "Hyperkalemia (KβΊ 5.6)", rx: "Low-KβΊ diet; patiromer if persistent" },
{ prob: "Metabolic acidosis (HCOββ» 14)", rx: "Oral sodium bicarbonate (target β₯ 20 mEq/L)" },
{ prob: "Hyperphosphatemia", rx: "Dietary restriction; phosphate binder if needed" },
{ prob: "Hypertension", rx: "Continue losartan; monitor KβΊ closely" },
];
sup.forEach((r, i) => {
s.addText("β’ " + r.prob + ":", {
x: 0.6, y: 3.82 + i * 0.54, w: 3.8, h: 0.28, fontSize: 11, color: MID_GREY, fontFace: "Calibri",
});
s.addText(r.rx, {
x: 4.5, y: 3.82 + i * 0.54, w: 4.1, h: 0.28, fontSize: 11, color: LIGHT_SLATE, fontFace: "Calibri",
});
});
// Step 4 β Prognosis
card(s, 9.15, 3.35, 3.8, 2.9);
s.addText("Prognosis", {
x: 9.35, y: 3.41, w: 3.4, h: 0.32, fontSize: 13, bold: true, color: TEAL, fontFace: "Calibri",
});
const prog = [
"Most recover with drug withdrawal",
"Recovery may take months",
"Older patients / delayed Dx β higher risk of incomplete recovery",
];
prog.forEach((p, i) => {
s.addText("βΈ " + p, {
x: 9.35, y: 3.82 + i * 0.68, w: 3.4, h: 0.60, fontSize: 10.5, color: LIGHT_SLATE, fontFace: "Calibri",
});
});
// Source
s.addText("Sources: Harrison's 22e Ch 319 Β· Brenner & Rector's The Kidney Ch 35 Β· Robbins Basic Pathology Ch 12", {
x: 0.35, y: 7.1, w: 12.6, h: 0.25,
fontSize: 9, color: MID_GREY, fontFace: "Calibri", align: "right",
});
}
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
// SLIDE 12 β KEY TEACHING POINTS
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
{
let s = pres.addSlide();
setBackground(s);
addTitle(s, "Key Teaching Points");
addLine(s);
const points = [
{ n: "1", t: "Classic Triad is Rare", b: "Fever + Rash + Eosinophilia present in < 10% of cases. Absence does NOT exclude ATIN." },
{ n: "2", t: "PPIs are Common Culprits", b: "Now among the most frequent causes of drug-induced ATIN, alongside NSAIDs and synthetic penicillins." },
{ n: "3", t: "Urine Microscopy is Key", b: "WBC casts + eosinophiluria on cytocentrifuged Giemsa-stained preparation = most suggestive findings." },
{ n: "4", t: "Non-AG Metabolic Acidosis", b: "Hyperchloremic normal anion gap acidosis reflects tubular dysfunction β distinguishes from glomerular disease." },
{ n: "5", t: "Negative IF on Biopsy", b: "Negative immunofluorescence excludes immune complex glomerulonephritis." },
{ n: "6", t: "Biopsy = Gold Standard", b: "Confirms diagnosis and guides decision to initiate corticosteroids β essential when recovery stalls." },
];
points.forEach((pt, i) => {
const col = i < 3 ? 0.35 : 6.75;
const row = i < 3 ? i : i - 3;
card(s, col, 0.92 + row * 1.88, 6.15, 1.72);
// Badge
s.addShape(pres.shapes.RECTANGLE, {
x: col, y: 0.92 + row * 1.88, w: 0.48, h: 1.72,
fill: { color: TEAL }, line: { color: TEAL, width: 0 },
});
s.addText(pt.n, {
x: col, y: 0.92 + row * 1.88, w: 0.48, h: 1.72,
fontSize: 18, bold: true, color: WHITE, fontFace: "Calibri",
align: "center", valign: "middle",
});
s.addText(pt.t, {
x: col + 0.62, y: 0.98 + row * 1.88, w: 5.38, h: 0.38,
fontSize: 13, bold: true, color: AMBER, fontFace: "Calibri",
});
s.addText(pt.b, {
x: col + 0.62, y: 1.38 + row * 1.88, w: 5.38, h: 1.1,
fontSize: 11, color: LIGHT_SLATE, fontFace: "Calibri",
});
});
}
// βββ WRITE FILE ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
const outPath = "/home/daytona/workspace/atin-pptx/Acute_Tubulointerstitial_Nephritis.pptx";
pres.writeFile({ fileName: outPath }).then(() => {
console.log("PPTX created:", outPath);
}).catch(err => {
console.error("Error:", err);
});