HIV Infection in children and ART Therapy for both children and adults with pictures

Reading File
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Finding Sources
Reading File
Reading File
Reading File
Reading File
Finding Sources
Loading Image
Reading File
Finding Sources
Finding Sources
Reading File
Reading File
Finding Sources
Reading File
Reading File
Reading File
Reading File
Reading File
Finding Sources
Reading File
Reading File
Reading File
Reading File
Searching Content

"cdn.orris.care" in /textbooks/9780443264528

Reading File
Loading Image
Reading File
Loading Image
Loading Image
I now have all the content and images needed. Let me compile the comprehensive response.

HIV Infection in Children and Antiretroviral Therapy (ART)

Sources: Robbins, Cotran & Kumar - Pathologic Basis of Disease | Red Book 2021 | Harrison's Principles of Internal Medicine 22E | Cellular and Molecular Immunology

Part 1 - HIV: The Virus

Structure and Genome

HIV is a cytopathic lentivirus of the family Retroviridae. It carries a single-stranded RNA genome flanked by Long Terminal Repeats (LTRs) and encodes three core gene groups:
GeneProductFunction
gagPr55gag polyproteinCleaved into matrix p17, capsid p24, nucleocapsid p7
polPolyproteinEncodes reverse transcriptase (p66/51), integrase (p32), protease (p10)
envgp160Cleaved to gp120 (receptor binding) + gp41 (membrane fusion)
tatp14Transcriptional activator; enhances RNA Pol II elongation
revRegulatoryControls export of viral RNA
vif, vpr, vpu, nefAccessoryVarious replication-enhancing roles
HIV genome diagram showing LTR, gag, pol, vif, vpr, vpu, env, nef and tat/rev regulatory genes
HIV genome. gp120 mediates CD4 and coreceptor binding; gp41 mediates membrane fusion. - Robbins, Cotran & Kumar Pathologic Basis of Disease

Part 2 - Pathogenesis of HIV Infection

Cellular Entry

HIV enters via CD4 as the primary receptor plus chemokine coreceptors:
  • CCR5 - used by R5 (M-tropic) strains; dominant in acute/early infection; preferentially infects macrophages
  • CXCR4 - used by X4 (T-tropic) strains; accumulate later; more virulent due to greater T-cell depletion
  • R5X4 - dual-tropic strains
The sequence of entry:
  1. gp120 binds CD4 → conformational change exposes new site for CCR5/CXCR4
  2. Coreceptor binding triggers conformational change in gp41, exposing the fusion peptide
  3. gp41 inserts into the target cell membrane → viral and host membranes fuse
  4. Viral core (RNA genome + enzymes) enters the cell

Viral Replication Cycle

  1. Reverse transcriptase converts RNA → double-stranded DNA
  2. Integrase inserts proviral DNA into host genome
  3. Host transcription factors (NF-κB, NFAT, Sp1) activate viral gene expression
  4. Tat dramatically amplifies transcription
  5. New virions bud off, and protease cleaves Gag polyprotein into mature structural proteins

CD4+ T-Cell Destruction - Mechanisms

The hallmark of AIDS is progressive CD4+ T-cell depletion by multiple mechanisms:
  • Direct cytopathic killing during viral replication and budding
  • Apoptosis via chronic activation-induced cell death (uninfected bystander cells)
  • Pyroptosis from abortive HIV infection activating the inflammasome
  • Syncytia formation - gp120 on infected cells binds CD4 on uninfected T cells → giant cells die within hours (X4 strains)
  • Decreased thymic output - HIV infects thymic progenitors
  • Latent reservoir - up to 0.05% of CD4+ cells in lymph nodes harbor integrated provirus in long-lived memory T cells; these are not eliminated by ART
HIV destroys up to 2 × 10⁹ CD4+ T cells per day. Up to 10% of CD4+ T cells in lymphoid organs may be infected, but only <0.1% of circulating CD4+ cells carry virus.

Macrophage and DC Involvement

  • Macrophages express CCR5 and low-level CD4; can be infected in a non-dividing state (via Vpr gene)
  • Act as portals of infection (>90% of acute infections are M-tropic R5 strains)
  • Carry virus to the CNS (microglia become infected)
  • Dendritic cells (DCs) capture virus at mucosal sites and transport it to lymph nodes, presenting it to CD4+ T cells

Immune Effects Summary (Robbins Table 6.14)

SystemEffect
T cellsLymphopenia; loss of activated/memory CD4+ cells; decreased IL-2, IFN-γ; decreased delayed-type hypersensitivity
B cellsParadoxical polyclonal activation → hypergammaglobulinemia; BUT inability to mount new antibody responses
MacrophagesDecreased chemotaxis, phagocytosis; decreased antigen presentation; decreased IL-1
CNSMicroglia infection; HIV-associated neurocognitive disorder (HAND) via cytokines (IL-1, TNF, IL-6) and gp41/gp120 toxicity

Part 3 - Clinical Course of HIV Infection

Fig. 6.42A - Disease Progression (CD4 Count + Viral Load Over Time)

Clinical course of HIV infection showing CD4+ T cell count decline and viremia rise across acute phase, clinical latency, and AIDS phase
Fig. 6.42A - Clinical course of HIV infection: CD4+ T-cell count (blue, declining) vs. viremia/HIV RNA copies/mL (gold, rising). Three stages: Acute → Clinical Latency (7-10 years) → AIDS. - Robbins, Cotran & Kumar

Fig. 6.42B - Immune Response to HIV

Immune response to HIV showing anti-envelope antibody, anti-p24 antibody, CTL response, and viral particle levels over weeks and years
Fig. 6.42B - Humoral and cellular immune responses to HIV. CTL response peaks at 9-12 weeks. Anti-envelope and anti-p24 antibodies peak ~12 weeks then persist. Viral particles spike acutely, drop during latency, then surge in AIDS. - Robbins, Cotran & Kumar

The Three Phases

Phase 1 - Acute Retroviral Syndrome (3-6 weeks after infection)
  • Occurs in 40-90% of infected adults, 50-90% of adolescents
  • Mononucleosis-like illness: fever, malaise, lymphadenopathy, skin rash, sore throat, myalgias
  • Viremia is extremely high; CD4 count drops sharply then partially recovers
  • Immune response partially controls virus → viral set point established (predictor of progression rate)
Phase 2 - Clinical Latency (average 7-10 years without ART)
  • Continuous viral replication in lymphoid tissues despite apparent clinical quiescence
  • CD4 count steadily declines
  • Minor opportunistic infections may emerge: oral candidiasis, herpes zoster, vaginal candidiasis, TB
  • Viral set point determines progression speed: only 8% with <4,350 copies/μL progressed to AIDS in 5 years vs. 62% with >36,270 copies
Phase 3 - AIDS
  • CD4 count <200 cells/μL (CDC Category 3)
  • Long-lasting fever, fatigue, weight loss, diarrhea, generalized lymphadenopathy
  • Serious opportunistic infections and AIDS-defining neoplasms emerge

CDC Classification of HIV Infection

CD4+ CategoryCountSignificance
Category 1≥500 cells/μLRelatively intact immunity
Category 2200-499 cells/μLModerate immunosuppression
Category 3 (AIDS)<200 cells/μLSevere immunosuppression; high OI risk

AIDS-Defining Opportunistic Infections

CategoryPathogens
ProtozoaCryptosporidium/Cystoisospora (enteritis), Pneumocystis jirovecii (PCP), Toxoplasma gondii
FungiCandida (esophageal/pulmonary), Cryptococcus (CNS), Coccidioides, Histoplasma
BacteriaM. avium-intracellulare, M. tuberculosis, Nocardia, Salmonella (disseminated)
VirusesCMV (retinitis, colitis, pneumonia), HSV, JC virus (PML)
NeoplasmsKaposi sarcoma (HHV8), B-cell lymphoma (EBV, HHV8), cervical/anal carcinoma (HPV)

B-Cell Lymphoma Pathogenesis in HIV

Flowchart showing HIV infection leading to germinal center B cell hyperplasia and failure to control EBV/KSHV-infected B cells, resulting in various B cell lymphomas
HIV-associated B-cell lymphomas arise via two pathways: AID-dependent DNA breaks/translocations (Burkitt, large B-cell lymphomas) and unchecked oncovirus-infected B cells (EBV+, HHV8+ lymphomas). - Robbins, Cotran & Kumar

Part 4 - HIV Infection in Children

Epidemiology

  • In 2023, new HIV infections among children <15 years fell to ~120,000 globally (from 300,000 in 2010), largely due to availability of ART and PMTCT programs - Harrison's 22E
  • In 2019, around 150,000 children aged 0-9 years were receiving ART - Comprehensive Clinical Nephrology
  • HIV-2 is found predominantly in West Africa; has a milder course and is intrinsically resistant to NNRTIs and enfuvirtide

