An intelligent, offline-first personal finance application that utilizes reinforcement learning to provide dynamic gamification and adaptive budgeting strategies.
This repository contains the Thin Client / Edge-Compute Android Application. It is designed to work in tandem with a Python FastAPI backend running a customized LinUCB Contextual Bandit algorithm.
- Edge Feature Engineering: To preserve data privacy and reduce latency, the raw transaction data is never sent to the cloud. Instead, the local SQLite database calculates mathematical user contexts (like
spending_volatilityandtransaction_count) on the edge device and sends an anonymized context vector to the AI. - Offline-First Resilience: Network failures are treated as an expected state. If the AI is unreachable, or if a user engages with a gamification strategy while offline, the app queues the feedback telemetry locally.
- Decoupled Feedback Loop: User rewards are explicitly decoupled from the inference request. The app uses Android's
WorkManagerto silently sync pending reinforcement learning rewards (+1.0or0.0) to the cloud backend whenever an internet connection is re-established. - Dynamic UI Generation: The UI is completely decoupled from hardcoded logic. Colors, text, and gamification strategies are dynamically rendered in real-time based on the exact JSON schema provided by the cloud LinUCB model.
- Language: Kotlin
- UI Toolkit: Jetpack Compose (Material 3)
- Architecture: MVVM (Model-View-ViewModel)
- Local Persistence: Room Database (SQLite)
- Network Client: Retrofit 2 & OkHttp
- Background Processing: Android WorkManager & Kotlin Coroutines
core/network/- Retrofit configuration and singleton API client.data/local/- Room DAOs, Entities, and local edge-compute queries.data/remote/- Strict Kotlin data classes matching the Python Pydantic schemas.data/repository/- The single source of truth bridging SQLite and Retrofit.feature/- Jetpack Compose screens and ViewModels.worker/- Background sync services for offline telemetry persistence.
- Clone this repository.
- Open the project in Android Studio (Koala or newer recommended).
- Ensure your
local.propertiesorApiClient.ktcontains the validAPI_TOKENand backendBASE_URLpointing to the FastAPI server. - Run Gradle Sync.
- Deploy to an Android Emulator or physical device (API Level 24+).