Build a Cold-Chain IoT Telemetry and OpenAttestation Claim Packager — implementation
Linked challenge: Build a Cold-Chain IoT Telemetry and OpenAttestation Claim Packager
Prompt source
implementation101 lines11 sectionsNo variables1 code block
## Build
Orchestrate reefer container IoT telemetry logs against handover boundaries during port transfer using Mastra AI. Compile and output verifiable claim dossiers formatted in OpenAttestation cryptographic wrapping for cargo insurance adjusters.
## User
Maritime insurance claims officer
## Workflow
1. Ingest synthetic IoT temperature time-series logs and port gate interchange timestamps for refrigerated container handoffs.
2. Evaluate cumulative degree-minute excursions exceeding pharmaceutical or frozen food thresholds using a Mastra AI orchestrated workflow.
3. Calculate financial loss estimates based on cargo invoice line items, mapping physical container custody to specific transport legs.
4. Wrap the compiled evidence dossier into an OpenAttestation verifiable document using a cryptographic merkle root.
## Interface
Command-line claim packager outputting verifiable OpenAttestation JSON dossiers and a summary report of custody breaches.
## Data
Synthetic CSV datasets of hourly reefer temperature readings, terminal handoff timestamps, and simplified cargo invoices. Note: Dataset and examples reflect simplified synthetic app records, not complete official schema files.
Starter examples below are synthetic. They are not downloaded records.
## Source
[OpenAttestation](https://raw.githubusercontent.com/Open-Attestation/open-attestation/master/README.md)
Uses OpenAttestation's wrapDocuments mechanism to produce cryptographically rooted claim dossiers with merkleRoot hashes.
## Tools
mastra-ai, pydantic, fastapi.
Mastra AI orchestrates multi-step claim workflow graphs with deterministic telemetry validation and automated document wrapping.
Hosted reasoning model capable of analyzing tabular telemetry logs and structuring claim narratives.
## 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
- Detects sustained thermal excursions exceeding specified SLA margins over consecutive hourly readings.
- Calculates total breach duration and assigns financial liability to the correct physical container custody leg.
- Generates a valid OpenAttestation wrapped JSON dossier containing calculated damages, merkle root, and event logs.
## Starter Examples
```json
[
{
"input": {
"consignment_id": "REEF-9920",
"temperature_sla_max_c": -18,
"declared_cargo_value_sgd": 150000,
"telemetry_readings": [
{
"timestamp": "2025-02-10T08:00:00Z",
"temp_c": -19.2,
"custody": "Vessel Discharge"
},
{
"timestamp": "2025-02-10T10:00:00Z",
"temp_c": -14.1,
"custody": "Tanjung Pagar Yard Staging"
},
{
"timestamp": "2025-02-10T12:00:00Z",
"temp_c": -12.5,
"custody": "Tanjung Pagar Yard Staging"
},
{
"timestamp": "2025-02-10T14:00:00Z",
"temp_c": -18.5,
"custody": "Warehouse Intake"
}
]
},
"expected_output": {
"breach_detected": true,
"total_breach_hours": 4,
"max_recorded_temp_c": -12.5,
"liable_custody_party": "Tanjung Pagar Yard Staging",
"claim_eligibility": "ACTIONABLE",
"recommended_reserve_sgd": 45000,
"oa_bundle_ready": true
}
},
{
"input": {
"consignment_id": "REEF-9921",
"temperature_sla_max_c": 4,
"declared_cargo_value_sgd": 85000,
"telemetry_readings": [
{
"timestamp": "2025-02-11T01:00:00Z",
"temp_c": 3.1,
"custody": "Pasir Panjang Terminal"
},
{
"timestamp": "2025-02-11T02:00:00Z",
"temp_c": 3.5,
"custody": "Pasir Panjang Terminal"
}
]
},
"expected_output": {
"breach_detected": false,
"total_breach_hours": 0,
"max_recorded_temp_c": 3.5,
"liable_custody_party": "NONE",
"claim_eligibility": "INELIGIBLE_NO_BREACH",
"recommended_reserve_sgd": 0,
"oa_bundle_ready": false
}
}
]
```
## Safety
Calculates mock claims without transmitting binding settlement orders or contacting real underwriters.
Use mock external writes. Require human review before any real deployment.