Android library that powers growth monitoring within OpenSRP deployments, providing reusable UI flows, repositories, and z-score utilities for weight, height, and weight-for-height tracking.
- Toolchain: Gradle 8.7, Android Gradle Plugin 8.6.0, Java 17 (library is Java-based; Kotlin is optional)
- CI: GitHub Actions builds (ci.yml) and snapshot publishing (release.yml)
- Default branch:
master; tagged releases: not yet published
- Capture current or historical weight and height measurements with built-in dialogs
- Render WHO-aligned growth charts with weight-for-age, height-for-age, and weight-for-height indicators
- Calculate z-scores and derive color-coded status thresholds for quick assessments
- Provide repositories and intent services for synchronizing growth data with OpenSRP backends
- JDK 17+
- Android Studio/Gradle using AGP 8.6.0 and Gradle 8.7
- (Optional) Kotlin 1.9.x if your host app uses Kotlin
- Android minSdk 28
- Android compileSdk/targetSdk 35
Add the dependency from Maven Central (coordinates from gradle.properties). Replace <version> with the desired release (see Releases).
Groovy DSL
repositories {
mavenCentral()
}
dependencies {
implementation 'org.smartregister:opensrp-growth-monitoring:<version>'
}Kotlin DSL
dependencies {
implementation("org.smartregister:opensrp-growth-monitoring:<version>")
}GrowthMonitoringLibrary must be initialized once from your Application class after the OpenSRP core has been bootstrapped.
public class MyOpensrpApp extends Application {
private static final int DATABASE_VERSION = 1;
@Override
public void onCreate() {
super.onCreate();
org.smartregister.Context opensrp = org.smartregister.Context.getInstance();
Repository repository = opensrp.updateApplicationContext(this).getRepository();
GrowthMonitoringLibrary.init(
opensrp,
repository,
BuildConfig.VERSION_CODE,
BuildConfig.VERSION_NAME,
DATABASE_VERSION,
new GrowthMonitoringConfig()
);
}
}// Launch the record-growth dialog for the selected child
WeightWrapper wrapper = new WeightWrapper();
wrapper.setId(baseEntityId);
wrapper.setDob(childDobIsoString);
RecordGrowthDialogFragment dialog = RecordGrowthDialogFragment
.newInstance(childDob, wrapper, null);
dialog.show(getSupportFragmentManager(), "record_growth");// Display the weight monitoring fragment inside an activity or host fragment
List<Weight> weights = GrowthMonitoringLibrary.getInstance()
.weightRepository()
.findByEntityId(baseEntityId);
Fragment fragment = WeightMonitoringFragment
.createInstance(childDobIsoString, Gender.FEMALE, weights);
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.content_frame, fragment)
.commit();// Calculate a z-score for the most recent weight entry
Double z = WeightZScore.calculate(
Gender.FEMALE,
childDob,
latestWeighingDate,
latestWeightKg
);
if (z != null) {
int colorRes = WeightZScore.getZScoreColor(z);
// apply color-coded status to your UI
}A demo client lives in the sample/ module.
- Install on a connected device/emulator:
./gradlew :sample:installDebug - Alternatively, open the project in Android Studio and run the sample configuration.
./gradlew clean assemble
./gradlew testSee GitHub Releases for published versions, release notes, and change logs.
We welcome issues and pull requests. Please build with the toolchain noted above and run the unit tests before submitting patches. (If your organization has additional contribution guidelines, follow those as well.)
Licensed under the Apache License 2.0.