Contributing to ihsMW
Source:CONTRIBUTING.md
Thank you for your interest in contributing to ihsMW! This document outlines how to report bugs, suggest improvements, and submit code.
Reporting bugs
Please open an issue on GitHub Issues with:
- A short, descriptive title.
- The output of
sessionInfo(). - A minimal reproducible example (reprex) demonstrating the problem.
- The expected vs. actual behaviour.
Suggesting crosswalk corrections
The harmonisation crosswalk lives at inst/extdata/ihs_crosswalk.csv. To correct a mapping or add a new variable:
- Fork the repository and create a branch (e.g.,
fix/rexp-cat01-mapping). - Edit
inst/extdata/ihs_crosswalk.csvdirectly. - If you are unsure about a mapping, set
needs_review = TRUE. - Open a pull request describing which variable changed, in which round, and your source (e.g., the BID page number).
Code style
- Follow the tidyverse style guide.
- Use
cli::cli_abort(),cli::cli_warn(), andcli::cli_inform()for all user-facing messages. Never usestop(),message(), orcat(). - Use
rlang::abort()only if you need a low-level programmatic error. - Use
httr2for all HTTP calls, nothttrorcurl.
Running tests locally
devtools::test()All tests use httptest2 mocks and run completely offline. No API key is required.
Adding a new Malawi survey
To extend ihsMW with a new survey (e.g., IHPS or future IHS6):
- Add the round key and IDNo to
.IHS_ROUNDSand.IHS_IDNOSinR/utils.R. - Add weight/strata/cluster mappings to
.ihs_weight_varsinR/IHS_survey.R. - Extend
inst/extdata/ihs_crosswalk.csvwith a newihs{N}_namecolumn. - Update
mwi_surveys()in the relevant R file. - Add corresponding tests and update the vignettes.