Clinical Commander

All dossiers
pulm.pcp-pneumonia.core.v1

Pneumocystis (jirovecii) Pneumonia

pulmonologyacutesubacuteadultacuteinpatient

PJP = host-defined opportunistic Bayesian rule-in engine. §5.5.2 wired: pretest set by host class (HIV CD4 band vs non-HIV iatrogenic substrate) in FRAME/CONTEXT; sequential test LRs (serum β-D-glucan sens ~91%/spec ~79% PMID 32479781, BAL immunofluorescence specific vs quantitative PCR sensitive, LDH sensitive/non-specific, HRCT ground-glass with high NPV if normal); confirm → empiric TMP-SMX → adjunctive-steroid threshold (PaO2 <70 / A-a >35 / SpO2 <92%) → immune reconstitution. HIV-vs-non-HIV is the dominant axis (tempo, burden, β-D-glucan NPV, steroid-evidence strength, mortality). Two conditional dependencies explicitly modeled and flagged do-not-read-in-isolation: (1) β-D-glucan post-test probability | host pretest band — a negative test rules out only at low-intermediate prior (non-HIV ≤20%, HIV ≤50%) (severity_trigger beta_d_glucan_negative_conditional_on_host_band; INITIAL_WORKUP phase logic; Del Corpo CMI 2020 PMID 32479781, Li 2015 PMID 26793343); (2) BAL-PCR positivity | colonization vs invasive disease — a low-burden positive PCR may reflect colonization, interpreted jointly with IF stain + HRCT + host (severity_trigger bal_pcr_positive_low_burden_colonization_vs_disease). Effect sizes wired with PMIDs (≥5): Bozzette/California Collaborative (PMID 2233917) 31-d respiratory failure 0.14 vs 0.30 (P=0.004), death 0.11 vs 0.23 (P=0.009), 84-d death 0.16 vs 0.26 (P=0.026); Gagnon/Consensus (PMID 2233916) survival 75% vs 18% (P<0.008); Del Corpo β-D-glucan (PMID 32479781) sens 91%/spec 79%, HIV 94% vs non-HIV 86%; Li (PMID 26793343) sens 0.91/spec 0.75; Cilloniz (PMID 31550942) HIV ~15% vs non-HIV ~50% in-hospital mortality; Feng (PMID 35313548) non-HIV nomogram AUC 0.865 / HIV C-index 0.904; Zolopa ACTG A5164 (PMID 19440326) early-ART AIDS progression/death OR 0.51 (95% CI 0.27-0.94), HR 0.53; Safrin ACTG 108 (PMID 8610948) TMP-SMX ≈ dapsone-TMP ≈ clinda-primaquine mild-moderate. Cross-dossier routing via workups[].branches_to + sibling_differentiation[].sibling_engine_id using real engine_ids confirmed by grep of src/lib/dossiers/: pulm.cap.core.v1, pulm.tuberculosis.v1, id.sepsis.core.v1, pulm.ards.core.v1, id.cmv-immunocompromised.core.v1, id.hiv-initial.chronic.v1, id.opportunistic-infection.hiv-transplant.v1. Differential pivots authored as sibling feature rows + DIFFERENTIAL/BRANCHING phase logic: PJP vs bacterial CAP vs CMV vs viral (flu/COVID) vs TB vs invasive fungal vs lymphangitic carcinomatosis vs drug-induced pneumonitis vs IRIS. Special populations: HIV (CD4 band prior, strong steroid RCT evidence, early ART per Zolopa ACTG A5164, secondary prophylaxis stop at CD4 >200 ×3 mo) vs non-HIV (iatrogenic substrate, fulminant/higher-mortality, lower diagnostic yield → earlier BAL, weaker steroid evidence at same threshold, immunosuppressant minimization) as DISTINCT branches; transplant/biologic/chemo (route id.opportunistic-infection.hiv-transplant.v1); pregnancy (TMP-SMX still first-line + folate + delivery-timing for neonatal kernicterus, avoid primaquine); G6PD (screen before dapsone/primaquine — absolute contraindication); severe sulfa allergy (alternatives vs desensitization for non-severe only); renal/hepatic dose-adjust per drug in contraindication_rules. Regimen axis: TMP-SMX 15-20 mg/kg/day TMP weight-based (mild PO / moderate-severe IV) + Bozzette adjunctive steroid taper (40 BID×5d → 40 daily×5d → 20 daily×11d) + alternatives by sulfa-allergy/G6PD/severity (clindamycin+primaquine, atovaquone mild, IV pentamidine severe, dapsone-TMP, sulfa desensitization for non-severe reactions) + duration HIV 21 d / non-HIV 14-21 d + secondary prophylaxis with explicit stop criteria (CD4 >200 ×3 mo HIV; immunosuppression resolved non-HIV) + deprescribing + explicit leucovorin-AVOID rule. Matches pulm.cap.core.v1 / pulm.pe.core.v1 regimen depth. RxCUI sanity-check vs RxNav REST /rxcui/{cui}/properties.json 2026-05-16 — THREE SAFETY-CRITICAL CORRECTIONS: (a) TMP-SMX combination 10180 (=sulfamethoxazole single-ingredient IN) / 10829 (=trimethoprim single-ingredient IN) → 10831 = sulfamethoxazole/trimethoprim (MIN); (b) the prior dossier notes mapped dapsone→3008 (=cyclosporine), primaquine→8745 (=promethazine), pentamidine→8167 (=phenylhydrazine) — all WRONG; corrected to dapsone 3108 (IN), primaquine 8687 (IN), pentamidine 7994 (IN), clindamycin 2582 (IN), all RxNav-verified. Confirmed-correct unchanged: atovaquone 60212 (IN), prednisone 8640 (IN), methylprednisolone 6902 (IN), oxygen 7806 (IN); added caspofungin 140108 (IN), leucovorin 6313 (IN). No hand-authored CUIs — every CUI WebSearch/RxNav-confirmed. Run npm run research:rxnav:validate for dose-specific SCD/SBD resolution. SCHEMA-GAP NOTES: (1) _types.ts has no first-class field for Bayesian pretest/LR/post-test/decision-threshold or a host-conditional graph — encoded in severity_triggers, phase purpose/advance_when, calculator guideline_basis, regimen rationale, and the .depth.md LR table; (2) RequiredCalculator.drives lacks diagnostic_gate — A-a/host bands reuse severity_classification; (3) no pretest-prevalence field — captured in calc.aa_gradient guideline_basis + .depth.md; (4) no co-infection/overlap field — CMV/TB co-infection encoded via severity_triggers + workups branches_to + BRANCHING phase logic; (5) no host-class enum (HIV vs non-HIV) — modeled in FRAME phase + non_hiv_pjp_fulminant_high_mortality trigger + sibling feature rows. PRODUCTION blockers: (1) all RxCUIs RxNav-verified this pass but run npm run research:rxnav:validate before dosing automation (SCD/SBD); (2) calc.aa_gradient / calc.ckd_epi_2021 not confirmed individually in clinical-tools-registry this scope (reused existing pcp_pneumonia workup adapter id only — no registry edits); (3) no engine-specific test file under tests/ beyond the shared contract test; (4) no _design-brief.md inside the package path (separate from the in-scope _briefs/ deliverables authored this pass); (5) package path pneumocystis-jirovecii-pneumonia/ unchanged (manifest/package pointers out of scope, not touched).