Routes of Transmission to Children

  1. Vertical (mother-to-child) transmission - the primary route in children:
    • In utero (transplacental)
    • Intrapartum (during delivery - most common)
    • Postnatal via breastfeeding
  2. Blood transfusion or contaminated blood products
  3. Sexual abuse (rare)
  4. Adolescent routes: sexual contact, IV drug use
Risk factors that increase MTCT:
  • No prenatal ART or late initiation of ART
  • Detectable maternal viral load at delivery
  • Breastfeeding without infant prophylaxis
  • Premature rupture of membranes
  • Syphilis coinfection during pregnancy
The CDC advises against breastfeeding by HIV-positive mothers. Zidovudine (ZDV) prophylaxis significantly reduces perinatal/vertical transmission. - Rosen's Emergency Medicine

Infant Risk Stratification (Red Book 2021)

Risk LevelDefinition
Low RiskMother received standard ART with sustained viral suppression throughout pregnancy
Higher RiskNo prenatal care, no antepartum/intrapartum ARVs, ARVs started late (late 2nd/3rd trimester), acute HIV during pregnancy, or detectable viral load near delivery

Diagnosis in Children

  • Infants <18 months: HIV-1 DNA PCR or RNA PCR (NAAT) - serology is unreliable due to maternal IgG antibodies crossing the placenta
  • Testing schedule: at birth (if higher risk), at 14-21 days, at 1-2 months, at 4-6 months
  • Two positive virologic tests confirm infection
  • Children ≥18 months: standard HIV antibody testing is valid
  • Acute retroviral syndrome in adolescents: urgent antigen/antibody immunoassay + HIV RNA NAAT
  • CD4 counts require age-adjustment in children (children normally have higher counts than adults)

Clinical Manifestations in Children (Red Book 2021)

Clinical manifestations of untreated pediatric HIV infection include:
Constitutional features:
  • Unexplained recurrent fevers
  • Failure to thrive / poor weight gain
  • Generalized lymphadenopathy
  • Hepatomegaly and splenomegaly
  • Parotitis
Infections:
  • Persistent oral and diaper candidiasis
  • Recurrent diarrhea
  • Hepatitis
  • Recurrent invasive bacterial infections (encapsulated bacteria)
Neurological:
  • Encephalopathy (most serious CNS complication)
  • Hyperreflexia, hypertonia, or floppiness
  • Developmental delay and regression
  • Psychiatric disorders in HIV-infected children living to adolescence
Pulmonary:
  • Lymphoid interstitial pneumonia (LIP) - more common in children than adults; a defining feature of pediatric HIV
  • Pneumocystis jirovecii pneumonia (PCP)
Pre-ART era major opportunistic pathogens in US children:
  • Pneumocystis jirovecii (PCP)
  • Invasive encapsulated bacteria
  • Varicella-zoster virus
  • CMV, HSV
  • Mycobacterium avium complex
  • Cryptococcus neoformans
  • Candida species
Malignancies in HIV-infected children:
  • Leiomyosarcomas
  • Non-Hodgkin B-cell lymphoma (Burkitt type, including CNS)
  • Kaposi sarcoma (rare in US children; more common in children from sub-Saharan Africa)
Immune Reconstitution Inflammatory Syndrome (IRIS): Paradoxical clinical deterioration after ART initiation as cell-mediated immunity is restored. Observed with mycobacteria (TB, BCG), herpesviruses, and fungi (Cryptococcus).

Part 5 - Antiretroviral Therapy (ART)

Principles of ART

  • Indication: ART is indicated for all HIV-infected individuals - adults, adolescents, and children - regardless of CD4 count, and should be initiated as soon as possible after diagnosis
  • Goal: Sustained suppression of HIV RNA to undetectable levels (<50 copies/mL)
  • A minimum of 3 active drugs targeting different viral steps is standard
  • ARV resistance testing (genotyping) should be done before starting ART
  • With effective ART, CD4 count gradually normalizes over years; annual AIDS death rate in the US fell from 18/100,000 (1996 peak) to <2/100,000
  • Enrollment in clinical trials is encouraged for HIV-infected children and adolescents

The Six Drug Classes and Their Targets

ART targets distinct steps of the HIV life cycle:
Drug ClassTarget StepExamples
NRTIs (Nucleoside/Nucleotide Reverse Transcriptase Inhibitors)Competitive inhibition of reverse transcriptase; chain terminationTenofovir (TDF, TAF), Zidovudine (ZDV/AZT), Lamivudine (3TC), Emtricitabine (FTC), Abacavir (ABC), Stavudine (d4T)
NNRTIs (Non-Nucleoside Reverse Transcriptase Inhibitors)Non-competitive inhibition of reverse transcriptaseEfavirenz (EFV), Rilpivirine, Nevirapine, Doravirine
PIs (Protease Inhibitors)Block viral protease; prevent Gag/Pol polyprotein cleavage → immature, non-infectious virionsRitonavir, Lopinavir/r, Atazanavir, Darunavir
INSTIs (Integrase Strand Transfer Inhibitors)Block integration of proviral DNA into host genomeDolutegravir (DTG), Raltegravir, Bictegravir, Cabotegravir
Fusion InhibitorsBlock gp41-mediated membrane fusionEnfuvirtide (T-20)
CCR5 Antagonists (Entry Inhibitors)Block CCR5 coreceptor; only effective against R5-tropic strainsMaraviroc
HIV-2 is intrinsically resistant to NNRTIs and enfuvirtide - Red Book 2021

First-Line ART Regimens

Preferred regimens for adults and adolescents (WHO/US guidelines):
  • Tenofovir (TDF or TAF) + Emtricitabine (FTC) or Lamivudine (3TC) + Dolutegravir (DTG) - the backbone of modern global HIV treatment; endorsed by WHO as preferred regimen
This fixed-dose combination is now available for <$45/patient/year in low- and middle-income countries (down from >$10,000 in 2000).
For children:
  • The regimen is age- and weight-based
  • Consultation with a pediatric HIV specialist is strongly recommended
  • ARV resistance testing (genotyping) before initiation
  • Pediatric-specific guidelines available at AIDSinfo NIH - Pediatric ARV Guidelines

When to Change ART

A regimen change should be considered when:
  1. Evidence of virologic failure (detectable viral load on therapy)
  2. Evidence of immunologic failure (declining CD4 count)
  3. Clinical disease progression
  4. Drug toxicity or intolerance
  5. Evidence of drug resistance on genotyping
  6. Availability of a superior regimen

ART in Pregnancy and PMTCT

  • Zidovudine (ZDV/AZT) prophylaxis has been shown to significantly reduce vertical/perinatal HIV transmission
  • The benefit of HIV treatment far outweighs drug risks during pregnancy
  • Didanosine, lamivudine, stavudine, zidovudine, zalcitabine carry a small risk of mitochondrial dysfunction in the fetus; no specific malformation pattern has been described for PIs (ritonavir, nelfinavir)
  • Maternal viral load directly determines the risk of MTCT - suppressed VL = minimal transmission risk
  • Breastfeeding by HIV-positive mothers is discouraged by CDC (postnatal transmission risk)

Long-Term ART Complications

Even with excellent virologic control, long-term ART is associated with:
  • Lipodystrophy: lipoatrophy (facial fat loss) + lipohypertrophy (central fat accumulation)
  • Dyslipidemia and insulin resistance
  • Peripheral neuropathy
  • Cardiovascular, renal, and hepatic dysfunction (mechanisms include persistent inflammation even with undetectable VL)
  • IRIS: paradoxical worsening after ART initiation in severely immunosuppressed patients

The Global ART Scale-Up

  • UNAIDS 95-95-95 targets for 2030: 95% of PLHIV know their status → 95% on ART → 95% virally suppressed
  • Five countries (Botswana, Eswatini, Rwanda, Tanzania, Zimbabwe) have already met these targets
  • By 2022, 76% of all people with HIV globally were receiving ART - Harrison's 22E
  • Generic manufacturing has brought first-line costs from >$10,000 to <$45/patient/year

Key Concepts Summary

