Management of vit d deficiency according standard

Reading File
Vitamin D deficiency management involves correcting serum 25(OH)D levels with supplementation - typically cholecalciferol (D3) or ergocalciferol (D2). Regimens vary by severity: deficiency (<20 ng/mL) usually requires loading doses of 50,000 IU weekly for 8-12 weeks, followed by maintenance of 1,500-2,000 IU/day. Insufficiency (20-29 ng/mL) may need 1,500-2,000 IU/day directly.
Searching sources...
Finding Sources
Searching PubMed

"vitamin D deficiency" AND treatment guidelines

Finding Sources
Reading Article

PMID: 38828931

Reading File
Finding Sources
Reading File
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Finding Sources
I now have comprehensive information from Harrison's Principles of Internal Medicine (22E), the Harriet Lane Handbook (23E), and the 2024 Endocrine Society Clinical Practice Guideline. Let me compile the full answer.

Management of Vitamin D Deficiency - Standard Guidelines

1. Diagnosis and Classification

Status25(OH)D Level
Sufficiency>50 nmol/L (>20 ng/mL) per National Academy of Medicine
Insufficiency12-20 ng/mL
Deficiency<12 ng/mL (severe: <5 ng/mL)
Higher levels (>30 ng/mL) may be needed in elderly, obese patients, or those with malabsorptive conditions to optimize intestinal calcium absorption.

2. General Principles

  • Treatment should be directed at the underlying disorder (e.g., malabsorption, sun avoidance, medications) and tailored to severity.
  • Vitamin D must always be repleted alongside calcium supplementation because most consequences of deficiency result from impaired mineral ion homeostasis.
  • Calcium supplementation: 1.5-2 g/day of elemental calcium.
  • Normocalcemia is usually restored within 1 week of starting therapy; PTH and alkaline phosphatase may remain elevated for 3-6 months.
