You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Production Disruption Early Warning System - Backend API
This is the backend server for the AI-Enabled Production Disruption Early Warning System. It simulates real-time manufacturing telemetry, runs an Isolation Forest model to detect anomalies on the fly, and provides a GenAI Decision Support layer for factory operators.
Returns current system state ("NORMAL" / "DISRUPTED") & latest telemetry.
/api/telemetry/history
GET
Returns the last 20 telemetry records (chronological order for line charts).
/api/alerts
GET
Returns the 10 most recent disruption alerts.
/api/telemetry
POST
Manually pushes telemetry to evaluate against Isolation Forest.
Demo Simulation & Scenarios
Endpoint
Method
Description
/api/inject-failure
POST
Forces live simulator into generating disruption data.
/api/reset-demo
POST
Clears all alerts and restores simulator to normal operation.
/api/scenarios
GET
Returns the 5 predefined factory disruption scenarios.
/api/scenarios/{name}/activate
POST
Instantly loads and activates one of the 5 scenarios into the database (normal_operation, high_processing_delay, high_error_rate, low_throughput, combined_disruption).
GenAI Decision Support & Chat Assistant
Endpoint
Method
Description
/api/ai/decision-support
GET
Returns the structured 5-part AI intelligence (what_happened, possible_causes, prediction, risk_score, action_required with dynamic role filtering).
/api/ai/decision-support/scenario/{name}
POST
Returns 5-part decision intelligence for any specific scenario.
/api/ai/chat
POST
Conversational assistant endpoint for chat widgets (e.g. {"query": "What should maintenance do?"}).
🔒 CORS
CORS is enabled for all origins (*), so any frontend application running on localhost:3000, localhost:5173, etc., can communicate freely with this API.