General engineering
AuraScore 81/100

Jobsite Environmental Sensor Ingestion Script

Collect, filter, and stream edge telemetry data from jobsite IoT nodes to cloud monitoring endpoints.

Use this template when building resilient data ingestion workers for jobsite safety and compliance monitoring. It outputs a lightweight edge script designed to process sensor bursts and alert on regulatory breaches.

Template

Role: Lead Site Telemetry & Embedded Systems Engineer specializing in commercial real estate IoT networks.

Context

  • Telemetry Transport Protocol: {{telemetry_source_protocol}}
  • Sensor Poll Interval: {{sampling_interval_seconds}}
  • Structural Vibration Ceiling: {{vibration_limit_g}}
  • Permissible Decibel Ceiling: {{noise_threshold_db}}
  • Compliance Webhook URL: {{alert_webhook_url}}
  • Local Edge Buffer Path: {{local_cache_path}}

Task

Create a resilient edge Python monitoring script that ingests environmental telemetry across jobsite hardware nodes, computes moving window averages for noise and vibration, persists buffers locally during network outages, and dispatches immediate breach alerts.

Method

  1. Establish connection to the jobsite telemetry stream using {{telemetry_source_protocol}} with automatic retry logic.
  2. Configure periodic sampling loops governed strictly by {{sampling_interval_seconds}}.
  3. Validate incoming sensor payload schemas for dust, temperature, sound, and tri-axial acceleration.
  4. Maintain a 60-second sliding window buffer to compute rolling averages for environmental readings.
  5. Compare rolling vibration metrics against {{vibration_limit_g}} and acoustic levels against {{noise_threshold_db}}.
  6. Assemble an incident JSON payload upon limit violation and dispatch an HTTP POST to {{alert_webhook_url}}.
  7. Intercept network failure exceptions, writing telemetry packages into {{local_cache_path}} for subsequent replay.
  8. Implement a graceful SIGINT/SIGTERM shutdown hook to flush remaining buffers to persistent storage.

Constraints

  • Memory footprint MUST NOT exceed 128MB to ensure execution on resource-constrained edge gateways.
  • The script MUST continue logging to {{local_cache_path}} without crashing if the upstream network disconnects.
  • Third-party dependencies MUST be limited to standard networking and parsing modules (e.g., requests, paho-mqtt).
  • Plaintext API tokens or sensitive site credentials MUST NOT be hardcoded in the script body.

Output format

Format the response with the following clearly labeled sections:

  1. Runtime Architecture (brief overview of thread handling and queue mechanism).
  2. Complete Edge Python Script (fully runnable script with inline error handling).
  3. Daemon Service Configuration (systemd service unit file definition for automatic restart).

Self-review

  • Check that moving window calculations handle zero-division and empty arrays cleanly.
  • Verify all 6 context variables ({{telemetry_source_protocol}}, {{sampling_interval_seconds}}, {{vibration_limit_g}}, {{noise_threshold_db}}, {{alert_webhook_url}}, {{local_cache_path}}) are explicitly parameterized.
  • Ensure the edge buffer replay mechanism flushes stored records once network connectivity is restored.
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
real-estate-construction
iot
telemetry
python