Malaria basic to clinical

Reading File
Finding Sources
Searching the Web

malaria pathophysiology clinical features treatment 2024 guidelines

Reading File
Reading File
Finding Sources
Reading File
Reading File
Finding Sources
Reading File
Reading File
Loading Image
Loading Image
Reading File
Finding Sources
Finding Sources
Reading File
Searching PubMed

malaria treatment artemisinin combination therapy

Loading Image
I now have all the key content and images. Let me compile the comprehensive answer.

Malaria: Basic to Clinical


1. Overview & Epidemiology

Malaria is one of the world's most serious infectious diseases. The WHO estimated >200 million cases worldwide in 2020, resulting in over 600,000 deaths - predominantly children under 5 in sub-Saharan Africa. It is endemic across Asia and Africa; with global air travel, cases now appear worldwide. The key point for clinicians: most fatalities in the developed world result from delayed diagnosis because providers don't think of it.
  • Robbins & Kumar Basic Pathology, p. 391

2. The Causative Agents - Five Plasmodium Species

SpeciesDiseaseFever PeriodicitySpecial Notes
P. falciparumFalciparum (tertian) malariaEvery 48 hMost dangerous; causes severe/fatal disease; no hypnozoites
P. vivaxBenign tertianEvery 48 hHypnozoites → relapse; can cause ARDS
P. ovaleOvale tertianEvery 48 hHypnozoites → relapse
P. malariaeQuartan malariaEvery 72 hCauses nephrotic syndrome (membranoproliferative pattern)
P. knowlesiZoonotic malaria (SE Asia)Every 24 hMorphologically resembles P. malariae; can be rapidly fatal
Transmission: bite of the female Anopheles mosquito. Humans are the only natural reservoir for the four main species.

3. Life Cycle & Pathogenesis

Life Cycle of P. falciparum showing hepatic and erythrocytic stages, PfEMP1 knobs, ICAM-1/VCAM-1/CD36 adhesion, and gametocyte formation
Fig. 10.8 Life cycle of Plasmodium falciparum - Robbins & Kumar Basic Pathology

Hepatic (Pre-erythrocytic) Stage - Clinically Silent

  1. Mosquito bite injects sporozoites into the bloodstream
  2. Two sporozoite surface proteins (thrombospondin-related adhesive protein and circumsporozoite protein) bind heparan sulfate proteoglycans on hepatocytes
  3. Sporozoites enter hepatocytes → differentiate into merozoites (1-4 week incubation)
  4. Infected hepatocytes rupture → release thousands of merozoites into blood
  5. In P. vivax and P. ovale: some organisms remain dormant as hypnozoites in the liver, capable of relapsing months to years later

Erythrocytic Stage - Clinical Disease

  1. A lectin-like molecule on the merozoite surface binds to sialidated glycophorin on RBCs → merozoite invaginates into a digestive vacuole
  2. Intraerythrocytic organisms differentiate into trophozoites
  3. Trophozoites follow two paths:
    • Some → gametocytes (sexual stage; infective for mosquitoes)
    • Most → schizonts, which express PfEMP1 (P. falciparum erythrocyte membrane protein 1) on knoblike extensions of the RBC surface
  4. Cytoadherence: PfEMP1 binds ICAM-1, VCAM-1, and CD36 on microvascular endothelium → parasitized RBCs sequester in capillary beds (especially brain, placenta)
  5. Schizonts mature → burst → release new merozoites → cycle repeats every 48 h (falciparum)
Sequestration of infected erythrocytes in brain microvessels is the key pathogenic mechanism of cerebral malaria. Malaria has also been the most powerful selective force on human evolution: sickle cell trait, thalassemia, G6PD deficiency, and Duffy antigen negativity all arose in malaria-endemic regions because they confer partial protection.
  • Robbins & Kumar Basic Pathology, p. 392; Murray & Nadel's Respiratory Medicine, p. 1352

4. Morphology (What You See Under the Microscope)

  • Red cell trophozoites from each species have distinctive appearances on Giemsa/Wright-stained blood films
  • Destruction of RBCs → hemolytic anemia with elevated LDH, indirect bilirubin, low haptoglobin
  • A characteristic brown malarial pigment (hematin/hemozoin) - a degradation product of hemoglobin - discolors the spleen, liver, lymph nodes, and bone marrow
  • Activation of mononuclear phagocytes → massive splenomegaly and hepatomegaly
  • Falciparum uniquely: only ring forms and banana-shaped gametocytes seen in peripheral blood (late forms sequester internally)
Thin blood smear - P. falciparum stages (WHO reference images):
Thin blood film P. falciparum: A=Young ring trophozoite, B=Old trophozoite, C=Trophozoites with pigment in PMNs, D=Mature schizont, E=Female gametocyte (crescentic), F=Male gametocyte
P. falciparum thin blood film: A. Young ring trophozoite. B. Old trophozoite. C. Trophozoites + pigment in PMNs. D. Mature schizont. E. Female gametocyte (banana/crescentic). F. Male gametocyte - Harrison's Principles of Internal Medicine 22e

5. Clinical Features

Uncomplicated Malaria

  • Classic triad: headache + fatigue → fever + chills + rigors → sweating (each episode lasts a few hours)
  • Periodic fever: every 24 h (P. knowlesi), every 48 h (P. falciparum, P. vivax, P. ovale), every 72 h (P. malariae) - but NOT reliable, especially in falciparum
  • Hemolytic anemia, thrombocytopenia, splenomegaly, jaundice
  • Nausea, vomiting, myalgias

Severe / Complicated Malaria (almost always P. falciparum)

WHO criteria for severe malaria include any of:
ComplicationNotes
Cerebral malariaImpaired consciousness, seizures, coma; rapidly progressive; high mortality even with treatment
Severe anemiaHb <5 g/dL in hyperparasitemia
Acute respiratory distress syndrome (ARDS)Bilateral lung opacities; children, pregnant women, and non-immune travelers most at risk
Acute kidney injuryRenal failure from hemoglobinuria, microthrombi
Blackwater feverMassive intravascular hemolysis → hemoglobinemia + hemoglobinuria + jaundice + AKI (rare complication of falciparum)
HypoglycemiaDue to parasite glucose consumption + quinine-induced hyperinsulinemia
Hyperparasitemia>5% RBCs parasitized = poor prognosis marker
ThrombocytopeniaVery common
Circulatory collapse / shock"Algid malaria"
Metabolic acidosisLactic acidosis from poor tissue perfusion
P. falciparum can progress from uncomplicated to multiorgan failure within days in non-immune individuals.
  • Murray & Nadel's Respiratory Medicine, p. 1352; Robbins & Kumar, p. 392

6. Diagnosis

Microscopy (Gold Standard)

  • Thick blood film: lysed RBCs concentrate parasites 40-100x; best sensitivity for low-parasitemia detection; count parasites per 200 WBCs under oil immersion (×1000); examine at least 100-200 fields before calling negative
  • Thin blood film: RBCs intact; best for species identification and parasite density (% parasitized RBCs)
  • Repeat smears at least twice daily if first is negative but malaria remains suspected
  • Artifacts are common on thick films; experience is needed for interpretation
  • In high-transmission areas, up to 10,000 parasites/µL may be tolerated in partial immunity - thus a positive smear in endemic areas doesn't always mean malaria is the cause of illness

Rapid Diagnostic Tests (RDTs)

  • Antibody-based stick/card tests detecting:
    • PfHRP2 (P. falciparum histidine-rich protein 2) - falciparum specific
    • Parasite lactate dehydrogenase (pLDH) - all species
    • Aldolase - pan-species
  • Main method of diagnosis at the point of care in endemic regions
  • Note: deletions in pfhrp2/pfhrp3 genes can cause false negatives with HRP2-based tests

Other

  • PCR: most sensitive, used for species confirmation and low-density infection
  • CBC: anemia, thrombocytopenia; leukocyte count usually normal
  • Liver function tests: elevated bilirubin, transaminases
  • Blood glucose: monitor closely (hypoglycemia risk)
  • Renal function: AKI in severe disease
  • Harrison's Principles of Internal Medicine 22e, p. 1810

7. Treatment

Malaria parasite life cycle with drug targets at each stage
Sites of action of antimalarial drugs across the parasite life cycle - Lippincott Pharmacology

Drug Classes and Mechanisms

8-Aminoquinolines (Liver/Gametocyte Drugs)

