feat: add badges module with offline evaluation engine - #594
Open
vaibhav45sktech wants to merge 1 commit into
Open
feat: add badges module with offline evaluation engine#594vaibhav45sktech wants to merge 1 commit into
vaibhav45sktech wants to merge 1 commit into
Conversation
* badge tables BADGE_EARNED, BADGE_STATE, BADGE_SYNC_LOG, BADGE_STREAK_FREEZE, BADGE_CONFIG with migration 63 to 64 * badge evaluator with streak engine, grace tokens and freeze windows over existing health tables * badge shelf screen and live progress widget on home with tiered badge artwork * badge config and earned sync workers on flw-api/badges endpoints with offline defaults * unit tests for streak engine
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
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.



📋 Description
This PR implements the Badges module per the badge system LLD. ASHAs earn recognition badges for consistency, breadth, and case-completion quality, evaluated fully on-device over the existing encrypted Room database. The module is strictly read-only over health data, pays out nothing financially, and no beneficiary-level data ever leaves the device.
Changes
BADGE_EARNED,BADGE_STATE,BADGE_SYNC_LOG,BADGE_STREAK_FREEZE,BADGE_CONFIG) via additiveMIGRATION_63_64; no health-table changes.badges/domain): rules-as-data catalog of 9 badges, recompute-only evaluator, and a streak engine with grace tokens and server-pushed freeze windows for streak fairness.InvalidationTracker(no per-repository wiring), on successful syncs, and nightly via WorkManager.BadgeSyncWorkerfor/flw-api/badges/*config/freeze/earned sync on the existing authenticated client; degrades silently to compiled defaults while backend endpoints are unavailable.BADGE_SYNC_LOG) at pull completion and at the end of a fully successful push cycle.✅ Type of Change
ℹ️ Additional Information
sakshamUatDebug(emulator, API 36): DB migration 63→64 applies cleanly, badge shelf and home widget render with tiered artwork, evaluation recomputes within ~3s of form saves, andStreakEngineTest(9 cases) passes.GET/POST /flw-api/badges/*) are not yet deployed; the module runs on compiled defaults until then (config pulls are skipped silently).