📡 API Endpoints
Python Service (Port 8000)
GET /health
Service health status (lists controlled junctions)
GET /predict_action
Predict action for a junction (requires junction_id + obs_data)
GET /reset_hidden
Reset GRU hidden states (call at start of each simulation run)
GET /model_info
MAPPO model details (architecture, junctions, action masks)
GET /docs
Swagger UI documentation
Java Gateway (Port 8080)
GET /api/traffic/health
Service health status
GET /api/traffic/action
Demo prediction (random junction, auto-generated observations)
POST /api/traffic/action
Predict action (requires junctionId + observations)
POST /api/traffic/reset
Reset MAPPO GRU hidden states
LSTM Predictor Service (Port 8001)
GET /health
Check if service is running
Response:
{
"status": "ok",
"model_loaded": true
}
POST /forecast
Predict traffic flow 15 minutes into future
Request:
{
"junction_id": "joinedS_265580996_300839357",
"vehicle_counts": [45, 52, 48, 51, 49, ...], # last 60 minutes
"timestamp": 1234567890
}
{
"junction_id": "joinedS_265580996_300839357",
"forecast_15min": [55, 58, 62, 60], # next 15 minutes
"mae": 0.087, # model's error estimate
"timestamp": 1234567890
}
GET /model_info
Get details about loaded LSTM model
Response:
{
"architecture": "LSTM",
"input_size": 60,
"hidden_size": 64,
"output_size": 15,
"trained_on": "SUMO simulation data",
"mae_target": 0.10
}
Examples
GET /todo
Example of what GET would look like
POST /todo
Example of what POST would look like
PUT /todo
Example of what PUT would look like
DELETE /todo
Example of what DELETE would look like