TopicKey Points
HIV entryCD4 receptor + CCR5/CXCR4 coreceptor; gp120 binds then gp41 fuses
Primary targetCD4+ helper T cells; also macrophages and DCs
Pediatric transmissionVertical (in utero, intrapartum, breastfeeding) is dominant; ZDV prophylaxis prevents it
Pediatric presentationFTT, recurrent candidiasis, LIP, developmental delay, encephalopathy
ART indicationAll HIV-infected individuals, all ages, regardless of CD4 count
ART backboneTDF/TAF + 3TC/FTC + DTG (dolutegravir preferred integrase inhibitor)
Goal of ARTUndetectable viral load (<50 copies/mL); CD4 normalization
ART in pregnancyPrevents MTCT; ZDV reduces transmission; breastfeeding discouraged
6 drug classesNRTIs, NNRTIs, PIs, INSTIs, fusion inhibitors, CCR5 antagonists

Make a quick reference PDF guide on pediatric HIV diagnosis, treatment, and monitoring

Reading File
Reading File
Running Command

ls -la /tmp/workspace/ 2>/dev/null || echo "workspace empty or missing"

Running Command

mkdir -p /tmp/workspace/pediatric-hiv-guide

Writing File

~/pediatric-hiv-guide/build_pdf.py

"""
Pediatric HIV Quick Reference Guide - PDF Builder
Uses reportlab for professional medical reference layout
"""

from reportlab.platypus import (
    SimpleDocTemplate, Table, TableStyle, Paragraph, Spacer,
    HRFlowable, KeepTogether, PageBreak
)
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib import colors
from reportlab.lib.units import mm, inch
from reportlab.lib.pagesizes import A4
from reportlab.lib.enums import TA_CENTER, TA_LEFT, TA_JUSTIFY
from reportlab.platypus import Flowable

OUTPUT = "/tmp/workspace/pediatric-hiv-guide/Pediatric_HIV_Quick_Reference.pdf"

# ── Color Palette ──────────────────────────────────────────────────────────────
RED_DARK    = colors.HexColor("#C0392B")
RED_LIGHT   = colors.HexColor("#FADBD8")
TEAL_DARK   = colors.HexColor("#117A65")
TEAL_LIGHT  = colors.HexColor("#D5F5E3")
BLUE_DARK   = colors.HexColor("#1A5276")
BLUE_MED    = colors.HexColor("#2E86C1")
BLUE_LIGHT  = colors.HexColor("#D6EAF8")
ORANGE_DARK = colors.HexColor("#BA4A00")
ORANGE_LIGHT= colors.HexColor("#FAE5D3")
PURPLE_DARK = colors.HexColor("#6C3483")
PURPLE_LIGHT= colors.HexColor("#E8DAEF")
GREY_DARK   = colors.HexColor("#2C3E50")
GREY_MED    = colors.HexColor("#566573")
GREY_LIGHT  = colors.HexColor("#F2F3F4")
GREY_RULE   = colors.HexColor("#BDC3C7")
WHITE       = colors.white
YELLOW_LIGHT= colors.HexColor("#FEF9E7")
YELLOW_DARK = colors.HexColor("#D4AC0D")

# ── Document Setup ─────────────────────────────────────────────────────────────
doc = SimpleDocTemplate(
    OUTPUT,
    pagesize=A4,
    leftMargin=14*mm, rightMargin=14*mm,
    topMargin=14*mm, bottomMargin=14*mm,
    title="Pediatric HIV Quick Reference Guide",
    author="Orris Medical Reference",
    subject="Pediatric HIV Diagnosis, Treatment and Monitoring"
)

W = A4[0] - 28*mm   # usable width

# ── Styles ─────────────────────────────────────────────────────────────────────
base = getSampleStyleSheet()

def S(name, parent='Normal', **kw):
    return ParagraphStyle(name, parent=base[parent], **kw)

sTitle = S('sTitle', 'Title',
    fontSize=22, textColor=WHITE, alignment=TA_CENTER,
    spaceAfter=2, leading=26)

sSubtitle = S('sSubtitle',
    fontSize=11, textColor=colors.HexColor("#D6EAF8"),
    alignment=TA_CENTER, spaceAfter=4, leading=14)

sSectionHead = S('sSectionHead',
    fontSize=11, textColor=WHITE, fontName='Helvetica-Bold',
    alignment=TA_LEFT, leading=14, leftIndent=4)

sBody = S('sBody',
    fontSize=8.5, textColor=GREY_DARK, leading=12, spaceAfter=2)

sBullet = S('sBullet',
    fontSize=8.2, textColor=GREY_DARK, leading=11.5,
    leftIndent=10, firstLineIndent=-8, spaceAfter=1.5)

sTableHead = S('sTableHead',
    fontSize=8, textColor=WHITE, fontName='Helvetica-Bold',
    alignment=TA_CENTER, leading=10)

sTableCell = S('sTableCell',
    fontSize=7.8, textColor=GREY_DARK, leading=10.5)

sTableCellC = S('sTableCellC',
    fontSize=7.8, textColor=GREY_DARK, leading=10.5, alignment=TA_CENTER)

sWarning = S('sWarning',
    fontSize=8, textColor=colors.HexColor("#7D6608"),
    fontName='Helvetica-Bold', leading=11)

sNote = S('sNote',
    fontSize=7.5, textColor=GREY_MED, leading=10, fontName='Helvetica-Oblique')

sFooter = S('sFooter',
    fontSize=7, textColor=GREY_MED, alignment=TA_CENTER, leading=9)

sBadge = S('sBadge',
    fontSize=7.8, textColor=WHITE, fontName='Helvetica-Bold',
    alignment=TA_CENTER, leading=10)

# ── Helper Flowables ───────────────────────────────────────────────────────────
def rule(color=GREY_RULE, thickness=0.5, spB=3, spA=3):
    return HRFlowable(width="100%", thickness=thickness,
                      color=color, spaceAfter=spA, spaceBefore=spB)

def sp(h=4):
    return Spacer(1, h*mm)

def section_header(text, bg=BLUE_DARK, icon=""):
    label = f"{icon}  {text}" if icon else text
    tbl = Table([[Paragraph(label, sSectionHead)]], colWidths=[W])
    tbl.setStyle(TableStyle([
        ('BACKGROUND', (0,0), (-1,-1), bg),
        ('TOPPADDING',    (0,0), (-1,-1), 5),
        ('BOTTOMPADDING', (0,0), (-1,-1), 5),
        ('LEFTPADDING',   (0,0), (-1,-1), 8),
        ('RIGHTPADDING',  (0,0), (-1,-1), 8),
        ('ROUNDEDCORNERS', [3, 3, 3, 3]),
    ]))
    return tbl

def banner_box(text, bg=BLUE_LIGHT, border=BLUE_MED, style=sBody):
    tbl = Table([[Paragraph(text, style)]], colWidths=[W])
    tbl.setStyle(TableStyle([
        ('BACKGROUND',    (0,0), (-1,-1), bg),
        ('BOX',           (0,0), (-1,-1), 1.2, border),
        ('TOPPADDING',    (0,0), (-1,-1), 6),
        ('BOTTOMPADDING', (0,0), (-1,-1), 6),
        ('LEFTPADDING',   (0,0), (-1,-1), 10),
        ('RIGHTPADDING',  (0,0), (-1,-1), 10),
    ]))
    return tbl

def warning_box(text):
    style = ParagraphStyle('wb', fontSize=8, textColor=colors.HexColor("#7D6608"),
                           fontName='Helvetica-Bold', leading=11)
    tbl = Table([[Paragraph("⚠  " + text, style)]], colWidths=[W])
    tbl.setStyle(TableStyle([
        ('BACKGROUND',    (0,0), (-1,-1), YELLOW_LIGHT),
        ('BOX',           (0,0), (-1,-1), 1.2, YELLOW_DARK),
        ('TOPPADDING',    (0,0), (-1,-1), 6),
        ('BOTTOMPADDING', (0,0), (-1,-1), 6),
        ('LEFTPADDING',   (0,0), (-1,-1), 10),
        ('RIGHTPADDING',  (0,0), (-1,-1), 10),
    ]))
    return tbl

def make_table(headers, rows, col_widths, header_bg=BLUE_DARK, alt=True):
    data = [[Paragraph(h, sTableHead) for h in headers]]
    for i, row in enumerate(rows):
        data.append([Paragraph(str(c), sTableCell) for c in row])
    tbl = Table(data, colWidths=col_widths)
    style_cmds = [
        ('BACKGROUND',    (0,0), (-1,0),  header_bg),
        ('TEXTCOLOR',     (0,0), (-1,0),  WHITE),
        ('FONTNAME',      (0,0), (-1,0),  'Helvetica-Bold'),
        ('ALIGN',         (0,0), (-1,-1), 'LEFT'),
        ('VALIGN',        (0,0), (-1,-1), 'TOP'),
        ('TOPPADDING',    (0,0), (-1,-1), 4),
        ('BOTTOMPADDING', (0,0), (-1,-1), 4),
        ('LEFTPADDING',   (0,0), (-1,-1), 5),
        ('RIGHTPADDING',  (0,0), (-1,-1), 5),
        ('GRID',          (0,0), (-1,-1), 0.4, GREY_RULE),
        ('ROWBACKGROUNDS',(0,1), (-1,-1), [WHITE, GREY_LIGHT] if alt else [WHITE]),
    ]
    tbl.setStyle(TableStyle(style_cmds))
    return tbl