Primaquine
  • Active against: primary liver exoerythrocytic forms (causal prophylaxis), hypnozoites (P. vivax, P. ovale - prevents relapse), and gametocytes (blocks transmission)
  • NOT active against erythrocytic stage → cannot be used as monotherapy
  • Mechanism: oxidant metabolites disrupt plasmodial mitochondria
  • Key toxicity: hemolytic anemia in G6PD deficiency (test G6PD before use); methemoglobinemia; GI upset
  • Contraindicated in pregnancy; not with rheumatoid arthritis or SLE
Tafenoquine
  • Long-acting 8-aminoquinoline; single dose for hypnozoite eradication (vs. 14-day primaquine course)
  • Also used for chemoprophylaxis (weekly dosing after loading)
  • Same G6PD contraindication; additionally: neuropsychiatric effects (depression, anxiety, abnormal dreams)

4-Aminoquinolines (Blood Schizonticides)

Chloroquine
  • Mechanism: concentrates in parasite food vacuole → binds heme → prevents polymerization to hemozoin → toxic heme accumulates → oxidative damage → parasite lysis
  • Was the cornerstone of malaria treatment for decades
  • Now mostly useless for P. falciparum due to widespread resistance (except parts of Central America)
  • Still used for P. vivax/P. ovale/P. malariae in chloroquine-sensitive areas and for chemoprophylaxis in chloroquine-sensitive zones
  • Also treats extraintestinal amebiasis

Artemisinins (Most Important Current Drugs)

Artesunate / Artemether / Dihydroartemisinin
  • Derived from sweet wormwood (Artemisia annua) used in Chinese traditional medicine
  • Mechanism: heme iron in parasite food vacuole cleaves the endoperoxide bridge → free radical generation → broad oxidative damage to parasite proteins and membranes
  • IV artesunate = preferred treatment for severe malaria (faster parasite clearance, lower mortality than IV quinine)
  • Short half-life → always used in combination (Artemisinin-based Combination Therapy, ACT) to prevent resistance
  • Artemether-lumefantrine (oral ACT): first-line for uncomplicated falciparum
  • Adverse effects: thrombocytopenia, hemolytic anemia, elevated LFTs, hyperbilirubinemia
  • For P. vivax/P. ovale treated with artesunate, always add primaquine or tafenoquine to eradicate hypnozoites

Antifolates

Pyrimethamine
  • Inhibits plasmodial dihydrofolate reductase → blocks tetrahydrofolate synthesis → inhibits nucleic acid synthesis
  • Blood schizonticide + sporonticide
  • Combined with sulfadoxine (SP); resistance common, now used with ACT
  • Pyrimethamine + sulfadiazine also treats toxoplasmosis
  • If megaloblastic anemia develops: treat with leucovorin

Quinoline Methanol / Aryl Amino Alcohols

Mefloquine: Blood schizonticide; used for chloroquine-resistant malaria and prophylaxis; notable neuropsychiatric adverse effects (vivid dreams, anxiety, depression, dizziness)
Quinine: Historical first-line; IV quinine remains alternative for severe malaria when artesunate is unavailable; narrow therapeutic index; causes cinchonism (tinnitus, nausea, headache), hypoglycemia via stimulation of insulin release

Atovaquone-Proguanil (Malarone)

  • Atovaquone: inhibits mitochondrial electron transport (collapses mitochondrial membrane potential)
  • Proguanil: inhibits dihydrofolate reductase
  • Active against liver stage (causal prophylaxis) and erythrocytic stage
  • First-line for uncomplicated falciparum and chemoprophylaxis for travelers

Treatment Summary Table

Clinical ScenarioPreferred Regimen
Severe falciparum malariaIV artesunate; complete with oral ACT
Uncomplicated falciparum (chloroquine-resistant area)Artemether-lumefantrine OR atovaquone-proguanil OR quinine + doxycycline
Uncomplicated falciparum (chloroquine-sensitive area)Chloroquine
P. vivax / P. ovale (chloroquine-sensitive)Chloroquine + primaquine (or tafenoquine) for radical cure
P. vivax (chloroquine-resistant)ACT + primaquine/tafenoquine
P. malariaeChloroquine
Cerebral malariaIV artesunate; anticonvulsants if seizures; steroids NOT proven beneficial
Note on cerebral malaria: corticosteroids (once thought lifesaving) have been shown in controlled studies to be ineffective and may worsen outcome. Exchange transfusion has modest benefit in hyperparasitemia.
  • Lippincott Pharmacology, p. 1167-1177; Adams & Victor's Neurology, p. 743

8. Chemoprophylaxis for Travelers

DrugScheduleNotes
Atovaquone-proguanilDaily (start 1-2 days before, continue 7 days after)Causal prophylaxis; good tolerance
DoxycyclineDailyInexpensive; photosensitivity; no use in pregnancy or children <8
MefloquineWeekly (start 2 weeks before, continue 4 weeks after)Neuropsychiatric effects
ChloroquineWeeklyOnly for chloroquine-sensitive zones (now limited)
TafenoquineWeekly (single loading dose ×3 days, then weekly)New; G6PD testing mandatory
PrimaquineDailyG6PD testing mandatory; for P. vivax-endemic areas
  • Red Book 2021; Harrison's Principles of Internal Medicine 22e

9. Special Populations

  • Pregnancy: P. falciparum sequesters in the placenta (binds CSA on chondroitin sulfate A) → placental malaria → IUGR, preterm birth, maternal anemia; IV artesunate preferred for severe malaria in pregnancy; ACT in 2nd/3rd trimester for uncomplicated; avoid primaquine, doxycycline
  • Children: Most severe disease and deaths occur in children under 5 in Africa; cerebral malaria is the leading killer
  • Nephrotic syndrome: P. malariae causes a membranoproliferative GN with nephrotic syndrome
  • Splenomegaly: Hyperreactive malarial splenomegaly (HMS) - massive splenomegaly, high IgM, due to exaggerated immune response; distinct from acute splenomegaly

10. Prevention Beyond Drugs

  1. Insecticide-treated bed nets (ITNs) - most effective single intervention in endemic areas
  2. Indoor residual spraying (IRS) with insecticides
  3. Environmental management: elimination of mosquito breeding sites (stagnant water)
  4. Personal protection: repellents (DEET), protective clothing, screened accommodation
  5. RTS,S/AS01 vaccine (Mosquirix): Targets the P. falciparum circumsporozoite protein; partial protection (~30-50%); approved by WHO for routine use in children in sub-Saharan Africa; reduces but does not eliminate cases of fatal cerebral malaria in children
  • Robbins & Kumar Basic Pathology, p. 393

11. Recent Evidence (2025)

A 2025 systematic review and meta-analysis (PMID 41291512) examining ACT efficacy trends from 2010-2024 in sub-Saharan Africa confirms that artemisinin-based combinations remain highly efficacious overall, though partial artemisinin resistance (particularly kelch13 mutations) is an emerging concern in East Africa and the Greater Mekong subregion.
A 2025 Lancet Infectious Diseases meta-analysis (PMID 40286803) confirms that single-dose primaquine (0.25 mg/kg) is safe and effective at reducing P. falciparum gametocyte density to interrupt transmission - even in young children - provided G6PD status is considered.

Quick Reference: Key Mnemonics

  • "Fever every 3 days = P. malariae (quartan)", every 2 days = the rest (tertian)
  • Hypnozoites = vivax + ovale ("V.O. = vivid, overstays its welcome")
  • Only falciparum shows banana gametocytes on peripheral smear
  • Chloroquine MOA: prevents hemozoin formation → toxic heme accumulates
  • Artesunate MOA: endoperoxide bridge + heme iron → free radicals
  • Primaquine: G6PD check mandatory before prescribing

Sources: Robbins & Kumar Basic Pathology (Robbins Pathology); Murray & Nadel's Textbook of Respiratory Medicine; Lippincott Illustrated Reviews: Pharmacology; Harrison's Principles of Internal Medicine 22e; Adams and Victor's Principles of Neurology 12e; Red Book 2021; Park's Preventive & Social Medicine

Create a clinical case workup guide for suspected severe malaria diagnosis and management

Reading File
Finding Sources
Finding Sources
Reading File
Finding Sources
Finding Sources
Reading File
Finding Sources
Reading File
Reading File
Reading File
Reading File
Running Command

mkdir -p /home/daytona/workspace/severe-malaria-guide && ls /home/daytona/worksp…

Running Command

node /home/daytona/skills/shared/scripts/fetch_images.js "https://cdn.orris.care…

Writing File

~/severe-malaria-guide/build.js

