How tktarun03/chennai-waterguard-ai-poc works
WaterGuard-AI is a synthetic-data water-governance dashboard, not a live utility integration. The primary path is synthetic telemetry and scenario generation through backend ingestion, anomaly detection, incident/safety assessment, and API responses to citizen/operator dashboard panels; separate branches cover simulated lab verification, building hygiene, authentication, and auditability. Edges are limited to relationships shown by the README or SOURCE INDEX; unsampled route and service internals are represented without speculative wiring.
Main entry points: synthetic.py Synthetic worker · router.py API v1 router · telemetry.py Telemetry ingestion · entities.py WaterGuard database
Components 28
Dashboard
- Dashboard shell
frontend/src/App.tsx - Sign-in and roles
frontend/src/hooks/useAuth.tsx - Typed API client
frontend/src/lib/api.ts - Dashboard panels
frontend/src/components - UI primitives
frontend/src/components/primitives.tsx - Display formatting
frontend/src/lib/format.ts
API and access
- API v1 router
backend/app/api/v1/router.py - Authentication routes
backend/app/api/v1/auth.py - Safety routes
backend/app/api/v1/safety.py - Telemetry routes
backend/app/api/v1/telemetry.py - System routes
backend/app/api/v1/system.py - Account service
backend/app/services/accounts.py
Monitoring and response
- Telemetry ingestion
backend/app/services/telemetry.py - Anomaly detection
backend/app/services/detection.py - Safety assessment
backend/app/services/assessment.py - Safe Meter engine
backend/app/services/safe_meter.py - Incident lifecycle
backend/app/services/incidents.py - Lab verification
backend/app/services/laboratory.py - Building hygiene
backend/app/services/hygiene.py
Synthetic operations
- Scenario controls
backend/app/services/scenarios.py - Synthetic worker
backend/app/workers/synthetic.py - Sensor generator
simulator/sensor_generator.py
Persistence and foundations
- WaterGuard database
backend/app/models/entities.py - Database sessions
backend/app/db/session.py - Domain state types
backend/app/models/enums.py - Structured logging
backend/app/core/logging.py - Runtime configuration
backend/app/core/config.py
Other components
- Citizen / operator
Connections 33
- Citizen / operator → Dashboard shell: views
README.md - Dashboard shell → Typed API client: requests data
frontend/src/App.tsx - Dashboard shell → Dashboard panels: renders
frontend/src/App.tsx - Dashboard panels → Typed API client: requests data
frontend/src/components/IncidentPanel.tsx - Dashboard panels → Display formatting: formats values
frontend/src/components/IncidentPanel.tsx - Dashboard panels → UI primitives: renders
frontend/src/components/IncidentPanel.tsx - Sign-in and roles → Typed API client: authenticates
frontend/src/hooks/useAuth.tsx - Typed API client → API v1 router: calls API
README.md - API v1 router → Authentication routes: registers
backend/app/api/v1/router.py - API v1 router → Safety routes: registers
backend/app/api/v1/router.py - API v1 router → Telemetry routes: registers
backend/app/api/v1/router.py - System routes → API v1 router: mounts routes
- Authentication routes → Account service: delegates to
backend/app/api/v1/auth.py - Telemetry routes → Telemetry ingestion: delegates to
- Safety routes → Safe Meter engine: delegates to
- Telemetry ingestion → Anomaly detection: evaluates readings
backend/app/services/telemetry.py - Telemetry ingestion → Incident lifecycle: creates incidents
backend/app/services/telemetry.py - Safe Meter engine → Anomaly detection: uses signals
backend/app/services/safe_meter.py - Safety assessment → Safe Meter engine: assesses safety
- Incident lifecycle → Lab verification: requests verification
- Synthetic worker → Telemetry ingestion: submits readings
backend/app/workers/synthetic.py - Synthetic worker → Scenario controls: runs scenarios
backend/app/workers/synthetic.py - Synthetic worker → Safety assessment: runs assessment
backend/app/workers/synthetic.py - Synthetic worker → Building hygiene: checks hygiene
backend/app/workers/synthetic.py - Sensor generator → Synthetic worker: supplies synthetic data
- Telemetry ingestion → WaterGuard database: stores readings
backend/app/services/telemetry.py - Incident lifecycle → WaterGuard database: stores incidents
- Building hygiene → WaterGuard database: stores hygiene records
backend/app/services/hygiene.py - Database sessions → WaterGuard database: provides sessions
backend/app/db/session.py - WaterGuard database → Domain state types: uses domain states
backend/app/models/entities.py - Runtime configuration → Database sessions: configures database
backend/app/db/session.py - Runtime configuration → Structured logging: configures logging
backend/app/core/logging.py - Account service → Structured logging: records events
backend/app/services/accounts.py