Skip to main content
Loading navigation

Build a Phytosanitary and Wood Packaging Evidence Synthesizer — implementation

Prompt source

implementation82 lines11 sectionsNo variables1 code block
## Build
Evaluate wood packaging and phytosanitary inspection holds at Singapore checkpoint terminals. Assemble verifiable TradeTrust wrapped evidence packages and draft urgent consignee fumigation notices.

## User
Cross-Border Logistics Exception Manager

## Workflow
1. Parse customs inspection discrepancy logs and wood packaging fumigation flags from terminal gate exception timestamps.
2. Correlate phytosanitary incident logs with bill of lading consignee records and regional agricultural import limits.
3. Wrap incident photos and inspection receipts into a verifiable OpenAttestation document envelope.
4. Draft clear plain-language consignee exception notices with estimated fumigation delay and actionable next steps.

## Interface
An incident triage queue displaying affected container IDs, attached inspection reports, cryptographic wrapping controls, and notice dispatch drafts.

## Data
Use open-attestation npm schema libraries with JSON data. Note: The provided examples are 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)
Use OpenAttestation wrapDocuments and validateSchema routines to generate verifiable evidence batches for phytosanitary holds.

## Tools
langgraph, @govtechsg/open-attestation, pydantic.
LangGraph manages stateful branch execution between document wrapping, schema validation, and consignee communication drafting.
Hosted reasoning model capable of generating structured notifications and JSON state updates.

## 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
- Wraps phytosanitary exception incident data into a valid OpenAttestation v2 schema payload.
- Computes verifiable targetHash and merkleRoot over attached inspection survey files.
- Drafts consignee notices detailing exact hold reasons and estimated fumigation delay hours.
- Requires explicit officer review before final customer communication dispatch.

## Starter Examples
```json
[
  {
    "input": {
      "exception_id": "EX-2025-881",
      "container_number": "TGHU4819201",
      "bill_of_lading": "BL-SG-MY-9901",
      "consignee_email": "ops@sgimporter.com",
      "checkpoint": "Tuas Checkpoint",
      "incident_type": "phytosanitary_hold",
      "inspection_summary": "Untreated wood pallets detected; ISPM 15 stamp missing",
      "estimated_delay_hours": 48
    },
    "expected_output": {
      "status": "ready_for_notice_dispatch",
      "oa_wrapped": true,
      "merkle_root": "0x4f128bcde9017234567890abcdef1234567890abcdef1234567890abcdef1234",
      "notice_draft": {
        "recipient": "ops@sgimporter.com",
        "subject": "Shipment Exception Notice: Container TGHU4819201 Phytosanitary Hold",
        "delay_estimate": "48 hours",
        "summary": "Your shipment was subject to mandatory phytosanitary inspection at Tuas Checkpoint due to missing ISPM 15 stamps. Fumigation required."
      }
    }
  },
  {
    "input": {
      "exception_id": "EX-2025-882",
      "container_number": "WHLU3301928",
      "bill_of_lading": "BL-SG-ID-4412",
      "consignee_email": "claims@batamtransit.com",
      "checkpoint": "Jurong Island Terminal",
      "incident_type": "pest_detection",
      "inspection_summary": "Live agricultural pests identified in dunnage material",
      "estimated_delay_hours": 72
    },
    "expected_output": {
      "status": "ready_for_notice_dispatch",
      "oa_wrapped": true,
      "merkle_root": "0x9a87bc1245def34567890abcdef1234567890abcdef1234567890abcdef1234",
      "notice_draft": {
        "recipient": "claims@batamtransit.com",
        "subject": "Urgent Shipment Exception: Container WHLU3301928 Pest Detection",
        "delay_estimate": "72 hours",
        "summary": "Live agricultural pests recorded in container dunnage at Jurong Island Terminal. Verified evidence dossier attached."
      }
    }
  }
]
```

## Safety
Cryptographically wraps evidence and prepares customer drafts; does not transmit unverified claims or alter customs declarations.
Use mock external writes. Require human review before any real deployment.