Skip to main content
Back to Prompt Library
implementation

Build the application

Inspect the original prompt language first, then copy or adapt it once you know how it fits your workflow.

Linked challenge: Build a Sparkplug B Nuisance Alarm Suppressor and Aggregator

Format
Code-aware
Lines
95
Sections
11
Linked challenge
Build a Sparkplug B Nuisance Alarm Suppressor and Aggregator

Prompt source

Original prompt text with formatting preserved for inspection.

95 lines
11 sections
No variables
1 code block
## Build
Correlate repetitive Sparkplug B DDATA alarm payloads to identify oscillating sensor nuisance trips. Synthesize an aggregated alarm dashboard that groups related warnings and suppresses redundant notifications for operators.

## User
Control Room Operator

## Workflow
1. Ingest continuous Sparkplug B DDATA streams containing raw alarm state transitions and metric timestamps.
2. Identify rapidly toggling sensor states that cross threshold limits multiple times within a short observation window.
3. Group related nuisance alarms originating from the same equipment node and calculate a composite severity score based on the toggle count.
4. Output an aggregated incident ticket that suppresses individual toggle noise while preserving the core equipment fault for the dashboard.

## Interface
Real-time alerting dashboard displaying aggregated equipment incidents, suppressed alarm toggle counts, and historical Sparkplug B metric timelines.

## Data
Generate a continuous stream of Sparkplug B JSON payloads featuring nominal states mixed with high-frequency oscillating alarm states across multiple equipment nodes.
Starter examples below are synthetic. They are not downloaded records.

## Source
[Eclipse Sparkplug](https://raw.githubusercontent.com/eclipse-sparkplug/sparkplug/master/README.md)
Uses Sparkplug B DDATA specification structures to represent realistic stateful device metric updates and oscillating sensor transitions.

## Tools
mastra-ai, fastapi, react.
Mastra AI provides stateful agent memory and data aggregation patterns to analyze time-windowed sensor events and group nuisance alarms.
Requires structured data parsing and temporal reasoning capabilities to group related state transitions using local or hosted LLMs.

## Deliverables
Submit runnable source, pinned dependencies, setup commands, a working interface, example outputs, and a recorded end-to-end demo. Include tests and an action log.

## Acceptance
- Successfully detects alarms toggling between normal and fault states within the defined suppression window.
- Groups oscillating events into a single aggregated incident ticket with an accurate toggle count.
- Maintains the correct original timestamp for the first instance of the fault while suppressing subsequent redundant notifications.

## Starter Examples
```json
[
  {
    "input": {
      "node_id": "Line1/Feeder3",
      "alarms": [
        {
          "timestamp": "2025-06-01T14:09:40Z",
          "metric": "Vibration",
          "state": "HIGH"
        },
        {
          "timestamp": "2025-06-01T14:09:42Z",
          "metric": "Vibration",
          "state": "NORMAL"
        },
        {
          "timestamp": "2025-06-01T14:09:45Z",
          "metric": "Vibration",
          "state": "HIGH"
        }
      ],
      "suppression_window_sec": 10,
      "schema_note": "Simplified synthetic app records, not complete official schema files"
    },
    "expected_output": {
      "node_id": "Line1/Feeder3",
      "nuisance_detected": true,
      "toggle_count": 2,
      "aggregated_incident": {
        "metric": "Vibration",
        "status": "OSCILLATING_HIGH",
        "first_seen": "2025-06-01T14:09:40Z"
      },
      "suppressed_events": 2
    }
  },
  {
    "input": {
      "node_id": "Line1/Chiller",
      "alarms": [
        {
          "timestamp": "2025-06-01T21:15:00Z",
          "metric": "Temp",
          "state": "HIGH"
        }
      ],
      "suppression_window_sec": 10,
      "schema_note": "Simplified synthetic app records, not complete official schema files"
    },
    "expected_output": {
      "node_id": "Line1/Chiller",
      "nuisance_detected": false,
      "toggle_count": 0,
      "aggregated_incident": {
        "metric": "Temp",
        "status": "HIGH",
        "first_seen": "2025-06-01T21:15:00Z"
      },
      "suppressed_events": 0
    }
  }
]
```

## Safety
Outputs advisory alarm aggregations for operator review; does not actively modify machine configurations or bypass physical safety interlocks.
Use mock external writes. Require human review before any real deployment.

Adaptation plan

Keep the source stable, then change the prompt in a predictable order so the next run is easier to evaluate.

Keep stable

Hold the task contract and output shape stable so generated implementations remain comparable.

Tune next

Update libraries, interfaces, and environment assumptions to match the stack you actually run.

Verify after

Test failure handling, edge cases, and any code paths that depend on hidden context or secrets.