General engineering
AuraScore 81/100

SCADA Telemetry Stream Anomaly Monitor Generator

Generate a resilient Python telemetry monitoring script for power grid SCADA sensors.

Use this template when setting up real-time edge monitoring for utility substation sensors. It produces a hardened script that polls telemetry endpoints and fires alerts upon threshold breaches.

Template

Role: Senior SCADA Systems Integration Engineer with deep expertise in industrial control systems and power distribution networks.

Context

  • Operating entity: {{utility_provider}}
  • Ingestion protocol: {{scada_protocol}}
  • Sensor feed location: {{telemetry_data_source}}
  • Operational threshold schema: {{sensor_threshold_profile}}
  • Incident notification endpoint: {{alert_webhook_url}}
  • Polling frequency: {{poll_interval_seconds}}

Task

Construct a production-ready Python monitoring script that ingests time-series telemetry from {{telemetry_data_source}} using {{scada_protocol}}, evaluates readings against {{sensor_threshold_profile}}, and publishes structured incident payloads to {{alert_webhook_url}} without stalling real-time telemetry processing for {{utility_provider}}.

Method

  1. Import required standard networking and industrial protocol client libraries based on {{scada_protocol}}.
  2. Define configuration constants and load {{sensor_threshold_profile}} boundaries into structured memory objects.
  3. Implement a resilient network connection wrapper targeting {{telemetry_data_source}} with exponential backoff retry logic.
  4. Build an asynchronous polling loop governed by {{poll_interval_seconds}} to sample voltage, current, and temperature streams.
  5. Write continuous anomaly detection logic comparing active sensor readings against deadbands and critical trip levels.
  6. Structure a standardized alert payload containing sensor tag, value, timestamp, threshold delta, and severity code.
  7. Implement an HTTP dispatcher transmitting the payload to {{alert_webhook_url}} using TLS verification and timeout guards.
  8. Add graceful SIGINT/SIGTERM handling to release industrial socket handles cleanly upon shutdown.

Constraints

  • MUST implement strictly non-blocking I/O or background worker threads for alert dispatching.
  • MUST NOT log cleartext authentication tokens or sensitive network credentials to standard output.
  • Code MUST include inline type annotations and standard PEP 8 docstrings for every utility function.
  • Script dependencies must be restricted to standard library modules plus one verified protocol driver.

Output format

1. Environment and Prerequisites

  • Required external libraries and environment variables (max 10 lines).

2. Executable Script

  • Fully commented Python script ready for systemd daemonization (100-180 lines).

3. Execution Verification

  • Concrete command line example to start the script and test dry-run alerting (max 15 lines).

Self-review

  • Confirm every variable from context is actively referenced in the generated script logic.
  • Verify error handling catches transient connection drops without terminating the main process loop.
  • Check that timestamp formatting strictly follows ISO 8601 UTC standards.
AuraScore breakdown
81/100Provisional
Instruction clarity15/15 · Strong

Explicit role, a named task, and discrete steps the model can follow.

Context architecture12/12 · Strong

Background, inputs and variables the model needs before it starts.

Constraint engineering12/12 · Strong

Hard boundaries — what the model must and must not do.

Output specification6/14 · Thin

A named, field-level shape for the response.

Reasoning structure10/10 · Strong

Ordered work items that force analysis before an answer.

Model compatibility10/10 · Strong

Length and structure that travel across frontier models.

Token efficiency5/10 · Thin

Signal density — instruction weight without padding.

Reusability7/7 · Strong

Documented variables so the scaffold adapts to new inputs.

Robustness3/5 · Adequate

Quality bar, assumptions and behaviour when inputs are thin.

Observed performance1/5 · Thin

How much real usage the template has behind it.

developers
developers-general
energy-utilities
scada
telemetry
python