Entry points (5)

  • symptom
    Subacute progressive dyspnea + dry non-productive cough ± low-grade fever, often with marked exertional desaturation, in an immunocompromised host (NIH/CDC OI 2025)
    subacute_dyspnea_dry_cough
  • imaging
    Bilateral perihilar / diffuse ground-glass opacities on HRCT (HRCT GGO LR+ high in the right host; near-perfect negative predictive value if HRCT normal) (NIH/CDC OI 2025)
    bilateral_perihilar_ground_glass
  • lab_abnormality
    Elevated LDH (often >500 U/L) — sensitive but non-specific; tracks burden/response (NIH/CDC OI 2025)
    ldh_elevated
  • lab_abnormality
    Elevated serum (1→3)-β-D-glucan in an immunocompromised host (sens ~91%; interpret post-test conditional on host pretest band — Del Corpo CMI 2020 PMID 32479781)
    beta_d_glucan_elevated
  • problem_list
    HIV CD4 <200 (esp. <100), solid-organ/HSCT transplant, prednisone ≥20 mg/day ≥4 wk, B-cell-depleting/anti-TNF/calcineurin/chemo immunosuppression, primary immunodeficiency (NIH/CDC OI 2025)
    immunocompromised

Required inputs (20)

  • agerequired
    demographic • used at CONTEXT
    Adult dosing of TMP-SMX; pediatric PJP routes to pediatric OI guidance (out of scope here) (NIH/CDC OI 2025)
  • weightrequired
    demographic • used at TREATMENT
    Weight-based TMP-SMX dosing 15-20 mg/kg/day of the TMP component ÷ q6-8h (NIH/CDC OI 2025)
  • spo2required
    vital • used at CONTEXT
    Resting room-air SpO2 <92% is a guideline adjunctive-steroid trigger and the bedside surrogate for the PaO2/A-a threshold (NIH/CDC OI 2025; Bozzette NEJM 1990 PMID 2233917)
  • rrrequired
    vital • used at CONTEXT
    Tachypnea + work of breathing — severity grading and respiratory-failure screen (NIH/CDC OI 2025)
  • sbp
    vital • used at CONTEXT
    Septic shock / concurrent bacterial sepsis screen (route → id.sepsis.core.v1) (SSC 2026)
  • hiv_or_immunosuppressionrequired
    history • used at CONTEXT
    Sets the Bayesian PRIOR — HIV CD4 band vs non-HIV iatrogenic substrate; the HIV-vs-non-HIV axis governs presentation tempo, β-D-glucan NPV, steroid-evidence strength, and mortality (Cilloniz 2019 PMID 31550942)
  • cd4_count
    lab • used at CONTEXT
    HIV pretest band: CD4 <200 (esp. <100) → high PJP prior; CD4 >200 makes HIV-PJP unlikely and shifts the differential (NIH/CDC OI 2025)
  • immunosuppressant_regimen
    history • used at CONTEXT
    Non-HIV substrate weighting: chronic steroid ≥20 mg pred ≥4 wk, rituximab/anti-CD20, anti-TNF, calcineurin inhibitor, alkylator/fludarabine, transplant — most non-HIV PJP occurs when NOT on prophylaxis (NIH/CDC OI 2025)
  • sulfa_allergyrequired
    history • used at CONTEXT
    Drives alternative-agent selection and the desensitization-vs-alternative decision if sulfa-allergic (NIH/CDC OI 2025)
  • g6pd_status
    history • used at CONTEXT
    G6PD deficiency contraindicates dapsone and primaquine (hemolysis) — screen before either; do not delay treatment waiting for the assay if alternatives exist (NIH/CDC OI 2025)
  • pregnancy
    history • used at CONTEXT
    TMP-SMX still first-line in pregnancy (folate supplementation; neonatal kernicterus risk near term — coordinate timing); avoid primaquine; weigh dapsone (NIH/CDC OI 2025)
  • on_PCP_prophylaxis
    history • used at CONTEXT
    Breakthrough PJP on adherent TMP-SMX prophylaxis is rare and lowers the prior — re-examine adherence, dose, alternative pathogens, resistant organism (NIH/CDC OI 2025)
  • ldh
    lab • used at INITIAL_WORKUP
    Elevated LDH supports PJP (sensitive, non-specific); tracks treatment response and prognosis (NIH/CDC OI 2025)
  • beta_d_glucan
    lab • used at INITIAL_WORKUP
    Serum (1→3)-β-D-glucan: pooled sens ~91% / spec ~79%; a NEGATIVE test rules out only at LOW-intermediate pretest (non-HIV ≤20%, HIV ≤50%) — post-test probability is CONDITIONAL on the host band, do not read in isolation (Del Corpo CMI 2020 PMID 32479781; Li 2015 PMID 26793343)
  • creatininerequired
    lab • used at CONTEXT
    Renal dose-adjust TMP-SMX (CrCl <30 → reduce/avoid), pentamidine nephrotoxicity, dapsone; baseline before nephrotoxic alternatives (NIH/CDC OI 2025)
  • pao2
    lab • used at CONTEXT
    Room-air PaO2 <70 mmHg OR A-a gradient >35 → adjunctive corticosteroids within 72 h of anti-PCP therapy (Bozzette NEJM 1990 PMID 2233917)
  • cxr
    imaging • used at INITIAL_WORKUP
    May be normal early; classically bilateral perihilar interstitial pattern — a normal CXR does NOT exclude PJP (HRCT more sensitive) (NIH/CDC OI 2025)
  • hrct_chest
    imaging • used at INITIAL_WORKUP
    Diffuse/perihilar ground-glass opacities; a NORMAL HRCT has high negative predictive value and argues strongly against PJP (NIH/CDC OI 2025)
  • pcp_PCR_or_silver_stain
    lab • used at INITIAL_WORKUP
    Definitive: immunofluorescence/silver/Giemsa stain (specific, organism = disease) vs quantitative PCR (more sensitive but a positive low-burden PCR may reflect COLONIZATION not invasive disease — interpret conditional on host + clinical-radiologic gestalt) on induced sputum or BAL (NIH/CDC OI 2025)
  • cmv_pcr_or_culture
    lab • used at BRANCHING_WORKUP
    CMV co-infection is a major non-HIV PJP mortality driver and a key differential — quantitative CMV PCR / BAL shell-vial (route → id.cmv-immunocompromised.core.v1) (Feng 2022 PMID 35313548)

