DOI: 10.5281/zenodo.18116991
title: HIV Prevention Barrier Modeling for PWID

description: ⚠️ SUPERSEDED: This record has been replaced by https://doi.org/10.5281/zenodo.18746065, which is linked to the dedicated HIV_Prevention_PWID repository. This archive is retained for historical reference only.

 

HIV Prevention Barrier Modeling for PWID


 

Code repository for: Demidont AC. Structural barriers drive near-zero population-level effectiveness of Long Acting Injectable HIV prevention (LAI-PrEP) among people who inject drugs: A Computational Modeling Study. The Lancet HIV (2025). [Manuscript ID: thelancethiv-D-25-00576, Submitted Dec 29, 2025]



Overview


This repository contains the computational models, simulation code, and visualization scripts supporting the analysis of structural barriers to HIV prevention among people who inject drugs (PWID). The model demonstrates how policy, stigma, and infrastructure barriers compound across an 8-step prevention cascade to produce near-zero population-level effectiveness despite highly efficacious pharmacological interventions.



Key Findings




Current policy achieves ~0.003% sustained HIV prevention among PWID vs. 16.3% for MSM receiving identical interventions

Barrier multiplication effect: Even moderate barriers at each cascade step compound to near-total prevention failure

Policy-determined outcomes: Results are structural, not individual choice-based

63% outbreak probability within 5 years under current conditions




Repository Structure




├── architectural_barrier_model.py    # Main simulation model
├── visualize_md_results.py           # Publication figure generation
├── architectural_barrier_results.json # Monte Carlo simulation outputs
├── pwid_simulation_results.json       # PWID-specific analyses
├── manuscript/                        # LaTeX manuscript files
│   └── lancet_hiv_manuscript_acd_2025.tex
└── figures/                           # Publication-ready figures
    ├── Fig1_CascadeComparison.png
    ├── Fig3_PolicyScenarios.png
    └── Fig5_SNR_LOOCV.png


 




Model Architecture




Three-Layer Barrier Framework


Layer 1: Pathogen Biology



HIV establishes irreversible R₀ > 0 within hours of infection

No intervention can restore R₀ = 0 post-exposure


Layer 2: Testing Barriers



Acute infection detection gaps (RNA testing not standard of care)

4th gen Ag/Ab tests miss first 2-4 weeks


Layer 3: Architectural Barriers



Policy (criminalization, incarceration)

Stigma (healthcare discrimination, disclosure barriers)

Infrastructure (MSM-centric cascade design)

Research exclusion (LOOCV framework)

Machine learning (algorithmic deprioritization)




Eight-Step Prevention Cascade




Awareness of LAI-PrEP availability

Willingness to seek care despite system visibility

Healthcare access

Disclosure of injection drug use

Provider willingness to prescribe

Adequate HIV testing

First injection received

Sustained engagement




Policy Scenarios





Scenario
P(R₀=0)




Current Policy
0.003%


Decriminalization Only
0.20%


Decrim + Stigma Reduction
0.45%


SSP-Integrated Delivery
5.0%


Full Harm Reduction
9.5%


Full HR + PURPOSE-4 Data
11.9%


Full HR + Algorithmic Debiasing
18.6%


Theoretical Maximum
19.7%


MSM (Comparison)
16.3%






Installation




Requirements




Python 3.9+

NumPy

Matplotlib

SciPy (optional, for advanced statistics)




Setup




git clone https://github.com/Nyx-Dynamics/hiv-prevention-master.git
cd hiv-prevention-master
pip install -r requirements.txt

 




Usage




1. Main Simulation (architectural_barrier_model.py)


Run the core Monte Carlo simulation to evaluate cascade completion across multiple policy scenarios.



python architectural_barrier_model.py --output-dir ./results --n-individuals 100000

 




--output-dir: Directory to save .json and .csv results (default: .)

--n-individuals: Number of individuals to simulate per scenario (default: 100000)

--n-sa-sims: Number of stochastic avoidance simulations (default: 10000)




2. Cascade Sensitivity (cascade_sensitivity_analysis.py)


Analyze how parameter uncertainty and barrier removal affect prevention probability.



python cascade_sensitivity_analysis.py --output-dir ./outputs --n-samples 1000

 




--output-dir: Directory for figures and results (default: outputs)

--n-samples: Number of Probabilistic Sensitivity Analysis (PSA) samples (default: 1000)




3. Enhanced Stochastic Avoidance (stochastic_avoidance_enhanced.py)


Forecast regional outbreak probabilities and methamphetamine prevalence trajectories.



python stochastic_avoidance_enhanced.py --output-dir ./outputs --n-sims 2000 --n-psa 500

 