const pptxgen = require("pptxgenjs");
const { execSync } = require("child_process");

// ─── Fetch images ───────────────────────────────────────────────────────────
const imgUrls = [
  "https://cdn.orris.care/cdss_images/95c5879b3a1dda597f29bf69dce4c266650edaab7722bc613ac01d1ba491eb8f.png", // life cycle
  "https://cdn.orris.care/cdss_images/64ffb6776f27ee5cda1c59e4fa39f048223a0a9ed89852c9a485a3f356e61fe1.png", // blood smear falciparum
  "https://cdn.orris.care/cdss_images/170b7c1b92348d3114ce6055f2db6c9aa2fa2673143d7b08fa1617f6c20fab18.png", // drug targets
];
const imgs = JSON.parse(
  execSync(
    `node /home/daytona/skills/shared/scripts/fetch_images.js ${imgUrls.map(u => `"${u}"`).join(" ")}`
  ).toString()
);
const [lifecycleImg, smearImg, drugImg] = imgs;

// ─── Palette ────────────────────────────────────────────────────────────────
const C = {
  darkBg:    "0D1B2A",   // deep navy  (title / section slides)
  medBg:     "1B3A5C",   // deep blue  (accent headers)
  accent:    "E63946",   // vivid red  (danger / alerts)
  accentOr:  "F4A261",   // amber      (warning markers)
  accentGr:  "2A9D8F",   // teal-green (positive / treatment)
  white:     "FFFFFF",
  lightGray: "F1F3F5",
  midGray:   "8D99AE",
  textDark:  "1A1A2E",
};

const pres = new pptxgen();
pres.layout = "LAYOUT_16x9";
pres.title  = "Severe Malaria – Clinical Case Workup Guide";
pres.author = "Orris Clinical Series";

