How prajwalj1506/waterleakagedetection works
This is a water-leak inspection system: an engineer enters pressure, refill status, pipe identity and inspection metadata in the Android app; the app submits a reading to the FastAPI backend, which runs four trained models, averages their leak probabilities, and saves the result. The app then presents the prediction and supports dashboard, searchable/filterable history and record details. Backend persistence and model inference are shown in sampled source; Android-to-backend submission is documented, while unsampled implementation details are not inferred.
Main entry points: WaterLeakageRepository.kt API repository · AppNavHost.kt App navigation · main.py FastAPI entry · readings.py Reading endpoints
Components 25
Android app
- App navigation
android/app/src/main/kotlin/com/waterleakage/app/ui/navigation/AppNavHost.kt - Add reading
android/app/src/main/kotlin/com/waterleakage/app/ui/screens/add/AddReadingScreen.kt - Submission state
android/app/src/main/kotlin/com/waterleakage/app/ui/screens/add/AddReadingViewModel.kt - Prediction result
android/app/src/main/kotlin/com/waterleakage/app/ui/screens/result/PredictionResultScreen.kt - Result state
android/app/src/main/kotlin/com/waterleakage/app/ui/screens/result/PredictionResultViewModel.kt - Dashboard
android/app/src/main/kotlin/com/waterleakage/app/ui/screens/dashboard/DashboardScreen.kt - Dashboard state
android/app/src/main/kotlin/com/waterleakage/app/ui/screens/dashboard/DashboardViewModel.kt - Reading history
android/app/src/main/kotlin/com/waterleakage/app/ui/screens/history/ReadingHistoryScreen.kt - History state
android/app/src/main/kotlin/com/waterleakage/app/ui/screens/history/ReadingHistoryViewModel.kt - Reading details
android/app/src/main/kotlin/com/waterleakage/app/ui/screens/details/ReadingDetailScreen.kt - Detail state
android/app/src/main/kotlin/com/waterleakage/app/ui/screens/details/ReadingDetailViewModel.kt - API repository
android/app/src/main/kotlin/com/waterleakage/app/data/repository/WaterLeakageRepository.kt - Server connection
android/app/src/main/kotlin/com/waterleakage/app/data/remote/ApiClient.kt - API endpoints
android/app/src/main/kotlin/com/waterleakage/app/data/remote/WaterLeakageApi.kt - Reading data models
android/app/src/main/kotlin/com/waterleakage/app/data/model/ReadingModels.kt
API and inference
- FastAPI entry
backend/app/main.py - Reading endpoints
backend/app/routers/readings.py - Dashboard endpoint
backend/app/routers/dashboard.py - Request and response schemas
backend/app/schemas.py - Ensemble inference
backend/app/services/ml_service.py - Trained models
backend/artifacts
Reading storage
- Database session
backend/app/database.py - Reading records
backend/app/models.py - SQLite database
backend/water_leakage.db
Other components
- Engineer
Connections 34
- Engineer → App navigation: opens app
- App navigation → Dashboard: shows
android/app/src/main/kotlin/com/waterleakage/app/ui/navigation/AppNavHost.kt - App navigation → Add reading: routes to
android/app/src/main/kotlin/com/waterleakage/app/ui/navigation/AppNavHost.kt - App navigation → Prediction result: routes to
android/app/src/main/kotlin/com/waterleakage/app/ui/navigation/AppNavHost.kt - App navigation → Reading history: routes to
android/app/src/main/kotlin/com/waterleakage/app/ui/navigation/AppNavHost.kt - App navigation → Reading details: routes to
android/app/src/main/kotlin/com/waterleakage/app/ui/navigation/AppNavHost.kt - Add reading → Submission state: uses state
android/app/src/main/kotlin/com/waterleakage/app/ui/screens/add/AddReadingScreen.kt - Submission state → API repository: submits reading
android/app/src/main/kotlin/com/waterleakage/app/ui/screens/add/AddReadingViewModel.kt - API repository → Server connection: gets API client
android/app/src/main/kotlin/com/waterleakage/app/data/repository/WaterLeakageRepository.kt - Server connection → API endpoints: creates client
android/app/src/main/kotlin/com/waterleakage/app/data/remote/ApiClient.kt - API repository → FastAPI entry: calls REST API
README.md - FastAPI entry → Reading endpoints: registers routes
backend/app/main.py - FastAPI entry → Dashboard endpoint: registers routes
backend/app/main.py - FastAPI entry → Database session: creates tables
backend/app/main.py - FastAPI entry → Ensemble inference: loads models
backend/app/main.py - Reading endpoints → Ensemble inference: requests prediction
backend/app/routers/readings.py - Reading endpoints → Database session: uses session
backend/app/routers/readings.py - Dashboard endpoint → Database session: queries records
backend/app/routers/dashboard.py - Reading endpoints → Request and response schemas: validates and returns
backend/app/routers/readings.py - Dashboard endpoint → Request and response schemas: returns summary
backend/app/routers/dashboard.py - Ensemble inference → Trained models: loads models
backend/app/services/ml_service.py - Database session → SQLite database: connects to
backend/app/database.py - Reading endpoints → Reading records: creates and queries
backend/app/routers/readings.py - Dashboard endpoint → Reading records: aggregates
backend/app/routers/dashboard.py - Reading records → Database session: uses ORM base
backend/app/models.py - Submission state → Prediction result: navigates after submit
android/app/src/main/kotlin/com/waterleakage/app/ui/navigation/AppNavHost.kt - Prediction result → Result state: uses state
android/app/src/main/kotlin/com/waterleakage/app/ui/navigation/AppNavHost.kt - Result state → API repository: loads reading
android/app/src/main/kotlin/com/waterleakage/app/ui/screens/result/PredictionResultViewModel.kt - Dashboard → Dashboard state: uses state
android/app/src/main/kotlin/com/waterleakage/app/ui/screens/dashboard/DashboardScreen.kt - Dashboard state → API repository: loads summary
android/app/src/main/kotlin/com/waterleakage/app/ui/screens/dashboard/DashboardViewModel.kt - Reading history → History state: uses state
android/app/src/main/kotlin/com/waterleakage/app/ui/screens/history/ReadingHistoryScreen.kt - History state → API repository: loads readings
android/app/src/main/kotlin/com/waterleakage/app/ui/screens/history/ReadingHistoryViewModel.kt - Reading details → Detail state: uses state
android/app/src/main/kotlin/com/waterleakage/app/ui/screens/details/ReadingDetailScreen.kt - Detail state → API repository: loads and deletes
android/app/src/main/kotlin/com/waterleakage/app/ui/screens/details/ReadingDetailViewModel.kt