Manual mode lets you test the signal decision algorithm with arbitrary vehicle counts without needing a live camera feed or an active video source. It is the default state of the dashboard — the four range sliders are enabled from the moment the page loads, and every slider movement fires an immediate prediction request.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Xander44-4/traffic_reducer/llms.txt
Use this file to discover all available pages before exploring further.
How manual mode works
When the Simulación en vivo toggle is off (the default), all four range sliders in the Manual Control section are enabled. Moving any slider immediately callsPOST /predict with the current values from all four inputs. No debounce delay is applied — the request fires on every input event.
The sliders and their identifiers:
| Slider label | HTML input ID | Direction index |
|---|---|---|
| Norte | input-north | 0 |
| Sur | input-south | 1 |
| Este | input-east | 2 |
| Oeste | input-west | 3 |
0 to 100 (representing vehicle count) with a default of 10. A live numeric readout beneath each slider updates on every change.
Visual density feedback
As you drag a slider, the corresponding road arm in the intersection visualization updates its cars density bar opacity in real time using this formula fromscript.js:
0 produces opacity 0.05 (nearly invisible); a value of 100 produces opacity 0.65 (fully rendered). This gives immediate visual feedback about relative traffic load across all four directions before the prediction response arrives.
Prediction request and response
Every slider interaction sends this request to the server:np.argmax([norte, sur, este, oeste]) and responds with the zero-based direction index and the echo of the submitted counts:
prediction maps to directions as follows: 0 = NORTE, 1 = SUR, 2 = ESTE, 3 = OESTE.
On receiving the response the dashboard:
- Activates the winning direction’s green traffic light bulb in the intersection graphic.
- Sets all other lights to red.
- Updates the Prioridad activa status card with the direction name.
- Highlights the winning road arm with the
.active-roadCSS class.
Randomized scenarios with /simulate
To quickly generate a realistic but random traffic scenario, call the /simulate endpoint directly:
0 and 80, one per direction. The values are not automatically applied to the sliders via the API — use the response data to manually set slider positions, or integrate the endpoint into your own test script.
Priority display edge cases
The Prioridad activa card can show values other than a direction name:EMERGENCIA(rendered in#b64400) — appears whentraffic_data.emergencyistruein the prediction response. This overrides the direction name regardless of which direction won.PEATONES(rendered in#707070) — appears whentraffic_data.pedestriansexceeds5.
/predict endpoint, emergency and pedestrians are not part of the slider payload. They will only appear in the priority display if the server-side model or camera pipeline injects them into the response.