# ═══════════════════════════════════════════════════════════════════════════════
# BUILD CONTENT
# ═══════════════════════════════════════════════════════════════════════════════
elements = []

# ── COVER HEADER ──────────────────────────────────────────────────────────────
cover_data = [[
    Paragraph("PEDIATRIC HIV", sTitle),
    Paragraph("Quick Reference Guide", sSubtitle),
    Paragraph(
        "Diagnosis  •  Treatment  •  Monitoring  •  PMTCT",
        S('cs2', fontSize=9.5, textColor=colors.HexColor("#AED6F1"),
          alignment=TA_CENTER, leading=13)
    ),
    Paragraph(
        "Sources: Red Book 2021 | Harrison's 22E | Robbins Pathology | NIH AIDSinfo Guidelines",
        S('cs3', fontSize=7.5, textColor=colors.HexColor("#85C1E9"),
          alignment=TA_CENTER, fontName='Helvetica-Oblique', leading=10)
    ),
]]
cover = Table(cover_data, colWidths=[W])
cover.setStyle(TableStyle([
    ('BACKGROUND',    (0,0), (-1,-1), BLUE_DARK),
    ('TOPPADDING',    (0,0), (-1,-1), 12),
    ('BOTTOMPADDING', (0,0), (-1,-1), 12),
    ('LEFTPADDING',   (0,0), (-1,-1), 16),
    ('RIGHTPADDING',  (0,0), (-1,-1), 16),
    ('LINEBELOW',     (0,0), (-1,-1), 3, RED_DARK),
]))
elements.append(cover)
elements.append(sp(3))

# ═══════════════════════════════════════════════════════
# SECTION 1 — EPIDEMIOLOGY & TRANSMISSION
# ═══════════════════════════════════════════════════════
elements.append(section_header("1.  EPIDEMIOLOGY & ROUTES OF TRANSMISSION", bg=BLUE_DARK))
elements.append(sp(2))

epi_left = [
    Paragraph("<b>Global Burden</b>", sBody),
    Paragraph("• ~39 million people living with HIV worldwide (2022)", sBullet),
    Paragraph("• New child (<15 yrs) infections fell from 300,000 (2010) → 120,000 (2023)", sBullet),
    Paragraph("• 67% of PLHIV live in Sub-Saharan Africa", sBullet),
    Paragraph("• ~150,000 children age 0-9 receiving ART globally (2019)", sBullet),
    sp(2),
    Paragraph("<b>HIV-1 vs HIV-2</b>", sBody),
    Paragraph("• HIV-1: dominant worldwide; 8 subtypes (clades A–K, Group M)", sBullet),
    Paragraph("• HIV-2: West Africa; milder course; longer time to AIDS", sBullet),
    Paragraph("• HIV-2 is intrinsically resistant to NNRTIs and enfuvirtide", sBullet),
]

trans_rows = [
    ["In utero", "Transplacental; ~5–10% of MTCT"],
    ["Intrapartum", "During delivery; MOST common (~65–70% of MTCT)"],
    ["Postnatal", "Breastfeeding; ~15–20% risk without prophylaxis"],
    ["Blood products", "Transfusion, contaminated needles"],
    ["Sexual abuse", "Rare; adolescent risk"],
    ["Adolescent routes", "Sexual contact, IV drug use"],
]
trans_tbl = make_table(
    ["Route", "Notes"],
    trans_rows,
    [35*mm, W - 35*mm - 4*mm],
    header_bg=TEAL_DARK
)

two_col = Table(
    [[epi_left, trans_tbl]],
    colWidths=[(W/2)-3*mm, (W/2)-1*mm]
)
two_col.setStyle(TableStyle([
    ('VALIGN', (0,0), (-1,-1), 'TOP'),
    ('LEFTPADDING', (0,0), (-1,-1), 0),
    ('RIGHTPADDING', (0,0), (-1,-1), 0),
    ('TOPPADDING', (0,0), (-1,-1), 0),
    ('BOTTOMPADDING', (0,0), (-1,-1), 0),
    ('LINEAFTER', (0,0), (0,-1), 0.5, GREY_RULE),
]))
elements.append(two_col)
elements.append(sp(2))

elements.append(warning_box(
    "CDC advises against breastfeeding by HIV-positive mothers. "
    "Zidovudine (ZDV) prophylaxis significantly reduces perinatal/vertical transmission."
))
elements.append(sp(3))

# ═══════════════════════════════════════════════════════
# SECTION 2 — MATERNAL RISK STRATIFICATION
# ═══════════════════════════════════════════════════════
elements.append(section_header("2.  MATERNAL RISK STRATIFICATION (Red Book 2021)", bg=TEAL_DARK))
elements.append(sp(2))

risk_rows = [
    [
        Paragraph("<b>LOW RISK</b>", S('lr', fontSize=8.5, textColor=colors.HexColor("#117A65"), fontName='Helvetica-Bold', alignment=TA_CENTER)),
        Paragraph(
            "Mother received standard ART during pregnancy WITH sustained viral suppression "
            "(HIV RNA below lower limit of detection of ultrasensitive assay) AND no adherence concerns.",
            sTableCell
        )
    ],
    [
        Paragraph("<b>HIGHER RISK</b>", S('hr', fontSize=8.5, textColor=RED_DARK, fontName='Helvetica-Bold', alignment=TA_CENTER)),
        Paragraph(
            "• No prenatal care   • No antepartum or intrapartum ARVs<br/>"
            "• Intrapartum ARVs only   • ART initiated late (late 2nd / 3rd trimester)<br/>"
            "• Acute HIV infection during pregnancy<br/>"
            "• Detectable viral load close to delivery (even if on combination ARVs)<br/>"
            "• No sustained viral suppression",
            sTableCell
        )
    ],
]
risk_tbl = Table(risk_rows, colWidths=[28*mm, W - 28*mm])
risk_tbl.setStyle(TableStyle([
    ('BACKGROUND',    (0,0), (0,0), TEAL_LIGHT),
    ('BACKGROUND',    (0,1), (0,1), RED_LIGHT),
    ('BOX',           (0,0), (-1,-1), 0.8, GREY_RULE),
    ('INNERGRID',     (0,0), (-1,-1), 0.4, GREY_RULE),
    ('VALIGN',        (0,0), (-1,-1), 'MIDDLE'),
    ('TOPPADDING',    (0,0), (-1,-1), 6),
    ('BOTTOMPADDING', (0,0), (-1,-1), 6),
    ('LEFTPADDING',   (0,0), (-1,-1), 6),
    ('RIGHTPADDING',  (0,0), (-1,-1), 6),
]))
elements.append(risk_tbl)
elements.append(sp(1))
elements.append(Paragraph(
    "* For higher-risk infants: additional virologic testing at birth AND 2–4 weeks after cessation of ARV prophylaxis (8–10 weeks of life)",
    sNote
))
elements.append(sp(3))

# ═══════════════════════════════════════════════════════
# SECTION 3 — DIAGNOSIS
# ═══════════════════════════════════════════════════════
elements.append(section_header("3.  DIAGNOSIS", bg=PURPLE_DARK))
elements.append(sp(2))

elements.append(banner_box(
    "<b>KEY RULE:</b> In infants <18 months, maternal IgG antibodies cross the placenta — "
    "standard HIV antibody tests are UNRELIABLE. Use virologic (PCR/NAAT) testing only.",
    bg=PURPLE_LIGHT, border=PURPLE_DARK,
    style=S('bx', fontSize=8.5, textColor=GREY_DARK, leading=12)
))
elements.append(sp(2))