// ═══════════════════════════════════════════════════════════════════════════
// HELPERS
// ═══════════════════════════════════════════════════════════════════════════
function darkSlide(slide) {
  slide.background = { color: C.darkBg };
}
function lightSlide(slide) {
  slide.background = { color: C.white };
}
function accentBar(slide, text, barColor = C.accent) {
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 0.55, fill: { color: barColor }, line: { color: barColor } });
  slide.addText(text, { x: 0.3, y: 0, w: 9.4, h: 0.55, fontSize: 14, bold: true, color: C.white, valign: "middle", margin: 0 });
}
function sectionLabel(slide, label, color = C.accentOr) {
  slide.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0.55, w: 0.18, h: 4.5, fill: { color: color }, line: { color: color } });
}
function slideNum(slide, n) {
  slide.addText(`${n}`, { x: 9.5, y: 5.2, w: 0.4, h: 0.3, fontSize: 9, color: C.midGray, align: "right" });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 1 — TITLE
// ═══════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  darkSlide(sl);

  // Top red stripe
  sl.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 0.12, fill: { color: C.accent }, line: { color: C.accent } });

  // Large title text
  sl.addText("SEVERE MALARIA", {
    x: 0.6, y: 0.55, w: 8.8, h: 1.2,
    fontSize: 48, bold: true, color: C.white, charSpacing: 4,
    fontFace: "Calibri",
  });
  sl.addText("Clinical Case Workup Guide", {
    x: 0.6, y: 1.7, w: 8.8, h: 0.65,
    fontSize: 26, color: C.accentOr, italic: true,
  });

  // Subtitle block
  sl.addShape(pres.shapes.RECTANGLE, { x: 0.6, y: 2.55, w: 5.2, h: 0.04, fill: { color: C.midGray }, line: { color: C.midGray } });
  sl.addText([
    { text: "Recognition  •  Workup  •  ICU Management  •  Treatment Protocols", options: { breakLine: true } },
    { text: "Based on WHO 2024 Guidelines  |  Harrison's 22e  |  Red Book 2021", options: {} },
  ], {
    x: 0.6, y: 2.7, w: 8.6, h: 0.85,
    fontSize: 13, color: C.midGray,
  });

  // Bottom life cycle image
  if (lifecycleImg.base64) {
    sl.addImage({ data: lifecycleImg.base64, x: 5.8, y: 0.4, w: 4.0, h: 2.7, transparency: 15 });
  }

  // Bottom bar
  sl.addShape(pres.shapes.RECTANGLE, { x: 0, y: 5.32, w: 10, h: 0.305, fill: { color: C.medBg }, line: { color: C.medBg } });
  sl.addText("ORRIS CLINICAL SERIES  •  Severe Malaria Workup  •  July 2026", {
    x: 0.3, y: 5.32, w: 9.4, h: 0.305, fontSize: 9, color: C.midGray, valign: "middle", align: "center", margin: 0,
  });
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 2 — CASE PRESENTATION
// ═══════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  lightSlide(sl);
  accentBar(sl, "CASE PRESENTATION", C.accent);

  sl.addShape(pres.shapes.RECTANGLE, { x: 0.3, y: 0.7, w: 9.4, h: 4.6,
    fill: { color: C.lightGray }, line: { color: "D0D7DE", width: 1 },
    shadow: { type: "outer", color: "000000", blur: 6, offset: 2, angle: 135, opacity: 0.1 }
  });

  // Patient box
  sl.addShape(pres.shapes.RECTANGLE, { x: 0.5, y: 0.85, w: 2.5, h: 0.9,
    fill: { color: C.medBg }, line: { color: C.medBg }
  });
  sl.addText([
    { text: "Patient: ", options: { bold: true, color: C.accentOr } },
    { text: "35 M, returning traveler", options: { color: C.white } },
  ], { x: 0.55, y: 0.85, w: 2.4, h: 0.9, fontSize: 11, valign: "middle", margin: 4 });

  sl.addShape(pres.shapes.RECTANGLE, { x: 3.2, y: 0.85, w: 3.0, h: 0.9,
    fill: { color: C.medBg }, line: { color: C.medBg }
  });
  sl.addText([
    { text: "Travel: ", options: { bold: true, color: C.accentOr } },
    { text: "Sub-Saharan Africa (3 wks ago)", options: { color: C.white } },
  ], { x: 3.25, y: 0.85, w: 2.9, h: 0.9, fontSize: 11, valign: "middle", margin: 4 });

  sl.addShape(pres.shapes.RECTANGLE, { x: 6.4, y: 0.85, w: 3.1, h: 0.9,
    fill: { color: C.medBg }, line: { color: C.medBg }
  });
  sl.addText([
    { text: "Prophylaxis: ", options: { bold: true, color: C.accentOr } },
    { text: "Incomplete (stopped early)", options: { color: C.white } },
  ], { x: 6.45, y: 0.85, w: 3.0, h: 0.9, fontSize: 11, valign: "middle", margin: 4 });

  // Presenting complaints
  sl.addText("Chief Complaints & History", { x: 0.5, y: 1.9, w: 4, h: 0.4, fontSize: 13, bold: true, color: C.medBg });
  sl.addText([
    { text: "• 5-day history of high-grade fever with rigors, now daily\n", options: { breakLine: false } },
    { text: "• Severe headache, myalgias, anorexia, and vomiting\n", options: { breakLine: false } },
    { text: "• Confusion and drowsiness since this morning\n", options: { breakLine: false } },
    { text: "• Decreased urine output; dark-colored urine\n", options: { breakLine: false } },
    { text: "• One episode of witnessed tonic-clonic seizure (2 min)\n", options: { breakLine: false } },
    { text: "• No prophylaxis completed; no jaundice noticed", options: {} },
  ], { x: 0.55, y: 2.3, w: 4.4, h: 2.75, fontSize: 12, color: C.textDark, lineSpacingMultiple: 1.3 });

  // Vitals
  sl.addText("Vitals on Arrival", { x: 5.15, y: 1.9, w: 4, h: 0.4, fontSize: 13, bold: true, color: C.accent });

  const vitals = [
    ["Temp", "40.2 °C", C.accent],
    ["HR", "118 bpm", C.accentOr],
    ["BP", "88/60 mmHg", C.accent],
    ["RR", "28/min", C.accentOr],
    ["SpO₂", "91% (RA)", C.accent],
    ["GCS", "10/15", C.accent],
  ];
  vitals.forEach(([label, val, col], i) => {
    const col_x = i < 3 ? 5.15 : 7.65;
    const row_y = 2.35 + (i % 3) * 0.75;
    sl.addShape(pres.shapes.RECTANGLE, { x: col_x, y: row_y, w: 2.3, h: 0.6,
      fill: { color: C.darkBg }, line: { color: col, width: 2 }
    });
    sl.addText([
      { text: `${label}\n`, options: { color: C.midGray, fontSize: 9, breakLine: true } },
      { text: val, options: { color: col, fontSize: 13, bold: true } },
    ], { x: col_x + 0.07, y: row_y, w: 2.16, h: 0.6, valign: "middle", align: "center" });
  });

  slideNum(sl, 2);
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 3 — CLINICAL RED FLAGS & WHY THINK MALARIA
// ═══════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  darkSlide(sl);
  accentBar(sl, "STEP 1 — CLINICAL RECOGNITION: Red Flags for Severe Malaria", C.medBg);

  // Left column - red flags
  sl.addShape(pres.shapes.RECTANGLE, { x: 0.3, y: 0.65, w: 4.5, h: 4.7,
    fill: { color: "111C2B" }, line: { color: C.accent, width: 2 }
  });
  sl.addText("🚨 WHO Severe Malaria Criteria", {
    x: 0.4, y: 0.72, w: 4.3, h: 0.45, fontSize: 13, bold: true, color: C.accent,
  });

  const redFlags = [
    "Impaired consciousness / coma (Unarousable)",
    "Repeated convulsions (≥2 in 24 h)",
    "Respiratory distress / ARDS (acidotic breathing)",
    "Circulatory collapse / shock (SBP <70 mmHg)",
    "Severe anemia (Hb <7 g/dL in adults)",
    "Hyperparasitemia (>5% RBCs infected)",
    "Hypoglycemia (Blood glucose <2.2 mmol/L)",
    "Acute kidney injury (Creatinine ≥265 µmol/L)",
    "Clinically significant bleeding / DIC",
    "Hemoglobinuria (Blackwater fever)",
  ];
  redFlags.forEach((item, i) => {
    sl.addShape(pres.shapes.RECTANGLE, { x: 0.38, y: 1.22 + i * 0.38, w: 0.25, h: 0.25,
      fill: { color: C.accent }, line: { color: C.accent }
    });
    sl.addText(item, {
      x: 0.7, y: 1.2 + i * 0.38, w: 4.0, h: 0.35,
      fontSize: 10.5, color: C.white, valign: "middle",
    });
  });

  // Right column - risk factors / think malaria
  sl.addShape(pres.shapes.RECTANGLE, { x: 5.05, y: 0.65, w: 4.6, h: 2.2,
    fill: { color: "111C2B" }, line: { color: C.accentGr, width: 2 }
  });
  sl.addText("Always Consider Malaria When:", {
    x: 5.15, y: 0.72, w: 4.4, h: 0.4, fontSize: 13, bold: true, color: C.accentGr,
  });
  const thinkMalaria = [
    "• Fever + travel to endemic area (within 3 months)",
    "• Fever of unknown origin with no localizing signs",
    "• Thrombocytopenia + anemia in a febrile patient",
    "• Unexplained impaired consciousness with fever",
    "• Incomplete or no malaria prophylaxis",
  ];
  sl.addText(thinkMalaria.join("\n"), {
    x: 5.15, y: 1.15, w: 4.4, h: 1.6, fontSize: 11, color: C.white, lineSpacingMultiple: 1.4,
  });

  // Alert box
  sl.addShape(pres.shapes.RECTANGLE, { x: 5.05, y: 3.0, w: 4.6, h: 2.3,
    fill: { color: "111C2B" }, line: { color: C.accentOr, width: 2 }
  });
  sl.addText("⚠ KEY CLINICAL PEARL", {
    x: 5.15, y: 3.07, w: 4.4, h: 0.4, fontSize: 13, bold: true, color: C.accentOr,
  });
  sl.addText(
    "The classical periodic fever pattern (every 48-72 h) is UNRELIABLE in P. falciparum. " +
    "Do not wait for a 'textbook fever' — suspect malaria in ANY febrile returning traveler. " +
    "Onset of confusion or seizure = cerebral malaria until proven otherwise. " +
    "Mortality in cerebral malaria with treatment: ~15-20% in adults; higher if untreated.",
    { x: 5.15, y: 3.52, w: 4.4, h: 1.7, fontSize: 10.5, color: C.white, lineSpacingMultiple: 1.4 }
  );

  slideNum(sl, 3);
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 4 — IMMEDIATE WORKUP (STAT INVESTIGATIONS)
// ═══════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  lightSlide(sl);
  accentBar(sl, "STEP 2 — IMMEDIATE WORKUP: Investigations to Order NOW", C.medBg);
  sectionLabel(sl, "", C.accentGr);

  // 3-column layout
  const cols = [
    {
      title: "CONFIRMATORY TESTS",
      color: C.accent,
      x: 0.35,
      items: [
        ["Thick + Thin Blood Film", "STAT — examine under oil immersion ×1000; confirm species, quantify % parasitemia. Repeat every 12-24h if first negative (×3 over 72h)"],
        ["RDT (PfHRP2 / pLDH)", "Rapid, finger-prick; run PARALLEL to smear. PfHRP2 = falciparum-specific. LDH = pan-species. Confirm all results by microscopy"],
        ["PCR (Reference lab)", "Most sensitive; speciation and resistance genotyping. NOT for acute management — use for confirmation"],
      ],
    },
    {
      title: "SEVERITY MARKERS",
      color: C.accentOr,
      x: 3.6,
      items: [
        ["% Parasitemia", ">5% = severe marker. Also note: >20% parasites pigmented + >5% PMNs with pigment = poor prognosis"],
        ["Blood Glucose", "STAT and every 6h. Hypoglycemia (<2.2 mmol/L) = medical emergency; treat with IV dextrose immediately"],
        ["Lactate / ABG", "Lactic acidosis = organ hypoperfusion; correlates with mortality. Check HCO₃, PaO₂, pH"],
      ],
    },
    {
      title: "ORGAN FUNCTION PANEL",
      color: C.accentGr,
      x: 6.85,
      items: [
        ["CBC + Reticulocytes", "Hb, platelets (almost always low), WBC (usually normal). Rapid fall in Hct expected; transfuse if Hct <20%"],
        ["RFT / LFT / Coagulation", "Creatinine ≥265 µmol/L = AKI criterion. Bilirubin elevated (hemolysis). PT/aPTT for DIC screen"],
        ["Urinalysis / Output", "Hemoglobinuria (dark urine) = blackwater fever. Monitor hourly urine output. Target >0.5 mL/kg/h"],
      ],
    },
  ];

  cols.forEach(col => {
    sl.addShape(pres.shapes.RECTANGLE, { x: col.x, y: 0.65, w: 3.1, h: 0.45,
      fill: { color: col.color }, line: { color: col.color }
    });
    sl.addText(col.title, { x: col.x, y: 0.65, w: 3.1, h: 0.45,
      fontSize: 10, bold: true, color: C.white, align: "center", valign: "middle", margin: 0
    });

    col.items.forEach(([test, note], i) => {
      const yBase = 1.18 + i * 1.42;
      sl.addShape(pres.shapes.RECTANGLE, { x: col.x, y: yBase, w: 3.1, h: 0.4,
        fill: { color: C.darkBg }, line: { color: col.color, width: 1.5 }
      });
      sl.addText(test, { x: col.x + 0.1, y: yBase, w: 2.9, h: 0.4,
        fontSize: 11, bold: true, color: col.color, valign: "middle", margin: 0
      });
      sl.addShape(pres.shapes.RECTANGLE, { x: col.x, y: yBase + 0.4, w: 3.1, h: 0.9,
        fill: { color: C.lightGray }, line: { color: "D0D7DE", width: 1 }
      });
      sl.addText(note, { x: col.x + 0.08, y: yBase + 0.42, w: 2.94, h: 0.85,
        fontSize: 9.5, color: C.textDark, lineSpacingMultiple: 1.25, valign: "top"
      });
    });
  });

  // Blood smear image small
  if (smearImg.base64) {
    sl.addImage({ data: smearImg.base64, x: 0.35, y: 4.55, w: 2.6, h: 0.95 });
    sl.addText("P. falciparum thin smear — ring trophozoites (A,B), schizont (D), banana gametocytes (E,F)", {
      x: 3.05, y: 4.65, w: 6.65, h: 0.8, fontSize: 9, color: C.midGray, italic: true
    });
  }

  slideNum(sl, 4);
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 5 — DIAGNOSTIC ALGORITHM (FLOWCHART-STYLE)
// ═══════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  darkSlide(sl);
  accentBar(sl, "STEP 3 — DIAGNOSTIC ALGORITHM: Fever + Travel History", C.accent);

  // Box helper
  function box(x, y, w, h, text, bgColor, textColor, fSize = 11) {
    sl.addShape(pres.shapes.RECTANGLE, { x, y, w, h, fill: { color: bgColor }, line: { color: "334455", width: 1.5 } });
    sl.addText(text, { x, y, w, h, fontSize: fSize, color: textColor, align: "center", valign: "middle", bold: fSize >= 12 });
  }
  function arrow(x1, y1, x2, y2) {
    sl.addShape(pres.shapes.LINE, { x: x1, y: y1, w: x2 - x1, h: y2 - y1,
      line: { color: C.midGray, width: 1.5, endArrowType: "arrow" }
    });
  }

  // Start
  box(3.5, 0.65, 3, 0.5, "Febrile Patient + Travel to Endemic Area", C.medBg, C.white, 10);
  // Arrow down
  sl.addShape(pres.shapes.LINE, { x: 5, y: 1.15, w: 0.01, h: 0.3, line: { color: C.midGray, width: 1.5, endArrowType: "arrow" } });

  box(2.8, 1.45, 4.4, 0.5, "STAT: Blood Film (Thick+Thin) + RDT", C.accentOr, C.darkBg, 11);
  sl.addShape(pres.shapes.LINE, { x: 5, y: 1.95, w: 0.01, h: 0.3, line: { color: C.midGray, width: 1.5, endArrowType: "arrow" } });

  // Branch: positive
  box(0.4, 2.25, 3.5, 0.55, "POSITIVE for Plasmodium", C.accent, C.white, 11);
  // Branch: negative
  box(6.1, 2.25, 3.5, 0.55, "NEGATIVE — but suspect persists", C.accentGr, C.darkBg, 11);

  // Arrows from branch
  sl.addShape(pres.shapes.LINE, { x: 3.5, y: 2.0, w: -1.45, h: 0.25, line: { color: C.accent, width: 1.5, endArrowType: "arrow" } });
  sl.addShape(pres.shapes.LINE, { x: 6.5, y: 2.0, w: 1.1, h: 0.25, line: { color: C.accentGr, width: 1.5, endArrowType: "arrow" } });

  // Left branch steps
  box(0.4, 2.9, 3.5, 0.5, "Identify Species on Thin Film\n(Falciparum vs. non-falciparum)", C.darkBg, C.white, 10);
  sl.addShape(pres.shapes.LINE, { x: 2.15, y: 3.4, w: 0.01, h: 0.25, line: { color: C.midGray, width: 1.5, endArrowType: "arrow" } });
  box(0.4, 3.65, 3.5, 0.5, "Calculate % Parasitemia\n>5% = SEVERE  |  >1-2% = high risk", C.medBg, C.white, 10);
  sl.addShape(pres.shapes.LINE, { x: 2.15, y: 4.15, w: 0.01, h: 0.25, line: { color: C.midGray, width: 1.5, endArrowType: "arrow" } });
  box(0.4, 4.4, 3.5, 0.65, "Assess for Severe Malaria Criteria\n(any 1 = SEVERE → ICU + IV Artesunate)", C.accent, C.white, 10);

  // Right branch steps
  box(6.1, 2.9, 3.5, 0.5, "Repeat Smear every 12-24h\n(minimum 3 smears over 72h)", C.darkBg, C.white, 10);
  sl.addShape(pres.shapes.LINE, { x: 7.85, y: 3.4, w: 0.01, h: 0.25, line: { color: C.midGray, width: 1.5, endArrowType: "arrow" } });
  box(6.1, 3.65, 3.5, 0.5, "Consider PCR for low-density\nor mixed infection", "1B3A5C", C.white, 10);
  sl.addShape(pres.shapes.LINE, { x: 7.85, y: 4.15, w: 0.01, h: 0.25, line: { color: C.midGray, width: 1.5, endArrowType: "arrow" } });
  box(6.1, 4.4, 3.5, 0.65, "If all negative at 72h:\nSeek alternative fever diagnosis", C.accentGr, C.darkBg, 10);

  // Center label
  sl.addText("NEVER DELAY TREATMENT if high clinical suspicion with positive RDT — treat while awaiting confirmatory smear", {
    x: 3.85, y: 2.9, w: 2.2, h: 1.7, fontSize: 9, color: C.accentOr, align: "center", valign: "middle",
    italic: true, bold: true,
  });

  slideNum(sl, 5);
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 6 — ICU MANAGEMENT & MONITORING
// ═══════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  lightSlide(sl);
  accentBar(sl, "STEP 4 — ICU MANAGEMENT: Monitoring & Supportive Care", C.medBg);

  // Left panel — monitoring
  sl.addShape(pres.shapes.RECTANGLE, { x: 0.25, y: 0.65, w: 4.6, h: 4.7,
    fill: { color: C.lightGray }, line: { color: C.medBg, width: 1.5 }
  });
  sl.addText("Bedside Monitoring Protocol", {
    x: 0.35, y: 0.7, w: 4.4, h: 0.45, fontSize: 13, bold: true, color: C.medBg,
  });

  const monItems = [
    { freq: "Continuous", items: "ECG, SpO₂, arterial line BP, temp" },
    { freq: "Every Hour", items: "GCS, urine output (target ≥0.5 mL/kg/h), fluid balance" },
    { freq: "Every 6 Hours", items: "Blood glucose (treat if <2.2 mmol/L), parasitemia %" },
    { freq: "Every 12 Hours", items: "CBC, ABG / lactate, RFT, electrolytes" },
    { freq: "Every 24 Hours", items: "LFT, coagulation panel (PT, aPTT, fibrinogen)" },
    { freq: "Twice Daily", items: "Blood smears for parasite count and stage" },
  ];
  monItems.forEach((item, i) => {
    const yy = 1.22 + i * 0.67;
    sl.addShape(pres.shapes.RECTANGLE, { x: 0.32, y: yy, w: 1.45, h: 0.55,
      fill: { color: C.medBg }, line: { color: C.medBg }
    });
    sl.addText(item.freq, { x: 0.32, y: yy, w: 1.45, h: 0.55, fontSize: 9.5, bold: true, color: C.white, align: "center", valign: "middle" });
    sl.addText(item.items, { x: 1.82, y: yy, w: 2.9, h: 0.55, fontSize: 10, color: C.textDark, valign: "middle" });
  });

  // Right panel — supportive care
  sl.addShape(pres.shapes.RECTANGLE, { x: 5.1, y: 0.65, w: 4.6, h: 4.7,
    fill: { color: C.lightGray }, line: { color: C.accent, width: 1.5 }
  });
  sl.addText("Supportive Care Priorities", {
    x: 5.2, y: 0.7, w: 4.4, h: 0.45, fontSize: 13, bold: true, color: C.accent,
  });

  const supportItems = [
    ["Airway & Breathing", "Intubate if GCS ≤8 or respiratory failure. ARDS: lung-protective ventilation (6 mL/kg tidal volume), PEEP. Supplemental O₂ target SpO₂ ≥95%."],
    ["Fluid Management", "NOT like sepsis — avoid aggressive fluid boluses (risk of pulmonary edema). Use cautious fluid replacement. Treat hypovolemia gently with balanced crystalloid."],
    ["Seizure Control", "IV/rectal benzodiazepine acutely. Levetiracetam preferred for ongoing control. Avoid full phenobarbital load (20 mg/kg) if respiratory support unavailable."],
    ["Blood Transfusion", "Transfuse packed RBCs if Hct <20% (or Hb <7 g/dL; use 15% threshold in high-burden settings). Transfuse slowly with cardiac monitoring."],
    ["Hypoglycemia", "Bolus 25-50% dextrose IV, then continuous 10% dextrose infusion. Monitor BGL every 6h minimum."],
    ["Avoid These!", "Corticosteroids (no benefit; may worsen coma duration). NSAIDs (bleeding risk). Exchange transfusion (no proven benefit per Red Book 2021)."],
  ];
  supportItems.forEach(([title, desc], i) => {
    const yy = 1.22 + i * 0.67;
    const col = i === 5 ? C.accent : C.accentGr;
    sl.addShape(pres.shapes.RECTANGLE, { x: 5.18, y: yy, w: 1.8, h: 0.55,
      fill: { color: col }, line: { color: col }
    });
    sl.addText(title, { x: 5.18, y: yy, w: 1.8, h: 0.55, fontSize: 9, bold: true, color: C.white, align: "center", valign: "middle" });
    sl.addText(desc, { x: 7.05, y: yy, w: 2.55, h: 0.55, fontSize: 8.5, color: C.textDark, valign: "middle" });
  });

  slideNum(sl, 6);
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 7 — TREATMENT PROTOCOLS (WITH DRUG DIAGRAM)
// ═══════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  darkSlide(sl);
  accentBar(sl, "STEP 5 — TREATMENT PROTOCOL: Antimalarial Therapy", C.accentGr);

  // Drug life cycle image
  if (drugImg.base64) {
    sl.addImage({ data: drugImg.base64, x: 0.2, y: 0.65, w: 3.8, h: 2.6 });
    sl.addText("Drug targets across the malaria life cycle", {
      x: 0.2, y: 3.2, w: 3.8, h: 0.3, fontSize: 8.5, color: C.midGray, italic: true, align: "center"
    });
  }

  // Treatment table
  const rows = [
    { scenario: "Severe P. falciparum\n(any severity criterion)", drug: "IV Artesunate", dose: "2.4 mg/kg IV at 0, 12, 24h then daily", notes: "First-line. Safe in pregnancy. Does not need dose adjustment for renal/hepatic failure.", color: C.accent },
    { scenario: "Severe malaria\n(artesunate unavailable)", drug: "IV Quinine", dose: "20 mg/kg loading, then 10 mg/kg q8h by rate-controlled infusion", notes: "Dangerous if rapid bolus → hypotension. Reduce dose by 30-50% after day 2 in renal failure.", color: C.accentOr },
    { scenario: "Step-down therapy\n(once oral tolerated)", drug: "Artemether-\nLumefantrine (AL)", dose: "1 tab twice daily × 3 days (weight-based dosing in children)", notes: "Complete full 3-day ACT course after IV. Avoid mefloquine as follow-on (neurologic risk).", color: C.accentGr },
    { scenario: "P. vivax / P. ovale\n(add for relapse prevention)", drug: "Primaquine", dose: "0.25 mg/kg/day × 14 days (0.5 mg/kg in SE Asia)", notes: "CHECK G6PD FIRST. Tafenoquine 300 mg single dose = alternative if G6PD normal.", color: C.medBg },
  ];

  rows.forEach((row, i) => {
    const yy = 0.72 + i * 1.12;
    // Scenario box
    sl.addShape(pres.shapes.RECTANGLE, { x: 4.15, y: yy, w: 2.05, h: 0.95, fill: { color: row.color }, line: { color: row.color } });
    sl.addText(row.scenario, { x: 4.15, y: yy, w: 2.05, h: 0.95, fontSize: 9.5, color: C.white, bold: true, align: "center", valign: "middle" });
    // Drug name
    sl.addShape(pres.shapes.RECTANGLE, { x: 6.25, y: yy, w: 1.65, h: 0.95, fill: { color: "111C2B" }, line: { color: row.color, width: 2 } });
    sl.addText(row.drug, { x: 6.25, y: yy, w: 1.65, h: 0.95, fontSize: 10, color: row.color, bold: true, align: "center", valign: "middle" });
    // Dose
    sl.addShape(pres.shapes.RECTANGLE, { x: 7.95, y: yy, w: 2.0, h: 0.95, fill: { color: "111C2B" }, line: { color: "334455", width: 1 } });
    sl.addText(row.dose, { x: 8.0, y: yy, w: 1.9, h: 0.95, fontSize: 8.5, color: C.white, valign: "middle" });
    // Notes below
    sl.addShape(pres.shapes.RECTANGLE, { x: 4.15, y: yy + 0.95, w: 5.8, h: 0.15, fill: { color: "111C2B" }, line: { color: "111C2B" } });
    sl.addText(`  📌 ${row.notes}`, { x: 4.15, y: yy + 0.96, w: 5.8, h: 0.13, fontSize: 8, color: C.midGray, italic: true });
  });

  slideNum(sl, 7);
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 8 — COMPLICATION-SPECIFIC MANAGEMENT
// ═══════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  lightSlide(sl);
  accentBar(sl, "STEP 6 — COMPLICATION-SPECIFIC MANAGEMENT", C.accent);

  const cards = [
    {
      title: "Cerebral Malaria",
      icon: "🧠",
      color: C.accent,
      points: [
        "IV artesunate — first line",
        "Levetiracetam for seizures (not phenobarbital if no ventilator)",
        "Head of bed at 30° if raised ICP suspected",
        "NO steroids — worsen outcome",
        "Avoid hypoglycemia, hyperpyrexia, hypoxia",
        "LP if CSF normal → rule out bacterial meningitis",
      ],
    },
    {
      title: "Severe Anemia",
      icon: "🩸",
      color: C.accentOr,
      points: [
        "Transfuse pRBCs if Hct <20% (Hb <7 g/dL)",
        "Transfuse slowly — risk of pulmonary edema",
        "15% threshold acceptable in resource-limited settings",
        "Children with Hb <4 g/dL + acidotic breathing → immediate transfusion",
        "Monitor for post-transfusion fluid overload",
      ],
    },
    {
      title: "AKI / Renal Failure",
      icon: "🫘",
      color: C.accentGr,
      points: [
        "Monitor creatinine ≥ daily",
        "Avoid NSAIDs, nephrotoxins",
        "Cautious fluid management (not aggressive resuscitation)",
        "Hemodialysis / CRRT for persistent AKI or fluid overload",
        "If quinine used: reduce maintenance dose 30-50% after day 2",
      ],
    },
    {
      title: "Pulmonary Edema / ARDS",
      icon: "🫁",
      color: C.medBg,
      points: [
        "Lung-protective ventilation (6 mL/kg, PEEP titration)",
        "Fluid restriction — ARDS risk worsens with excess fluid",
        "Target SpO₂ ≥95% with supplemental O₂",
        "Prone positioning if severe ARDS (P/F ratio <150)",
        "Screen for aspiration pneumonia",
      ],
    },
    {
      title: "Hypoglycemia",
      icon: "🍬",
      color: C.accentOr,
      points: [
        "BGL <2.2 mmol/L = emergency → IV 50% dextrose bolus",
        "Continuous 10% dextrose infusion thereafter",
        "Check BGL every 6h in all severe malaria",
        "Especially in: pregnant women, children, quinine users",
        "Quinine → hyperinsulinemia → recurrent hypoglycemia",
      ],
    },
    {
      title: "Blackwater Fever",
      icon: "🖤",
      color: C.textDark,
      points: [
        "Massive intravascular hemolysis → hemoglobinuria",
        "Monitor renal function hourly",
        "Maintain high urine output (forced diuresis if needed)",
        "Transfuse for severe hemolytic anemia",
        "Switch from quinine if quinine-triggered; use artesunate",
      ],
    },
  ];

  cards.forEach((card, i) => {
    const col = i % 3;
    const row = Math.floor(i / 3);
    const cx = 0.28 + col * 3.24;
    const cy = 0.7 + row * 2.35;

    sl.addShape(pres.shapes.RECTANGLE, { x: cx, y: cy, w: 3.1, h: 2.2,
      fill: { color: C.lightGray }, line: { color: card.color, width: 2 }
    });
    sl.addShape(pres.shapes.RECTANGLE, { x: cx, y: cy, w: 3.1, h: 0.42,
      fill: { color: card.color }, line: { color: card.color }
    });
    sl.addText(`${card.icon}  ${card.title}`, { x: cx, y: cy, w: 3.1, h: 0.42,
      fontSize: 11, bold: true, color: C.white, align: "center", valign: "middle"
    });

    card.points.forEach((pt, pi) => {
      sl.addShape(pres.shapes.RECTANGLE, { x: cx + 0.12, y: cy + 0.5 + pi * 0.28, w: 0.14, h: 0.14,
        fill: { color: card.color }, line: { color: card.color }
      });
      sl.addText(pt, { x: cx + 0.32, y: cy + 0.46 + pi * 0.28, w: 2.7, h: 0.28,
        fontSize: 8.8, color: C.textDark, valign: "middle"
      });
    });
  });

  slideNum(sl, 8);
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 9 — SPECIAL POPULATIONS
// ═══════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  darkSlide(sl);
  accentBar(sl, "STEP 7 — SPECIAL POPULATIONS & DRUG CONSIDERATIONS", C.accentOr);

  const pops = [
    {
      group: "Pregnant Women",
      color: C.accentOr,
      points: [
        "IV artesunate = preferred for severe malaria in ALL trimesters",
        "ACT (artemether-lumefantrine) safe in 2nd & 3rd trimester",
        "1st trimester: artesunate preferred over quinine if both available",
        "Avoid: primaquine (teratogenic), doxycycline (fetal bone/teeth)",
        "P. falciparum sequesters in placenta → IUGR, maternal anemia, preterm birth",
        "Monitor BGL every 4h (higher hypoglycemia risk in pregnancy)",
      ],
    },
    {
      group: "Children (Pediatric)",
      color: C.accentGr,
      points: [
        "IV artesunate: weight-based dosing (2.4 mg/kg at 0, 12, 24h, then daily)",
        "Children <20 kg: consider higher mg/kg dosing (discuss with ID/Tropical Med)",
        "Artemether-lumefantrine oral step-down: weight-based tablet dosing",
        "Severe anemia (Hb <4 g/dL) + acidotic breathing → immediate transfusion",
        "Cerebral malaria: highest burden in children <5 in Africa",
        "Phenobarbital loading: DO NOT give full 20 mg/kg without ventilator support",
      ],
    },
    {
      group: "G6PD Deficiency",
      color: C.accent,
      points: [
        "SCREEN ALL patients before giving primaquine or tafenoquine",
        "Mild G6PD deficiency: primaquine 0.75 mg/kg once weekly × 8 weeks",
        "Severe G6PD deficiency: primaquine CONTRAINDICATED",
        "Tafenoquine: CONTRAINDICATED in any G6PD deficiency",
        "Artesunate, ACTs, chloroquine, quinine: safe in G6PD deficiency",
        "Hemolytic anemia + methemoglobinemia = signs of toxicity",
      ],
    },
  ];

  pops.forEach((pop, i) => {
    const cx = 0.25 + i * 3.25;
    sl.addShape(pres.shapes.RECTANGLE, { x: cx, y: 0.65, w: 3.1, h: 4.65,
      fill: { color: "111C2B" }, line: { color: pop.color, width: 2.5 }
    });
    sl.addShape(pres.shapes.RECTANGLE, { x: cx, y: 0.65, w: 3.1, h: 0.5,
      fill: { color: pop.color }, line: { color: pop.color }
    });
    sl.addText(pop.group, { x: cx, y: 0.65, w: 3.1, h: 0.5,
      fontSize: 12, bold: true, color: C.white, align: "center", valign: "middle"
    });
    pop.points.forEach((pt, pi) => {
      sl.addShape(pres.shapes.RECTANGLE, { x: cx + 0.15, y: 1.25 + pi * 0.62, w: 0.16, h: 0.16,
        fill: { color: pop.color }, line: { color: pop.color }
      });
      sl.addText(pt, { x: cx + 0.38, y: 1.2 + pi * 0.62, w: 2.6, h: 0.58,
        fontSize: 9.5, color: C.white, valign: "middle", lineSpacingMultiple: 1.2
      });
    });
  });

  slideNum(sl, 9);
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 10 — RESPONSE ASSESSMENT & DISCHARGE CRITERIA
// ═══════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  lightSlide(sl);
  accentBar(sl, "STEP 8 — TREATMENT RESPONSE & DISCHARGE CRITERIA", C.accentGr);

  // Response column
  sl.addShape(pres.shapes.RECTANGLE, { x: 0.28, y: 0.65, w: 4.5, h: 4.65,
    fill: { color: C.lightGray }, line: { color: C.accentGr, width: 1.5 }
  });
  sl.addText("Assessing Treatment Response", {
    x: 0.38, y: 0.7, w: 4.3, h: 0.45, fontSize: 13, bold: true, color: C.accentGr,
  });

  const responseItems = [
    ["Parasitemia Clearance", "Expected: 50% reduction in parasitemia within 24h with artesunate. Full clearance by 72h. If NOT clearing → suspect partial artemisinin resistance (kelch13 mutation). Notify public health."],
    ["Fever Clearance", "Fever typically clears within 24-48h. Persistent fever with clearing parasitemia may reflect inflammatory response — not treatment failure."],
    ["Consciousness Recovery", "GCS should improve within 24-48h of treatment. Prolonged coma despite parasite clearance = post-malaria neurological syndrome (PMNS)."],
    ["Lab Normalization", "Creatinine, BGL, LFTs, Hb typically improve over 3-7 days. Platelet recovery lags (may take 1-2 weeks). Hb nadir may occur 7-10 days post-artesunate (delayed hemolysis)."],
    ["Oral Transition", "Switch IV → oral ACT once: patient conscious, tolerating oral fluids, parasitemia <1%, afebrile ≥24h."],
  ];

  responseItems.forEach(([title, desc], i) => {
    const yy = 1.22 + i * 0.82;
    sl.addShape(pres.shapes.RECTANGLE, { x: 0.35, y: yy, w: 0.25, h: 0.25,
      fill: { color: C.accentGr }, line: { color: C.accentGr }
    });
    sl.addText(title, { x: 0.68, y: yy - 0.02, w: 3.95, h: 0.3, fontSize: 11, bold: true, color: C.medBg });
    sl.addText(desc, { x: 0.42, y: yy + 0.28, w: 4.25, h: 0.48, fontSize: 9.2, color: C.textDark, lineSpacingMultiple: 1.2 });
  });

  // Discharge & follow-up column
  sl.addShape(pres.shapes.RECTANGLE, { x: 5.0, y: 0.65, w: 4.7, h: 2.25,
    fill: { color: C.lightGray }, line: { color: C.accentGr, width: 1.5 }
  });
  sl.addText("Discharge Criteria", {
    x: 5.1, y: 0.7, w: 4.5, h: 0.45, fontSize: 13, bold: true, color: C.accentGr,
  });
  const dischargeCriteria = [
    "✓ Completed full 3-day oral ACT course",
    "✓ No detectable parasitemia on smear for ≥24h",
    "✓ Afebrile for >24h without antipyretics",
    "✓ GCS 15/15, no neurological deficit",
    "✓ Tolerating oral medications and fluids",
    "✓ Renal, hepatic, glucose parameters stable",
    "✓ Hb ≥7 g/dL and stable (not dropping)",
  ];
  sl.addText(dischargeCriteria.join("\n"), {
    x: 5.1, y: 1.2, w: 4.5, h: 1.6, fontSize: 10.5, color: C.textDark, lineSpacingMultiple: 1.35,
  });

  // Follow-up
  sl.addShape(pres.shapes.RECTANGLE, { x: 5.0, y: 3.05, w: 4.7, h: 2.25,
    fill: { color: C.lightGray }, line: { color: C.accentOr, width: 1.5 }
  });
  sl.addText("Follow-Up & Relapse Prevention", {
    x: 5.1, y: 3.1, w: 4.5, h: 0.45, fontSize: 13, bold: true, color: C.accentOr,
  });
  const followUp = [
    "• P. vivax / P. ovale: ADD primaquine or tafenoquine for radical cure (G6PD screen first) — prevents hypnozoite relapse",
    "• Delayed hemolysis: warn patient about Hb drop at days 7-10 post-artesunate; recheck CBC at 1 week",
    "• Outpatient review in 1 week with repeat blood film",
    "• Report all malaria cases to public health authority",
    "• Travel counseling: prophylaxis, nets, repellents for future trips",
  ];
  sl.addText(followUp.join("\n"), {
    x: 5.1, y: 3.58, w: 4.5, h: 1.62, fontSize: 9.8, color: C.textDark, lineSpacingMultiple: 1.3,
  });

  slideNum(sl, 10);
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 11 — QUICK REFERENCE SUMMARY
// ═══════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  darkSlide(sl);
  accentBar(sl, "QUICK REFERENCE — One-Glance Summary Card", C.accent);

  // Left quick checklist
  sl.addShape(pres.shapes.RECTANGLE, { x: 0.28, y: 0.65, w: 4.6, h: 4.65,
    fill: { color: "111C2B" }, line: { color: C.accentGr, width: 2 }
  });
  sl.addText("⚡ Management Checklist", {
    x: 0.38, y: 0.72, w: 4.4, h: 0.45, fontSize: 13, bold: true, color: C.accentGr,
  });
  const checklist = [
    ["Airway / O₂", "Secure airway, SpO₂ ≥95%"],
    ["IV Access", "2 large-bore IVs; send bloods"],
    ["Blood Film + RDT", "STAT — do not wait for results to start if high suspicion"],
    ["Blood Glucose", "STAT — treat hypoglycemia immediately"],
    ["IV Artesunate", "2.4 mg/kg IV at 0h (THEN 12h, 24h, then daily)"],
    ["Fluid Balance", "Cautious — not aggressive; avoid fluid overload"],
    ["Seizures", "IV benzos → levetiracetam; no phenobarbital without ventilator"],
    ["Monitor Parasitemia", "Every 12h smear; look for clearance"],
    ["NO Steroids", "Contraindicated in cerebral malaria"],
    ["Notify", "Public health reporting; consider ID/Tropical Med consult"],
  ];
  checklist.forEach(([step, detail], i) => {
    const yy = 1.22 + i * 0.4;
    sl.addShape(pres.shapes.RECTANGLE, { x: 0.35, y: yy + 0.07, w: 1.1, h: 0.27,
      fill: { color: i === 8 ? C.accent : C.accentGr }, line: { color: i === 8 ? C.accent : C.accentGr }
    });
    sl.addText(step, { x: 0.35, y: yy + 0.07, w: 1.1, h: 0.27, fontSize: 8.5, bold: true, color: C.white, align: "center", valign: "middle" });
    sl.addText(detail, { x: 1.5, y: yy + 0.07, w: 3.25, h: 0.27, fontSize: 9, color: C.white, valign: "middle" });
  });

  // Right — antimalarials quick ref
  sl.addShape(pres.shapes.RECTANGLE, { x: 5.1, y: 0.65, w: 4.6, h: 4.65,
    fill: { color: "111C2B" }, line: { color: C.accentOr, width: 2 }
  });
  sl.addText("💊 Antimalarial Quick Reference", {
    x: 5.2, y: 0.72, w: 4.4, h: 0.45, fontSize: 13, bold: true, color: C.accentOr,
  });

  const drugRef = [
    { drug: "IV Artesunate", dose: "2.4 mg/kg IV @ 0, 12, 24h then daily", use: "Severe malaria — 1st line", color: C.accent },
    { drug: "IV Quinine", dose: "20 mg/kg loading, 10 mg/kg q8h", use: "If artesunate unavailable", color: C.accentOr },
    { drug: "Artemether-\nLumefantrine", dose: "4 tablets BD × 3 days (adult)", use: "Oral step-down / uncomplicated", color: C.accentGr },
    { drug: "Primaquine", dose: "0.25 mg/kg/day × 14d", use: "Vivax/Ovale radical cure (G6PD check!)", color: C.medBg },
    { drug: "Tafenoquine", dose: "300 mg single dose", use: "Vivax/Ovale radical cure — G6PD normal only", color: C.midGray },
    { drug: "Atovaquone-\nProguanil", dose: "4 adult tabs daily × 3 days", use: "Uncomplicated falciparum / prophylaxis", color: C.accentGr },
  ];
  drugRef.forEach((d, i) => {
    const yy = 1.22 + i * 0.68;
    sl.addShape(pres.shapes.RECTANGLE, { x: 5.18, y: yy, w: 1.4, h: 0.58,
      fill: { color: d.color }, line: { color: d.color }
    });
    sl.addText(d.drug, { x: 5.18, y: yy, w: 1.4, h: 0.58, fontSize: 9, bold: true, color: C.white, align: "center", valign: "middle" });
    sl.addShape(pres.shapes.RECTANGLE, { x: 6.63, y: yy, w: 1.6, h: 0.58,
      fill: { color: "1B3A5C" }, line: { color: "334455", width: 1 }
    });
    sl.addText(d.dose, { x: 6.68, y: yy, w: 1.5, h: 0.58, fontSize: 8.5, color: C.white, valign: "middle" });
    sl.addShape(pres.shapes.RECTANGLE, { x: 8.28, y: yy, w: 1.35, h: 0.58,
      fill: { color: "0D1B2A" }, line: { color: "334455", width: 1 }
    });
    sl.addText(d.use, { x: 8.3, y: yy, w: 1.3, h: 0.58, fontSize: 8, color: C.midGray, valign: "middle" });
  });

  slideNum(sl, 11);
}

