Overview
The Predictive Maintenance System ingests high-frequency sensor data at 100Hz (100 samples per second) from industrial assets like motors, pumps, and compressors. The ingestion pipeline validates, transforms, and persists sensor events with server-side power computation.Ingestion Architecture
Sensor Data Model
The system captures four primary signals:| Signal | Unit | Description | Validation |
|---|---|---|---|
voltage_v | Volts | Line voltage | ≥ 0 |
current_a | Amperes | Load current | ≥ 0 |
power_factor | Dimensionless | Efficiency ratio | 0.0 - 1.0 |
vibration_g | g-force | Mechanical vibration | ≥ 0 |
Power Calculation: The
power_kw field is computed server-side and must NOT be provided by clients. Requests including power_kw will be rejected with a 422 validation error.Ingestion Endpoint
Request Format
Field Requirements
event_id Validation
event_id Validation
- Must be UUIDv4: The system validates that the UUID is version 4 specifically
- Uniqueness: Used for deduplication and event tracking
- Example:
550e8400-e29b-41d4-a716-446655440000
timestamp Validation
timestamp Validation
- Must be timezone-aware: Naive timestamps are rejected
- UTC conversion: Non-UTC timestamps are automatically converted to UTC
- ISO 8601 format:
2026-03-02T12:00:00Zor2026-03-02T12:00:00+00:00
operating_state Enumeration
operating_state Enumeration
Allowed values (case-insensitive, normalized to uppercase):
RUNNING- Asset is actively operatingIDLE- Asset is powered but not under loadOFF- Asset is powered down
Server-Side Power Computation
Power is calculated using the three-phase power formula:Example Calculation
For a healthy motor:- Voltage: 230.0 V
- Current: 15.0 A
- Power Factor: 0.95
Response Format
Success Response (200 OK)
Notice that
power_kw is now included in the response even though it wasn’t in the request.Error Responses
| Status Code | Scenario | Response |
|---|---|---|
| 422 | Validation error | Invalid field values or constraints |
| 503 | Database unavailable | InfluxDB connection failure |
422 Validation Error Example
503 Service Unavailable Example
100Hz Ingestion Capability
The system is designed to handle 100 samples per second from each asset:- Throughput: 100 events/second/asset
- Batch Processing: Events are aggregated into 1-second windows for ML inference
- Real-time Updates: Dashboard updates with ~1 second latency
Performance Characteristics
The system reduces 100 raw samples into a 16-dimensional feature vector per second using statistical aggregation (mean, std, peak-to-peak, RMS). This enables anomaly detection on high-frequency patterns like jitter and spikes.
Data Persistence
Ingested events are written to InfluxDB Cloud as time-series data:Measurement Schema
Graceful Degradation
If InfluxDB is unavailable:- System falls back to mock mode
- Data is logged to console for debugging
/healthendpoint reports"database": "mock"- Demo features remain available via
/system/*endpoints
Validation Rules Summary
Complete Validation Checklist
Complete Validation Checklist
Event Metadata
- ✅
event_id: Valid UUIDv4 - ✅
timestamp: Timezone-aware UTC
- ✅
asset_id: Non-empty string - ✅
asset_type: Non-empty string
- ✅
voltage_v: ≥ 0 - ✅
current_a: ≥ 0 - ✅
power_factor: 0.0 ≤ value ≤ 1.0 - ✅
vibration_g: ≥ 0 - ❌
power_kw: Must be absent (server-computed)
- ✅
operating_state: Must be RUNNING, IDLE, or OFF (case-insensitive) - ✅
source: String (default: “api”)
Source Code Reference
Key implementation files:- API Route:
backend/api/routes.py:61-126-/ingestendpoint handler - Schema Validation:
backend/api/schemas.py:69-114- Pydantic models with validators - Power Computation:
backend/api/services.py- Business logic for server-side calculations
Next Steps
Anomaly Detection
Learn how ingested data is analyzed using dual Isolation Forest models
Health Assessment
Understand how sensor data drives health scoring and risk classification