Milestone 0: Rwanda district-level VCI smoke test - #65
Draft
goldingn wants to merge 15 commits into
Draft
Conversation
Create the R package skeleton with usethis: DESCRIPTION, MIT licence, NEWS, package-level docs, and testthat (3rd edition) infrastructure. Add the formatting/linting toolchain (Air config, .lintr deferring line-width and indentation to Air) and the build/ignore rules that keep dev files out of the built package. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R8QmvZEJTz9b7uNfJZTy3n
Implement the core equations, test-first: vectorial_capacity() (the species-specific Garrett-Jones form, maths spec section 1), sum_species() (aggregation across species, section 18), and compute_vci() (the reference-vs- alternative scenario comparison, section 19), plus small internal input validators. Tests encode the section 10.1 scientific invariants (zero abundance gives zero capacity, monotonicity, identical-scenario VCI of zero, ...). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R8QmvZEJTz9b7uNfJZTy3n
Implement the intervention-dependent stage (maths spec sections 15-17): host_destination() redistributes feeding attempts under repellency, successful_feeding_rate() and mortality_hazard() assemble the realised feeding rate and survival, and survival_probability() converts hazard to survival. intervention_effect_stub() maps product/coverage/susceptibility to the (R, B, K) channels -- a deliberately crude, clearly-labelled placeholder (not issue #17), capturing only that pyrethroid killing collapses with resistance while dual-AI killing does not. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R8QmvZEJTz9b7uNfJZTy3n
vci_inputs() constructs and validates the minimal Milestone 0 input object (DESIGN.md section 7): three keyed tables (per-district-species abundance, per-species bionomics, per-district intervention context) plus optional geometry, with a print method. Validation is strict and non-imputing -- required columns, value ranges, no missing data (section 7.4), and referential integrity between the tables. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R8QmvZEJTz9b7uNfJZTy3n
data-raw/rwanda_inputs.R builds rwanda_inputs from GADM admin-2 boundaries and cached Africa rasters (abundance, pyrethroid susceptibility, 2024 net use), attaching malariasimulation bionomics and ballpark stub parameters. The abundance layer (proportional to the biting rate m*a) is divided by the feeding rate to recover adults per human m. Host-opportunity weights use an explicit, documented equal-availability assumption (issues #13, #16). Source rasters are git-ignored; the small derived object is committed for a deterministic example. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R8QmvZEJTz9b7uNfJZTy3n
compute_capacity() runs the whole pipeline (intervention stub, host choice, survival, capacity equation, species sum) for each scenario, returning tidy per-district capacity; vci_by_scenario() turns those capacities into vector control impact against a named reference. Together they express the three Milestone 0 scenarios: no intervention, pyrethroid BAU, and dual-AI alternative. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R8QmvZEJTz9b7uNfJZTy3n
The vignette (vignette("rwanda-smoke-test")) runs the three scenarios end to
end and maps the inputs (per-species abundance, LLIN use, susceptibility) and
results (capacity and VCI), with a prominent illustrative-only banner. The
integration test pins the run on the committed rwanda_inputs: the DoD invariants
(reference VCI of zero, BAU in (0,1), dual-AI at least pyrethroid, invariance to
abundance) plus a snapshot of district VCI.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R8QmvZEJTz9b7uNfJZTy3n
Auto-generated Claude Code session log capturing the prompts behind this branch. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R8QmvZEJTz9b7uNfJZTy3n
biting_rate() and eip() are simple mechanistic Briere thermal responses (the An. gambiae fits from Mordecai et al. 2013, as used by Villena et al. 2022): the biting rate peaks near the thermal optimum and falls to zero at the limits, and the EIP is shortest near the optimum and lengthens (to infinity outside the parasite-development range) as it cools. These map the two temperature-sensitive Garrett-Jones parameters across space from a temperature layer. Refs #64 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R8QmvZEJTz9b7uNfJZTy3n
Move the biting rate and EIP out of the (constant) bionomics and derive them, per district, from a WorldClim annual-mean-temperature layer added to the sites table: compute_capacity() now computes them once via biting_rate()/eip(). This fixes the smoke test's implausible moderate capacity in cool, high-altitude districts (e.g. Burera, Musanze, Nyabihu in the north), which now show near-zero capacity, matching the low malaria burden there. VCI stays invariant to absolute abundance; the vignette gains a temperature map and the input maps are updated. Fixes #64 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R8QmvZEJTz9b7uNfJZTy3n
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R8QmvZEJTz9b7uNfJZTy3n
The source species-abundance raster was updated to fix a bug. Rebuild rwanda_inputs from it (via data-raw/rwanda_inputs.R): abundances are lower and the species composition shifts, so the district capacities and the pinned VCI snapshot change. Invariants and check remain clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R8QmvZEJTz9b7uNfJZTy3n
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R8QmvZEJTz9b7uNfJZTy3n
The species-abundance layers are relative, not on a daily-landing scale. Add a single multiplicative calibration constant (~2.19) anchoring them to observed 24-h outdoor human landing rates from Msugupakulya et al. 2024 (Parasites & Vectors, Table 2) in the Kilombero Valley. Calibrate on An. arabiensis (outdoor 0.72 bites/person/hour) rather than the endophilic An. funestus, whose outdoor rate (~0.01/hour) is a poor anchor; the paper pools its two villages. As a single uniform constant this rescales absolute vectorial capacity but leaves VCI (and the pinned snapshot) unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R8QmvZEJTz9b7uNfJZTy3n
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R8QmvZEJTz9b7uNfJZTy3n
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Milestone 0: the first end-to-end run of the package — a district-level VCI
smoke test for Rwanda, built (per DESIGN.md §14) to shake out architecture and
integration problems before the science is signed off. It computes vector control
impact across Rwanda's 30 GADM admin-2 districts for three scenarios: no
intervention (reference), business-as-usual (current net use, all pyrethroid
LLIN), and an alternative (the same use, all dual-AI LLIN).
Illustrative only. Ballpark parameters and a clearly-labelled intervention
stub — the outputs are not a real analysis, and every surface says so.
The kernel is pure base R (zero runtime
Imports);sf/terra/geodataandggplot2/patchworkareSuggests, used only indata-raw/and the vignette.devtools::check()is clean: 0 errors, 0 warnings, 0 notes; 93 testassertions plus a pinned integration snapshot.
The eight commits are thematic and dependency-ordered: scaffolding → capacity
kernel → host-choice + intervention stub → input contract → dataset → pipeline →
vignette + integration test → session log.
How this was produced
vs dual-AI LLIN, three scenarios; test-first kernel following the maths spec;
prepare district inputs in
data-raw/from provided Africa rasters; a vignettewith clean ggplot2/sf figures of the inputs and of capacity/VCI.
Suggests(data-prep/vignette only), soR CMD checkstays free of unusedImports.intervention_effect_stub()), not thereal Decide how interventions become effects, and how combinations of them compose #17 design — plausible round numbers, loudly labelled, capturing only
that pyrethroid killing collapses with resistance while dual-AI killing does
not.
Q0andphi_indoorsunder an explicit, documented equal-host-availabilityassumption (relates to Choose the final symbol for host-destination fractions #13, Confirm how human landing catch data connect to abundance and biting rate #16) — adopted knowingly, not silently.
m·a, so it is divided by the feeding rate to recoveradults-per-human
m. This surfaced that survival and abundance are decoupledhere (VCI is invariant to absolute abundance) — recorded as Survival and abundance are decoupled: VCI is invariant to absolute abundance #63.
biting_rate()andeip()are illustrative Brièrethermal responses (Mordecai et al. 2013 / Villena et al. 2022), driven by a
WorldClim temperature layer, so cool high-altitude districts (Burera,
Musanze, Nyabihu) now show near-zero capacity rather than an implausible
moderate value.
.lintrdefers line-width and indentation to Air (the projectformatter); the
NEWS.mdheading uses the numeric dev version so R's NEWSparser recognises it.
Suggests, none at runtime):sf,terra,geodata(data prep);
ggplot2,patchwork(vignette figures);knitr,rmarkdown(vignette builder).
patchworkwas flagged and approved.dev/sessions/2026-07-24-54f0b094-iss45-milestone-0-smoke-test.mdFixes #45
Fixes #64
🤖 Generated with Claude Code