Skip to main content

Overview

Returns the current system lifecycle state along with validation metrics and fault injection parameters. Use this endpoint to monitor system transitions and track model performance during calibration and fault injection phases.

Endpoint

GET /system/state

System States

The system operates in one of four states:
StateDescription
IDLESystem ready. Click ‘Calibrate’ to begin.
CALIBRATINGGenerating healthy data, building baseline, training ML models.
MONITORING_HEALTHYCalibration complete. Monitoring healthy operation with batch-feature detection.
FAULT_INJECTIONInjecting faulty sensor data with specified fault type and severity.

Response

state
string
required
Current system state enum: IDLE, CALIBRATING, MONITORING_HEALTHY, or FAULT_INJECTION
message
string
required
Human-readable status message describing current operation
started_at
datetime
ISO 8601 timestamp when current state was entered (UTC)
fault_type
string
Active fault type during FAULT_INJECTION state: SPIKE, DRIFT, JITTER, or DEFAULT
fault_severity
string
Active fault severity: MILD, MEDIUM, or SEVERE
training_samples
integer
required
Number of samples used for baseline training (1000 during calibration)
healthy_stability
float
required
Percentage of healthy points classified as LOW risk (target: ≥95%)
fault_capture_rate
float
required
Percentage of faulty points classified as HIGH+ risk (target: ≥90%)

Example Request

cURL
curl https://predictive-maintenance-uhlb.onrender.com/system/state
Python
import requests

response = requests.get(
    "https://predictive-maintenance-uhlb.onrender.com/system/state"
)

data = response.json()
print(f"System State: {data['state']}")
print(f"Message: {data['message']}")

Example Response

{
  "state": "IDLE",
  "message": "System ready. Click 'Calibrate' to begin.",
  "started_at": null,
  "fault_type": null,
  "fault_severity": null,
  "training_samples": 0,
  "healthy_stability": 100.0,
  "fault_capture_rate": 100.0
}

Validation Metrics

Healthy Stability

Measures the false positive rate during healthy monitoring:
healthy_stability = (healthy_correct / healthy_total) * 100
# healthy_correct = count of healthy points classified as LOW risk
Interpretation:
  • ≥95%: Excellent baseline (low false alarms)
  • 85-94%: Acceptable (minor noise)
  • 85%: Baseline needs recalibration

Fault Capture Rate

Measures the true positive rate during fault injection:
fault_capture_rate = (faulty_correct / faulty_total) * 100
# faulty_correct = count of faulty points classified as HIGH+ risk
Interpretation:
  • ≥90%: Strong anomaly detection
  • 70-89%: Moderate detection (consider severity tuning)
  • 70%: Weak detection (model may need retraining)

State Transitions

The system follows this lifecycle:

Use Cases

Dashboard Polling

Poll every 1-2 seconds to update UI state indicators and progress messages

Model Validation

Monitor healthy_stability and fault_capture_rate to verify baseline quality

Automation Scripts

Check state before triggering calibration or fault injection workflows

Debugging

Inspect message field for detailed status during long-running operations

Error Responses

This endpoint does not return errors under normal operation. It always returns the current system state.

Build docs developers (and LLMs) love