// ═══════════════════════════════════════════════════════════════════════════
// SLIDE 12 — CLOSING / SOURCES
// ═══════════════════════════════════════════════════════════════════════════
{
  const sl = pres.addSlide();
  darkSlide(sl);

  sl.addShape(pres.shapes.RECTANGLE, { x: 0, y: 0, w: 10, h: 0.12, fill: { color: C.accent }, line: { color: C.accent } });

  sl.addText("Key References", {
    x: 0.6, y: 0.4, w: 8.8, h: 0.65, fontSize: 28, bold: true, color: C.white,
  });
  sl.addShape(pres.shapes.RECTANGLE, { x: 0.6, y: 1.08, w: 4, h: 0.04, fill: { color: C.midGray }, line: { color: C.midGray } });

  const refs = [
    "Harrison's Principles of Internal Medicine, 22nd Edition (2025) — Chapter 231: Malaria",
    "Robbins & Kumar Basic Pathology — Chapter 10: Infectious Diseases",
    "Lippincott Illustrated Reviews: Pharmacology — Chapter 35: Antiprotozoal Drugs",
    "Murray & Nadel's Textbook of Respiratory Medicine — Pulmonary Manifestations of Malaria",
    "Adams & Victor's Principles of Neurology, 12th Edition — Cerebral Malaria",
    "Red Book 2021: Report of the Committee on Infectious Diseases (AAP)",
    "WHO Guidelines for Malaria, November 2024 (MAGICapp)",
    "Bohissou et al. (2025). ACT efficacy in sub-Saharan Africa 2010-2024. BMC Infect Dis [PMID 41291512]",
    "Yilma et al. (2025). Single-dose primaquine for P. falciparum transmission. Lancet Infect Dis [PMID 40286803]",
  ];
  refs.forEach((ref, i) => {
    sl.addShape(pres.shapes.RECTANGLE, { x: 0.6, y: 1.2 + i * 0.44, w: 0.22, h: 0.22,
      fill: { color: C.accentOr }, line: { color: C.accentOr }
    });
    sl.addText(ref, { x: 0.9, y: 1.18 + i * 0.44, w: 8.7, h: 0.42,
      fontSize: 10.5, color: C.white, valign: "middle"
    });
  });

  sl.addShape(pres.shapes.RECTANGLE, { x: 0, y: 5.32, w: 10, h: 0.305, fill: { color: C.medBg }, line: { color: C.medBg } });
  sl.addText("ORRIS CLINICAL SERIES  •  Severe Malaria Workup Guide  •  For educational purposes only — always follow local institutional protocols", {
    x: 0.3, y: 5.32, w: 9.4, h: 0.305, fontSize: 8.5, color: C.midGray, valign: "middle", align: "center", margin: 0,
  });
}

