How aymenhamzik/traffix3 works
TraffiX is a simulated hierarchical traffic-control product for a schematic central-Tunis network, with a live API and persona-based frontend. The principal workflow is scenario selection, demand generation, simulation and sensing, junction-level arbitration under network coordination, then live state and decision-log presentation. Experiments and Synapse language features are additional product branches. Connections follow the README and visible excerpts; several unsampled implementations are represented at their existing directory paths, so unshown internal calls are omitted.
Main entry points: master.py Junction master · explainer.py Decision explainer · server.py Backend API · api.js Frontend API client
Components 30
Scenario and demand
- Demand generator
traffix/demand/generator.py - Calendar model
traffix/demand/calendar_model.py
Simulation runtime
- SUMO simulation
traffix/simulation/backend.py - Sensor layer
traffix/simulation/sensors.py - World events
traffix/simulation/world.py - Light executor
traffix/simulation/executor.py
Hierarchical control
- Agent framework
traffix/agents/base.py - Junction agents
traffix/agents/junction - Junction observation
traffix/agents/junction/observation.py - Junction master
traffix/orchestration/master.py - Safety rules
traffix/orchestration/safety_rules.py - Network agents
traffix/agents/network - Network supermaster
traffix/orchestration/supermaster.py - System assembly
traffix/orchestration/system.py
Insights and language
- Decision log
traffix/core/decision_log.py - Decision narration
traffix/core/narrate.py - Decision explainer
traffix/agents/network/explainer.py - Language model client
traffix/synapse/llm.py - Alerts and copilot
traffix/synapse - Experiment runner
traffix/evaluation/runner.py - Persona metrics
traffix/evaluation/monitor.py - Model training
traffix/training
API and experience
- Live API
traffix/api/live.py - Backend API
traffix/api/server.py - Persona interface
frontend/src/App.jsx - Frontend API client
frontend/src/api.js - Decision feed
frontend/src/components/Feed.jsx - Network map
frontend/src/components/NetworkMap.jsx - Frontend languages
frontend/src/i18n.js
Other components
- Scenario user
Connections 33
- Scenario user → Persona interface: selects scenario
README.md - Persona interface → Frontend API client: requests state
frontend/src/App.jsx - Frontend API client → Backend API: calls API
frontend/src/api.js - Backend API → Live API: controls live run
traffix/api/server.py - Live API → System assembly: runs system
- System assembly → Junction master: assembles masters
README.md - System assembly → Network supermaster: assembles coordinator
- Demand generator → Calendar model: uses calendar
traffix/demand/generator.py - Demand generator → SUMO simulation: supplies traffic
README.md - SUMO simulation → Sensor layer: feeds readings
traffix/simulation/sensors.py - World events → SUMO simulation: applies events
traffix/simulation/world.py - Sensor layer → Junction agents: provides observations
- Junction agents → Junction observation: uses features
traffix/agents/junction/rl_light.py - Junction master → Junction agents: collects requests
traffix/orchestration/master.py - Junction master → Safety rules: checks safety
README.md - Junction master → Light executor: writes light
README.md - Network supermaster → Network agents: runs agents
README.md - Network supermaster → Junction master: sends directives
README.md - Junction master → Decision log: records decisions
traffix/orchestration/master.py - Live API → Decision log: exposes decisions
- Backend API → Decision explainer: serves explanation
traffix/api/server.py - Decision explainer → Decision log: cites entries
traffix/agents/network/explainer.py - Decision explainer → Decision narration: uses templates
traffix/agents/network/explainer.py - Decision explainer → Language model client: uses optional LLM
traffix/agents/network/explainer.py - Alerts and copilot → Language model client: uses optional LLM
README.md - Backend API → Alerts and copilot: serves copilot
traffix/api/server.py - Frontend API client → Decision feed: provides feed data
frontend/src/pages/Analyst.jsx - Frontend API client → Network map: provides map data
frontend/src/components/NetworkMap.jsx - Persona interface → Frontend languages: sets language
frontend/src/App.jsx - Experiment runner → System assembly: runs simulation
traffix/evaluation/runner.py - Experiment runner → Persona metrics: collects metrics
traffix/evaluation/runner.py - Model training → Demand generator: generates training traffic
traffix/training/datagen.py - Model training → Experiment runner: uses simulation runs
traffix/training/datagen.py