How code84/ev_traffic_optim works
This repository is an EV-network analytics and tariff-optimization product. Its main user-to-result workflow turns ACN and Shenzhen UrbanEV data into processed time series and engineered features, trains demand and congestion models, then runs a five-agent forecast-to-insight workflow that recommends prices and tracks operational KPIs. A Streamlit dashboard presents forecasts, congestion, pricing, station analytics, and agent insights; a separate pricing simulation produces network-level comparisons. The graph follows documented or excerpted calls; some training and dashboard wiring is only documented, so uncertain links are omitted.
Main entry points: orchestrator.py Agent Orchestrator · preprocessing_pipeline.py Preprocessing · app.py Streamlit Dashboard · trainer.py Forecast Trainer
Components 23
Data Preparation
- ACN Sessions
UrbanEV_dataset - UrbanEV Inputs
UrbanEV_dataset - ACN Processor
src/data_engineering/acn_processor.py - UrbanEV Processor
src/data_engineering/urban_ev_processor.py - Preprocessing
src/data_engineering/preprocessing_pipeline.py - Analytical ETL
src/data_engineering/etl_pipeline.py - Feature Engineering
src/feature_engineering/features.py - Feature Pipeline
src/feature_engineering/pipeline.py
Modeling
- Forecast Trainer
src/models/trainer.py - Congestion Model
src/models/congestion_model.py
Agent Workflow
- Demand Forecast Agent
src/agents/forecast_agent.py - Congestion Agent
src/agents/congestion_agent.py - Pricing Agent
src/agents/pricing_agent.py - Monitoring Agent
src/agents/monitoring_agent.py - Insights Agent
src/agents/insights_agent.py - Agent Orchestrator
src/agents/orchestrator.py
Pricing & Interface
- Pricing Engine
src/pricing/pricing_engine.py - Streamlit Dashboard
src/dashboard/app.py - Dashboard Data Loader
src/dashboard/data_loader.py - Pricing Simulation
run_pricing_simulation.py
Shared Analysis
- Data Helpers
src/utils/helpers.py - Evaluation Metrics
src/utils/metrics.py
Other components
- Operator
Connections 24
- Operator → Preprocessing: starts processing
README.md - ACN Sessions → Preprocessing: session input
README.md - UrbanEV Inputs → Preprocessing: network input
README.md - Preprocessing → ACN Processor: processes ACN
src/data_engineering/preprocessing_pipeline.py - Preprocessing → UrbanEV Processor: processes UrbanEV
src/data_engineering/preprocessing_pipeline.py - Analytical ETL → UrbanEV Processor: loads and transforms
src/data_engineering/etl_pipeline.py - Feature Pipeline → Feature Engineering: engineers features
src/feature_engineering/pipeline.py - Feature Engineering → Data Helpers: uses helpers
src/feature_engineering/features.py - Forecast Trainer → Congestion Model: trains models
README.md - Forecast Trainer → Feature Engineering: uses engineered inputs
README.md - Agent Orchestrator → Demand Forecast Agent: dispatches forecast
src/agents/orchestrator.py - Agent Orchestrator → Congestion Agent: dispatches risk
src/agents/orchestrator.py - Agent Orchestrator → Pricing Agent: dispatches pricing
src/agents/orchestrator.py - Agent Orchestrator → Monitoring Agent: dispatches monitoring
src/agents/orchestrator.py - Agent Orchestrator → Insights Agent: dispatches insights
src/agents/orchestrator.py - Pricing Agent → Pricing Engine: uses pricing engine
src/agents/pricing_agent.py - Monitoring Agent → Pricing Agent: feedback tunes
src/agents/orchestrator.py - Streamlit Dashboard → Dashboard Data Loader: loads dashboard data
src/dashboard/app.py - Streamlit Dashboard → Agent Orchestrator: runs agent workflow
src/dashboard/app.py - Streamlit Dashboard → Demand Forecast Agent: requests forecast
src/dashboard/app.py - Operator → Streamlit Dashboard: views operations
README.md - Pricing Simulation → Pricing Engine: simulates tariffs
run_pricing_simulation.py - Pricing Simulation → Data Helpers: uses helpers
run_pricing_simulation.py - Forecast Trainer → Evaluation Metrics: evaluates models
README.md