// ─── Write file ─────────────────────────────────────────────────────────────
pres.writeFile({ fileName: "/home/daytona/workspace/severe-malaria-guide/Severe_Malaria_Workup_Guide.pptx" })
  .then(() => console.log("✅ PPTX saved successfully"))
  .catch(err => { console.error("❌ Error:", err); process.exit(1); });
Running Command

cd /home/daytona/workspace/severe-malaria-guide && node build.js 2>&1

Running Command

cd /home/daytona/workspace/severe-malaria-guide && \ node -e " const { execSync …

Running Command

cd /home/daytona/workspace/severe-malaria-guide && \ curl -s -o lifecycle.png "h…

Editing File

~/severe-malaria-guide/build.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/severe-malaria-guide/build.js'
Editing File

~/severe-malaria-guide/build.js

Successfully replaced 1 instance(s) of the string in '/home/daytona/workspace/severe-malaria-guide/build.js'
Editing File

~/severe-malaria-guide/build.js

Error: String not found in file: '  // Blood smear image small
  if (smearImg.base64) {
    sl.addImage({ data: smearImg.base64, x: 0.35, y: 4.55, w: 2.6, h: 0.95 });
  }'
Running Command

grep -n "smearImg\|drugImg\|lifecycleImg" /home/daytona/workspace/severe-malaria…

Running Command

sed -i 's/if (smearImg\.base64) {/\/\/ smear image/g; s/ sl\.addImage({ data:…

Running Command

cd /home/daytona/workspace/severe-malaria-guide && \ python3 -c " txt = open('bu…

Running Command

cd /home/daytona/workspace/severe-malaria-guide && \ python3 -c " txt = open('bu…

Model call limits exceeded: run limit (20/20)
This is a shared conversation. Sign in to Orris to start your own chat.