# Testing by age
diag_rows = [
    ["<b>< 18 months</b>", "HIV-1 DNA PCR or HIV RNA PCR (NAAT)",
     "2 positive virologic tests confirm infection.\nAntibody testing unreliable (maternal IgG)."],
    ["<b>≥ 18 months</b>", "4th-gen HIV Ag/Ab combo assay",
     "Standard serology valid. Confirm positive screen with supplemental test."],
    ["<b>Acute retroviral syndrome</b>", "HIV Ag/Ab immunoassay + HIV RNA NAAT",
     "Do NOT assume negative antibody = uninfected. RNA NAAT needed for acute infection."],
]
diag_tbl = Table(
    [[Paragraph(h, sTableHead) for h in ["Age / Situation", "Test of Choice", "Notes"]]] +
    [[Paragraph(r[0], sTableCell), Paragraph(r[1], sTableCell), Paragraph(r[2], sTableCell)] for r in diag_rows],
    colWidths=[30*mm, 60*mm, W-93*mm]
)
diag_tbl.setStyle(TableStyle([
    ('BACKGROUND',    (0,0), (-1,0), PURPLE_DARK),
    ('TEXTCOLOR',     (0,0), (-1,0), WHITE),
    ('FONTNAME',      (0,0), (-1,0), 'Helvetica-Bold'),
    ('GRID',          (0,0), (-1,-1), 0.4, GREY_RULE),
    ('ROWBACKGROUNDS',(0,1), (-1,-1), [WHITE, PURPLE_LIGHT]),
    ('VALIGN',        (0,0), (-1,-1), 'TOP'),
    ('TOPPADDING',    (0,0), (-1,-1), 5),
    ('BOTTOMPADDING', (0,0), (-1,-1), 5),
    ('LEFTPADDING',   (0,0), (-1,-1), 5),
    ('RIGHTPADDING',  (0,0), (-1,-1), 5),
]))
elements.append(diag_tbl)
elements.append(sp(2))

# Testing Schedule
elements.append(Paragraph("<b>Recommended Virologic Testing Schedule for HIV-Exposed Infants</b>", sBody))
elements.append(sp(1))
sched_rows = [
    ["Birth", "Higher-risk infants only", "If positive — repeat ASAP; initiate ART"],
    ["14–21 days", "All exposed infants", "First routine test"],
    ["1–2 months", "All exposed infants", "—"],
    ["4–6 months", "All exposed infants", "If negative × 2 after 1 month AND not breastfeeding → presumptive uninfected"],
    ["8–10 weeks*", "Higher-risk infants", "2–4 weeks after cessation of ARV prophylaxis"],
    ["≥18 months", "All exposed children", "Confirmatory antibody test if prior virologic tests negative"],
]
sched_tbl = make_table(
    ["Timepoint", "Population", "Action if Positive"],
    sched_rows,
    [28*mm, 50*mm, W-81*mm],
    header_bg=PURPLE_DARK
)
elements.append(sched_tbl)
elements.append(sp(3))

# ═══════════════════════════════════════════════════════
# SECTION 4 — CLINICAL MANIFESTATIONS
# ═══════════════════════════════════════════════════════
elements.append(section_header("4.  CLINICAL MANIFESTATIONS OF PEDIATRIC HIV", bg=RED_DARK))
elements.append(sp(2))

def symptom_col(title, items, bg, border):
    content = [Paragraph(f"<b>{title}</b>",
                         S('st2', fontSize=8.5, textColor=border, fontName='Helvetica-Bold', leading=12))]
    for item in items:
        content.append(Paragraph(f"• {item}", sBullet))
    tbl = Table([content], colWidths=[(W/3)-2*mm])
    tbl.setStyle(TableStyle([
        ('BACKGROUND',    (0,0), (-1,-1), bg),
        ('BOX',           (0,0), (-1,-1), 1, border),
        ('TOPPADDING',    (0,0), (-1,-1), 6),
        ('BOTTOMPADDING', (0,0), (-1,-1), 6),
        ('LEFTPADDING',   (0,0), (-1,-1), 7),
        ('RIGHTPADDING',  (0,0), (-1,-1), 7),
    ]))
    return tbl

col1 = symptom_col("Constitutional", [
    "Recurrent unexplained fevers",
    "Failure to thrive / poor weight gain",
    "Generalized lymphadenopathy",
    "Hepatomegaly & splenomegaly",
    "Parotitis",
    "Chronic diarrhea",
], RED_LIGHT, RED_DARK)

col2 = symptom_col("Neurological / Pulmonary", [
    "Encephalopathy (most serious)",
    "Developmental delay / regression",
    "Hyperreflexia, hypertonia, floppiness",
    "Psychiatric disorders (adolescence)",
    "Lymphoid interstitial pneumonia (LIP)",
    "PCP (Pneumocystis jirovecii)",
], BLUE_LIGHT, BLUE_DARK)

col3 = symptom_col("Infections / Malignancies", [
    "Persistent oral & diaper candidiasis",
    "Recurrent invasive bacterial infections",
    "CMV, HSV, VZV reactivation",
    "M. avium complex (MAC)",
    "Cryptococcal meningitis",
    "Burkitt lymphoma, Leiomyosarcoma",
], PURPLE_LIGHT, PURPLE_DARK)

three_col = Table([[col1, col2, col3]], colWidths=[(W/3)-1*mm, (W/3)-1*mm, (W/3)])
three_col.setStyle(TableStyle([
    ('VALIGN',        (0,0), (-1,-1), 'TOP'),
    ('LEFTPADDING',   (0,0), (-1,-1), 1),
    ('RIGHTPADDING',  (0,0), (-1,-1), 1),
    ('TOPPADDING',    (0,0), (-1,-1), 0),
    ('BOTTOMPADDING', (0,0), (-1,-1), 0),
]))
elements.append(three_col)
elements.append(sp(2))

elements.append(banner_box(
    "<b>IRIS (Immune Reconstitution Inflammatory Syndrome):</b> Paradoxical clinical deterioration "
    "shortly after ART initiation as cell-mediated immunity is restored. Common triggers: "
    "Mycobacteria (TB, BCG), herpesviruses, Cryptococcus. Monitor closely in the first weeks of ART.",
    bg=ORANGE_LIGHT, border=ORANGE_DARK,
    style=S('iris', fontSize=8, textColor=GREY_DARK, leading=12)
))
elements.append(sp(3))

# ═══════════════════════════════════════════════════════
# SECTION 5 — ART DRUG CLASSES
# ═══════════════════════════════════════════════════════
elements.append(section_header("5.  ANTIRETROVIRAL DRUG CLASSES & MECHANISMS", bg=TEAL_DARK))
elements.append(sp(2))

art_rows = [
    ["NRTIs\n(Nucleoside/Nucleotide RTIs)",
     "Competitive inhibition of reverse transcriptase; chain termination — block RNA→DNA conversion",
     "Tenofovir (TDF/TAF), Zidovudine (ZDV/AZT), Lamivudine (3TC), Emtricitabine (FTC), Abacavir (ABC)"],
    ["NNRTIs\n(Non-Nucleoside RTIs)",
     "Non-competitive allosteric inhibition of reverse transcriptase",
     "Efavirenz (EFV), Rilpivirine, Nevirapine, Doravirine\n⚠ HIV-2 is intrinsically resistant"],
    ["PIs\n(Protease Inhibitors)",
     "Block viral protease; prevent Gag/Pol polyprotein cleavage → immature non-infectious virions",
     "Ritonavir (pharmacokinetic booster), Lopinavir/r, Atazanavir, Darunavir"],
    ["INSTIs\n(Integrase Strand Transfer Inhibitors)",
     "Block integration of proviral DNA into host genome; preferred class in modern regimens",
     "Dolutegravir (DTG) ★ preferred, Raltegravir, Bictegravir, Cabotegravir"],
    ["Fusion Inhibitors",
     "Block gp41-mediated membrane fusion between HIV and target cell",
     "Enfuvirtide (T-20)\n⚠ HIV-2 intrinsically resistant"],
    ["CCR5 Antagonists\n(Entry Inhibitors)",
     "Block CCR5 coreceptor; prevent R5-tropic HIV entry. Tropism testing required before use.",
     "Maraviroc"],
]

art_tbl = Table(
    [[Paragraph(h, sTableHead) for h in ["Drug Class", "Mechanism of Action", "Key Agents"]]] +
    [[Paragraph(r[0], S('tc2', fontSize=7.8, fontName='Helvetica-Bold', textColor=TEAL_DARK, leading=11)),
      Paragraph(r[1], sTableCell),
      Paragraph(r[2], sTableCell)] for r in art_rows],
    colWidths=[38*mm, 72*mm, W-113*mm]
)
art_tbl.setStyle(TableStyle([
    ('BACKGROUND',    (0,0), (-1,0), TEAL_DARK),
    ('TEXTCOLOR',     (0,0), (-1,0), WHITE),
    ('FONTNAME',      (0,0), (-1,0), 'Helvetica-Bold'),
    ('GRID',          (0,0), (-1,-1), 0.4, GREY_RULE),
    ('ROWBACKGROUNDS',(0,1), (-1,-1), [WHITE, TEAL_LIGHT]),
    ('VALIGN',        (0,0), (-1,-1), 'TOP'),
    ('TOPPADDING',    (0,0), (-1,-1), 5),
    ('BOTTOMPADDING', (0,0), (-1,-1), 5),
    ('LEFTPADDING',   (0,0), (-1,-1), 5),
    ('RIGHTPADDING',  (0,0), (-1,-1), 5),
]))
elements.append(art_tbl)
elements.append(sp(3))

