How hafizardd/ecotraffic-gis works
EcoTraffic GIS is a real-time WebGIS for monitoring vehicle emissions across Yogyakarta. Its primary workflow runs CCTV imagery through vehicle detection and emission estimation, then presents camera and road-segment results on a live map and analytics dashboard. A separate segment workflow aggregates traffic observations into volume, VKT, and Tier-2 emissions; spatial layers and activity-grid scoring add geographic context, while Bang Jo provides a segment-oriented assistant. The graph combines README capabilities with sampled source; some route and frontend wiring is documented but not shown in the excerpts.
Main entry points: api.ts API client · database.py PostGIS database · tracking_worker.py Camera tracking · routes API routes
Components 24
Web dashboard
- Dashboard shell
frontend/src/components/Dashboard/DashboardShell.tsx - Live map
frontend/src/components/Map/MapView.tsx - Camera details
frontend/src/components/Panel/SidePanel.tsx - Camera video
frontend/src/components/Panel/VideoFeed.tsx - Emission analytics
frontend/src/components/Analytics - Activity grid
frontend/src/hooks/useActivityGrid.ts - Bang Jo chat
frontend/src/components/Chatbot/BangJoWidget.tsx - API client
frontend/src/services/api.ts - Live emissions hook
frontend/src/hooks/useEmissions.ts
API services
- FastAPI app
backend/app/main.py - API routes
backend/app/api/routes - Bang Jo services
backend/app/services/bangjo_retrieval.py
Vision and tracking
- Camera tracking
backend/app/workers/tracking_worker.py - Vehicle detection
backend/cv/detector.py - Camera emission factors
backend/cv/emission_factors.py
Segment analytics
- Segment calculation
backend/app/workers/segment_calculation_worker.py - Segment emissions
backend/app/services/segment_emission_pipeline.py - Activity scoring
backend/app/services/hex_activity_scoring.py
Data and realtime
- PostGIS database
backend/app/core/database.py - Redis state and pub/sub
Other components
- City user
- CCTV feeds
- Browser user
- Embedding API
Connections 29
- City user → Dashboard shell: views
- Dashboard shell → Live map: shows
- Dashboard shell → Emission analytics: opens
- Live map → API client: requests layers
- Camera details → API client: requests details
- Camera video → API client: requests stream
- Emission analytics → API client: fetches history
- Activity grid → API client: fetches grid
- Bang Jo chat → API client: sends questions
- API client → FastAPI app: HTTP requests
- Live emissions hook → API client: hydrates emissions
- Live emissions hook → Redis state and pub/sub: receives updates
- FastAPI app → API routes: mounts routes
- API routes → PostGIS database: reads and writes
- API routes → Redis state and pub/sub: subscribes
- API routes → Bang Jo services: resolves queries
- Bang Jo services → PostGIS database: loads embeddings
- Bang Jo services → Embedding API: embeds query
- CCTV feeds → Camera tracking: supplies video
- Camera tracking → Vehicle detection: detects vehicles
- Camera tracking → Camera emission factors: estimates emissions
- Camera tracking → PostGIS database: persists observations
- Camera tracking → Redis state and pub/sub: publishes updates
- Segment calculation → PostGIS database: reads observations
- Segment calculation → Segment emissions: calculates windows
- Segment emissions → PostGIS database: persists results
- Segment calculation → Redis state and pub/sub: publishes segment state
- Activity scoring → PostGIS database: uses spatial data
- Browser user → Dashboard shell: interacts