How beksanoff/smart-city-ai works
Smart City AI Core monitors current Almaty conditions, predicts conditions for a user-selected date, and presents historical patterns plus a seven-day forecast. The main workflow runs from the React interface through the Go API to Python prediction/analytics logic, which uses a trained model and historical CSV; the Go backend also gathers live weather and traffic data and persists live snapshots and prediction logs. README statements establish several cross-service links; unsampled implementation details are left unconnected or shown as unverified.
Main entry points: http HTTP API · App.tsx Application shell · logic.py Prediction and analytics · api.ts Frontend API client
Components 25
React interface
- Application shell
frontend-react/src/App.tsx - Live widgets
frontend-react/src/components/dashboard - Trip planner
frontend-react/src/components/dashboard/TripPlanner.tsx - Analytics dashboard
frontend-react/src/components/analytics/AnalyticsDashboard.tsx - Almaty map
frontend-react/src/components/map/AlmatyMap.tsx - Frontend API client
frontend-react/src/services/api.ts
Go backend
- HTTP API
backend-go/internal/delivery/http - Live data services
backend-go/internal/service - Dashboard assembly
backend-go/internal/service/dashboard_service.go - Traffic service
backend-go/internal/service/traffic_service.go - Weather service
backend-go/internal/service/weather_service.go - ML bridge
backend-go/internal/service/ml_bridge.go - Domain contracts
backend-go/internal/domain - PostgreSQL repository
backend-go/internal/repository/postgres/postgres.go
Prediction and analytics
- Python ML API
ml-python/main.py - Prediction and analytics
ml-python/services/logic.py - AQI and traffic models
ml-python/services/ml_model.py - Weather forecasts
ml-python/services/forecast.py - Historical dataset
ml-python/data/almaty_history.csv
External data and services
- Open-Meteo
- TomTom
- Yandex Maps
- Groq
Other components
- City user
- PostgreSQL
Connections 29
- City user → Application shell: uses
README.md - Application shell → Live widgets: shows
frontend-react/src/App.tsx - Application shell → Trip planner: shows
frontend-react/src/App.tsx - Application shell → Analytics dashboard: shows
frontend-react/src/App.tsx - Live widgets → Frontend API client: requests live data
frontend-react/src/components/dashboard/TripPlanner.tsx - Trip planner → Frontend API client: submits forecast
frontend-react/src/components/dashboard/TripPlanner.tsx - Analytics dashboard → Frontend API client: requests analytics
frontend-react/src/components/analytics/AnalyticsDashboard.tsx - Application shell → Almaty map: displays
frontend-react/src/App.tsx - Almaty map → Yandex Maps: loads map and traffic
README.md - Frontend API client → HTTP API: calls endpoints
README.md - HTTP API → Dashboard assembly: assembles dashboard
- HTTP API → Live data services: serves live data
- Live data services → Weather service: handles weather
- Live data services → Traffic service: handles traffic
- Dashboard assembly → Weather service: collects weather
- Dashboard assembly → Traffic service: collects traffic
- HTTP API → ML bridge: proxies AI requests
README.md - ML bridge → Python ML API: calls ML service
README.md - HTTP API → PostgreSQL repository: persists records
- PostgreSQL repository → PostgreSQL: reads and writes
README.md - HTTP API → Domain contracts: uses contracts
- Python ML API → Prediction and analytics: dispatches requests
ml-python/main.py - Prediction and analytics → AQI and traffic models: computes predictions
ml-python/services/logic.py - Prediction and analytics → Weather forecasts: gets forecasts
ml-python/services/logic.py - Prediction and analytics → Historical dataset: reads history
README.md - Prediction and analytics → Groq: generates explanation
README.md - Weather service → Open-Meteo: gets live weather
README.md - Traffic service → TomTom: gets live traffic
README.md - Weather forecasts → Open-Meteo: gets forecast
README.md