How prism-system/prism-monitor works
Project type and purpose
• This is a Python-based “monitoring AI agent” (factory_monitoring_agent.py + main.py) designed to collect real-time manufacturing sensor data, run preprocessing and anomaly-detection algorithms, perform risk assessments, and feed results into a dashboard & notification system.
File structure
• Top-level files:
• factory_monitoring_agent.py – core agent logic (data ingestion, pipeline orchestration)
• main.py – service entry point (initializes modules, starts loops)
• requirements.txt – Python dependencies (ML libraries, messaging clients, DB drivers)
• README.md – domain & feature overview
• No frontend code here—UI/dashboard is external or a separate service.
• No obvious microservices or separate subdirectories: this is a single‐service, modular agent.
Extract additional insights from the README
• Components implied by README:
• Data‐collection & preprocessing pipeline
• Anomaly‐detection & pattern‐learning engine
• Risk‐assessment module with threshold logic
• Notification/alerting system
• Integration point for a real‐time dashboard (visualization)
1. Sensor Data Sources (PLC, IoT sensors)
2. Monitoring Agent Service
– Ingestion & Preprocessing Module
– Anomaly Detection Engine
– Risk Assessment Module
– Event Classification & Explanation Generator
3. Storage
– Time-Series Database (e.g. InfluxDB)
– Configuration & Threshold Store (SQL/NoSQL)
4. Notification Service (e-mail/Slack/SMS)
5. Dashboard/UI (e.g. Grafana or custom web app)
6. External Systems (PRISM-AGI Orchestrator)
• Sensors → Agent: raw data
• Agent: Preprocessing → Detection → Risk Assessment
• Agent → Storage: metrics, events, model updates
• Agent → Notification Service: alerts
• Storage → Dashboard: queries for real-time views
• Agent/Dashboard ↔ PRISM-AGI: control & metadata exchange
c. Architectural patterns & principles:
• Pipeline pattern for sequential processing (ingest→clean→infer→store)
• Layered separation (Data layer, Processing layer, Presentation layer)
• Modular design: each ML component (detection, risk) is a plug-in module
• Resilience & scalability: components can be containerized and scaled independently in future
d. Key technologies & libraries (from requirements.txt):
• Pandas / NumPy for preprocessing
• Scikit-learn / PyTorch for anomaly detection
• InfluxDB / PostgreSQL client for storage
• Flask / FastAPI (if used) for any REST endpoints
• SMTP / Slack SDK for alerts
Detailed capture of essential elements
• Processing steps (not just “Agent”)
• Threshold/config store feeding into Risk module
• Feedback loops (if the dashboard can send control commands back via PRISM-AGI)
• SLAs or performance targets (e.g., “F1 ≥ 0.9” next to Anomaly Detection)