--output-dir: Directory for figures and results (default: outputs)

--n-sims: Number of simulations for national forecast (default: 2000)

--n-psa: Number of PSA samples (default: 500)




4. Publication Figures (visualize_md_results.py)


Generate the primary figures used in the Lancet HIV manuscript.



python visualize_md_results.py --input architectural_barrier_results.json --output-dir ./figures

 




--input: Path to the simulation results JSON file

--output-dir: Directory where figures (Fig 1-5) will be saved




5. Quick Visualization (visualize_results.py)


Quickly generate a comparison bar chart from simulation results.



python visualize_results.py --input architectural_barrier_results.json --output ./figures/scenario_comparison.png

 




Outputs




architectural_barrier_results.json/csv: Core simulation data and barrier decomposition.

cascade_sensitivity_results.json/csv: PSA summary and step importance rankings.

stochastic_avoidance_sensitivity_results.json/csv: Regional outbreak forecasts and tornado analyses.

outputs/ or figures/: Publication-quality PNG and PDF figures.




Data Sources


All model parameters are derived from peer-reviewed literature:




Parameter
Source




PWID epidemiology
Degenhardt et al. (2017), Lancet


Criminalization effects
DeBeck et al. (2017), Lancet HIV


PrEP cascade
Mistler et al. (2021), AIDS Behav


Incarceration impact
Altice et al. (2016), Lancet


LAI-PrEP efficacy
PURPOSE-1/2 trials, Bekker et al. (2024), NEJM


Healthcare stigma
Biancarelli et al. (2019), Social Science & Medicine






Reproducibility


All analyses are fully reproducible:



Random seed: 42

Monte Carlo iterations: 100,000

Bootstrap replicates: 10,000




Citation


If you use this code, please cite:



@article{demidont2025structural,
  title={Structural barriers drive near-zero population-level effectiveness 
         of Long Acting Injectable HIV prevention (LAI-PrEP) among people 
         who inject drugs: A Computational Modeling Study},
  author={Demidont, AC},
  journal={The Lancet HIV},
  year={2025},
  note={Manuscript ID: thelancethiv-D-25-00576, Submitted}
}

 




License


This project is licensed under the CC 4.0 International and MIT Licenses - see the LICENSE file for details.



Contact


AC Demidont, DONyx Dynamics LLCEmail: acdemidont@nyxdynamics.orgORCID: 0000-0002-9216-8569



Acknowledgments




HIV prevention research community for published parameters

PWID community advocates for barrier characterization

AI tools (Anthropic Claude 4.5), Jetbrains Junie, Zotero AI, Numpy, Matplotlib, Scipy, Arviz, OpenAI GPT 5.2 used as assistive technology for literature search, reference management and code refinement. Author maintainces responsibility for all aspects of project and responsbility for use and software use.

This work honors the 44.1 M lives lost to HIV since the beginning of the epidemic and strives to use Mathematics and Machines to end the epidemic.
description: v1.2.0 Key Features and Improvements - ad4fde4

Architectural Barrier HIV Prevention ModelingThis major release (v1.2.0) finalizes the Architectural Barrier Model nomenclature. It also introduces significant enhancements for user control, data privacy, and script robustness, making the project fully prepared for academic submission to The Lancet HIV.

Command-Line Interface (CLI) Integration:◦Integrated argparse across all primary simulation and visualization scripts.◦ Users can now configure --output-dir, --n-individuals, --n-samples, and other parameters via the terminal without modifying the source code.

Enhanced Data Privacy:◦ Configurable output paths enable users to isolate sensitive simulation results from the project repository by redirecting them to secure or encrypted volumes.

Improved Visualization & Compatibility:◦ Visualization scripts are now more resilient, supporting both modern nested JSON and legacy list-based results.◦ Figures (Fig 1-5 and Fig S1-S8) are optimized for Lancet publication standards (300 DPI, dual PNG/PDF export).

Streamlined Environment:◦Updated requirements.txt to focus strictly on core dependencies (numpy, scipy, matplotlib),reducing environment overhead.

Unified Terminology Refactor:◦Transitioned all internal and external terminology to "Architectural Barrier Model".◦Renamed core scripts and classes (e.g., architectural_barrier_model.py) to align with the refined academic framing.

Primary Scripts Updated• architectural_barrier_model.py: Main Monte Carlo simulation with configurable output and scale.• cascade_sensitivity_analysis.py: PSA and bottleneck identification.• stochastic_avoidance_enhanced.py: Regional outbreak forecasting with regional meth trajectories.• visualize_md_results.py: High-fidelity manuscript figure generation.

