The Chap R SDK provides tools for building disease forecasting models compatible with the Chap platform.
Documentation
- Getting Started - Installation and quick start guide
- Building Your First Model - Step-by-step tutorial
- Function Reference - API documentation
What is this?
Chap (Climate Health Analytics Platform) enables health ministries to run disease forecasting models. This R SDK helps model developers create models that integrate seamlessly with Chap.
Who is this for?
- Epidemiologists and researchers who want to deploy their R models on Chap
- Model developers who need a standardized interface for train/predict workflows
- Teams who want to share models with collaborators via Chap
Key Features
- Zero boilerplate CLI: One function creates a complete command-line interface
- Automatic data handling: CSV loading, tsibble conversion, output formatting
- Configuration schemas: YAML/JSON config with validation and defaults
- Model validation: Test suite to verify Chap compatibility before deployment
Quick Example
A complete Chap-compatible model in one file:
library(chapr)
library(dplyr)
train_fn <- function(training_data, model_configuration = list(), run_info = list()) {
means <- training_data |>
as_tibble() |>
summarise(mean_cases = mean(disease_cases, na.rm = TRUE), .by = location)
list(means = means)
}
predict_fn <- function(historic_data, future_data, saved_model,
model_configuration = list(), run_info = list()) {
future_data |>
left_join(saved_model$means, by = "location") |>
mutate(samples = purrr::map(mean_cases, ~c(.x))) |>
select(-mean_cases)
}
if (!interactive()) {
create_chap_cli(train_fn, predict_fn)
}Then run from the command line:
Installation
Install from GitHub by running the following R-code:
# install.packages("remotes")
remotes::install_github("dhis2-chap/chap_r_sdk")Contributing
See CONTRIBUTING.md for development setup and guidelines.
Getting Help
- Documentation: dhis2-chap.github.io/chap_r_sdk
- Issues: GitHub Issues
- Chap Platform: github.com/dhis2/chap-core