12-phase flow (12)

  1. 1FRAME
    Establish the immunocompromised substrate and a PJP-compatible subacute illness pattern; assign the host CLASS (HIV CD4 band vs non-HIV iatrogenic) — this sets the Bayesian prior and selects the HIV-vs-non-HIV management branch (NIH/CDC OI 2025; Cilloniz 2019 PMID 31550942)
    inputs: hiv_or_immunosuppression
    advance: Immune substrate + host class (HIV vs non-HIV) confirmed
  2. 2ENTRY
    Triggered by subacute dyspnea + dry cough with exertional desaturation, diffuse ground-glass on HRCT, or LDH/β-D-glucan elevation in an immunocompromised host (NIH/CDC OI 2025)
    inputs: age
    advance: Entry trigger present
  3. 3CONTEXT
    Quantify the prior: HIV CD4 (<100 vs 100-200 vs >200), non-HIV regimen (steroid dose/duration, rituximab/anti-TNF/CNI/alkylator, transplant), prophylaxis status/adherence, sulfa allergy severity, G6PD, pregnancy, renal function, SpO2/PaO2/A-a (NIH/CDC OI 2025)
    inputs: spo2, rr, sbp, hiv_or_immunosuppression, cd4_count, immunosuppressant_regimen, sulfa_allergy, g6pd_status, pregnancy, on_PCP_prophylaxis, creatinine, pao2
    advance: Host pretest band + steroid-threshold inputs + allergy/G6PD captured
  4. 4RED_FLAGS
    Severe hypoxemic respiratory failure, ARDS physiology, spontaneous pneumothorax (PJP-classic), septic shock — escalate O2/ventilation and ICU; non-HIV PJP is more fulminant with higher mortality (NIH/CDC OI 2025; Cilloniz 2019 PMID 31550942)
    inputs: spo2, rr, sbp
    advance: No emergent escalation needed OR ICU pathway activated
  5. 5INITIAL_WORKUP
    Bayesian gate: HRCT (normal HRCT → PJP unlikely, pivot differential), ABG → PaO2/A-a, LDH, serum β-D-glucan (post-test CONDITIONAL on host band — negative rules out only at low-intermediate pretest), and the definitive specimen — induced sputum or BAL with immunofluorescence + quantitative PCR. Do NOT delay empiric TMP-SMX awaiting the specimen in moderate-severe disease (organisms persist days into therapy) (NIH/CDC OI 2025; Del Corpo CMI 2020 PMID 32479781)
    inputs: ldh, beta_d_glucan, cxr, hrct_chest, pao2, pcp_PCR_or_silver_stain
    actions: pcp_pneumonia
    advance: Definitive specimen sent AND empiric therapy started if moderate-severe
  6. 6BRANCHING_WORKUP
    Bronchoscopy + BAL if induced sputum negative but pretest remains high; co-pathogen panel — CMV (PCR/shell-vial → id.cmv-immunocompromised.core.v1), TB (route → pulm.tuberculosis.v1), invasive fungal (galactomannan/culture), bacterial; reconcile a positive low-burden PCR against colonization (NIH/CDC OI 2025; Feng 2022 PMID 35313548)
    inputs: cmv_pcr_or_culture, hrct_chest
    actions: pcp_pneumonia
    advance: Definitive specimen obtained when needed AND co-pathogens addressed
  7. 7DIFFERENTIAL
    PJP vs bacterial CAP vs viral pneumonia (CMV/influenza/COVID/RSV) vs TB vs invasive fungal vs lymphangitic carcinomatosis vs drug-induced pneumonitis vs IRIS — pivots on host band, β-D-glucan post-test, BAL IF-vs-PCR, LDH, HRCT pattern. HIV-vs-non-HIV is a key axis (tempo, burden, β-D-glucan NPV, mortality) (NIH/CDC OI 2025; Cilloniz 2019 PMID 31550942)
    advance: Working diagnosis + co-existence assessed
  8. 8RISK_STRATIFICATION
    Severity tier: mild (PaO2 ≥70, A-a <35, SpO2 ≥92% RA) vs moderate-severe (PaO2 <70 OR A-a >35 OR SpO2 <92% RA OR mechanical ventilation). HIV vs non-HIV stratifies steroid-evidence strength (strong RCT in HIV; weaker/observational in non-HIV) and mortality (HIV ~10-20% vs non-HIV up to ~30-50%); non-HIV adverse markers: pneumothorax, CD4 ≤100 surrogate, CMV co-infection (Bozzette NEJM 1990 PMID 2233917; Feng 2022 PMID 35313548)
    inputs: pao2, spo2
    advance: Severity tier + host class + steroid candidacy documented
  9. 9TREATMENT
    First-line TMP-SMX 15-20 mg/kg/day of TMP ÷ q6-8h IV (moderate-severe) or PO (mild); duration 21 d HIV, 14-21 d non-HIV. Adjunctive corticosteroids (prednisone 40 mg BID ×5 d → 40 mg daily ×5 d → 20 mg daily ×11 d, or IV methylprednisolone equivalent) if PaO2 <70 OR A-a >35 OR SpO2 <92% RA, started within 72 h — strong HIV evidence (Bozzette PMID 2233917), weaker in non-HIV. Sulfa allergy/G6PD/intolerance → primaquine+clindamycin, atovaquone (mild), IV pentamidine (severe), dapsone-TMP (mild-moderate, G6PD-permitting); consider sulfa desensitization if no severe reaction history. Renal/hepatic dose-adjust per drug (NIH/CDC OI 2025; Safrin ACTG 108 PMID 8610948)
    inputs: pao2, creatinine, weight, sulfa_allergy, g6pd_status, pregnancy
    advance: Anti-PCP regimen + steroid decision + duration documented
  10. 10DISPOSITION
    Most admit; ICU for respiratory failure / refractory hypoxia / pneumothorax / shock; outpatient oral therapy only for mild HIV-PCP with social support and reliable follow-up; non-HIV PJP has a low threshold for ICU given fulminant course (NIH/CDC OI 2025; Cilloniz 2019 PMID 31550942)
    advance: Disposition decided
  11. 11MONITORING
    Expect paradoxical clinical worsening days 3-5 (inflammatory; do NOT switch antibiotic empirically); LDH/oxygenation trend; CBC/BMP q48h on TMP-SMX (cytopenias, hyperkalemia, AKI); methemoglobin if dapsone/primaquine; glucose if pentamidine/steroid; true treatment failure assessed at ~7-10 d → bronchoscopy + co-infection workup + agent switch (NIH/CDC OI 2025)
    advance: Response trend documented and true-failure logic applied
  12. 12FOLLOWUP
    Secondary prophylaxis (TMP-SMX SS daily) until immune reconstitution — HIV: CD4 >200 ×3 mo on ART (consider stop at CD4 100-200 if VL suppressed ≥3-6 mo); non-HIV: until immunosuppression resolved. Initiate/optimize ART within 2 weeks of PJP treatment in HIV (early ART reduces progression/death — Zolopa ACTG A5164 PMID 19440326); monitor IRIS; minimize/taper the iatrogenic immunosuppressant where feasible (NIH/CDC OI 2025)
    advance: Prophylaxis + immune-recovery + ART/immunosuppression plan in place