How falexsun/neftekod2026 works
Q21 Shadow Pipeline is a shadow-mode diesel-sulfur forecasting and operator-advisory system; it does not send setpoints to plant control. The documented workflow runs from plant and laboratory inputs through feature preparation and multi-agent evaluation to forecasts, scenario checks, and operator review. The graph preserves the README’s timeline, anomaly, optimization, notification, monitoring, and model-lifecycle capabilities. Several subsystems are represented from README and tree descriptions rather than inspected implementation, so their links are documented flows, not claims of source-level call tracing.
Main entry points: app.py FastAPI gateway · App.tsx React operator console · quality/agent.py Quality agent · data_quality/agent.py Data quality agent
Components 30
Data and features
- Data loaders
project/src/ingestion/loaders.py - Q21 stream
project/src/ingestion/q21_stream.py - Feature engineering
project/src/feature_service/features.py - Process state
project/src/shared/schemas/process_state.py
Forecast and decisions
- Data quality agent
project/src/agents/data_quality/agent.py - Quality agent
project/src/agents/quality/agent.py - Multi-horizon advisory
project/src/inference/advisory_system.py - Anomaly detection
project/src/inference/anomaly/detector.py - Reliability agent
project/src/agents/reliability/agent.py - Surrogate model
project/src/agents/surrogate/model.py - Optimization agent
project/src/agents/optimization/agent.py - Safety agent
project/src/agents/safety/agent.py - Decision orchestrator
project/src/agents/orchestrator/agent.py
API and runtime
- FastAPI gateway
project/src/api/app.py - Decision journal
project/src/api/runtime_store.py - Timeline events
project/src/api/timeline/tracker.py - Live broadcaster
project/src/api/websocket/manager.py - Telegram adapter
project/src/api/notifications/telegram.py
Operator console
- React operator console
project/frontend/src/App.tsx - Shift and forecast views
project/frontend/src/views/ShiftView.tsx - What-if scenarios
project/frontend/src/views/ScenarioView.tsx - Decision journal view
project/frontend/src/views/JournalView.tsx - Live Q21 hook
project/frontend/src/hooks/useQ21WebSocket.ts
Monitoring and ML
- Prometheus and Grafana
project/src/api - Model training
project/src/training/models.py - MLflow registry
- Champion promotion
project/src/training/hotswap_manager.py
Other components
- Shift operator
- Plant telemetry
- LIMS and PAK
Connections 32
- Plant telemetry → Data loaders: provides telemetry
- LIMS and PAK → Data loaders: provides measurements
- Data loaders → Feature engineering: loads and normalizes
- Feature engineering → Process state: builds process state
- Process state → Data quality agent: validates state
project/src/agents/data_quality/agent.py - Data quality agent → Quality agent: screens data
- Data quality agent → Reliability agent: screens data
- Quality agent → Decision orchestrator: provides prediction
project/src/agents/orchestrator/agent.py - Reliability agent → Optimization agent: provides envelope
- Surrogate model → Optimization agent: scores scenarios
project/src/agents/optimization/agent.py - Optimization agent → Safety agent: proposes changes
- Safety agent → Decision orchestrator: checks constraints
project/src/agents/orchestrator/agent.py - Decision orchestrator → FastAPI gateway: serves decisions
project/src/api/app.py - Quality agent → Multi-horizon advisory: forecasts horizons
- Plant telemetry → Q21 stream: streams Q21
- Q21 stream → Live broadcaster: feeds live updates
- FastAPI gateway → Decision journal: writes audit
project/src/api/app.py - FastAPI gateway → Timeline events: records events
- FastAPI gateway → Prometheus and Grafana: exports metrics
project/src/api/app.py - FastAPI gateway → Telegram adapter: sends alerts
- Shift operator → React operator console: uses
- React operator console → FastAPI gateway: requests operator data
- React operator console → Shift and forecast views: renders shift view
project/frontend/src/App.tsx - React operator console → What-if scenarios: renders scenarios
project/frontend/src/App.tsx - React operator console → Decision journal view: renders journal
project/frontend/src/App.tsx - Shift and forecast views → Live Q21 hook: uses live feed
- Live Q21 hook → Live broadcaster: receives WebSocket feed
project/frontend/src/hooks/useQ21WebSocket.ts - FastAPI gateway → Multi-horizon advisory: runs advisory
project/src/api/app.py - Quality agent → Model training: supports retraining
project/src/agents/quality/agent.py - Model training → MLflow registry: registers models
- MLflow registry → Champion promotion: promotes candidate
- FastAPI gateway → Anomaly detection: exposes anomaly capability