Skip to main content
Loading navigation
Back to prompt library

Build a Cross-Border Temperature Excursion Evidence and Cargo Notice Hub — implementation

Linked challenge: Build a Cross-Border Temperature Excursion Evidence and Cargo Notice Hub

Prompt source

implementation77 lines11 sectionsNo variables1 code block
## Build
Parse cold-chain IoT temperature records during overland transit between Malaysia and Singapore. Bundle temperature breaches into verifiable TradeTrust packages and generate consignee spoilage risk notifications.

## User
Perishable Cargo Quality Inspector

## Workflow
1. Ingest IoT temperature data streams and checkpoint timestamp logs for reefer transport trucks.
2. Identify sustained temperature excursion events exceeding product perishability thresholds.
3. Wrap raw sensor records and breach telemetry into an OpenAttestation verifiable certificate.
4. Synthesize an urgent consignee cargo status bulletin detailing spoilage risks and quarantine instructions.

## Interface
A cold-chain monitor displaying transit temperature curves, breach interval highlights, OpenAttestation document hashes, and client notice previews.

## Data
Use mock IoT sensor logs alongside official @govtechsg/open-attestation schemas for certificate packaging.
Starter examples below are synthetic. They are not downloaded records.

## Source
[OpenAttestation](https://raw.githubusercontent.com/Open-Attestation/open-attestation/master/README.md)
Employ OpenAttestation wrapping and signature verification methods to authenticate cold-chain excursion logs.

## Tools
mastra-ai, @govtechsg/open-attestation, typescript.
Mastra AI manages end-to-end data transformation workflows and schema validations with typed agent state.
Hosted reasoning model capable of synthesizing technical quarantine briefs.

## 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
- Flags cumulative temperature excursions over 4°C exceeding 30 continuous minutes.
- Generates OpenAttestation v2 wrapped document containing uncorrupted raw telemetry hashes.
- Drafts quarantine advisories for high-risk perishable cargo items.
- Requires supervisor review before marking cargo as cleared or quarantined.

## Starter Examples
```json
[
  {
    "input": {
      "trip_id": "TRIP-KL-SG-091",
      "cargo_type": "fresh_vaccines",
      "temp_threshold_max": 8,
      "recorded_peak_temp": 14.2,
      "excursion_duration_min": 55,
      "checkpoint_arrival": "Woodlands Checkpoint"
    },
    "expected_output": {
      "quarantine_recommended": true,
      "breach_severity": "critical",
      "oa_merkle_root": "0x12ab89cd45ef670123456789abcdef0123456789abcdef0123456789abcdef01",
      "notice_headline": "Critical Cold-Chain Breach: Mandatory Quarantine at Woodlands Checkpoint",
      "actionable_steps": [
        "Do not break container pallet seals",
        "Transfer cargo to port-adjacent cold store at -20C",
        "Initiate manufacturer quality testing"
      ]
    }
  },
  {
    "input": {
      "trip_id": "TRIP-KL-SG-092",
      "cargo_type": "citrus_fruits",
      "temp_threshold_max": 10,
      "recorded_peak_temp": 9.2,
      "excursion_duration_min": 10,
      "checkpoint_arrival": "Tuas Checkpoint"
    },
    "expected_output": {
      "quarantine_recommended": false,
      "breach_severity": "none",
      "oa_merkle_root": "0x56ef0123456789abcdef0123456789abcdef0123456789abcdef0123456789ab",
      "notice_headline": "Cold-Chain Integrity Verified: Normal Ingestion Permitted",
      "actionable_steps": [
        "Proceed with regular warehouse intake",
        "Archive telemetry certificate in TradeTrust repository"
      ]
    }
  }
]
```

## Safety
Generates verifiable incident records; does not condemn or dispose of physical pharmaceutical or food cargo.
Use mock external writes. Require human review before any real deployment.