HIV modeling in Eswatini
# HIVSim Eswatini Model
Agent-based HIV model for Eswatini, built on STIsim and Starsim.
The model includes a structured sexual network with risk groups, HIV transmission, testing (FSW-targeted, general population, low-CD4), ART, and PrEP. It is calibrated to UNAIDS estimates and PHIA household survey data.
## Project Docs
## Prerequisites
1. **Python 3.9+** (we recommend Miniforge)
2. **Install Starsim and STIsim** by cloning and installing locally:
```bash
git clone
github.com
cd starsim
pip install -e .
cd ..
git clone
github.com
cd stisim
pip install -e .
cd ..
```
Installing with `-e` (editable mode) means changes to the source code take effect immediately without reinstalling.
3. **Clone this repo**:
```bash
git clone
github.com
cd hivsim_eswatini
```
4. **Raw data** (not tracked in git): place the `raw_data/` folder in the repo root. This contains UNAIDS Excel files, PHIA survey CSVs, and population data. Ask the project lead for access.
5. **IDE setup**: We recommend VS Code with the Python and Claude Code extensions. Open the `hivsim_eswatini` folder as your workspace. You can run any script by opening it and pressing the play button, or by using the integrated terminal.
## Workflow
The scripts are designed to be run in order. Each step produces outputs used by the next.
### Step 1: Format the input data for HIVsim (only needed once, or when raw data changes)
Run `utils.py`.
This reads raw UNAIDS and PHIA data from `raw_data/` and produces `data/eswatini_hiv_calib.csv` — a single CSV with one row per year and columns matching the sim's result names. The calibrator uses this file to compute goodness-of-fit.
### Step 2: Run a single simulation (for quick testing)
Run `run_sims.py`.
Runs one sim with default parameters and saves results to `results/eswatini_sim.df`. Also opens a plot window showing HIV dynamics. Use this to check that the mo …