Skip to main content
Loading navigation
Back to prompt library

Build an Open Commerce Perishable Food Cold-Chain Allocation Router — implementation

Linked challenge: Build an Open Commerce Perishable Food Cold-Chain Allocation Router

Prompt source

implementation89 lines11 sectionsNo variables1 code block
## Build
Evaluate refrigerated transport capacity across rural producer collectives to route perishable harvests under ONDC protocol specs. Compute remaining product shelf life and allocate shipments across certified local cold-storage providers.

## User
Horticulture export cooperative coordinator

## Workflow
1. Ingest perishable harvest batches with ambient temperature exposure logs and harvest timestamps.
2. Query simulated ONDC logistics provider quotes using Beckn core final-mile delivery schemas.
3. Calculate estimated transit times against remaining shelf-life thresholds for delicate agricultural produce.
4. Generate optimized multi-carrier fulfillment plans and simulated Beckn on_init contract proposals.

## Interface
Cold-chain control tower dashboard rendering real-time temperature logs, transit timelines, and dispatch slips.

## Data
Generate synthetic JSON records representing temperature-sensitive fruit batches and mock ONDC logistics bids.
Starter examples below are synthetic. They are not downloaded records.

## Source
[ONDC protocol specifications](https://raw.githubusercontent.com/ONDC-Official/ONDC-Protocol-Specs/master/README.md)
Implements ONDC logistics protocol extensions layered over Beckn core transaction specifications.

## Tools
ray-serve, pydantic, fastapi.
Ray Serve enables high-throughput concurrent evaluation of logistics bidding options across distributed farm nodes.
API-driven or local LLM for parsing unstructured logistics contract terms and transit SLA stipulations.

## 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 and rejects logistics routes whose estimated delivery time exceeds remaining produce shelf life.
- Formats simulated network logistics dispatch requests conforming to Beckn final-mile delivery context fields.
- Allocates shipment across secondary cold stores when primary refrigerated transport is at capacity.

## Starter Examples
```json
[
  {
    "input": {
      "batch": {
        "crop": "strawberry",
        "quantity_crates": 120,
        "harvest_time": "2025-03-01T04:00:00Z",
        "max_ambient_hours": 18
      },
      "available_carriers": [
        {
          "carrier_id": "cold_transit_a",
          "type": "reefer",
          "transit_hours": 8,
          "capacity_crates": 150
        },
        {
          "carrier_id": "dry_transit_b",
          "type": "ambient",
          "transit_hours": 5,
          "capacity_crates": 200
        }
      ]
    },
    "expected_output": {
      "selected_carrier_id": "cold_transit_a",
      "allocation_status": "CONFIRMED",
      "allocated_crates": 120,
      "risk_assessment": "Refrigerated transit protects shelf life within safe 8-hour window."
    }
  },
  {
    "input": {
      "batch": {
        "crop": "mango_alphonso",
        "quantity_crates": 300,
        "harvest_time": "2025-04-10T06:00:00Z",
        "max_ambient_hours": 24
      },
      "available_carriers": [
        {
          "carrier_id": "cold_transit_c",
          "type": "reefer",
          "transit_hours": 30,
          "capacity_crates": 400
        }
      ]
    },
    "expected_output": {
      "selected_carrier_id": null,
      "allocation_status": "REJECTED_SLA_BREACH",
      "allocated_crates": 0,
      "risk_assessment": "Transit duration of 30 hours exceeds safe freshness threshold of 24 hours."
    }
  }
]
```

## Safety
Simulates cold-chain allocation solely; does not execute binding carrier bookings or control real vehicle telematics.
Use mock external writes. Require human review before any real deployment.