Rwanda Malaria BYM model (R-INLA), packaged as a chapkit shell-r service.
# chapkit_rwanda_malaria_bym_model
Rwanda Malaria BYM model (R-INLA), packaged as a chapkit shell-r service.
A spatio-temporal Bayesian model for malaria incidence at the sector (ADM3)
level, combining BYM spatial effects, RW1 temporal effects, and IID
space-time interaction with lagged climate covariates. Implemented in
R-INLA. The original MLproject lives at
knutdrand/Kigali-Malaria-modelling-23-27-Feb;
this repo wraps the same R-INLA model body in chapkit's HTTP service so it
can be discovered, run, and managed by chap-core like any other registered
ML service.
## Layout
```
chapkit_rwanda_malaria_bym_model/
├── main.py # ShellModelRunner wiring + MLServiceInfo metadata
├── scripts/
│ ├── train.R # no-op (BYM fits during predict)
│ └── predict.R # BYM + RW1 + IID, R-INLA, requires polygons
├── pyproject.toml
├── uv.lock
├── Dockerfile # FROM
ghcr.io
├── compose.yml
└── Makefile
```
## Quick start
```bash
uv lock
docker compose up --build
# In another shell:
uv run chapkit test --url
localhost
```
`make test` builds the image, boots a one-shot container, runs `chapkit
test` against it (which synthesises panel data + polygons and drives a
full train -> predict cycle), and tears the container down.
## Model details
- **Family**: Poisson with `offset = log(population)`.
- **Spatial**: BYM (`f(ID, model = "bym", graph = ...)`), with a rook
adjacency graph built at predict-time from the supplied polygons.
- **Temporal**: RW1 over month-year time index.
- **Space-time interaction**: IID over (sector x time).
- **Covariates**: lagged climate variables (configurable depth, default 2).
- **Required covariates**: population, rainfall, mean_temperature,
relative_humidity. Free additional continuous covariates are accepted
via the chap-core config.
## Configuration
`main.py` exposes a small Config class that translates to YAML in the
workspace at predict-time:
| Field …