Overview
Performs a complete system purge by wiping all InfluxDB data, clearing in-memory state, and resetting the Degradation Index (DI) to 0.0. This is the nuclear option for starting fresh with a clean baseline.Endpoint
Purge Actions
The purge performs these operations in sequence:1. Stop Background Tasks
Halts any running calibration, monitoring, or fault injection threads.2. Delete InfluxDB Data
Attempts to delete all records in thesensor_data bucket.
InfluxDB Serverless v3 Limitation: Range deletes are not supported on serverless instances. The system writes a DI=0.0 reset point to overwrite stale data during hydration.
3. Write DI Reset Point
Writes a single point withdegradation_index=0.0 to ensure clean hydration on next startup:
4. Clear In-Memory State
Wipes the following dictionaries:_sensor_history- Last 1000 sensor readings_baselines- Baseline profiles per asset_detectors- Legacy 1Hz Isolation Forest models_batch_detectors- Batch 100Hz Isolation Forest models_degradation_state- Cumulative DI tracking
5. Initialize Clean DI State
Pre-populates DI=0.0 for Motor-01 to prevent stale InfluxDB queries:6. Reset System State
Returns toIDLE state with validation metrics zeroed.
Response
Always returns
"purged" when operation completes successfullyHuman-readable confirmation of purge actions
New system state:
"IDLE"Example Request
cURL
Python
JavaScript
Example Response
200 OK
Post-Purge State
After purge completes, the system returns to a clean slate:| Component | State |
|---|---|
| System State | IDLE |
| Degradation Index | 0.0 |
| Total Cycles | 0 |
| Training Samples | 0 |
| Healthy Stability | 100.0% |
| Fault Capture Rate | 100.0% |
| Baseline Profiles | None (cleared) |
| ML Models | None (cleared) |
| Sensor History | Empty |
| InfluxDB Data | Wiped (or DI=0.0 reset point only) |
Next Steps
After purge, you must recalibrate before monitoring:Use Cases
Reset Demo
Return to clean state for fresh demo runs without restarting server
Clear Cumulative Damage
Reset DI=0.0 after long fault injection sessions that pushed DI → 1.0
Baseline Corruption
Wipe corrupted baseline and retrain from scratch
Test Automation
Reset state between automated test runs for reproducibility
State Persistence vs. Purge
What Survives Restart?
| Data | Server Restart | Purge |
|---|---|---|
| InfluxDB Sensor Data | ✅ Persists | ❌ Deleted |
| Degradation Index (InfluxDB) | ✅ Persists | ❌ Reset to 0.0 |
| Baseline Profiles | ❌ Lost | ❌ Deleted |
| ML Models | ❌ Lost | ❌ Deleted |
| Sensor History (RAM) | ❌ Lost | ❌ Deleted |
| Degradation State (RAM) | ❌ Lost (hydrated from DB) | ❌ Deleted |
Restart behavior: DI is hydrated from InfluxDB on first
GET /system/state call, so cumulative damage survives restarts (unless purged first).DI Hydration After Purge
On next API call requiring degradation state:Error Responses
This endpoint does not return errors under normal operation. It always attempts to purge and returns success.If InfluxDB range delete fails (common on serverless v3), the system gracefully falls back to DI=0.0 reset point strategy.
Performance Characteristics
- Latency: 200-500ms (depends on InfluxDB delete performance)
- InfluxDB Deletes: Attempts full bucket wipe (may fail on serverless v3)
- InfluxDB Writes: 1 point (DI=0.0 reset)
- Memory Released: ~50MB (baselines + models)
- Downtime: None (purge is synchronous, 1s)
Safety Considerations
Comparison with Other Reset Endpoints
| Endpoint | State Transition | DI Reset | Data Deleted | Models Cleared |
|---|---|---|---|---|
POST /system/stop | → IDLE | ❌ No | ❌ No | ❌ No |
POST /system/reset | → MONITORING_HEALTHY | ❌ No | ❌ No | ❌ No |
POST /system/purge | → IDLE | ✅ Yes | ✅ Yes | ✅ Yes |
Related Endpoints
- GET /system/state - Verify post-purge state
- POST /system/calibrate - Recalibrate after purge
- POST /system/stop - Soft reset without data deletion