# ═══════════════════════════════════════════════════════
# PAGE 2
# ═══════════════════════════════════════════════════════
elements.append(PageBreak())

# ── PAGE 2 MINI HEADER ────────────────────────────────
pg2_hdr = Table(
    [[Paragraph("PEDIATRIC HIV QUICK REFERENCE  —  Page 2", 
                S('ph', fontSize=9, textColor=WHITE, fontName='Helvetica-Bold',
                  alignment=TA_LEFT))]],
    colWidths=[W]
)
pg2_hdr.setStyle(TableStyle([
    ('BACKGROUND',    (0,0), (-1,-1), BLUE_DARK),
    ('TOPPADDING',    (0,0), (-1,-1), 5),
    ('BOTTOMPADDING', (0,0), (-1,-1), 5),
    ('LEFTPADDING',   (0,0), (-1,-1), 10),
    ('RIGHTPADDING',  (0,0), (-1,-1), 10),
    ('LINEBELOW',     (0,0), (-1,-1), 2, RED_DARK),
]))
elements.append(pg2_hdr)
elements.append(sp(3))

# ═══════════════════════════════════════════════════════
# SECTION 6 — ART REGIMENS
# ═══════════════════════════════════════════════════════
elements.append(section_header("6.  ART REGIMENS — WHEN TO START & FIRST-LINE CHOICES", bg=BLUE_DARK))
elements.append(sp(2))

# When to start
start_box_data = [
    Paragraph("<b>WHEN TO START ART</b>", S('ws', fontSize=9, textColor=BLUE_DARK, fontName='Helvetica-Bold', leading=12)),
    Paragraph("ART is indicated for ALL HIV-infected individuals — infants, children, adolescents, and adults — "
              "regardless of CD4 count. Initiate as soon as possible after diagnosis is confirmed.", sBody),
    sp(1),
    Paragraph("• <b>Infants:</b> Start ART immediately after confirmed positive virologic test", sBullet),
    Paragraph("• <b>Children:</b> ART regardless of CD4 count or clinical stage", sBullet),
    Paragraph("• <b>Adolescents/Adults:</b> ART for all, regardless of CD4 count, once medication readiness is confirmed", sBullet),
    Paragraph("• <b>Goal:</b> HIV RNA undetectable (<50 copies/mL) and maintained indefinitely", sBullet),
    Paragraph("• <b>Minimum:</b> At least 3 active drugs from ≥2 drug classes", sBullet),
    Paragraph("• <b>Before starting:</b> ARV resistance testing (viral genotyping) is recommended", sBullet),
]
start_box = Table([start_box_data], colWidths=[W])
start_box.setStyle(TableStyle([
    ('BACKGROUND',    (0,0), (-1,-1), BLUE_LIGHT),
    ('BOX',           (0,0), (-1,-1), 1.2, BLUE_MED),
    ('TOPPADDING',    (0,0), (-1,-1), 7),
    ('BOTTOMPADDING', (0,0), (-1,-1), 7),
    ('LEFTPADDING',   (0,0), (-1,-1), 10),
    ('RIGHTPADDING',  (0,0), (-1,-1), 10),
]))
elements.append(start_box)
elements.append(sp(2))

regimen_rows = [
    ["Adults & Adolescents\n(Preferred, WHO/US)",
     "TDF (or TAF) + FTC (or 3TC) + DTG",
     "Dolutegravir-based; <$45/patient/year in LMICs.\nFixed-dose combination tablet available."],
    ["Adults — Alternative",
     "ABC/3TC + DTG  or  TAF/FTC + BIC  or  TAF/FTC + RPV",
     "ABC/3TC: check HLA-B*5701 first (abacavir hypersensitivity risk)"],
    ["Children (age/weight-based)",
     "Consult pediatric HIV specialist + current NIH guidelines",
     "clinicalinfo.hiv.gov/en/guidelines/pediatric-arv"],
    ["Infants <4 weeks",
     "ZDV + 3TC + NVP (or LPV/r)",
     "Lopinavir/r preferred if possible; NVP if LPV/r unavailable"],
    ["Infants 4 weeks – 3 years",
     "ABC or ZDV + 3TC + LPV/r\nor RAL-based if <4 weeks",
     "LPV/r is preferred PI backbone in young children"],
    ["Pregnancy / PMTCT",
     "Continue/start effective ART immediately\nZDV + 3TC + LPV/r or TDF/FTC + DTG",
     "ZDV for infant prophylaxis × 4–6 weeks. Breastfeeding DISCOURAGED (CDC)."],
]
regimen_tbl = Table(
    [[Paragraph(h, sTableHead) for h in ["Population", "Preferred Regimen", "Notes"]]] +
    [[Paragraph(r[0], S('rp', fontSize=8, fontName='Helvetica-Bold', textColor=BLUE_DARK, leading=11)),
      Paragraph(r[1], S('rr', fontSize=8.5, fontName='Helvetica-Bold', textColor=TEAL_DARK, leading=11)),
      Paragraph(r[2], sTableCell)] for r in regimen_rows],
    colWidths=[42*mm, 65*mm, W-110*mm]
)
regimen_tbl.setStyle(TableStyle([
    ('BACKGROUND',    (0,0), (-1,0), BLUE_DARK),
    ('TEXTCOLOR',     (0,0), (-1,0), WHITE),
    ('FONTNAME',      (0,0), (-1,0), 'Helvetica-Bold'),
    ('GRID',          (0,0), (-1,-1), 0.4, GREY_RULE),
    ('ROWBACKGROUNDS',(0,1), (-1,-1), [WHITE, BLUE_LIGHT]),
    ('VALIGN',        (0,0), (-1,-1), 'TOP'),
    ('TOPPADDING',    (0,0), (-1,-1), 5),
    ('BOTTOMPADDING', (0,0), (-1,-1), 5),
    ('LEFTPADDING',   (0,0), (-1,-1), 5),
    ('RIGHTPADDING',  (0,0), (-1,-1), 5),
]))
elements.append(regimen_tbl)
elements.append(sp(3))

# ═══════════════════════════════════════════════════════
# SECTION 7 — WHEN TO CHANGE ART
# ═══════════════════════════════════════════════════════
elements.append(section_header("7.  WHEN TO CHANGE ART & TREATMENT FAILURE", bg=ORANGE_DARK))
elements.append(sp(2))

change_rows = [
    ["Virologic Failure", "Detectable HIV RNA on therapy (confirm × 2); most common failure type",
     "Check adherence first → genotype resistance testing → switch ≥2 active drugs"],
    ["Immunologic Failure", "Declining CD4 count despite ART; CD4 <200 in child previously higher",
     "Distinguish from IRIS; intensify regimen if confirmed failure"],
    ["Clinical Failure", "New or recurrent WHO Stage 3/4 event after ≥6 months ART",
     "Evaluate for OIs; confirm virologic failure before switching"],
    ["Toxicity / Intolerance", "Adverse drug effects limiting adherence or causing harm",
     "Substitute single offending drug if possible; maintain backbone"],
    ["Drug Resistance", "Resistance mutations on genotyping",
     "Select ≥2 fully active agents; consult expert"],
    ["Better Regimen Available", "New formulations, fixed-dose combos, or superior tolerability profile",
     "Simplification or optimization; maintain viral suppression during switch"],
]
change_tbl = make_table(
    ["Reason to Change", "Definition / Trigger", "Action"],
    change_rows,
    [38*mm, 70*mm, W-111*mm],
    header_bg=ORANGE_DARK
)
elements.append(change_tbl)
elements.append(sp(3))

# ═══════════════════════════════════════════════════════
# SECTION 8 — MONITORING
# ═══════════════════════════════════════════════════════
elements.append(section_header("8.  MONITORING ON ART", bg=TEAL_DARK))
elements.append(sp(2))

