Skip to main content
Loading navigation

Build a Public Lightning Alert Yard Crane Suspension Scheduler — implementation

Prompt source

implementation74 lines11 sectionsNo variables1 code block
## Build
Correlate data.gov.sg real-time lightning alerts with port yard crane schedules. Generate automated terminal operation suspension windows to protect container handling personnel.

## User
Port Yard Operations Safety Manager

## Workflow
1. Query public real-time lightning strike warnings across Singapore port districts using the data.gov.sg API structure.
2. Ingest active terminal yard crane and reach stacker handling manifests.
3. Calculate safety exclusion zones and determine which yard blocks require immediate suspension.
4. Publish dynamic operation suspension notices and reschedule pending haulage gate-ins.

## Interface
Live safety dashboard displaying lightning strike proximity zones, affected crane blocks, and automated suspension timers.

## Data
Simulated lightning alert payloads matching data.gov.sg real-time API responses for port-adjacent stations.
Starter examples below are synthetic. They are not downloaded records.

## Source
[Singapore open data API](https://guide.data.gov.sg/developer-guide/api-overview)
Employs data.gov.sg real-time weather API structure and collection schema conventions for lightning strike queries.

## Tools
agno, httpx, fastapi.
Agno provides lightweight agent workflows to coordinate real-time lightning polling and safety exclusion zone calculations.
Local or hosted LLM API capable of generating operational safety advisories based on spatial metrics.

## 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
- Retrieve and parse lightning strike proximity from simulated data.gov.sg JSON payloads.
- Trigger crane suspension recommendations when a lightning strike occurs within a 5km radius.
- Generate downtime estimates and affected equipment lists based on the exclusion zone.
- Output structured safety alerts with clear operational directives.

## Starter Examples
```json
[
  {
    "input": {
      "terminal_block": "YARD-C-PASIR",
      "active_cranes": 4,
      "lightning_alert": {
        "station_id": "L001",
        "distance_km": 2.1,
        "status": "ACTIVE_STRIKE",
        "timestamp": "2025-05-02T14:15:00Z"
      }
    },
    "expected_output": {
      "suspension_required": true,
      "affected_cranes": 4,
      "exclusion_radius_km": 5,
      "safety_advisory": "Lightning strike within 2.1km. Suspend Yard C crane operations for 30 minutes.",
      "status": "OPERATIONS_SUSPENDED"
    }
  },
  {
    "input": {
      "terminal_block": "YARD-D-PASIR",
      "active_cranes": 2,
      "lightning_alert": {
        "station_id": "L002",
        "distance_km": 15,
        "status": "CLEAR",
        "timestamp": "2025-05-02T14:15:00Z"
      }
    },
    "expected_output": {
      "suspension_required": false,
      "affected_cranes": 0,
      "exclusion_radius_km": 5,
      "safety_advisory": "No active lightning within 5km. Continue nominal operations.",
      "status": "OPERATIONS_NOMINAL"
    }
  }
]
```

## Safety
All terminal operations changes are simulated recommendations and do not alter actual Singapore Port Authority yard systems.
Use mock external writes. Require human review before any real deployment.