(Harrison's Principles of Internal Medicine 22E)

3. Treatment Regimens

Standard Adults (Intact 1-hydroxylation pathway)

IndicationRepletion PhaseMaintenance
Vitamin D deficiencyCholecalciferol (D3) or ergocalciferol (D2) 50,000 IU weekly x 3-12 weeks800 IU daily
Drug-induced increased metabolism (phenytoin, barbiturates, rifampin)Pharmacologic doses - higher amounts neededHigher maintenance required

Pediatric Dosing (Harriet Lane Handbook 23E)

Without cystic fibrosis or malabsorptive conditions:
AgeInsufficiency (12-<20 ng/mL)Deficiency (<12 ng/mL)
<1 year1,000 IU once daily2,000-4,000 IU once daily
≥1 year2,000 IU once daily5,000-6,000 IU once daily OR 50,000 IU once weekly
With non-cystic fibrosis malabsorptive conditions:
AgeInsufficiencyDeficiency
<10 years2,000 IU once daily5,000 IU once daily
≥10 years4,000-6,000 IU once daily10,000 IU once daily OR 50,000 IU once weekly
Cystic fibrosis:
AgeInsufficiency (20-<30 ng/mL)Deficiency (<20 ng/mL)
<1 year2,000 IU once daily5,000 IU once daily
1-<10 years6,000 IU once daily50,000 IU once daily x 1 month, then 10,000 IU/day or 50,000 IU weekly
≥10 years10,000 IU once daily50,000 IU once daily x 1 month, then 10,000 IU/day or 50,000 IU weekly

Pediatric - CKD Stages 2-5 (25-OH vitamin D <30 ng/mL)

25-OH LevelRegimen
<5 ng/mL8,000 IU/day x 4 wk, then 4,000 IU/day x 2 months; OR 50,000 IU weekly x 4 wk, then 50,000 IU twice monthly x 3 months
5-15 ng/mL4,000 IU/day x 12 wk; OR 50,000 IU every other week x 12 wk
16-30 ng/mL2,000 IU/day x 3 months; OR 50,000 IU monthly x 3 months
Maintenance (after repletion)200-1,000 IU once daily
(Harriet Lane Handbook 23E)

Nutritional Rickets (Children and Adults)

  • 2,000-5,000 IU/day x 6-12 weeks with calcium supplementation
  • Decrease to maintenance once radiologically proven healing is achieved
    • Infant maintenance: 400 IU/day
    • Child/Adolescent maintenance: 600 IU/day

4. When 1-hydroxylation Is Impaired (Renal Disease, Specific Enzyme Defects)

Use active metabolites that bypass the kidney activation step:
DrugDose
Calcitriol (1,25(OH)2D)0.25-0.5 mcg/day
Doxercalciferol (1α-hydroxyvitamin D2)2.5-5 mcg/day
Alfacalcidol (1α-hydroxyvitamin D3, "One-Alpha")0.25-1.0 mcg/day
(Harrison's Principles of Internal Medicine 22E)

5. Malabsorption States

Large doses are required:
  • Child: 10,000-25,000 IU/day
  • Adult: 10,000-300,000 IU/day PO
(Harriet Lane Handbook 23E)

6. Monitoring

  • Serum and urinary calcium are the most effective monitoring tools.
  • Target 24-hour urinary calcium: 100-250 mg/24 hours
    • <100 mg/24h: suspect non-adherence or malabsorption
    • 250 mg/24h: risk of nephrolithiasis - reduce dose
  • Monitor serum 25-OH vitamin D and corrected calcium/phosphorus 1 month after initiation, then every 3 months.

7. Supplementation for Prevention (General Population)

  • Recommended for:
    • Children and adolescents (1-18 years) - prevents rickets, may reduce respiratory tract infections
    • Adults ≥75 years - may lower mortality risk
    • Pregnant individuals - may reduce preeclampsia, preterm birth, intra-uterine mortality, neonatal mortality
    • High-risk prediabetes - may reduce progression to diabetes
  • Not recommended for routine empiric supplementation above DRI in healthy adults <75 years without established deficiency
  • For non-pregnant people >50 years requiring vitamin D: prefer daily dosing over intermittent high-dose boluses (which paradoxically can increase fall and fracture risk)

8. Safety

  • Vitamin D toxicity is rare and usually only seen at doses >40,000 IU/day
  • The safety margin is wide; standard therapeutic doses are safe

Key Drug Interactions

Drugs that increase vitamin D catabolism via CYP3A4 induction and may require higher doses:
  • Phenytoin
  • Barbiturates
  • Rifampin
(Harrison's Principles of Internal Medicine 22E)

Management , prevention, and lifestyle modification of osteoarthritis and gout

Reading File
This is a broad clinical question covering two conditions. I'll search both in parallel across headings and paragraphs.
Searching sources...
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Good start. Now I need the actual treatment/management sections of both. Let me read more of the gout chapter and find the osteoarthritis management content.
Reading File
Finding Sources
Reading File
Reading File
I found the OA treatment section. Let me read it fully and also get the gout treatment section.
Reading File
Reading File
Excellent - gout treatment starts at line 559. Let me read it fully, plus complete the OA treatment section.
Reading File
Reading File
I need to read the full OA treatment section and the gout table on lifestyle/diet + urate-lowering therapy section.
Reading File
Reading File
I now have rich content for both conditions. Let me get one more read to capture OA surgical options and gout prevention completion.
Reading File
Reading File
Searching PubMed

"osteoarthritis" AND management guidelines

Searching PubMed

"gout" AND treatment guidelines

I now have comprehensive information from Goldman-Cecil Medicine on both conditions, including the ACR lifestyle/diet table for gout, OA treatment/prevention/exercise tables, and gout pharmacotherapy. Let me compile the final comprehensive answer.---

Osteoarthritis (OA) - Management, Prevention & Lifestyle

Definition

Osteoarthritis is characterized by failed repair of synovial joint tissues after intra-articular stress, resulting in cartilage/bone breakdown, pain, stiffness, and functional disability. It affects >50 million people worldwide, with women disproportionately affected.

Management

Step 1: Core / Non-Pharmacologic Interventions (First-Line, Mainstay)

Active, non-pharmacologic interventions should always be tried first, followed by or in concert with medications. These include:
Core TreatmentKey Points
Patient educationUnderstanding disease, treatment options, benefits/harms, self-management
Weight managementLose 5-10% of body weight as a starting point; greater loss = greater benefit. Aim for BMI <25 kg/m²
Therapeutic exercisePlanned, structured activities (see table below)
General physical activityWalking, cycling, swimming, gardening, dancing
Behavior change supportReferral to physiotherapist, dietician, or exercise specialist

Exercise Types for OA (Goldman-Cecil Medicine 26E)

TypeHandKneeHipExamples
General physical activity+++Walking, cycling, gardening, dancing
Aerobic exercise-++Running, stationary cycling, power walking
Strengthening+++Squats, seated knee extension, resistance bands
Neuromuscular/balance-++Wobble boards, single-leg balancing
Tai chi and yoga-++Mind-body focus, coordination, mindfulness
Joint mobility/stability+++Tailored range-of-motion exercises
Water-based exercise-++Aqua aerobics, hydrotherapy, swimming
Clinicians should prioritize interventions that are safe, accessible, and cost-effective.

Step 2: Pharmacologic Treatment

DrugRecommendationNotes
Topical NSAIDs (e.g., diclofenac gel)First-line preferred over oralSafer systemic profile
Oral NSAIDsRecommended (AAOS)Use lowest dose, shortest duration; avoid in renal disease, peptic ulcer, anticoagulation
Acetaminophen (paracetamol)Recommended (AAOS)Adjunct or alternative to NSAIDs
Oral corticosteroids (prednisolone 10 mg/day)Short-term use (up to 6 weeks)Symptoms return rapidly on discontinuation
Intra-articular corticosteroidsAdjunct for effusion/flarePhysical therapy may be superior for long-term function
DuloxetineUseful for neuropathic/central pain componentShooting, burning, pins-and-needles symptoms
Tramadol/oral narcoticsNOT Recommended (AAOS)Harms outweigh benefits in OA
Glucosamine/chondroitinAvoid relianceEvidence insufficient
Viscosupplements (hyaluronic acid)AvoidNot recommended by current guidelines
PRP (platelet-rich plasma)Still investigationalRCTs show no benefit over placebo
AAOS = American Academy of Orthopaedic Surgeons Evidence-Based Clinical Practice Guideline for Knee OA (Nonarthroplasty)

Step 3: Adjunctive/Assistive Measures

  • Cane/gait aid - recommended for impaired walking
  • Bracing - recommended for varus/valgus malalignment
  • Lateral wedge insoles - Not Recommended (AAOS)
  • Footwear advice/orthotics (podiatry referral for abnormal foot posture)
  • Physiotherapy - manual therapy, exercise prescription, balance training

Step 4: Surgical Referral

Refer to orthopedic surgeon for end-stage OA when conservative options have failed. Indications include:
  • Joint pain disrupting normal sleep
  • Severely reduced walking distance
  • Markedly restricted activities of daily living
  • Significantly reduced quality of life
Surgical options include total knee or hip arthroplasty.

Newer/Investigational Treatments

  • Sprifermin (intra-articular recombinant human FGF-18): increases femorotibial cartilage thickness but without clear clinical benefit so far
  • IL-1β inhibitors (e.g., canakinumab): under investigation for disease modification

Prevention of OA

Two major strategies:
  1. Prevent joint injury
    • ACL injury prevention programs focusing on sports-specific movements reduce ACL injury rates by 50-80%, thereby reducing future knee OA risk
    • Use of proper technique in sports/occupational tasks
    • Avoid repetitive joint stress and overuse
  2. Weight reduction
    • Reducing BMI from obese (≥30) to overweight (≥26-<30): reduces symptomatic knee OA incidence by ~20% in men, ~33% in women
    • A 5 kg or 5% weight loss can reduce incident clinical knee OA from 21% to 7% over 6-7 years
(Goldman-Cecil Medicine International Edition, 26E)


Gout - Management, Prevention & Lifestyle

Key Concept

Gout results from monosodium urate (MSU) crystal deposition in/around joints due to sustained hyperuricemia (uric acid >6.8 mg/dL). Most cases (>90%) result from renal underexcretion, not overproduction.

Phase 1: Acute Gouty Flare - Treatment

Goal: Relieve pain and terminate the flare as quickly as possible.
InterventionDetails
Rest + iceGenerally helpful; not sufficient alone
NSAIDsFirst-line; widely used. Avoid in renal insufficiency, peptic ulcer disease, chronic anticoagulation
Oral colchicine1.2 mg (2 tablets) at onset, then 0.6 mg 1 hour later (total 1.8 mg day 1), followed by 0.6 mg once or twice daily x 7-10 days (adjusted for renal function). Do NOT use this acute dosing if patient already on colchicine prophylaxis
CorticosteroidsOral (prednisolone 30 mg/day), IM, or intra-articular. Equally effective, slightly safer than NSAIDs. Best for those with renal impairment or colchicine intolerance
Key principles:
  • Start treatment early
  • Ensure adequate dosing
  • Continue anti-inflammatory therapy until flare completely resolves (6-10 days)
  • If already on urate-lowering therapy: do NOT stop it during a flare
  • Urate-lowering therapy can be safely started during a flare if anti-inflammatory cover is maintained for the following months

Phase 2: Chronic Urate-Lowering Therapy (ULT)

Goal: "Treat-to-target" - lower serum uric acid to prevent crystal formation and dissolve existing deposits.

Targets (ACR/AHA):

Patient GroupSerum Uric Acid Target
History of ≥2 flares OR single flare with CKD stage ≥3 OR serum urate ≥9 mg/dL<6.0 mg/dL
Advanced/severe gout (tophi, frequent flares)<5.0 mg/dL

Urate-Lowering Agents:

DrugDoseNotes
Allopurinol (1st line)Start ≤100 mg/day; escalate by 100 mg every 2-5 weeks; max 800 mg/dayStart at 50 mg/day and escalate by 50 mg in advanced CKD
Febuxostat (2nd line)Start 20-40 mg/day; increase to 80 mg/day over 2-6 weeksUse if allopurinol failed, intolerant, or sensitive. Possible increased cardiovascular/all-cause mortality vs. allopurinol in patients with CVD
Probenecid (uricosuric)Up to 2 g/dayAdd-on when XO inhibitors fail. Avoid in nephrolithiasis or CKD stage ≥4
Pegloticase (recombinant uricase)8 mg IV every 2 weeksRefractory gout when conventional therapy fails. Can be combined with methotrexate or mycophenolate mofetil for better response
Empagliflozin (SGLT2i)Standard dosingSignificantly reduces uric acid and gout attacks in heart failure patients (beneficial side effect)

Phase 3: Anti-Inflammatory Prophylaxis During ULT Initiation

When starting any ULT, flare activity typically increases initially - prophylaxis is mandatory:
  • Colchicine 0.6 mg once or twice daily (preferred) OR
  • Low-dose NSAIDs
  • Continue prophylaxis for at least 3-6 months after ULT initiation
  • Monitor CBC and renal function during this period

Lifestyle Modifications for Gout

ACR Recommendations on Lifestyle and Diet:

CategorySpecific Recommendations
AvoidOrgan meats (liver, kidney, sweetbreads); High-fructose corn syrup drinks; Alcohol overuse (especially beer and spirits)
LimitBeef, pork, lamb, shellfish; Beer (any amount)
EncourageLow-fat dairy products; Adequate hydration (stay well-hydrated); Healthy overall diet; Exercise to achieve fitness
GeneralWeight loss for obese patients; Smoking cessation
(Goldman-Cecil Medicine, Table 252-3 - ACR Lifestyle/Diet Recommendations)

Additional Dietary Notes:

  • Fructose from high-fructose corn syrup and fruit juices raises uric acid - minimize these
  • Coffee and vitamin C have some uricosuric effect (evidence modest)
  • Cherries/cherry extract have shown reduction in gout attacks in observational studies
  • Alcohol causes decreased renal urate excretion AND increased purine production - avoid overuse

Prevention of Gout (Primary and Secondary)

StrategyDetails
Maintain serum urate <6.0 mg/dLPrevents crystal formation; existing crystals dissolve over months to years
Avoid precipitating drugsThiazide diuretics, low-dose aspirin, cyclosporine, tacrolimus all raise uric acid; consider alternatives if possible
Treat underlying comorbiditiesHypertension, metabolic syndrome, obesity, CKD all drive hyperuricemia
Dietary modificationAs above (ACR recommendations)
Review medicationsLoop diuretics, pyrazinamide, ethambutol raise uric acid
Patient educationCritical - patients must understand the treat-to-target strategy; early treatment initiation on flare onset; never stopping ULT during a flare

Summary Comparison Table

FeatureOsteoarthritisGout
MechanismCartilage/bone degeneration; failed repairMSU crystal deposition from hyperuricemia
Pain typeChronic, use-related, morning stiffness <30 minEpisodic, acute, excruciating flares
First-line RxTopical NSAIDs + therapeutic exerciseNSAIDs / colchicine / corticosteroids for flare
Long-term RxCore non-pharmacologic + oral NSAIDs PRNUrate-lowering therapy (allopurinol first)
Key lifestyleWeight loss, exercise, joint protectionLow-purine diet, reduce alcohol, hydration
PreventionWeight reduction, injury preventionTreat-to-target <6.0 mg/dL, dietary changes
Surgical optionTotal joint arthroplasty (end-stage)Tophus debulking (rare, severe cases)

Sources:
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment
attachment

Make ppt according to u

analyse_media
analyse_media
analyse_media
analyse_media
analyse_media
I now have all the content. Let me read the PPTX skill and build the presentation.
Reading File
Running Command

ls /tmp/workspace/ 2>/dev/null || mkdir -p /tmp/workspace && ls /tmp/workspace/

Writing File

~/ras_drugs_ppt.py

from pptx import Presentation
from pptx.util import Inches, Pt, Emu
from pptx.dml.color import RGBColor
from pptx.enum.text import PP_ALIGN
from pptx.util import Inches, Pt
import copy

prs = Presentation()
prs.slide_width = Inches(13.33)
prs.slide_height = Inches(7.5)

# Color scheme
DARK_BLUE = RGBColor(0x0D, 0x47, 0xA1)    # Deep blue
MED_BLUE  = RGBColor(0x15, 0x65, 0xC0)    # Medium blue
LIGHT_BLUE= RGBColor(0xE3, 0xF2, 0xFD)    # Light blue bg
ACCENT    = RGBColor(0x1E, 0x88, 0xE5)    # Accent blue
GREEN     = RGBColor(0x2E, 0x7D, 0x32)    # Dark green
ORANGE    = RGBColor(0xE6, 0x51, 0x00)    # Orange highlight
WHITE     = RGBColor(0xFF, 0xFF, 0xFF)
DARK_GRAY = RGBColor(0x21, 0x21, 0x21)
LIGHT_GRAY= RGBColor(0xF5, 0xF5, 0xF5)
RED       = RGBColor(0xC6, 0x28, 0x28)

def blank_layout(prs):
    return prs.slide_layouts[6]  # completely blank

def add_rect(slide, l, t, w, h, fill_color, line_color=None):
    shape = slide.shapes.add_shape(1, Inches(l), Inches(t), Inches(w), Inches(h))
    shape.fill.solid()
    shape.fill.fore_color.rgb = fill_color
    if line_color:
        shape.line.color.rgb = line_color
        shape.line.width = Pt(0.75)
    else:
        shape.line.fill.background()
    return shape

def add_textbox(slide, text, l, t, w, h, font_size=12, bold=False, color=DARK_GRAY,
                align=PP_ALIGN.LEFT, wrap=True, italic=False):
    txBox = slide.shapes.add_textbox(Inches(l), Inches(t), Inches(w), Inches(h))
    txBox.word_wrap = wrap
    tf = txBox.text_frame
    tf.word_wrap = wrap
    p = tf.paragraphs[0]
    p.alignment = align
    run = p.add_run()
    run.text = text
    run.font.size = Pt(font_size)
    run.font.bold = bold
    run.font.italic = italic
    run.font.color.rgb = color
    return txBox

def add_slide_header(slide, title, subtitle=None):
    """Dark blue header bar at top"""
    add_rect(slide, 0, 0, 13.33, 1.1, DARK_BLUE)
    add_textbox(slide, title, 0.3, 0.08, 12.5, 0.7, font_size=28, bold=True,
                color=WHITE, align=PP_ALIGN.LEFT)
    if subtitle:
        add_textbox(slide, subtitle, 0.3, 0.72, 12.5, 0.35, font_size=13,
                    color=RGBColor(0xBB, 0xDE, 0xFF), align=PP_ALIGN.LEFT, italic=True)

def add_section_box(slide, title, l, t, w, h, title_color=MED_BLUE, bg=LIGHT_BLUE):
    """Colored section box with title"""
    add_rect(slide, l, t, w, 0.35, title_color)
    add_textbox(slide, title, l+0.1, t+0.02, w-0.2, 0.3,
                font_size=12, bold=True, color=WHITE)
    add_rect(slide, l, t+0.35, w, h-0.35, bg, line_color=MED_BLUE)

def bullet_text(slide, bullets, l, t, w, h, font_size=10.5, color=DARK_GRAY, spacing=0.02):
    """Add bulleted list"""
    txBox = slide.shapes.add_textbox(Inches(l), Inches(t), Inches(w), Inches(h))
    txBox.word_wrap = True
    tf = txBox.text_frame
    tf.word_wrap = True
    first = True
    for item in bullets:
        if first:
            p = tf.paragraphs[0]
            first = False
        else:
            p = tf.add_paragraph()
        p.space_before = Pt(2)
        if isinstance(item, tuple):
            text, is_bold, indent = item
        else:
            text, is_bold, indent = item, False, False
        if indent:
            p.level = 1
        run = p.add_run()
        run.text = ("  • " if indent else "• ") + text
        run.font.size = Pt(font_size)
        run.font.bold = is_bold
        run.font.color.rgb = color

def key_value_box(slide, items, l, t, w, h, font_size=10.5):
    """Two-column key:value text"""
    txBox = slide.shapes.add_textbox(Inches(l), Inches(t), Inches(w), Inches(h))
    txBox.word_wrap = True
    tf = txBox.text_frame
    tf.word_wrap = True
    first = True
    for key, val in items:
        if first:
            p = tf.paragraphs[0]; first = False
        else:
            p = tf.add_paragraph()
        p.space_before = Pt(3)
        run1 = p.add_run()
        run1.text = f"{key}: "
        run1.font.size = Pt(font_size)
        run1.font.bold = True
        run1.font.color.rgb = MED_BLUE
        run2 = p.add_run()
        run2.text = val
        run2.font.size = Pt(font_size)
        run2.font.bold = False
        run2.font.color.rgb = DARK_GRAY

# ─────────────────────────────────────────────────────────────
# SLIDE 1: TITLE SLIDE
# ─────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank_layout(prs))
add_rect(slide, 0, 0, 13.33, 7.5, DARK_BLUE)
add_rect(slide, 0, 2.6, 13.33, 2.3, MED_BLUE)
add_rect(slide, 0, 4.9, 13.33, 0.05, ACCENT)

add_textbox(slide, "DRUGS AFFECTING THE", 1.5, 1.1, 10.3, 0.8,
            font_size=24, bold=False, color=RGBColor(0xBB,0xDE,0xFF), align=PP_ALIGN.CENTER)
add_textbox(slide, "RENIN-ANGIOTENSIN SYSTEM", 1.0, 1.7, 11.3, 1.0,
            font_size=36, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
add_textbox(slide, "ACE Inhibitors  |  ARBs  |  Direct Renin Inhibitors", 1.5, 2.75, 10.3, 0.65,
            font_size=18, bold=False, color=LIGHT_BLUE, align=PP_ALIGN.CENTER)
add_textbox(slide, "Cardiovascular Pharmacology", 1.5, 3.35, 10.3, 0.45,
            font_size=13, bold=False, color=RGBColor(0xBB,0xDE,0xFF), align=PP_ALIGN.CENTER, italic=True)

# Drug class tags
tags = [("ACE Inhibitors", 1.5), ("ARBs", 4.5), ("Direct Renin Inhibitors", 7.5), ("Aldosterone Antagonists", 10.3)]
for tag, x in [("ACE Inhibitors", 1.2), ("ARBs", 4.2), ("Direct Renin Inhibitors", 6.8), ("Aldost. Antagonists", 10.0)]:
    add_rect(slide, x, 5.5, 2.5, 0.5, ACCENT)
    add_textbox(slide, tag, x+0.05, 5.52, 2.4, 0.45, font_size=11, bold=True,
                color=WHITE, align=PP_ALIGN.CENTER)

add_textbox(slide, "Chapter 36 — Cardiovascular Drugs", 0.5, 6.9, 12.3, 0.4,
            font_size=10, italic=True, color=RGBColor(0x90,0xCA,0xF9), align=PP_ALIGN.CENTER)

# ─────────────────────────────────────────────────────────────
# SLIDE 2: RAS OVERVIEW — How the System Works
# ─────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank_layout(prs))
add_rect(slide, 0, 0, 13.33, 7.5, LIGHT_GRAY)
add_slide_header(slide, "Renin-Angiotensin System (RAS)", "Overview & Sites of Drug Action")

# 5 drug classes boxes
classes = [
    ("1. Sympathetic Blockers", "β-blockers, central sympatholytics,\nadrenergic neurone blockers\n→ Decrease renin release", MED_BLUE),
    ("2. Direct Renin Inhibitors", "e.g. Aliskiren\n→ Block renin action\n→ Prevent Ang I generation\n(rate-limiting step)", GREEN),
    ("3. ACE Inhibitors", "e.g. Captopril, Enalapril\n→ Prevent Ang II generation\n→ ↑ Bradykinin, Ang(1-7)", DARK_BLUE),
    ("4. ARBs", "e.g. Losartan, Valsartan\n→ Block AT₁ receptors\n→ Antagonize Ang II at target cells", ACCENT),
    ("5. Aldosterone Antagonists", "e.g. Spironolactone\n→ Block mineralocorticoid\nreceptors", ORANGE),
]
col_w = 2.4
for i, (title, body, color) in enumerate(classes):
    x = 0.2 + i * 2.6
    add_rect(slide, x, 1.3, col_w, 0.4, color)
    add_textbox(slide, title, x+0.05, 1.3, col_w-0.1, 0.38,
                font_size=11, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
    add_rect(slide, x, 1.7, col_w, 2.3, WHITE, line_color=color)
    add_textbox(slide, body, x+0.1, 1.75, col_w-0.2, 2.2,
                font_size=10.5, color=DARK_GRAY)

# Bottom note
add_rect(slide, 0.2, 4.2, 12.9, 1.1, RGBColor(0xE8,0xF5,0xE9), line_color=GREEN)
add_textbox(slide, "KEY CONCEPT", 0.35, 4.25, 2.0, 0.35, font_size=11, bold=True, color=GREEN)
add_textbox(slide,
    "Hyperuricemia → Ang II→ Vasoconstriction + Aldosterone release + Na⁺ retention + Sympathetic activation → Hypertension\n"
    "All RAS drugs interrupt this cascade at different points. Combination strategies target multiple points for superior BP control.",
    0.35, 4.55, 12.6, 0.7, font_size=10.5, color=DARK_GRAY)

# ─────────────────────────────────────────────────────────────
# SLIDE 3: ACE INHIBITORS — Mechanism & Captopril Prototype
# ─────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank_layout(prs))
add_rect(slide, 0, 0, 13.33, 7.5, LIGHT_GRAY)
add_slide_header(slide, "ACE Inhibitors — Mechanism of Action", "Prototype: Captopril")

# Left column — Mechanism
add_section_box(slide, "Mechanism of Action", 0.2, 1.2, 6.3, 5.1, DARK_BLUE, RGBColor(0xE3,0xF2,0xFD))
bullet_text(slide, [
    ("Sulfhydryl-containing dipeptide surrogate of proline", False, False),
    ("Abolishes pressor action of Ang I (NOT Ang II)", True, False),
    ("Does NOT block AT₁ or AT₂ receptors directly", False, False),
    ("ACE is nonspecific — also cleaves bradykinin, substance P, enkephalins", False, False),
    ("Inhibiting ACE → ↑ plasma kinins → ↑ vasodilation", True, False),
    ("Blocks Ang I→Ang II conversion → Ang I diverted to Ang(1-7) → vasodilation", False, False),
    ("Reflex feedback: ↓Ang II → ↑ renin release → ↑ Ang I (but cannot convert to Ang II)", False, False),
], 0.35, 1.6, 6.0, 3.5, font_size=10.5)

add_section_box(slide, "Hemodynamic Effects", 0.2, 4.8, 6.3, 1.5, MED_BLUE, WHITE)
bullet_text(slide, [
    ("↓ Total peripheral resistance → ↓ systolic & diastolic BP", False, False),
    ("Cardiac output unchanged; cardiovascular reflexes intact", False, False),
    ("Renal, cerebral, and coronary blood flow maintained", True, False),
    ("Postural hypotension NOT a problem", True, False),
], 0.35, 5.2, 6.0, 1.0, font_size=10.5)

# Right column — Captopril details
add_section_box(slide, "Captopril — Pharmacokinetics", 6.7, 1.2, 6.4, 2.2, DARK_BLUE, WHITE)
kv = [
    ("Absorption", "~70% oral; food reduces bioavailability"),
    ("Distribution", "Poor CNS penetration; 98% protein bound"),
    ("Metabolism", "Partly metabolized; partly excreted unchanged in urine"),
    ("Half-life (t½)", "~2 hours; action lasts 6–12 hrs"),
    ("Dose", "25 mg BD, gradually up to 50 mg TDS"),
]
key_value_box(slide, kv, 6.85, 1.6, 6.1, 1.7, font_size=10.5)

add_section_box(slide, "Adverse Effects of Captopril / All ACE Inhibitors", 6.7, 3.5, 6.4, 2.8, RED, RGBColor(0xFF,0xEB,0xEE))
bullet_text(slide, [
    ("Hypotension — first dose; worse in diuretic-treated/CHF patients", True, False),
    ("Hyperkalaemia — with K⁺-sparing diuretics, NSAIDs, β-blockers", False, False),
    ("Dry persistent cough — 10–16%; due to ↑ bradykinin/substance P breakdown inhibition", True, False),
    ("Rashes & urticaria — 1–4% (don't usually require drug stoppage)", False, False),
    ("Angioedema — rare but serious", True, False),
    ("Dysgeusia — reversible taste alteration (more common with captopril)", False, False),
    ("Foetotoxicity — contraindicated in pregnancy (stop when woman conceives)", True, False),
    ("Acute renal failure — in bilateral renal artery stenosis", False, False),
    ("Granulocytopenia & proteinuria — rare; warrant withdrawal", False, False),
], 6.85, 3.9, 6.1, 2.3, font_size=10)

# ─────────────────────────────────────────────────────────────
# SLIDE 4: ACE Inhibitors Comparative Table
# ─────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank_layout(prs))
add_rect(slide, 0, 0, 13.33, 7.5, LIGHT_GRAY)
add_slide_header(slide, "ACE Inhibitors — Comparative Features", "Table 36.1")

# Table header
headers = ["Feature", "Captopril", "Enalapril", "Lisinopril", "Fosinopril", "Perindopril", "Ramipril"]
col_widths = [2.1, 1.6, 1.6, 1.6, 1.6, 1.65, 1.58]
x_starts = [0.2]
for w in col_widths[:-1]:
    x_starts.append(x_starts[-1] + w)

for i, (h, x, w) in enumerate(zip(headers, x_starts, col_widths)):
    add_rect(slide, x, 1.2, w, 0.4, DARK_BLUE)
    add_textbox(slide, h, x+0.05, 1.22, w-0.1, 0.36,
                font_size=10, bold=True, color=WHITE, align=PP_ALIGN.CENTER)

rows = [
    ["Chemical nature", "Sulfhydryl", "Carboxyl", "Carboxyl", "Phosphinate\nCarboxyl", "Carboxyl", "Carboxyl"],
    ["Activity status", "Active", "Prodrug", "Active", "Prodrug", "Prodrug", "Prodrug"],
    ["Bioavailability", "70%", "50%", "25%", "30%", "30–60%", "60%"],
    ["Time to peak", "1 hr", "4–6 hr", "6–8 hr", "3–5 hr", "6 hr", "3–6 hr"],
    ["Elimination t½", "2 hr", "11 hr", "12 hr", "12 hr", "25–30 hr", "8–18 hr"],
    ["Mode of excretion", "Renal", "Renal", "Renal", "Renal/\nHepatic", "Renal", "Renal"],
    ["Duration of action", "6–12 hr", "24 hr", ">24 hr", "24 hr", ">24 hr", ">24 hr"],
    ["Daily dose (mg)", "25–150", "2.5–40", "5–40", "10–40", "2–8", "1.25–10"],
]

for r_idx, row in enumerate(rows):
    bg = WHITE if r_idx % 2 == 0 else RGBColor(0xE8,0xEA,0xF6)
    y = 1.6 + r_idx * 0.52
    for i, (cell, x, w) in enumerate(zip(row, x_starts, col_widths)):
        add_rect(slide, x, y, w, 0.5, bg, line_color=RGBColor(0xC5,0xCA,0xE9))
        add_textbox(slide, cell, x+0.05, y+0.03, w-0.1, 0.44,
                    font_size=9.5, align=PP_ALIGN.CENTER, color=DARK_GRAY,
                    bold=(i==0))

# Note at bottom
add_rect(slide, 0.2, 5.9, 12.9, 0.5, RGBColor(0xFF,0xF9,0xC4), line_color=ORANGE)
add_textbox(slide, "⚑  No single ACE inhibitor is superior to others. Differences are primarily pharmacokinetic (time course). "
            "All share the same pharmacological actions, therapeutic uses, adverse effects, and contraindications.",
            0.35, 5.95, 12.6, 0.4, font_size=10, italic=True, color=RGBColor(0x5D,0x40,0x37))

# ─────────────────────────────────────────────────────────────
# SLIDE 5: ACE Inhibitors — Clinical Uses
# ─────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank_layout(prs))
add_rect(slide, 0, 0, 13.33, 7.5, LIGHT_GRAY)
add_slide_header(slide, "ACE Inhibitors — Clinical Uses & Indications", "First-line drugs in multiple cardiovascular and renal conditions")

uses = [
    ("1. Hypertension", [
        "First-choice in all grades: essential, renovascular, malignant, accelerated HTN",
        "Control BP in ~50% as monotherapy; ~90% with added diuretic/β-blocker",
        "Low-dose diuretic (HCZ 12.5 mg) sufficient due to supra-additive synergism",
        "More effective in younger (<55 yr) and white patients",
        "Preferred in: Diabetes, CKD, LVH, CHF, angina, post-MI",
        "Confirmed by AIRE, HOPE, ALLHAT trials",
    ], MED_BLUE),
    ("2. Congestive Heart Failure (CHF)", [
        "Cause both arteriolar and venodilation → reduce preload & afterload",
        "↑ Cardiac output, ↑ exercise capacity, improve NYHA functional class",
        "Retard progression of LV systolic dysfunction",
        "Reduce mortality by ~20% in symptomatic CHF",
        "Reduce episodes of decompensation, MI, and sudden death",
        "Supported by CONSENSUS, SOLVD, AIRE trials",
    ], GREEN),
    ("3. Myocardial Infarction (MI)", [
        "Initiated within 24 hrs of evolving MI, continued for ≥6 weeks",
        "Reduce early + long-term mortality regardless of EF",
        "In high-risk/NSTEMI: long-term therapy reduces re-MI & need for CABG/PTCA (SAVE, SOLVD)",
        "Sustained survival benefit extends over years",
    ], ORANGE),
    ("4. Diabetic Nephropathy", [
        "Prevent/delay end-stage renal disease in Type 1 & 2 diabetes",
        "Stabilize albuminuria (index of glomerulopathy)",
        "Reduce intraglomerular pressure and hyperfiltration",
        "Also retard retinopathy progression",
        "Non-diabetic renal failure also benefits (reduce proteinuria)",
    ], RED),
    ("5. Prophylaxis — High CV Risk", [
        "Ramipril (HOPE study, 9297 post-MI patients): reduced cardiac death + MI + stroke by 22% over 4.5 yr",
        "Protect even without LV dysfunction or heart failure",
        "Protective effect via improved endothelial function independent of BP lowering",
    ], DARK_BLUE),
    ("6. Scleroderma Crisis", [
        "ACE inhibitors produce dramatic improvement",
        "Are life-saving in this condition",
        "Marked rise in BP and deterioration of renal function mediated by Ang II",
    ], MED_BLUE),
]

box_w = 4.1
box_h = 2.75
positions = [(0.2,1.25),(4.4,1.25),(8.6,1.25),(0.2,4.1),(4.4,4.1),(8.6,4.1)]

for (title, bullets, color), (x, y) in zip(uses, positions):
    add_rect(slide, x, y, box_w, 0.35, color)
    add_textbox(slide, title, x+0.08, y+0.02, box_w-0.15, 0.32,
                font_size=11, bold=True, color=WHITE)
    add_rect(slide, x, y+0.35, box_w, box_h-0.35, WHITE, line_color=color)
    bullet_text(slide, bullets, x+0.12, y+0.4, box_w-0.18, box_h-0.45, font_size=9.5)

# ─────────────────────────────────────────────────────────────
# SLIDE 6: ARBs — Introduction, Mechanism, Differences from ACEi
# ─────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank_layout(prs))
add_rect(slide, 0, 0, 13.33, 7.5, LIGHT_GRAY)
add_slide_header(slide, "Angiotensin Receptor Blockers (ARBs)", "Angiotensin AT₁ Receptor Antagonists — Overview")

# Left: Introduction & Mechanism
add_section_box(slide, "Introduction & Mechanism", 0.2, 1.2, 6.4, 3.8, MED_BLUE, WHITE)
bullet_text(slide, [
    ("Orally active, nonpeptide AT₁ receptor blockers (ARBs) developed as alternatives to ACE inhibitors over 25 years", False, False),
    ("Drugs: Losartan, candesartan, valsartan, telmisartan, olmesartan, irbesartan, eprosartan", True, False),
    ("Selective antagonists of AT₁ receptors; AT₂ receptors remain intact", False, False),
    ("Block all actions of Ang II: vasoconstriction, sympathetic stimulation, aldosterone release, Na⁺ reabsorption, vasopressin release, growth-promoting actions on heart & vessels", False, False),
    ("Blocking AT₁ → feedback ↑ Ang II → stimulates unblocked AT₂ receptors (vasodilator, antiproliferative) → indirect benefit", False, False),
    ("Unlike ACE inhibitors — do NOT increase bradykinin (no cough, no angioedema)", True, False),
    ("Result in more complete inhibition of AT₁ activation (Ang II generated by non-ACE pathways also blocked)", True, False),
], 0.35, 1.6, 6.1, 3.25, font_size=10.5)

# Middle/Right: Key Differences from ACEi
add_section_box(slide, "ARBs vs ACE Inhibitors — Key Differences", 6.8, 1.2, 6.3, 3.8, DARK_BLUE, RGBColor(0xE8,0xEA,0xF6))
diff_table = [
    ("Feature", "ACE Inhibitors", "ARBs"),
    ("Bradykinin", "↑ (inhibit breakdown)", "No effect"),
    ("Cough", "10–16% (persistent)", "Rare / absent"),
    ("Ang II blockade", "Partial (non-ACE paths escape)", "Complete AT₁ block"),
    ("AT₂ stimulation", "No direct effect", "↑ (indirect via ↑ Ang II)"),
    ("Angioedema", "Uncommon (~0.1–0.3%)", "Very rare"),
    ("Uricosuric effect", "No", "Losartan: mild uricosuric"),
    ("Foetotoxicity", "Yes (contraindicated)", "Yes (contraindicated)"),
    ("First-line status", "Yes", "Yes (preferred in black race)"),
]
col_ws = [2.8, 1.7, 1.7]
x_pos = [6.9, 9.75, 11.5]
for i, (feat, ace, arb) in enumerate(diff_table):
    bg = DARK_BLUE if i == 0 else (WHITE if i%2==1 else RGBColor(0xE3,0xF2,0xFD))
    txt_color = WHITE if i == 0 else DARK_GRAY
    y = 1.6 + i * 0.38
    for j, (txt, x, w) in enumerate(zip([feat, ace, arb], x_pos, col_ws)):
        add_rect(slide, x, y, w, 0.37, bg, line_color=RGBColor(0xBB,0xDE,0xFF))
        add_textbox(slide, txt, x+0.05, y+0.02, w-0.1, 0.33,
                    font_size=9.5, bold=(i==0 or j==0), color=txt_color,
                    align=PP_ALIGN.CENTER)

# Bottom — ARBs adverse effects
add_section_box(slide, "Adverse Effects of ARBs", 0.2, 5.1, 6.4, 1.5, RED, RGBColor(0xFF,0xEB,0xEE))
bullet_text(slide, [
    ("Remarkably free of side effects", True, False),
    ("Hypotension and hyperkalemia — possible but less common than ACEi first-dose hypotension", False, False),
    ("No ACE inhibitor-related cough (do not increase kinin levels)", True, False),
    ("Angioedema, urticaria, taste disturbance — rare", False, False),
    ("CONTRAINDICATED in pregnancy — fetopathic potential similar to ACE inhibitors", True, False),
], 0.35, 5.5, 6.1, 1.0, font_size=10.5)

add_section_box(slide, "Important Guideline Notes", 6.8, 5.1, 6.3, 1.5, ORANGE, RGBColor(0xFF,0xF3,0xE0))
bullet_text(slide, [
    ("JNC8 & NICE: Do NOT combine ACE inhibitors + ARBs for hypertension", True, False),
    ("NICE (2011): ARBs preferred over ACEi for black races", False, False),
    ("For CHF/diabetic nephropathy: combination may offer added benefit but risk ↑ hyperkalemia, hypotension, renal impairment", False, False),
    ("COOPERATE (2003): ARB + ACEi retards non-diabetic renal disease progression more than monotherapy", False, False),
], 6.95, 5.5, 6.1, 1.05, font_size=10)

# ─────────────────────────────────────────────────────────────
# SLIDE 7: Individual ARBs — Drug Profiles
# ─────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank_layout(prs))
add_rect(slide, 0, 0, 13.33, 7.5, LIGHT_GRAY)
add_slide_header(slide, "Individual ARBs — Drug Profiles", "Dosing, Pharmacokinetics & Special Features")

arb_data = [
    ("Losartan", "50 mg OD (rarely BD)\n25 mg in liver disease\n+ HCZ 12.5–25 mg enhances effect",
     "t½: 2 hr (metabolite E3174: 6–9 hr)\nActive metabolite E3174: 10–30× more potent\nMild uricosuric (probenecid-like)\nBrands: LOSACAR, LOSAR, TOZAAR"),
    ("Candesartan", "8 mg OD (max 8 mg BD)\n4 mg OD in liver/renal impairment",
     "Highest AT₁ affinity\nInsurrmountable antagonism\n(slow receptor dissociation)\nBrands: CANDESAR, CANDILONG"),
    ("Irbesartan", "150–300 mg OD",
     "High oral bioavailability\nt½ ~12 hr\nMetabolized + excreted in bile\nBrands: IROVEL, IRBEST"),
    ("Valsartan", "80–160 mg OD\n(1 hr before meal)\n40 mg initial in liver disease",
     "Bioavailability ~23%\nFood reduces absorption\nt½: 6–9 hr; action 24 hr\nBrands: DIOVAN, STARVAL, VALZAAR"),
    ("Olmesartan", "20–40 mg OD",
     "Ester prodrug → completely hydrolyzed in gut\nt½ ~12 hr\nEliminated in urine + bile\nSprue-like symptoms (rare)\nBrands: OLMAT, OLSAR"),
    ("Telmisartan", "20–80 mg OD\nReduce dose in liver disease",
     "No active metabolite\nPeak action at 3 hrs\nAction >24 hr\nExcreted mainly in bile\nBrands: TELMA, TELSAR, TELVAS"),
    ("Eprosartan", "600 mg OD (400–800 mg OD)",
     "Newer AT₁ blocker\nAlso blocks prejunctional AT₁ → ↓ NA release\nBioavailability ~13%\nt½ 20 hr; excreted in faeces\nBrands: TEVETEN, EPROZAR"),
]

col_w = 1.82
for i, (name, dose, features) in enumerate(arb_data):
    x = 0.2 + i * 1.87
    add_rect(slide, x, 1.2, col_w, 0.38, ACCENT)
    add_textbox(slide, name, x+0.04, 1.22, col_w-0.08, 0.34,
                font_size=11, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
    add_rect(slide, x, 1.58, col_w, 1.6, RGBColor(0xE3,0xF2,0xFD), line_color=ACCENT)
    add_textbox(slide, "Dose:", x+0.06, 1.62, col_w-0.12, 0.25,
                font_size=9.5, bold=True, color=MED_BLUE)
    add_textbox(slide, dose, x+0.06, 1.85, col_w-0.12, 1.25,
                font_size=9.5, color=DARK_GRAY)
    add_rect(slide, x, 3.2, col_w, 3.1, WHITE, line_color=MED_BLUE)
    add_textbox(slide, "Key Features:", x+0.06, 3.24, col_w-0.12, 0.25,
                font_size=9.5, bold=True, color=DARK_BLUE)
    add_textbox(slide, features, x+0.06, 3.48, col_w-0.12, 2.7,
                font_size=9, color=DARK_GRAY)

# ─────────────────────────────────────────────────────────────
# SLIDE 8: Uses of ARBs — Clinical Applications
# ─────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank_layout(prs))
add_rect(slide, 0, 0, 13.33, 7.5, LIGHT_GRAY)
add_slide_header(slide, "Clinical Uses of ARBs", "Same overall range as ACE Inhibitors — Better tolerated")

uses_arbs = [
    ("Hypertension", [
        "First-line drugs: comparable to ACE inhibitors",
        "Advantage: no cough, lower angioedema, rash, dysgeusia",
        "Maximum effect: 2–4 weeks",
        "Reverse vascular/ventricular hypertrophy similarly to ACEi",
        "Preferred by NICE (2011) for black races over ACEi",
        "Evidence: LIFE, VALUE, SCOPE, JLIGHT trials",
        "Losartan: also controls portal hypertension in cirrhosis",
    ], MED_BLUE),
    ("Congestive Heart Failure (CHF)", [
        "ARBs afford clear-cut symptomatic relief + survival benefit",
        "Reserved for patients intolerant to ACEi (cough, angioedema)",
        "Relative value vs ACEi for long-term survival: still uncertain",
        "Candesartan + valsartan showed superior benefit vs losartan/irbesartan in trials",
        "For CHF: prefer specific ARBs (candesartan, valsartan) over losartan/irbesartan",
    ], DARK_BLUE),
    ("Myocardial Infarction", [
        "Utility in MI comparable to ACEi including long-term survival",
        "ACEi generally used first due to greater clinical experience",
        "Valsartan in acute MI (VAL-HEFT, VALIANT): non-inferior to captopril",
    ], ORANGE),
    ("Diabetic Nephropathy", [
        "ARBs are renoprotective in Type 2 DM, independent of BP lowering",
        "Magnitude of benefit comparable to ACEi",
        "Better tolerability profile → many consider ARBs first choice now",
        "Reduce proteinuria, slow CKD progression",
    ], GREEN),
    ("Combination with ACE Inhibitors", [
        "NOT recommended for hypertension (JNC8, NICE)",
        "Rationale in CHF/CKD: more complete RAS suppression",
        "Short-term CHF benefit with ACEi + ARB combination",
        "COOPERATE trial: ARB + ACEi retards non-diabetic renal disease",
        "Risks: ↑ hyperkalemia, ↑ hypotension, ↑ renal impairment",
        "ACEi adds bradykinin benefit; ARBs add non-ACE Ang II blockade",
    ], RED),
]

box_w = 2.42
box_h = 5.1
for i, (title, bullets, color) in enumerate(uses_arbs):
    x = 0.2 + i * 2.58
    add_rect(slide, x, 1.2, box_w, 0.38, color)
    add_textbox(slide, title, x+0.06, 1.22, box_w-0.1, 0.34,
                font_size=11, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
    add_rect(slide, x, 1.58, box_w, box_h-0.38, WHITE, line_color=color)
    bullet_text(slide, bullets, x+0.1, 1.62, box_w-0.18, box_h-0.55, font_size=10)

# ─────────────────────────────────────────────────────────────
# SLIDE 9: Direct Renin Inhibitor — Aliskiren
# ─────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank_layout(prs))
add_rect(slide, 0, 0, 13.33, 7.5, LIGHT_GRAY)
add_slide_header(slide, "Direct Renin Inhibitor — Aliskiren", "Latest class of RAS inhibitory drugs | Only available member of class")

# Left column
add_section_box(slide, "Mechanism of Action", 0.2, 1.2, 6.3, 2.3, DARK_BLUE, WHITE)
bullet_text(slide, [
    ("Nonpeptide; binds to catalytic site of renin → competitive blockade", False, False),
    ("Blocks access of angiotensinogen to renin → no Ang I generated", True, False),
    ("Interrupts entire RAS effector chain (no Ang I → no Ang II)", False, False),
    ("Plasma renin activity (PRA) decreases despite ↑ renin concentration (feedback)", False, False),
    ("Ang I and Ang II levels fall in dose-dependent manner", True, False),
    ("Aldosterone levels lowered; mild natriuresis; tendency to K⁺ retention", False, False),
    ("Pattern of hemodynamic effect resembles ACE inhibitors", False, False),
    ("Postural hypotension NOT a problem", True, False),
], 0.35, 1.6, 6.0, 1.85, font_size=10.5)

add_section_box(slide, "Pharmacokinetics", 0.2, 3.6, 6.3, 1.8, MED_BLUE, RGBColor(0xE3,0xF2,0xFD))
kv = [
    ("Route", "Oral; bioavailability very low (active extrusion by P-glycoprotein)"),
    ("Elimination", "Mainly in faeces; small amount in urine"),
    ("Half-life (t½)", ">24 hours; BP lowering persists days after regular intake"),
    ("Dose", "150–300 mg OD | Brands: RASILEZ 150 mg; RASILEZ-HCT (+ HCZ)"),
]
key_value_box(slide, kv, 0.35, 3.95, 6.0, 1.35, font_size=10.5)

add_section_box(slide, "Adverse Effects", 0.2, 5.5, 6.3, 1.6, RED, RGBColor(0xFF,0xEB,0xEE))
bullet_text(slide, [
    ("Few and mild: dyspepsia, abdominal pain, loose motions, headache, dizziness", False, False),
    ("Acute hypotension, hyperkalemia, cough, angioedema, rashes — less frequent than with ACEi", False, False),
    ("CONTRAINDICATED in pregnancy", True, False),
    ("Do NOT combine with ACEi/ARBs in Type 2 diabetics — no benefit, may worsen outcome", True, False),
], 0.35, 5.9, 6.0, 1.1, font_size=10.5)

# Right column
add_section_box(slide, "Clinical Uses & Efficacy", 6.7, 1.2, 6.4, 2.4, GREEN, WHITE)
bullet_text(slide, [
    ("Antihypertensive efficacy nearly equivalent to ACEi/ARBs", True, False),
    ("Reduces hypertensive left ventricular hypertrophy", False, False),
    ("Benefits CHF patients", False, False),
    ("Reduces albuminuria; renoprotective in hypertension and DM", True, False),
    ("Combination with ACEi/ARB: greater BP fall (blocks PRA rise caused by ACEi/ARBs)", False, False),
], 6.85, 1.6, 6.1, 1.9, font_size=10.5)

add_section_box(slide, "Current Recommendations (Guideline Status)", 6.7, 3.7, 6.4, 2.0, ORANGE, RGBColor(0xFF,0xF3,0xE0))
bullet_text(slide, [
    ("Alternative antihypertensive for those who don't respond/tolerate 1st-line drugs (ACEi/ARBs)", False, False),
    ("Can combine with ACEi/ARB for more complete RAS blockade and cardioprotection", False, False),
    ("Adding to ACEi/ARB in Type 2 diabetes: NOT beneficial, may worsen outcome — NOT advised", True, False),
    ("Experience limited; employed only when established ACEi/ARBs cannot be used", False, False),
    ("Value as additional drug vs ACEi/ARBs monotherapy: needs more outcome data", False, False),
], 6.85, 4.05, 6.1, 1.55, font_size=10.5)

add_section_box(slide, "Combination Strategies — Key Points", 6.7, 5.8, 6.4, 1.35, DARK_BLUE, RGBColor(0xE8,0xEA,0xF6))
bullet_text(slide, [
    ("Aliskiren + ACEi/ARB: greater BP fall; more complete RAS blockade", False, False),
    ("Hemodynamic pattern resembles ACEi (no postural hypotension)", False, False),
    ("Evidence for outcome benefit beyond BP: still being established", False, False),
], 6.85, 6.15, 6.1, 0.9, font_size=10.5)

# ─────────────────────────────────────────────────────────────
# SLIDE 10: Summary — RAS Drug Classes at a Glance
# ─────────────────────────────────────────────────────────────
slide = prs.slides.add_slide(blank_layout(prs))
add_rect(slide, 0, 0, 13.33, 7.5, LIGHT_GRAY)
add_slide_header(slide, "Summary — RAS Drugs at a Glance", "Quick Reference Comparison")

headers2 = ["Drug Class", "Representative Drugs", "Target", "Cough?", "Key Use", "Avoid In"]
col_ws2 = [1.9, 2.5, 2.2, 0.85, 3.0, 2.7]
x_pos2 = [0.15]
for w in col_ws2[:-1]:
    x_pos2.append(x_pos2[-1] + w)

for h, x, w in zip(headers2, x_pos2, col_ws2):
    add_rect(slide, x, 1.2, w, 0.4, DARK_BLUE)
    add_textbox(slide, h, x+0.05, 1.22, w-0.1, 0.36,
                font_size=10.5, bold=True, color=WHITE, align=PP_ALIGN.CENTER)

summary_rows = [
    ("ACE Inhibitors", "Captopril, Enalapril,\nLisinopril, Ramipril", "ACE enzyme\n(prevents Ang II)", "Yes\n(10–16%)", "HTN, CHF, MI,\nDiabetic nephropathy,\nScleroderma crisis", "Bilateral renal artery\nstenosis, Pregnancy,\nHyperkalemia"),
    ("ARBs", "Losartan, Valsartan,\nCandesartan, Telmisartan,\nOlmesartan, Irbesartan", "AT₁ receptor\n(blocks Ang II effect)", "Rarely", "HTN, CHF, MI,\nDiabetic nephropathy\n(Type 2 preferred)", "Pregnancy; Not combined\nwith ACEi for HTN\n(JNC8, NICE)"),
    ("Direct Renin Inhibitors", "Aliskiren", "Renin enzyme\n(rate-limiting step)", "Rare", "HTN (alternative);\nCHF; renoprotection", "Pregnancy; Type 2 DM\non ACEi/ARB combo"),
    ("Aldosterone Antagonists", "Spironolactone,\nEplerenone", "Mineralocorticoid\nreceptors", "No", "Add-on for resistant\nHTN (ACEi+ARB+CCB+\nthiazide not sufficient)", "Hyperkalemia;\nMonitor K⁺ closely\nwith ACEi/ARBs"),
]

colors_rows = [DARK_BLUE, ACCENT, GREEN, ORANGE]
for r_idx, (row_data, color) in enumerate(zip(summary_rows, colors_rows)):
    y = 1.65 + r_idx * 1.35
    row_vals = list(row_data)
    # first cell gets colored bg
    add_rect(slide, x_pos2[0], y, col_ws2[0], 1.3, color)
    add_textbox(slide, row_vals[0], x_pos2[0]+0.05, y+0.02, col_ws2[0]-0.1, 1.25,
                font_size=10.5, bold=True, color=WHITE, align=PP_ALIGN.CENTER)
    for j, (val, x, w) in enumerate(zip(row_vals[1:], x_pos2[1:], col_ws2[1:])):
        bg = WHITE if r_idx % 2 == 0 else RGBColor(0xF3,0xF4,0xF7)
        add_rect(slide, x, y, w, 1.3, bg, line_color=RGBColor(0xC5,0xCA,0xE9))
        add_textbox(slide, val, x+0.06, y+0.03, w-0.12, 1.22,
                    font_size=9.5, color=DARK_GRAY, align=PP_ALIGN.CENTER)

# ─────────────────────────────────────────────────────────────
# Save
out_path = "/tmp/workspace/RAS_Drugs_Pharmacology.pptx"
prs.save(out_path)
print(f"Saved: {out_path}")
Running Command

cd /tmp/workspace && python ras_drugs_ppt.py

Running Command

ls -lh /tmp/workspace/RAS_Drugs_Pharmacology.pptx

Your presentation is ready! Here's what was built:

RAS Drugs Pharmacology

Presentation · PPTX


The PPT contains 10 slides covering everything from your textbook images:
SlideContent
1Title Slide - Drugs Affecting the Renin-Angiotensin System
2RAS Overview - How the system works & 5 sites of drug action
3ACE Inhibitors - Mechanism, Captopril pharmacokinetics, Adverse effects
4ACE Inhibitors Comparative Table - Captopril vs Enalapril vs Lisinopril vs Fosinopril vs Perindopril vs Ramipril (bioavailability, t½, duration, dose)
5ACE Inhibitors Clinical Uses - Hypertension, CHF, MI, Diabetic nephropathy, CV prophylaxis, Scleroderma crisis
6ARBs Overview - Mechanism, differences from ACEi, adverse effects, guideline notes
7Individual ARBs - All 7 drugs (Losartan, Candesartan, Irbesartan, Valsartan, Olmesartan, Telmisartan, Eprosartan) with doses & key features
8Clinical Uses of ARBs - HTN, CHF, MI, Diabetic nephropathy, Combination therapy
9Direct Renin Inhibitor (Aliskiren) - Mechanism, PK, uses, adverse effects, recommendations
10Summary Table - All 4 RAS drug classes at a glance

Please try again

Let me check what went wrong and rebuild the presentation with improvements.
Running Command

cd /tmp/workspace && python -c " from pptx import Presentation prs = Presentation('RAS_Drugs_Pharmacology.pptx') print(f'Slides: {len(prs.slides)}') for i, slide in enumerate(prs.slides): shapes = slide.shapes print(f'Slide {i+1}: {len(shapes)} shapes') "

The file exists and has all 10 slides. Could you clarify what you'd like me to change? For example:
  • Different design/theme (darker, lighter, more colorful)?
  • More slides / more detail on specific topics?
  • Fewer slides / simpler layout?
  • Different content (e.g., focus more on gout/OA from our earlier discussion instead)?
  • Add images or diagrams?
  • Different font size / text size?
Or did the file not download/open correctly? Please let me know what to fix and I'll rebuild it right away.

Generate a clinical decision tree PPT for choosing between RAAS MECHANISM INHIBITORS,ACE inhibitors, ARBs, and DRI

Running Command

ls /tmp/workspace/ && python -c "import pptx; print('pptx ok')"

Writing File

~/ras_decision_tree.py

from pptx import Presentation
from pptx.util import Inches, Pt, Emu
from pptx.dml.color import RGBColor
from pptx.enum.text import PP_ALIGN
from pptx.oxml.ns import qn
from lxml import etree
import copy

prs = Presentation()
prs.slide_width  = Inches(13.33)
prs.slide_height = Inches(7.5)

# ── Palette ────────────────────────────────────────────────
C_BG       = RGBColor(0xF7, 0xF9, 0xFF)
C_NAVY     = RGBColor(0x0D, 0x2B, 0x55)
C_BLUE     = RGBColor(0x15, 0x65, 0xC0)
C_LBLUE    = RGBColor(0xBB, 0xDE, 0xFF)
C_TEAL     = RGBColor(0x00, 0x69, 0x7A)
C_GREEN    = RGBColor(0x1B, 0x7A, 0x3E)
C_ORANGE   = RGBColor(0xD8, 0x55, 0x00)
C_RED      = RGBColor(0xB7, 0x1C, 0x1C)
C_PURPLE   = RGBColor(0x4A, 0x14, 0x8C)
C_GOLD     = RGBColor(0xF9, 0xA8, 0x25)
C_WHITE    = RGBColor(0xFF, 0xFF, 0xFF)
C_DGRAY    = RGBColor(0x21, 0x21, 0x21)
C_LGRAY    = RGBColor(0xEC, 0xEF, 0xF5)
C_ARROW    = RGBColor(0x55, 0x55, 0x55)

BLANK = prs.slide_layouts[6]

# ── Helpers ────────────────────────────────────────────────

def rgb(r, g, b): return RGBColor(r, g, b)

def rect(slide, l, t, w, h, fill, line=None, lw=0.75, radius=False):
    from pptx.util import Inches, Pt
    shp = slide.shapes.add_shape(1, Inches(l), Inches(t), Inches(w), Inches(h))
    shp.fill.solid(); shp.fill.fore_color.rgb = fill
    if line:
        shp.line.color.rgb = line; shp.line.width = Pt(lw)
    else:
        shp.line.fill.background()
    return shp

def textbox(slide, text, l, t, w, h, fs=11, bold=False, color=C_DGRAY,
            align=PP_ALIGN.LEFT, italic=False, wrap=True):
    tb = slide.shapes.add_textbox(Inches(l), Inches(t), Inches(w), Inches(h))
    tb.word_wrap = wrap
    tf = tb.text_frame; tf.word_wrap = wrap
    p = tf.paragraphs[0]; p.alignment = align
    r = p.add_run(); r.text = text
    r.font.size = Pt(fs); r.font.bold = bold
    r.font.italic = italic; r.font.color.rgb = color
    return tb

def label(slide, text, l, t, w, h, fs=11, bold=False, color=C_WHITE,
          fill=C_BLUE, line=None, align=PP_ALIGN.CENTER, italic=False):
    rect(slide, l, t, w, h, fill, line)
    textbox(slide, text, l+0.06, t+0.04, w-0.12, h-0.08,
            fs=fs, bold=bold, color=color, align=align, italic=italic)

def arrow_h(slide, x1, y, x2, color=C_ARROW, text=''):
    """Horizontal arrow x1→x2 at height y"""
    from pptx.util import Inches, Pt, Emu
    cx, cy = Inches((x1+x2)/2), Inches(y)
    cw = Inches(abs(x2-x1))
    ch = Inches(0.03)
    connector = slide.shapes.add_connector(1, Inches(x1), Inches(y), Inches(x2), Inches(y))
    connector.line.color.rgb = color
    connector.line.width = Pt(1.5)
    if text:
        textbox(slide, text, (x1+x2)/2-0.5, y-0.22, 1.0, 0.2,
                fs=9, italic=True, color=color, align=PP_ALIGN.CENTER)

def arrow_v(slide, x, y1, y2, color=C_ARROW, text='', text_side='right'):
    connector = slide.shapes.add_connector(1, Inches(x), Inches(y1), Inches(x), Inches(y2))
    connector.line.color.rgb = color
    connector.line.width = Pt(1.5)
    if text:
        tx = x+0.06 if text_side == 'right' else x-0.6
        textbox(slide, text, tx, (y1+y2)/2-0.12, 0.55, 0.25,
                fs=9, italic=True, color=color)

def diamond(slide, text, l, t, w, h, fill=C_GOLD, line=C_ORANGE, fs=10, bold=True):
    """Draw a diamond shape using freeform"""
    from pptx.util import Inches
    cx = Inches(l + w/2); cy = Inches(t + h/2)
    hw = Inches(w/2);     hh = Inches(h/2)
    # Use a rotated rectangle as diamond proxy via MSO_AUTO_SHAPE_TYPE = 4
    shp = slide.shapes.add_shape(4, Inches(l), Inches(t), Inches(w), Inches(h))
    shp.fill.solid(); shp.fill.fore_color.rgb = fill
    shp.line.color.rgb = line; shp.line.width = Pt(1.5)
    tf = shp.text_frame; tf.word_wrap = True
    p = tf.paragraphs[0]; p.alignment = PP_ALIGN.CENTER
    r = p.add_run(); r.text = text
    r.font.size = Pt(fs); r.font.bold = bold; r.font.color.rgb = C_DGRAY
    return shp

def pill(slide, text, l, t, w, h, fill=C_BLUE, fs=10, bold=True, color=C_WHITE, line=None):
    """Rounded rectangle (pill shape = MSO type 5)"""
    shp = slide.shapes.add_shape(5, Inches(l), Inches(t), Inches(w), Inches(h))
    shp.fill.solid(); shp.fill.fore_color.rgb = fill
    if line:
        shp.line.color.rgb = line; shp.line.width = Pt(1.2)
    else:
        shp.line.fill.background()
    tf = shp.text_frame; tf.word_wrap = True
    p = tf.paragraphs[0]; p.alignment = PP_ALIGN.CENTER
    r = p.add_run(); r.text = text
    r.font.size = Pt(fs); r.font.bold = bold; r.font.color.rgb = color
    return shp

def header(slide, title, sub=''):
    rect(slide, 0, 0, 13.33, 0.95, C_NAVY)
    rect(slide, 0, 0.95, 13.33, 0.04, C_BLUE)
    textbox(slide, title, 0.3, 0.05, 12.5, 0.6,
            fs=26, bold=True, color=C_WHITE, align=PP_ALIGN.LEFT)
    if sub:
        textbox(slide, sub, 0.32, 0.62, 12.5, 0.3,
                fs=11, italic=True, color=C_LBLUE, align=PP_ALIGN.LEFT)

def footer(slide, text):
    rect(slide, 0, 7.18, 13.33, 0.32, C_NAVY)
    textbox(slide, text, 0.3, 7.2, 12.7, 0.28,
            fs=8.5, color=C_LBLUE, align=PP_ALIGN.CENTER, italic=True)

# ══════════════════════════════════════════════════════════════
#  SLIDE 1 — TITLE
# ══════════════════════════════════════════════════════════════
sl = prs.slides.add_slide(BLANK)
rect(sl, 0, 0, 13.33, 7.5, C_NAVY)
rect(sl, 0, 2.8,  13.33, 2.0, C_BLUE)
rect(sl, 0, 4.8,  13.33, 0.06, C_GOLD)

textbox(sl, "CLINICAL DECISION TREE", 1.0, 1.0, 11.3, 0.7,
        fs=20, bold=False, color=C_LBLUE, align=PP_ALIGN.CENTER)
textbox(sl, "RAAS Inhibitor Selection", 0.5, 1.6, 12.3, 1.1,
        fs=38, bold=True, color=C_WHITE, align=PP_ALIGN.CENTER)
textbox(sl, "ACE Inhibitors  ·  Angiotensin Receptor Blockers (ARBs)  ·  Direct Renin Inhibitors (DRI)", 0.8, 2.95, 11.7, 0.6,
        fs=15, bold=False, color=C_WHITE, align=PP_ALIGN.CENTER)
textbox(sl, "Evidence-based guidance per JNC8, ACC/AHA, NICE & ESC Guidelines", 1.0, 3.52, 11.3, 0.45,
        fs=12, italic=True, color=C_GOLD, align=PP_ALIGN.CENTER)

# 4 badge boxes
badges = [("ACE\nInhibitors", C_TEAL), ("ARBs", C_GREEN),
          ("DRI\n(Aliskiren)", C_PURPLE), ("Combination\nStrategies", C_ORANGE)]
bx = 1.8
for name, col in badges:
    pill(sl, name, bx, 5.2, 2.2, 0.9, fill=col, fs=12, bold=True)
    bx += 2.5

textbox(sl, "Cardiovascular Pharmacology  |  Chapter 36", 0.5, 7.0, 12.3, 0.35,
        fs=10, italic=True, color=C_LBLUE, align=PP_ALIGN.CENTER)

# ══════════════════════════════════════════════════════════════
#  SLIDE 2 — MASTER DECISION TREE  (main algorithm)
# ══════════════════════════════════════════════════════════════
sl = prs.slides.add_slide(BLANK)
rect(sl, 0, 0, 13.33, 7.5, C_BG)
header(sl, "Master Decision Tree — RAAS Inhibitor Selection",
       "Step-by-step clinical algorithm for choosing the right drug class")

# ── Level 0: START ──
pill(sl, "PATIENT REQUIRES\nRAAS INHIBITION", 4.9, 1.08, 3.5, 0.7,
     fill=C_NAVY, fs=11, bold=True)

arrow_v(sl, 6.65, 1.78, 2.28)

# ── Level 1: Contraindication check ──
diamond(sl, "Bilateral Renal\nArtery Stenosis?", 4.9, 2.28, 3.5, 0.9,
        fill=C_GOLD, line=C_ORANGE, fs=10)

# YES → avoid all RAS
arrow_h(sl, 8.4, 2.73, 9.6, color=C_RED, text='YES')
pill(sl, "⚠ AVOID ALL\nRAAS Inhibitors\n(risk of acute renal failure)", 9.6, 2.38, 3.5, 0.8,
     fill=C_RED, fs=9.5, bold=True)

# NO → continue
arrow_v(sl, 6.65, 3.18, 3.65, text='NO')

# ── Level 2: Pregnancy check ──
diamond(sl, "Pregnant /\nPlanning Pregnancy?", 4.9, 3.65, 3.5, 0.9,
        fill=C_GOLD, line=C_ORANGE, fs=10)

# YES → avoid
arrow_h(sl, 8.4, 4.1, 9.6, color=C_RED, text='YES')
pill(sl, "⚠ AVOID ACEi / ARBs / DRI\n(Fetotoxic — all three classes)\nUse methyldopa / labetalol", 9.6, 3.75, 3.5, 0.8,
     fill=C_RED, fs=9.5, bold=True)

# NO → continue
arrow_v(sl, 6.65, 4.55, 5.05, text='NO')

# ── Level 3: Hyperkalaemia check ──
diamond(sl, "Significant\nHyperkalemia\n(K⁺ > 5.5 mEq/L)?", 4.9, 5.05, 3.5, 1.0,
        fill=C_GOLD, line=C_ORANGE, fs=10)

# YES → caution
arrow_h(sl, 8.4, 5.55, 9.6, color=C_ORANGE, text='YES')
pill(sl, "⚠ CAUTION\nAll RAAS Inhibitors raise K⁺\nCorrect K⁺ first; use lowest dose;\nmonitor closely", 9.6, 5.18, 3.5, 0.85,
     fill=C_ORANGE, fs=9, bold=False)

# NO → go to slide 3
arrow_v(sl, 6.65, 6.05, 6.6, text='NO')
pill(sl, "➜  Proceed to Drug Class\n     Selection Algorithm  (Slide 3)", 4.9, 6.62, 3.5, 0.65,
     fill=C_NAVY, fs=10, bold=True)

# Left side legend
rect(sl, 0.15, 1.1, 4.5, 5.5, C_LGRAY, line=C_BLUE, lw=0.5)
textbox(sl, "LEGEND", 0.3, 1.15, 4.2, 0.3, fs=10, bold=True, color=C_NAVY)
legends = [
    (C_GOLD, "Decision node (diamond)"),
    (C_NAVY, "Action / drug choice (pill)"),
    (C_RED,  "Contraindication / stop"),
    (C_ORANGE, "Caution / monitor"),
    (C_GREEN, "Preferred drug choice"),
]
for i, (col, desc) in enumerate(legends):
    y = 1.55 + i*0.42
    rect(sl, 0.3, y, 0.4, 0.28, col)
    textbox(sl, desc, 0.8, y, 3.6, 0.28, fs=10, color=C_DGRAY)

footer(sl, "Decision nodes reflect absolute contraindications. Proceed left-to-right at each diamond: YES = branch right, NO = continue downward.")

# ══════════════════════════════════════════════════════════════
#  SLIDE 3 — DRUG CLASS SELECTION BY CLINICAL CONDITION
# ══════════════════════════════════════════════════════════════
sl = prs.slides.add_slide(BLANK)
rect(sl, 0, 0, 13.33, 7.5, C_BG)
header(sl, "Drug Class Selection — By Clinical Condition",
       "Which RAAS inhibitor to start? Match condition to preferred class")

# Central question
pill(sl, "SELECT BASED ON PRIMARY CONDITION", 3.7, 1.1, 5.9, 0.55,
     fill=C_NAVY, fs=13, bold=True)

# 6 condition boxes in two rows
conditions = [
    # (condition, first_choice, second_choice, avoid/note, fill_top, fill_body)
    ("Hypertension\n(Uncomplicated)", "ACEi  OR  ARB\n(equally effective)", "DRI (if ACEi/ARB\nnot tolerated)", "Not: ACEi+ARB combo\n(JNC8, NICE)", C_BLUE, RGBColor(0xE3,0xF2,0xFD)),
    ("Hypertension\n+ Diabetes", "ACEi  (1st line)\nARB  (if cough)", "DRI added if target\nnot achieved", "Not: ACEi+ARB in DM\n(worsen outcomes)", C_TEAL, RGBColor(0xE0,0xF2,0xF1)),
    ("Hypertension\n+ CKD / Proteinuria", "ACEi  OR  ARB\n(renoprotective)", "ARB preferred in\nType 2 DM + CKD", "Avoid in bilateral\nrenal artery stenosis", C_GREEN, RGBColor(0xE8,0xF5,0xE9)),
    ("Heart Failure\n(Reduced EF)", "ACEi  (CONSENSUS,\nSOLVD, SAVE evidence)", "ARB if ACEi\nnot tolerated", "Not: DRI routine\n(limited evidence)", C_PURPLE, RGBColor(0xED,0xE7,0xF6)),
    ("Post-MI /\nHigh CV Risk", "ACEi  (within 24 hrs;\nHOPE, AIRE, EUROPA)", "ARB if ACEi\nnot tolerated", "ARB non-inferior\n(VALIANT, OPTIMAAL)", C_ORANGE, RGBColor(0xFF,0xF3,0xE0)),
    ("Black Race\nHypertension", "ARB  preferred\n(NICE 2011)", "ACEi  acceptable\n(less effective solo)", "Combine with thiazide\nor CCB for added effect", C_RED, RGBColor(0xFF,0xEB,0xEE)),
]

box_w = 4.1; box_h = 2.6
positions = [(0.15, 1.8), (4.5, 1.8), (8.9, 1.8),
             (0.15, 4.5), (4.5, 4.5), (8.9, 4.5)]

for (cond, first, second, avoid, top_col, body_col), (bx, by) in zip(conditions, positions):
    # top band
    rect(sl, bx, by, box_w, 0.45, top_col)
    textbox(sl, cond, bx+0.08, by+0.03, box_w-0.14, 0.4,
            fs=11, bold=True, color=C_WHITE, align=PP_ALIGN.CENTER)
    # body
    rect(sl, bx, by+0.45, box_w, box_h-0.45, body_col, line=top_col, lw=0.8)
    # 1st choice
    textbox(sl, "1st Choice:", bx+0.1, by+0.52, 1.1, 0.22, fs=9, bold=True, color=top_col)
    textbox(sl, first, bx+0.1, by+0.72, box_w-0.18, 0.6, fs=10, bold=True, color=C_DGRAY)
    # 2nd choice
    textbox(sl, "Alternative:", bx+0.1, by+1.32, 1.2, 0.22, fs=9, bold=True, color=top_col)
    textbox(sl, second, bx+0.1, by+1.52, box_w-0.18, 0.5, fs=9.5, color=C_DGRAY)
    # avoid / note
    rect(sl, bx+0.08, by+2.12, box_w-0.16, 0.35, RGBColor(0xFF,0xF9,0xC4), line=C_ORANGE, lw=0.5)
    textbox(sl, "⚑ " + avoid, bx+0.12, by+2.14, box_w-0.22, 0.3, fs=8.5, italic=True,
            color=RGBColor(0x5D,0x40,0x37))

footer(sl, "ACEi = ACE Inhibitor  |  ARB = Angiotensin Receptor Blocker  |  DRI = Direct Renin Inhibitor (Aliskiren)  |  Based on JNC8, ACC/AHA, NICE, ESC guidelines")

# ══════════════════════════════════════════════════════════════
#  SLIDE 4 — ACEi vs ARB DECISION BRANCH
# ══════════════════════════════════════════════════════════════
sl = prs.slides.add_slide(BLANK)
rect(sl, 0, 0, 13.33, 7.5, C_BG)
header(sl, "ACE Inhibitor vs ARB — Which One to Choose?",
       "Detailed decision branch once RAAS inhibition is confirmed appropriate")

# Start pill
pill(sl, "RAAS Inhibition Indicated\n(no absolute contraindications)", 4.65, 1.08, 4.0, 0.65,
     fill=C_NAVY, fs=11, bold=True)

arrow_v(sl, 6.65, 1.73, 2.2)

# Q1: Cough on ACEi?
diamond(sl, "Dry Cough\non ACE Inhibitor?", 4.9, 2.2, 3.5, 0.88, fill=C_GOLD, line=C_ORANGE)

# YES → switch to ARB
arrow_h(sl, 8.4, 2.64, 9.5, color=C_GREEN, text='YES')
rect(sl, 9.5, 2.25, 3.6, 1.15, C_GREEN)
textbox(sl, "✔ SWITCH TO ARB", 9.6, 2.28, 3.4, 0.3, fs=11, bold=True, color=C_WHITE)
textbox(sl, "ARBs do NOT raise bradykinin → no cough.\nLosar tan / Valsartan / Telmisartan / Candesartan",
        9.6, 2.58, 3.4, 0.75, fs=9.5, color=C_WHITE)

# NO → continue
arrow_v(sl, 6.65, 3.08, 3.55, text='NO')

# Q2: Race
diamond(sl, "Patient is\nBlack Race?", 4.9, 3.55, 3.5, 0.88, fill=C_GOLD, line=C_ORANGE)

# YES → prefer ARB
arrow_h(sl, 8.4, 4.0, 9.5, color=C_GREEN, text='YES')
rect(sl, 9.5, 3.6, 3.6, 1.1, C_GREEN)
textbox(sl, "✔ PREFER ARB", 9.6, 3.63, 3.4, 0.3, fs=11, bold=True, color=C_WHITE)
textbox(sl, "NICE (2011): ARBs preferred over ACEi\nfor black races. Add thiazide or CCB.",
        9.6, 3.93, 3.4, 0.7, fs=9.5, color=C_WHITE)

# NO → continue
arrow_v(sl, 6.65, 4.43, 4.9, text='NO')

# Q3: Type 2 DM?
diamond(sl, "Type 2 Diabetes\nMellitus?", 4.9, 4.9, 3.5, 0.88, fill=C_GOLD, line=C_ORANGE)

# YES → ARB preferred
arrow_h(sl, 8.4, 5.34, 9.5, color=C_TEAL, text='YES')
rect(sl, 9.5, 4.95, 3.6, 1.1, C_TEAL)
textbox(sl, "✔ ARB PREFERRED", 9.6, 4.98, 3.4, 0.3, fs=11, bold=True, color=C_WHITE)
textbox(sl, "ARBs renoprotective in T2DM independent of BP.\nBetter tolerability → now first choice by many.",
        9.6, 5.28, 3.4, 0.7, fs=9.5, color=C_WHITE)

# NO → ACEi
arrow_v(sl, 6.65, 5.78, 6.28, text='NO')
rect(sl, 4.65, 6.28, 4.0, 0.85, C_BLUE)
textbox(sl, "✔ START ACE INHIBITOR", 4.75, 6.31, 3.8, 0.3, fs=11, bold=True, color=C_WHITE, align=PP_ALIGN.CENTER)
textbox(sl, "Enalapril / Ramipril / Lisinopril / Perindopril\nStart low; uptitrate; monitor BP, K⁺, Cr",
        4.75, 6.61, 3.8, 0.45, fs=9.5, color=C_WHITE, align=PP_ALIGN.CENTER)

# Left panel — quick notes
rect(sl, 0.15, 1.1, 4.35, 6.0, C_LGRAY, line=C_BLUE, lw=0.5)
textbox(sl, "KEY NOTES", 0.28, 1.15, 4.0, 0.3, fs=10, bold=True, color=C_NAVY)
notes = [
    ("ACEi cough:", "10–16% patients; brassy, persistent;\ncaused by ↑ bradykinin / substance P"),
    ("ARB advantage:", "No kinin effect → no cough;\nlower angioedema, rash, dysgeusia"),
    ("Equivalence:", "ACEi = ARB efficacy in HTN, CHF, MI,\ndiabetic nephropathy"),
    ("Do NOT combine:", "ACEi + ARB for HTN (JNC8, NICE);\n↑ hyperkalemia, ↑ hypotension, ↑ renal risk"),
    ("ARB options:", "Losartan, Valsartan, Candesartan,\nTelmisartan, Olmesartan, Irbesartan"),
]
for i, (k, v) in enumerate(notes):
    y = 1.55 + i * 1.05
    textbox(sl, k, 0.28, y, 1.4, 0.25, fs=9.5, bold=True, color=C_BLUE)
    textbox(sl, v, 0.28, y+0.22, 4.0, 0.7, fs=9.5, color=C_DGRAY)

footer(sl, "All decision nodes assume no absolute contraindications (bilateral RAS, pregnancy, severe hyperkalemia) — these screened out in Slide 2.")

# ══════════════════════════════════════════════════════════════
#  SLIDE 5 — DRI (ALISKIREN) DECISION BRANCH
# ══════════════════════════════════════════════════════════════
sl = prs.slides.add_slide(BLANK)
rect(sl, 0, 0, 13.33, 7.5, C_BG)
header(sl, "When to Use Direct Renin Inhibitor (Aliskiren)?",
       "DRI is a third-line option — specific indications and combinations")

# Start
pill(sl, "RAAS Inhibition Needed\n(ACEi & ARB considered first)", 4.65, 1.1, 4.0, 0.65,
     fill=C_NAVY, fs=11, bold=True)
arrow_v(sl, 6.65, 1.75, 2.22)

# Q1: ACEi/ARB failed?
diamond(sl, "ACEi AND ARB\nfailed / not tolerated?", 4.75, 2.22, 3.8, 0.95,
        fill=C_GOLD, line=C_ORANGE, fs=10)
arrow_h(sl, 8.55, 2.7, 9.55, color=C_PURPLE, text='YES')
rect(sl, 9.55, 2.25, 3.55, 1.15, C_PURPLE)
textbox(sl, "✔ ALISKIREN MONOTHERAPY", 9.65, 2.28, 3.35, 0.3, fs=10, bold=True, color=C_WHITE)
textbox(sl, "150–300 mg OD. Alternative for those who\ncannot tolerate 1st-line RAAS drugs.",
        9.65, 2.58, 3.35, 0.75, fs=9.5, color=C_WHITE)

arrow_v(sl, 6.65, 3.17, 3.62, text='NO')

# Q2: BP target not achieved on ACEi/ARB?
diamond(sl, "BP target NOT achieved\non ACEi or ARB alone?", 4.75, 3.62, 3.8, 0.95,
        fill=C_GOLD, line=C_ORANGE, fs=10)
arrow_h(sl, 8.55, 4.1, 9.55, color=C_PURPLE, text='YES')
rect(sl, 9.55, 3.65, 3.55, 1.15, C_PURPLE)
textbox(sl, "✔ ADD ALISKIREN", 9.65, 3.68, 3.35, 0.3, fs=10, bold=True, color=C_WHITE)
textbox(sl, "Combination ACEi+DRI or ARB+DRI:\ngreater BP fall; more complete RAS blockade.\nMonitor K⁺ and renal function.",
        9.65, 3.98, 3.35, 0.75, fs=9.5, color=C_WHITE)

arrow_v(sl, 6.65, 4.57, 5.02, text='NO')

# Q3: Type 2 DM on ACEi or ARB?
diamond(sl, "Type 2 Diabetes?\n(already on ACEi or ARB)", 4.75, 5.02, 3.8, 0.95,
        fill=C_GOLD, line=C_ORANGE, fs=10)
arrow_h(sl, 8.55, 5.5, 9.55, color=C_RED, text='YES')
rect(sl, 9.55, 5.05, 3.55, 1.15, C_RED)
textbox(sl, "✘ DO NOT ADD ALISKIREN", 9.65, 5.08, 3.35, 0.3, fs=10, bold=True, color=C_WHITE)
textbox(sl, "Adding DRI to ACEi/ARB in Type 2 DM:\nNo benefit; may worsen outcomes.\n(ALTITUDE trial evidence)", 9.65, 5.38, 3.35, 0.75, fs=9.5, color=C_WHITE)

arrow_v(sl, 6.65, 5.97, 6.45, text='NO')
rect(sl, 4.65, 6.45, 4.0, 0.75, C_TEAL)
textbox(sl, "✔ ALISKIREN CAN BE ADDED\nfor more complete cardioprotection",
        4.75, 6.48, 3.8, 0.65, fs=10, bold=True, color=C_WHITE, align=PP_ALIGN.CENTER)

# Left panel
rect(sl, 0.15, 1.1, 4.35, 6.0, C_LGRAY, line=C_PURPLE, lw=0.5)
textbox(sl, "ALISKIREN PROFILE", 0.28, 1.15, 4.0, 0.3, fs=10, bold=True, color=C_PURPLE)
alisk = [
    ("Mechanism:", "Nonpeptide; blocks catalytic site of\nrenin → no Ang I production"),
    ("Dose:", "150–300 mg OD\nBrands: RASILEZ, RASILEZ-HCT"),
    ("PK:", "Bioavailability low (P-gp efflux);\nt½ >24 hrs; excreted in faeces"),
    ("ADRs:", "Dyspepsia, dizziness, loose stools;\nhypotension, hyperkalemia (rare)"),
    ("Contraindicated:", "Pregnancy; T2DM + ACEi/ARB combo"),
    ("Evidence:", "LVH regression; reduces albuminuria;\nrenoprotective in HTN + DM"),
]
for i, (k, v) in enumerate(alisk):
    y = 1.55 + i * 0.87
    textbox(sl, k, 0.28, y, 1.4, 0.25, fs=9.5, bold=True, color=C_PURPLE)
    textbox(sl, v, 0.28, y+0.22, 4.0, 0.58, fs=9.5, color=C_DGRAY)

footer(sl, "DRI = Direct Renin Inhibitor (Aliskiren) | ALTITUDE trial showed harm with aliskiren + ACEi/ARB in T2DM — combination must be avoided.")

# ══════════════════════════════════════════════════════════════
#  SLIDE 6 — SPECIAL POPULATIONS DECISION TREE
# ══════════════════════════════════════════════════════════════
sl = prs.slides.add_slide(BLANK)
rect(sl, 0, 0, 13.33, 7.5, C_BG)
header(sl, "Special Populations — Tailored RAAS Drug Selection",
       "Adjust choice based on patient-specific comorbidities and characteristics")

# Title question block
pill(sl, "PATIENT HAS SPECIAL CONDITION — Select Below", 3.5, 1.1, 6.3, 0.5,
     fill=C_NAVY, fs=12, bold=True)

special = [
    # (condition, recommended, avoid, extra note, color)
    ("CHF + Sinus\nRhythm", "ACEi 1st line\n(CONSENSUS, SOLVD)\nARB if ACEi intolerant\n(valsartan, candesartan)", "DRI: limited evidence\nAldosterone antag: add\nif still symptomatic", "Target: NYHA class improvement;\n↓ mortality ~20%", C_BLUE),
    ("Post-MI\n(STEMI/NSTEMI)", "ACEi within 24 hrs\n(AIRE, TRACE, SAVE)\nContinue long-term", "ARB: non-inferior\n(VALIANT for captopril)\nUse if ACEi not tolerated", "High-risk: benefit greatest with\nassociated HTN or DM", C_ORANGE),
    ("Diabetic\nNephropathy\nType 1", "ACEi\n(slow end-stage\nrenal disease)", "ARB: alternative\nif ACEi not tolerated", "Albumin uria stabilizes;\n↓ dialysis requirement", C_TEAL),
    ("Diabetic\nNephropathy\nType 2", "ARB preferred\n(Losartan, Irbesartan\nINDEX, RENAAL trials)", "ACEi: acceptable\nalternative", "ARBs renoprotective\nindependent of BP effect", C_GREEN),
    ("Scleroderma\nRenal Crisis", "ACEi — LIFE-SAVING\n(dramatic improvement)", "ARB: less evidence\nbut acceptable", "ACEi dramatically\n↓ renovascular crisis\nrisk in scleroderma", C_RED),
    ("Hypertension\n+ LVH", "ACEi or ARB\n(reverse hypertrophy\nwithin weeks)", "Not: β-blocker alone\n(less LVH regression)", "LIFE trial: losartan\nsuperior to atenolol\nfor LVH + CV events", C_PURPLE),
    ("Resistant\nHypertension\n(3 drugs failing)", "Add DRI (Aliskiren)\nto ACEi or ARB +\nCCB + thiazide", "Not: ACEi + ARB\nalone (JNC8)", "NICE: add aldosterone\nantagonist 4th drug\nbefore DRI", C_NAVY),
    ("Non-Diabetic\nCKD / Proteinuria", "ACEi or ARB\n(reduce proteinuria,\nslow progression)", "Avoid combo ACEi+ARB\n(↑ renal risk, hyperK)", "COOPERATE: ARB+ACEi\nbetter than mono in\nnon-DM CKD (caution)", C_TEAL),
]

bw = 3.15; bh = 2.5
positions_sp = [
    (0.12, 1.75), (3.37, 1.75), (6.62, 1.75), (9.87, 1.75),
    (0.12, 4.35), (3.37, 4.35), (6.62, 4.35), (9.87, 4.35),
]

for (cond, rec, avoid, note, col), (bx, by) in zip(special, positions_sp):
    rect(sl, bx, by, bw, 0.42, col)
    textbox(sl, cond, bx+0.06, by+0.02, bw-0.1, 0.38,
            fs=10, bold=True, color=C_WHITE, align=PP_ALIGN.CENTER)
    rect(sl, bx, by+0.42, bw, bh-0.42, C_WHITE, line=col, lw=0.7)
    textbox(sl, "✔ " + rec, bx+0.08, by+0.46, bw-0.14, 0.85, fs=9.5, bold=True, color=col)
    rect(sl, bx+0.06, by+1.35, bw-0.12, 0.55, RGBColor(0xFF,0xEB,0xEE), line=C_RED, lw=0.4)
    textbox(sl, "✘ " + avoid, bx+0.1, by+1.38, bw-0.18, 0.5, fs=8.5, color=C_RED)
    rect(sl, bx+0.06, by+1.95, bw-0.12, 0.46, RGBColor(0xFF,0xF9,0xC4), line=C_ORANGE, lw=0.4)
    textbox(sl, "⚑ " + note, bx+0.1, by+1.97, bw-0.18, 0.42, fs=8, italic=True,
            color=RGBColor(0x5D,0x40,0x37))

footer(sl, "ACEi = ACE Inhibitor  |  ARB = Angiotensin Receptor Blocker  |  DRI = Aliskiren  |  LVH = Left Ventricular Hypertrophy  |  CKD = Chronic Kidney Disease")

# ══════════════════════════════════════════════════════════════
#  SLIDE 7 — ADVERSE EFFECTS & SWITCHING DECISION TREE
# ══════════════════════════════════════════════════════════════
sl = prs.slides.add_slide(BLANK)
rect(sl, 0, 0, 13.33, 7.5, C_BG)
header(sl, "Adverse Effect Management — When & How to Switch",
       "Practical algorithm for managing drug-induced problems")

pill(sl, "PATIENT ON RAAS INHIBITOR\nDevelops an Adverse Effect", 4.65, 1.1, 4.0, 0.65,
     fill=C_NAVY, fs=11, bold=True)

ae_tree = [
    # (y_start, question, yes_action, yes_color, no_text)
    (1.9,  "Dry Persistent Cough\n(on ACEi)?",
     "Switch to ARB\nSame efficacy, no kinin effect\n→ cough resolves in 4–6 days",
     C_GREEN, "NO ↓"),
    (3.1,  "Angioedema\n(on ACEi)?",
     "STOP ACEi immediately\nSwitch to ARB (angioedema\nrare with ARBs) or DRI",
     C_RED, "NO ↓"),
    (4.3,  "Hyperkalemia\n(K⁺ > 5.5 mEq/L)?",
     "REDUCE dose or STOP\nCorrect K⁺; avoid K⁺ sparing\ndiuretics, NSAIDs, β-blockers",
     C_ORANGE, "NO ↓"),
    (5.5,  "Rising Creatinine\n(>30% increase)?",
     "STOP; investigate for bilateral\nrenal artery stenosis\nMay restart at lower dose if <30%",
     C_RED, "NO ↓"),
]

for y, q, yes_act, yes_col, no_txt in ae_tree:
    diamond(sl, q, 4.85, y, 3.3, 0.9, fill=C_GOLD, line=C_ORANGE, fs=10)
    arrow_h(sl, 8.15, y+0.45, 9.2, color=yes_col, text='YES')
    rect(sl, 9.2, y+0.05, 3.9, 0.9, yes_col)
    textbox(sl, yes_act, 9.3, y+0.08, 3.7, 0.82, fs=9.5, color=C_WHITE)
    if no_txt == "NO ↓":
        arrow_v(sl, 6.5, y+0.9, y+1.1)

# Final: all well
rect(sl, 4.65, 6.52, 4.0, 0.68, C_GREEN)
textbox(sl, "✔ CONTINUE CURRENT THERAPY\nMonitor BP, K⁺, Cr every 3–6 months",
        4.75, 6.55, 3.8, 0.6, fs=10.5, bold=True, color=C_WHITE, align=PP_ALIGN.CENTER)
arrow_v(sl, 6.65, 6.4, 6.52)

# Left panel
rect(sl, 0.15, 1.1, 4.35, 5.85, C_LGRAY, line=C_RED, lw=0.5)
textbox(sl, "MONITORING CHECKLIST", 0.28, 1.15, 4.0, 0.3, fs=10, bold=True, color=C_RED)
checks = [
    "Baseline: BP, K⁺, serum Cr/eGFR before starting",
    "Recheck: 1–2 weeks after initiation",
    "Then: every 3–6 months when stable",
    "K⁺ >5.5 mEq/L → reduce dose or stop",
    "Cr rise >30% → investigate bilateral RAS",
    "Cr rise <30% → acceptable; continue",
    "Cough: confirm not cardiac / other cause first",
    "Angioedema: STOP immediately; airway risk",
    "Pregnancy test if reproductive-age women",
    "Avoid NSAIDs — reduce efficacy + raise K⁺",
]
for i, c in enumerate(checks):
    y = 1.55 + i * 0.5
    rect(sl, 0.28, y+0.02, 0.22, 0.22, C_RED if i in (3,4,7,8) else C_BLUE)
    textbox(sl, c, 0.58, y, 3.85, 0.45, fs=9.5, color=C_DGRAY)

footer(sl, "ACEi = ACE Inhibitor  |  ARB = Angiotensin Receptor Blocker  |  Cr = Creatinine  |  eGFR = estimated GFR  |  RAS = Renal Artery Stenosis")

# ══════════════════════════════════════════════════════════════
#  SLIDE 8 — COMBINATION STRATEGY & DOSE QUICK REFERENCE
# ══════════════════════════════════════════════════════════════
sl = prs.slides.add_slide(BLANK)
rect(sl, 0, 0, 13.33, 7.5, C_BG)
header(sl, "Combination Strategies & Quick Dose Reference",
       "When to combine, when to avoid, and recommended starting doses")

# Left: Combination decision boxes
rect(sl, 0.15, 1.1, 6.2, 5.9, C_LGRAY, line=C_NAVY, lw=0.5)
textbox(sl, "COMBINATION STRATEGIES", 0.28, 1.15, 5.8, 0.3, fs=11, bold=True, color=C_NAVY)

combos = [
    ("ACEi + Thiazide Diuretic", "✔ RECOMMENDED",
     "Supra-additive synergy; only 12.5 mg HCZ needed.\nExtends efficacy from ~50% to ~90%.", C_GREEN),
    ("ACEi + ARB", "✘ NOT for HTN (JNC8/NICE)",
     "↑ hyperkalemia, ↑ hypotension, ↑ renal failure.\nOnly consider in CHF/CKD under specialist guidance.", C_RED),
    ("ACEi/ARB + DRI (Aliskiren)", "✔ CONDITIONAL",
     "Greater BP fall + more complete RAS blockade.\nAVOID in Type 2 DM (worsens outcomes — ALTITUDE).", C_ORANGE),
    ("ACEi + CCB (Amlodipine)", "✔ RECOMMENDED",
     "Excellent combination; CCB offsets ACEi ankle edema\n(CCBs cause edema; ACEi reduces it). First-line combo.", C_GREEN),
    ("ACEi/ARB + Aldosterone\nAntagonist", "✔ FOR RESISTANT HTN",
     "Add when ACEi/ARB+CCB+thiazide fails.\nNICE/JNC8 recommend as 4th drug. Watch K⁺.", C_TEAL),
]

for i, (combo, verdict, detail, vcol) in enumerate(combos):
    y = 1.55 + i * 1.07
    rect(sl, 0.25, y, 6.0, 0.95, C_WHITE, line=vcol, lw=0.8)
    textbox(sl, combo, 0.35, y+0.03, 3.5, 0.3, fs=10, bold=True, color=C_NAVY)
    rect(sl, 3.9, y+0.03, 2.2, 0.28, vcol)
    textbox(sl, verdict, 3.95, y+0.04, 2.1, 0.25, fs=9, bold=True, color=C_WHITE, align=PP_ALIGN.CENTER)
    textbox(sl, detail, 0.35, y+0.35, 5.9, 0.55, fs=9.5, color=C_DGRAY)

# Right: Dose Quick Reference
rect(sl, 6.55, 1.1, 6.6, 5.9, C_LGRAY, line=C_BLUE, lw=0.5)
textbox(sl, "DOSE QUICK REFERENCE", 6.68, 1.15, 6.2, 0.3, fs=11, bold=True, color=C_BLUE)

dose_data = [
    # (class, drug, start_dose, usual_dose, max)
    ("ACEi", "Captopril",   "6.25–12.5 mg BD",  "25–50 mg BD",    "150 mg/day"),
    ("ACEi", "Enalapril",   "2.5–5 mg OD",       "10–20 mg OD",    "40 mg/day"),
    ("ACEi", "Lisinopril",  "5 mg OD",            "10–40 mg OD",    "40 mg/day"),
    ("ACEi", "Ramipril",    "1.25–2.5 mg OD",    "5–10 mg OD",     "10 mg/day"),
    ("ACEi", "Perindopril", "2–4 mg OD",          "4–8 mg OD",      "8 mg/day"),
    ("ARB",  "Losartan",    "25–50 mg OD",        "50–100 mg OD",   "100 mg/day"),
    ("ARB",  "Valsartan",   "40–80 mg OD",        "80–160 mg OD",   "320 mg/day"),
    ("ARB",  "Candesartan", "4–8 mg OD",          "8–16 mg OD",     "32 mg/day"),
    ("ARB",  "Telmisartan", "20–40 mg OD",        "40–80 mg OD",    "80 mg/day"),
    ("ARB",  "Irbesartan",  "75–150 mg OD",       "150–300 mg OD",  "300 mg/day"),
    ("DRI",  "Aliskiren",   "150 mg OD",          "150–300 mg OD",  "300 mg/day"),
]

# Table header
hdr_cols = ["Class", "Drug", "Start", "Usual", "Max"]
hdr_ws   = [0.7, 1.6, 1.6, 1.65, 1.0]
hdr_x    = [6.65]
for w in hdr_ws[:-1]: hdr_x.append(hdr_x[-1]+w)
for h, x, w in zip(hdr_cols, hdr_x, hdr_ws):
    rect(sl, x, 1.55, w, 0.32, C_NAVY)
    textbox(sl, h, x+0.03, 1.56, w-0.05, 0.29, fs=9, bold=True, color=C_WHITE, align=PP_ALIGN.CENTER)

class_colors = {"ACEi": C_BLUE, "ARB": C_GREEN, "DRI": C_PURPLE}
for r, (cls, drug, start, usual, mx) in enumerate(dose_data):
    y = 1.87 + r * 0.44
    bg = C_WHITE if r%2==0 else RGBColor(0xF0,0xF4,0xFF)
    for vals, x, w, bold_ in zip([cls, drug, start, usual, mx], hdr_x, hdr_ws,
                                   [True, True, False, False, False]):
        rect(sl, x, y, w, 0.42, bg if vals != cls else class_colors[cls], line=RGBColor(0xD0,0xD0,0xE0), lw=0.3)
        textbox(sl, vals, x+0.03, y+0.02, w-0.05, 0.38, fs=8.5,
                bold=bold_, align=PP_ALIGN.CENTER,
                color=C_WHITE if vals == cls else C_DGRAY)

footer(sl, "OD = once daily  |  BD = twice daily  |  Doses shown for hypertension; CHF/post-MI dosing may differ  |  Always start low, uptitrate, monitor renal function + K⁺")

# ══════════════════════════════════════════════════════════════
#  SLIDE 9 — ONE-PAGE SUMMARY FLOWCHART
# ══════════════════════════════════════════════════════════════
sl = prs.slides.add_slide(BLANK)
rect(sl, 0, 0, 13.33, 7.5, C_BG)
header(sl, "One-Page Clinical Summary — RAAS Inhibitor Algorithm",
       "Quick reference card for clinical use")

# Summary table
rect(sl, 0.15, 1.08, 13.0, 5.85, C_WHITE, line=C_NAVY, lw=0.7)

cols = ["Criterion", "Prefer ACEi", "Prefer ARB", "Consider DRI", "AVOID / Caution"]
col_ws = [2.4, 2.5, 2.5, 2.5, 3.1]
col_xs = [0.2]
for w in col_ws[:-1]: col_xs.append(col_xs[-1]+w)
col_fills = [C_NAVY, C_BLUE, C_GREEN, C_PURPLE, C_RED]

for h, x, w, f in zip(cols, col_xs, col_ws, col_fills):
    rect(sl, x, 1.12, w, 0.42, f)
    textbox(sl, h, x+0.06, 1.14, w-0.1, 0.38, fs=11, bold=True, color=C_WHITE, align=PP_ALIGN.CENTER)

rows_sum = [
    ("Race", "White / Asian", "Black race (NICE)", "Any (3rd line)", "—"),
    ("Cough on ACEi", "—", "✔ Switch to ARB", "Alternative", "ACEi causes cough"),
    ("Type 1 DM + nephropathy", "✔ First line", "Alternative", "—", "—"),
    ("Type 2 DM + nephropathy", "Acceptable", "✔ Preferred", "NOT with ACEi/ARB", "DRI+ACEi/ARB in T2DM"),
    ("CHF (reduced EF)", "✔ First line (RCT evidence)", "If ACEi intolerant", "Limited evidence", "ACEi + ARB (high risk)"),
    ("Post-MI", "✔ Within 24 hrs", "Non-inferior (VALIANT)", "—", "—"),
    ("LVH", "✔ Effective", "✔ Equally effective", "—", "β-blocker alone"),
    ("Scleroderma crisis", "✔ Life-saving", "Less evidence", "—", "—"),
    ("Pregnancy", "✘ Contraindicated", "✘ Contraindicated", "✘ Contraindicated", "ALL RAAS — stop immediately"),
    ("Bilateral RAS", "✘ Contraindicated", "✘ Contraindicated", "✘ Contraindicated", "All RAAS inhibitors"),
]

row_fills = [C_WHITE, RGBColor(0xF3,0xF5,0xFF)] * 5
for r, (row, rf) in enumerate(zip(rows_sum, row_fills)):
    y = 1.54 + r * 0.51
    for val, x, w in zip(row, col_xs, col_ws):
        is_contra = "✘" in val
        is_check  = "✔" in val
        bg = RGBColor(0xFF,0xEB,0xEE) if is_contra else (RGBColor(0xE8,0xF5,0xE9) if is_check else rf)
        tc = C_RED if is_contra else (C_GREEN if is_check else C_DGRAY)
        rect(sl, x, y, w, 0.49, bg, line=RGBColor(0xC0,0xC8,0xE0), lw=0.3)
        textbox(sl, val, x+0.06, y+0.02, w-0.1, 0.44, fs=9.5, color=tc,
                bold=(is_contra or is_check), align=PP_ALIGN.CENTER)

footer(sl, "ACEi = ACE Inhibitor  |  ARB = Angiotensin Receptor Blocker  |  DRI = Aliskiren  |  RAS = Renal Artery Stenosis  |  T1/T2 DM = Type 1/2 Diabetes  |  LVH = Left Ventricular Hypertrophy")

# ── SAVE ────────────────────────────────────────────────────
out = "/tmp/workspace/RAAS_Clinical_Decision_Tree.pptx"
prs.save(out)
print(f"Saved: {out}")
print(f"Slides: {len(prs.slides)}")
Running Command

cd /tmp/workspace && python ras_decision_tree.py 2>&1

Running Command

ls -lh /tmp/workspace/RAAS_Clinical_Decision_Tree.pptx

Your clinical decision tree PPT is ready:

RAAS Clinical Decision Tree

Presentation · PPTX


Here's what each slide contains:
SlideContent
1Title Slide - RAAS Inhibitor Selection overview
2Master Decision Tree - 3-step contraindication screening (bilateral RAS → Pregnancy → Hyperkalemia) before any RAAS drug is started
3Drug Class by Clinical Condition - 6 condition boxes (Uncomplicated HTN, HTN+DM, HTN+CKD, Heart Failure, Post-MI, Black Race) each showing 1st choice, alternative, and what to avoid
4ACEi vs ARB Decision Branch - Step-by-step tree: Cough? → Race? → T2DM? → each fork leads to ACEi or ARB with rationale
5DRI (Aliskiren) Decision Branch - When to use as monotherapy, as add-on, and the critical T2DM AVOID warning (ALTITUDE trial)
6Special Populations - 8 condition boxes (CHF, Post-MI, T1DM nephropathy, T2DM nephropathy, Scleroderma crisis, LVH, Resistant HTN, Non-DM CKD)
7Adverse Effect Management Tree - Cough → Angioedema → Hyperkalemia → Rising Creatinine; what to do at each step
8Combination Strategies + Dose Reference - Which combos are safe vs dangerous, plus a full dose table for all 11 drugs
9One-Page Summary Table - Color-coded matrix (✔ green / ✘ red) for every clinical scenario vs each drug class
This is a shared conversation. Sign in to Orris to start your own chat.