CitationIf you utilize this model in your research, please cite:Demidont AC. Structural barriers drive near-zero population-level effectiveness of Long Acting Injectable HIV prevention (LAI-PrEP) among people who inject drugs: A Computational Modeling Study. The Lancet HIV (2025). [Submitted]

Version: 1.2.0Date: January 1, 2026GitHub: Nyx-Dynamics/hiv-prevention-master
description: v1.0.0 - Lancet HIV Submission (thelancethiv-D-25-00576) - d03f974






 




Zenodo Release: HIV Prevention Barrier Modeling for PWID

DOI: 10.5281/zenodo.18116991



DESCRIPTION

Computational Monte Carlo simulation modeling structural barriers to HIV prevention among people who inject drugs (PWID). This repository contains the code, data, and documentation supporting the manuscript "Structural barriers drive near-zero population-level effectiveness of Long Acting Injectable HIV prevention (LAI-PrEP) among people who inject drugs: A Computational Modeling Study" submitted to The Lancet HIV (Manuscript ID: thelancethiv-D-25-00576).

Background: Despite LAI-PrEP (lenacapavir) demonstrating >99% efficacy in clinical trials, PWID face systematic exclusion from prevention benefits due to compounding barriers across the prevention cascade.

Methods: We developed a three-layer barrier framework modeling:



Layer 1: Pathogen biology (irreversible R₀ > 0 post-infection)

Layer 2: HIV testing failures (acute infection detection gaps)

Layer 3: Architectural barriers (policy, stigma, infrastructure, research exclusion, algorithmic bias)


Monte Carlo simulations (n=100,000; seed=42) quantified population-level prevention effectiveness across an 8-step cascade under multiple policy scenarios.

Key Findings:



Current U.S. policy achieves ~0.003% sustained HIV prevention among PWID

MSM receiving identical interventions achieve 16.3% effectiveness (5,000× disparity)

Barrier multiplication across cascade steps drives near-total prevention failure

63% probability of major HIV outbreak among PWID within 5 years under current policy

Full harm reduction integration could increase effectiveness to 18.6%


Contents:



architectural_barrier_model.py - Main simulation model

visualize_md_results.py - Publication figure generation

architectural_barrier_results.json - Full Monte Carlo outputs

pwid_simulation_results.json - PWID-specific scenario analyses

Publication-ready figures (PNG, 300 DPI)


All model parameters are derived from peer-reviewed literature. Code is fully reproducible.



METADATA TABLE
Field | Value -- | -- Title | HIV Prevention Barrier Modeling for PWID: Code and Data for Lancet HIV Submission Authors | Demidont, AC ORCID | 0000-0002-9216-8569 Affiliation | Nyx Dynamics LLC Publication Date | 2025-01-01 Version | v1.0.0 License | MIT License Resource Type | Software Language | English Keywords | HIV prevention; PrEP; LAI-PrEP; lenacapavir; PWID; people who inject drugs; Monte Carlo simulation; health disparities; structural barriers; epidemiology; harm reduction; drug policy Related Identifier | Manuscript ID: thelancethiv-D-25-00576 (IsSupplementTo) GitHub Repository | https://github.com/Nyx-Dynamics/hiv-prevention-master Communities | HIV/AIDS, Public Health

Reproducibility



Random seed: 42

Monte Carlo iterations: 100,000

Bootstrap replicates: 10,000

All parameters derived from peer-reviewed literature (see manuscript Table 1)


Files Included



├── architectural_barrier_model.py     # Main simulation (1,268 lines)
├── visualize_md_results.py            # Figure generation
├── cascade_sensitivity_analysis.py    # Sensitivity analyses
├── architectural_barrier_results.json # Full outputs
├── pwid_simulation_results.json       # Scenario results
├── figures/                           # Publication figures
│   ├── Fig1_CascadeComparison.png
│   ├── Fig3_PolicyScenarios.png
│   └── Fig5_SNR_LOOCV.png
├── README.md
├── CITATION.cff
├── LICENSE (MIT)
└── requirements.txt


 


Citation



@software{demidont2025hivbarrier,
  author       = {Demidont, AC},
  title        = {{HIV Prevention Barrier Modeling for PWID: Code and 
                   Data for Lancet HIV Submission}},
  year         = 2025,
  publisher    = {Zenodo},
  version      = {v1.0.0},
  doi          = {10.5281/zenodo.18116991},
  url          = {https://doi.org/10.5281/zenodo.18116991}
}


 


Requirements



Python 3.9+

NumPy ≥1.21.0

Matplotlib ≥3.5.0

SciPy ≥1.7.0


Contact

AC Demidont, DONyx Dynamics LLCacdemidont@nyxdynamics.orgORCID: 0000-0002-9216-8569