mon_rows = [
    ["HIV RNA (Viral Load)",
     "Primary measure of ART efficacy",
     "At baseline, 2–4 weeks after starting, then every 3–6 months once suppressed.\nGoal: <50 copies/mL"],
    ["CD4+ T-cell Count",
     "Immune status; primary indicator of disease progression.\nAge-adjust in children.",
     "At baseline; every 3–6 months initially; every 6–12 months once stable on ART with suppressed VL"],
    ["ARV Resistance Genotyping",
     "Guide regimen selection; detect transmitted resistance",
     "Before starting ART AND at virologic failure"],
    ["CBC + Differential",
     "Monitor for ZDV-associated anemia/neutropenia; baseline cytopenias",
     "Baseline; monitor per regimen"],
    ["Renal Function (Cr, eGFR, urine)",
     "TDF nephrotoxicity (Fanconi syndrome); TAF preferred if renal disease",
     "Baseline; every 6–12 months on TDF-containing regimen"],
    ["Liver Function Tests",
     "Hepatotoxicity (NVP, EFV); hepatitis B co-infection (TDF has anti-HBV activity)",
     "Baseline; periodic monitoring; check HBV/HCV status"],
    ["Fasting Lipids & Glucose",
     "PI/INSTI metabolic effects; cardiovascular risk",
     "Baseline; annually; more often if abnormal"],
    ["HLA-B*5701",
     "Required BEFORE prescribing Abacavir (ABC); positive → do NOT use ABC",
     "Once before initiating ABC-containing regimen"],
    ["OI Prophylaxis Thresholds",
     "Cotrimoxazole (PCP/Toxo prophylaxis); Azithromycin (MAC prophylaxis)",
     "Cotrimoxazole: all HIV-infected children <5 yrs regardless of CD4;\n≥5 yrs if CD4 <200. MAC: CD4 <50 cells/μL"],
    ["Growth & Development",
     "Height, weight, head circumference (infants); neurodevelopment milestones",
     "Every visit; plot on growth charts; address FTT actively"],
]
mon_tbl = Table(
    [[Paragraph(h, sTableHead) for h in ["Parameter", "Purpose", "Schedule / Target"]]] +
    [[Paragraph(r[0], S('mp', fontSize=7.8, fontName='Helvetica-Bold', textColor=TEAL_DARK, leading=11)),
      Paragraph(r[1], sTableCell),
      Paragraph(r[2], sTableCell)] for r in mon_rows],
    colWidths=[40*mm, 65*mm, W-108*mm]
)
mon_tbl.setStyle(TableStyle([
    ('BACKGROUND',    (0,0), (-1,0), TEAL_DARK),
    ('TEXTCOLOR',     (0,0), (-1,0), WHITE),
    ('FONTNAME',      (0,0), (-1,0), 'Helvetica-Bold'),
    ('GRID',          (0,0), (-1,-1), 0.4, GREY_RULE),
    ('ROWBACKGROUNDS',(0,1), (-1,-1), [WHITE, TEAL_LIGHT]),
    ('VALIGN',        (0,0), (-1,-1), 'TOP'),
    ('TOPPADDING',    (0,0), (-1,-1), 4),
    ('BOTTOMPADDING', (0,0), (-1,-1), 4),
    ('LEFTPADDING',   (0,0), (-1,-1), 5),
    ('RIGHTPADDING',  (0,0), (-1,-1), 5),
]))
elements.append(mon_tbl)
elements.append(sp(3))

# ═══════════════════════════════════════════════════════
# SECTION 9 — OI PROPHYLAXIS
# ═══════════════════════════════════════════════════════
elements.append(section_header("9.  OPPORTUNISTIC INFECTION PROPHYLAXIS IN CHILDREN", bg=RED_DARK))
elements.append(sp(2))

oi_rows = [
    ["Pneumocystis jirovecii (PCP)",
     "Cotrimoxazole (TMP-SMX)",
     "ALL HIV-infected children <5 yrs, regardless of CD4.\n≥5 yrs: if CD4 <200 cells/μL or CD4% <15%",
     "Discontinue when CD4 ≥200 sustained ≥3 months on ART"],
    ["Toxoplasma gondii",
     "Cotrimoxazole (TMP-SMX)",
     "CD4 <100 cells/μL (adults/older children); cotrimoxazole covers both PCP + Toxo",
     "Discontinue when CD4 >200 for >3 months"],
    ["MAC (M. avium complex)",
     "Azithromycin 20 mg/kg/wk (max 1200 mg) or Clarithromycin",
     "CD4 <50 cells/μL (age-adjusted for young children)",
     "Discontinue when CD4 >100 for >3 months on ART"],
    ["Cryptococcal meningitis",
     "Fluconazole",
     "Screen serum CrAg if CD4 <100; treat if positive even if asymptomatic",
     "Lifelong secondary prophylaxis after first episode"],
    ["Tuberculosis (TB)",
     "Isoniazid (INH) preventive therapy (IPT)",
     "All HIV-infected children in endemic settings, regardless of tuberculin test result",
     "6–36 months depending on guidelines; manage INH-ARV interactions"],
    ["CMV Retinitis",
     "Valganciclovir / Ganciclovir",
     "Treatment, not primary prophylaxis. Screen by fundoscopy if CD4 <50",
     "Maintenance therapy until CD4 >100 sustained ≥3–6 months"],
]
oi_tbl = Table(
    [[Paragraph(h, sTableHead) for h in ["Pathogen", "Drug", "Indication", "Stopping Rule"]]] +
    [[Paragraph(r[0], S('op', fontSize=7.5, fontName='Helvetica-Bold', textColor=RED_DARK, leading=10)),
      Paragraph(r[1], sTableCell),
      Paragraph(r[2], sTableCell),
      Paragraph(r[3], sTableCell)] for r in oi_rows],
    colWidths=[32*mm, 35*mm, 60*mm, W-130*mm]
)
oi_tbl.setStyle(TableStyle([
    ('BACKGROUND',    (0,0), (-1,0), RED_DARK),
    ('TEXTCOLOR',     (0,0), (-1,0), WHITE),
    ('FONTNAME',      (0,0), (-1,0), 'Helvetica-Bold'),
    ('GRID',          (0,0), (-1,-1), 0.4, GREY_RULE),
    ('ROWBACKGROUNDS',(0,1), (-1,-1), [WHITE, RED_LIGHT]),
    ('VALIGN',        (0,0), (-1,-1), 'TOP'),
    ('TOPPADDING',    (0,0), (-1,-1), 4),
    ('BOTTOMPADDING', (0,0), (-1,-1), 4),
    ('LEFTPADDING',   (0,0), (-1,-1), 5),
    ('RIGHTPADDING',  (0,0), (-1,-1), 5),
]))
elements.append(oi_tbl)
elements.append(sp(3))

# ═══════════════════════════════════════════════════════
# SECTION 10 — CDC CLASSIFICATION
# ═══════════════════════════════════════════════════════
elements.append(section_header("10.  CDC CLASSIFICATION & IMMUNOLOGIC CATEGORIES", bg=GREY_DARK))
elements.append(sp(2))

cdc_left_data = [
    [Paragraph("CD4 Category", sTableHead), Paragraph("Count", sTableHead), Paragraph("Significance", sTableHead)],
    [Paragraph("1 – No suppression", sTableCell),
     Paragraph("≥500 cells/μL\n(or ≥25% in <5 yrs)", sTableCell),
     Paragraph("Intact immunity", sTableCell)],
    [Paragraph("2 – Moderate suppression", sTableCell),
     Paragraph("200–499 cells/μL\n(15–24% in <5 yrs)", sTableCell),
     Paragraph("Moderate risk OIs", sTableCell)],
    [Paragraph("3 – Severe suppression (AIDS)", S('red', fontSize=7.8, textColor=RED_DARK, fontName='Helvetica-Bold', leading=10.5)),
     Paragraph("<200 cells/μL\n(<15% in <5 yrs)", S('red2', fontSize=7.8, textColor=RED_DARK, leading=10.5)),
     Paragraph("High risk OIs; AIDS diagnosis", S('red3', fontSize=7.8, textColor=RED_DARK, leading=10.5))],
]
cdc_tbl = Table(cdc_left_data, colWidths=[45*mm, 38*mm, (W/2)-88*mm])
cdc_tbl.setStyle(TableStyle([
    ('BACKGROUND',    (0,0), (-1,0), GREY_DARK),
    ('TEXTCOLOR',     (0,0), (-1,0), WHITE),
    ('FONTNAME',      (0,0), (-1,0), 'Helvetica-Bold'),
    ('BACKGROUND',    (0,3), (-1,3), RED_LIGHT),
    ('GRID',          (0,0), (-1,-1), 0.4, GREY_RULE),
    ('VALIGN',        (0,0), (-1,-1), 'TOP'),
    ('TOPPADDING',    (0,0), (-1,-1), 5),
    ('BOTTOMPADDING', (0,0), (-1,-1), 5),
    ('LEFTPADDING',   (0,0), (-1,-1), 5),
    ('RIGHTPADDING',  (0,0), (-1,-1), 5),
]))

