Build a Logistics Weight Variance Alert and Audit Scheduler — implementation
Linked challenge: Build a Logistics Weight Variance Alert and Audit Scheduler
Prompt source
implementation63 lines11 sectionsNo variables1 code block
## Build
Analyze Beckn delivery manifests to detect significant discrepancies between original dispatch weight and return carrier collection weight. Trigger automated audit scheduling for high-risk waybills indicating potential parcel pilferage during transit.
## User
Logistics operations auditor
## Workflow
1. Ingest Beckn fulfillment payloads containing forward dispatch and reverse collection weights.
2. Calculate weight variance percentages between the two logistical hops.
3. Evaluate discrepancies against defined tolerance thresholds for pilferage risk.
4. Generate an automated audit scheduling ticket for flagged carrier nodes.
## Interface
Audit scheduling dashboard displaying weight variance alerts, waybill data, and automated carrier inspection tickets.
## Data
Construct simplified synthetic app records mimicking Beckn logistics payload data with paired forward and reverse weight telemetry.
Starter examples below are synthetic. They are not downloaded records.
## Source
[Beckn protocol specifications](https://raw.githubusercontent.com/beckn/protocol-specifications/master/README.md)
References Beckn protocol fulfillment API structures for extracting payload weight specifications across transaction lifecycle stages.
## Tools
pydantic-ai, fastapi, pandas.
Pydantic AI enables robust structured data validation and automated extraction for calculating logistics thresholds directly from JSON payloads.
Local or hosted LLM with strong JSON parsing and structured logic evaluation capabilities.
## 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
- Successfully parses paired dispatch and reverse weights from input payloads.
- Calculates exact variance percentages correctly based on dispatch weight.
- Triggers automated audit scheduling output when variance exceeds a predefined tolerance threshold.
## Starter Examples
```json
[
{
"input": {
"waybill": "WB-771",
"dispatch_weight_kg": 1.2,
"reverse_weight_kg": 0.3,
"carrier_id": "CARRIER-01"
},
"expected_output": {
"variance_percentage": 75,
"threshold_exceeded": true,
"action": "SCHEDULE_CARRIER_AUDIT",
"risk_flag": "HIGH_PILFERAGE_PROBABILITY"
}
},
{
"input": {
"waybill": "WB-882",
"dispatch_weight_kg": 2,
"reverse_weight_kg": 1.95,
"carrier_id": "CARRIER-02"
},
"expected_output": {
"variance_percentage": 2.5,
"threshold_exceeded": false,
"action": "NONE",
"risk_flag": "NORMAL_PACKAGING_LOSS"
}
}
]
```
## Safety
Operates completely on simulated carrier IDs and mock waybill metrics without exposing real vendor data or tracking information.
Use mock external writes. Require human review before any real deployment.