Skip to main content
Loading navigation

Build a Rural Seed Cooperative Multi-Node Stock Rebalancing Allocator — implementation

Prompt source

implementation90 lines11 sectionsNo variables1 code block
## Build
Monitor regional certified seed inventories across community cooperative depots using Beckn catalog messages. Generate balanced inter-depot stock transfer schedules and localized allocation plans ahead of sowing season demand surges.

## User
District agricultural cooperative officer

## Workflow
1. Parse inventory levels and certified batch seed numbers across participating primary agricultural cooperative societies.
2. Model projected taluk-level sowing demand based on synthetic historical distribution quotas.
3. Calculate inter-depot transfer manifests to resolve localized shortages without exceeding logistics budgets.
4. Produce Beckn-compliant catalog item update batches reflecting balanced regional availability.

## Interface
Geographic map and depot balance console displaying stock surpluses, deficit flags, and transfer manifests.

## Data
Construct synthetic seed stock levels and distance matrices for 10 simulated rural agricultural depots.
Starter examples below are synthetic. They are not downloaded records.

## Source
[Beckn protocol specifications](https://raw.githubusercontent.com/beckn/protocol-specifications/master/README.md)
Applies Beckn protocol catalog management schemas and asynchronous BPP update patterns for inventory syncing.

## Tools
optuna, pydantic, fastapi.
Optuna optimizes multi-depot seed transfer routes to minimize transit distance and logistics expenses.
Lightweight API or local model for generating human-readable depot manager transfer justifications.

## 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
- Eliminates stock deficits in high-demand depots using surpluses from adjacent regional cooperative nodes.
- Maintains seed lot traceability codes throughout all planned inter-depot transfers.
- Emits normalized catalog update payloads ready for BPP network publication.

## Starter Examples
```json
[
  {
    "input": {
      "seed_id": "cotton_bt2_certified",
      "depots": [
        {
          "depot_id": "depot_north",
          "stock_bags": 500,
          "projected_demand": 200
        },
        {
          "depot_id": "depot_south",
          "stock_bags": 50,
          "projected_demand": 250
        }
      ],
      "transit_cost_per_bag_km": 0.5,
      "distance_km": 40
    },
    "expected_output": {
      "rebalance_status": "BALANCED",
      "transfer_orders": [
        {
          "from_depot": "depot_north",
          "to_depot": "depot_south",
          "quantity_bags": 200,
          "estimated_cost_inr": 4000
        }
      ],
      "final_projected_coverage_pct": 100
    }
  },
  {
    "input": {
      "seed_id": "mustard_hybrid_01",
      "depots": [
        {
          "depot_id": "depot_east",
          "stock_bags": 80,
          "projected_demand": 100
        },
        {
          "depot_id": "depot_west",
          "stock_bags": 40,
          "projected_demand": 150
        }
      ],
      "transit_cost_per_bag_km": 0.5,
      "distance_km": 60
    },
    "expected_output": {
      "rebalance_status": "REGIONAL_DEFICIT",
      "transfer_orders": [],
      "final_projected_coverage_pct": 48
    }
  }
]
```

## Safety
Agricultural inventory optimization is simulated; no physical transport work orders or real supplies are committed.
Use mock external writes. Require human review before any real deployment.