note_right = [
    Paragraph("<b>Important Notes on CD4 in Children</b>",
              S('cn', fontSize=8.5, textColor=GREY_DARK, fontName='Helvetica-Bold', leading=12)),
    sp(1),
    Paragraph("• Children normally have HIGHER CD4 counts than adults — age-adjustment is required", sBullet),
    Paragraph("• CD4 percentage is more reliable than absolute count in young children", sBullet),
    Paragraph("• Viral load is the primary measure of ART efficacy; CD4 count measures immune status", sBullet),
    Paragraph("• Viral set point (established after acute infection) predicts rate of CD4 decline", sBullet),
    Paragraph("• Long-term nonprogressors: ~1% remain asymptomatic >10 years with stable CD4", sBullet),
]
note_box = Table([note_right], colWidths=[(W/2)+4*mm])
note_box.setStyle(TableStyle([
    ('BACKGROUND',    (0,0), (-1,-1), GREY_LIGHT),
    ('BOX',           (0,0), (-1,-1), 0.8, GREY_RULE),
    ('TOPPADDING',    (0,0), (-1,-1), 7),
    ('BOTTOMPADDING', (0,0), (-1,-1), 7),
    ('LEFTPADDING',   (0,0), (-1,-1), 8),
    ('RIGHTPADDING',  (0,0), (-1,-1), 8),
]))

two_col2 = Table([[cdc_tbl, note_box]], colWidths=[(W/2)-3*mm, (W/2)+3*mm])
two_col2.setStyle(TableStyle([
    ('VALIGN',        (0,0), (-1,-1), 'TOP'),
    ('LEFTPADDING',   (0,0), (-1,-1), 0),
    ('RIGHTPADDING',  (0,0), (-1,-1), 0),
    ('TOPPADDING',    (0,0), (-1,-1), 0),
    ('BOTTOMPADDING', (0,0), (-1,-1), 0),
]))
elements.append(two_col2)
elements.append(sp(3))

# ═══════════════════════════════════════════════════════
# SECTION 11 — QUICK REFERENCE CHECKLIST
# ═══════════════════════════════════════════════════════
elements.append(section_header("11.  CLINICAL CHECKLIST — HIV-EXPOSED / INFECTED CHILD", bg=BLUE_DARK))
elements.append(sp(2))

check_items_col1 = [
    ("DIAGNOSIS", [
        "Virologic test (HIV DNA/RNA PCR) at 14–21 days if <18 months",
        "Repeat at 1–2 months and 4–6 months",
        "Confirmatory antibody test at ≥18 months",
        "Assess maternal risk category (low vs. higher risk)",
        "Order ARV resistance genotyping before starting ART",
    ]),
    ("ART INITIATION", [
        "Start ART immediately after confirmed diagnosis — all ages, all CD4 counts",
        "Select age/weight-appropriate regimen",
        "Educate caregiver on adherence — critical for viral suppression",
        "Check HLA-B*5701 before prescribing Abacavir",
        "Enroll in clinical trial if available",
    ]),
]

check_items_col2 = [
    ("MONITORING", [
        "HIV RNA at baseline, 2–4 wks after ART start, then q3–6 months",
        "CD4 count at baseline; q3–6 months initially; q6–12 months when stable",
        "CBC, LFTs, renal function at baseline and per regimen",
        "Fasting lipids and glucose annually",
        "Growth parameters and neurodevelopmental assessment every visit",
    ]),
    ("PROPHYLAXIS & PREVENTION", [
        "Cotrimoxazole: all children <5 yrs with HIV (regardless of CD4)",
        "MAC prophylaxis if CD4 <50 cells/μL",
        "Screen for TB; offer INH preventive therapy in endemic areas",
        "Advise against breastfeeding (CDC)",
        "Ensure immunizations are up to date (live vaccines may need timing consideration)",
    ]),
]

def checklist_box(items_list, bg, border):
    content = []
    for section_title, bullets in items_list:
        content.append(Paragraph(f"<b>{section_title}</b>",
                                  S('ct', fontSize=8, fontName='Helvetica-Bold',
                                    textColor=border, leading=12)))
        for b in bullets:
            content.append(Paragraph(f"☐  {b}", sBullet))
        content.append(sp(1))
    tbl = Table([content], colWidths=[(W/2)-3*mm])
    tbl.setStyle(TableStyle([
        ('BACKGROUND',    (0,0), (-1,-1), bg),
        ('BOX',           (0,0), (-1,-1), 1, border),
        ('TOPPADDING',    (0,0), (-1,-1), 7),
        ('BOTTOMPADDING', (0,0), (-1,-1), 7),
        ('LEFTPADDING',   (0,0), (-1,-1), 8),
        ('RIGHTPADDING',  (0,0), (-1,-1), 8),
    ]))
    return tbl

check_left  = checklist_box(check_items_col1, BLUE_LIGHT, BLUE_DARK)
check_right = checklist_box(check_items_col2, TEAL_LIGHT, TEAL_DARK)

two_check = Table([[check_left, check_right]], colWidths=[(W/2)-2*mm, (W/2)+2*mm])
two_check.setStyle(TableStyle([
    ('VALIGN',        (0,0), (-1,-1), 'TOP'),
    ('LEFTPADDING',   (0,0), (-1,-1), 0),
    ('RIGHTPADDING',  (0,0), (-1,-1), 0),
    ('TOPPADDING',    (0,0), (-1,-1), 0),
    ('BOTTOMPADDING', (0,0), (-1,-1), 0),
]))
elements.append(two_check)
elements.append(sp(3))

# ═══════════════════════════════════════════════════════
# FOOTER
# ═══════════════════════════════════════════════════════
elements.append(rule(GREY_RULE, 1))
elements.append(sp(1))
elements.append(Paragraph(
    "Sources: Red Book 2021 (AAP Committee on Infectious Diseases) | Harrison's Principles of Internal Medicine 22E (2025) | "
    "Robbins, Cotran & Kumar Pathologic Basis of Disease | Cellular & Molecular Immunology (Abbas et al.) | "
    "NIH AIDSinfo Guidelines (clinicalinfo.hiv.gov) | WHO HIV Guidelines.  "
    "This guide is a clinical quick-reference tool and does not replace specialist consultation. "
    "Always refer to current NIH pediatric ARV guidelines for up-to-date dosing recommendations.",
    sFooter
))

# ═══════════════════════════════════════════════════════
# BUILD
# ═══════════════════════════════════════════════════════
doc.build(elements)
print(f"PDF created: {OUTPUT}")
Running Command

cd /tmp/workspace/pediatric-hiv-guide && python build_pdf.py 2>&1

Editing File

~/pediatric-hiv-guide/build_pdf.py

Successfully replaced 1 instance(s) of the string in '/tmp/workspace/pediatric-hiv-guide/build_pdf.py'
Editing File

~/pediatric-hiv-guide/build_pdf.py

Successfully replaced 1 instance(s) of the string in '/tmp/workspace/pediatric-hiv-guide/build_pdf.py'
Editing File

~/pediatric-hiv-guide/build_pdf.py

Successfully replaced 1 instance(s) of the string in '/tmp/workspace/pediatric-hiv-guide/build_pdf.py'
Running Command

cd /tmp/workspace/pediatric-hiv-guide && python build_pdf.py 2>&1

Running Command

ls -lh /tmp/workspace/pediatric-hiv-guide/Pediatric_HIV_Quick_Reference.pdf

Your quick reference guide is ready:

Pediatric HIV Quick Reference

PDF Document · PDF


The PDF is a 2-page, color-coded quick reference guide covering 11 sections:
SectionContent
1. Epidemiology & TransmissionGlobal burden stats, MTCT routes (in utero, intrapartum, breastfeeding), HIV-1 vs HIV-2
2. Maternal Risk StratificationLow-risk vs. higher-risk definitions (Red Book 2021)
3. DiagnosisAge-specific testing rules, PCR vs. antibody testing, full testing schedule timeline
4. Clinical ManifestationsThree-column layout: constitutional, neurological/pulmonary, infections/malignancies + IRIS box
5. ART Drug ClassesAll 6 classes - NRTIs, NNRTIs, PIs, INSTIs, fusion inhibitors, CCR5 antagonists with mechanisms and drugs
6. ART RegimensWhen to start (all patients, all ages), first-line regimens by population (adults, infants <4 wks, children, pregnancy)
7. When to Change ART6 failure types (virologic, immunologic, clinical, toxicity, resistance, better regimen)
8. Monitoring on ART10-parameter monitoring table with schedules and targets
9. OI Prophylaxis6 pathogens with drugs, indications, and stopping rules
10. CDC ClassificationCD4 categories with pediatric age-adjustment notes
11. Clinical ChecklistDiagnosis + ART initiation + monitoring + prophylaxis checklists
This is a shared conversation. Sign in to Orris to start your own chat.