48 KiB
Product Requirements Document (PRD) / User Requirements Specification (URS)
Agricultural Mandi Trader App (AMTP)
| Field | Value |
|---|---|
| Document | PRD_Specification.md (Comprehensive Production-Grade URS) |
| Product | Agricultural Mandi Trader App (AMTP) |
| Version | 1.1.0 (Detailed Operational Baseline) |
| Author | @requirements-analyst (up-requirements-elicit) |
| Governance Standard | SEI-CMMI Level 3 (AI-Native Unified Process UP-AI v1.3) |
| Status | Baselined |
| Last Updated | 2026-10-09 |
1. Executive Summary & Problem Statement
1.1 The Business Need
Wholesale physical agricultural commodity trading in India's Agricultural Produce Market Committee (APMC) mandis (such as Neemuch, Mandsaur, Ratlam, Kota, and Indore) involves fast-paced daily auctions, high financial exposure, multi-warehouse storage, and strict quality grading.
Wholesale trading firms and licensed commission agents (arhatiyas) handle dozens of truckloads daily across dry-agri commodities (pulses, oilseeds, grains, and spices such as chickpea/chana, soybean, mustard seed, coriander seed, cumin seed, fenugreek, turmeric, and wheat). Trading firms currently struggle with:
- Disconnected Paper Slips (Sauda Buhis): Auction purchase commitments made in the mandi yard are not reflected in real time at the godowns, causing intake delays, truck detention, and weighbridge disputes.
- Dual-Unit Commercial Complexity: Trading rates are quoted strictly in Indian Rupees per Quintal (₹/Qtl), whereas physical freight, warehouse capacity, and bookkeeping operate in Metric Tonnes (MT) and physical bag counts (kattha/bora). Manual math frequently causes billing errors.
- Quality & Lot Segregation Risks: Consignments arriving with high moisture or impurities are accidentally mixed into clean warehouse stacks because quality inspection holds (QC Hold) are not enforced by software gates.
- Unhedged Customer Credit Exposure: Customers frequently buy on credit terms (e.g., 7–15 days). Without real-time exposure monitoring, sales desks book orders for customers who have exceeded their sanctioned credit limit, leading to severe bad debt.
- Multi-Godown Blind Spots: Stock balances across multiple transit and buffer godowns are reconciled manually at day-end, preventing real-time commitment of available inventory to buyers.
1.2 Target Operating Model
The Agricultural Mandi Trader App (AMTP) is a dedicated, modular, multi-tenant enterprise back-office and trading operations platform built on the Frappe Framework. It establishes an unbroken digital chain across 11 core functional modules:
Market Desk (Arrivals & Modal Price)
│
▼
Procurement (Auction Sauda Booking) ──► Inward Weighbridge (Gross/Tare/Bags)
│
▼
Godown Intake & Lot ID Generation
│
▼
Lab QC Inspection (QC Hold / Release)
│
▼
Customer Sales Contract ◄────────────── Available Warehouse Stock (MT & Bags)
│
▼
Credit Limit Check (≤80% / Breach Block)
│
▼
Outbound Dispatch Board ──► Transport Fleet Scheduling ──► Outward Weighbridge
│
▼
Customer Receivables Ledger
1.3 Key Performance Indicators (KPIs)
- 100% End-to-End Lot Traceability: Unique lot consignment tracking from supplier auction purchase through weighbridge intake, lab test, godown stack, and outbound customer dispatch.
- Zero Accidental QC Hold Dispatches: 100% backend programmatic prevention of allocating or dispatching any lot with
status != 'Released'. - Zero Unapproved Credit Limit Breaches: 100% programmatic enforcement blocking sales order dispatch when customer receivables exceed sanctioned credit limits without executive override.
- Sub-Second Inventory & Dual-Unit Reconciliation: Immediate stock ledger balance updates across Metric Tonnes, Quintals, and Bag counts with mathematical consistency:
\text{Value (INR)} = \text{Quantity (MT)} \times 10 \times \text{Rate (₹/Qtl)}
2. Target Personas & User Classes
| Persona | Role / Designation | Core Responsibilities & System Permissions |
|---|---|---|
| Partner / Managing Director | Executive Management | Full strategic oversight; reviews daily trading snapshots, net P&L metrics, operational alerts, cash flow, and holds exclusive authority for credit-limit override approvals. |
| Purchase Manager | Procurement Lead | Manages supplier relationships, monitors mandi auction windows, negotiates rates, reviews purchase vs. market modal rate variances, and approves purchase saudas. |
| Procurement Executive | Mandi Field Buyer | Enters daily mandi auction purchases, tracks arrival volumes, and logs daily market desk price observations directly from mandi yards. |
| Sales Manager | Commercial Lead | Evaluates customer inquiries, negotiates sales contracts, monitors customer credit exposure, approves sales contracts, and allocates inventory. |
| Sales Executive | Field / Desk Sales | Inputs customer sales orders, tracks order fulfillment stages, and communicates dispatch details to buyers. |
| Yard Supervisor / Godown Keeper | Warehouse Operations | Manages godown intake, operates weighbridge gross/tare weighment, verifies physical bag counts (bardana tally), manages stack placement, and oversees dispatch loading. |
| Quality Officer | Quality Inspection & Lab | Inspects inward lots, performs physical/lab sampling (moisture %, foreign matter %, damaged grains), enters test results, and toggles FSM states (QC Hold vs. Released). |
| Logistics Coordinator | Transport & Fleet | Coordinates carrier fleet (owned and contracted trucks), assigns vehicles to dispatches, generates dispatch bilties/manifests, and monitors transit status. |
| Accounts Executive | Finance & Accounting | Records customer payment receipts (NEFT/RTGS/Cheque/Cash), maintains supplier payables aging ledgers, records operational expense vouchers, and reconciles balances. |
| System Administrator | Technical Governance | Manages Frappe site tenancy, user accounts, DocType role permissions, master catalogs, system configuration, and audit trails. |
3. Mathematical & Commercial Calculation Engine Standards
3.1 Dual-Unit Conversion Engine
In Indian agricultural markets, rates are quoted in ₹ per Quintal, while transport and inventory operate in Metric Tonnes (MT) and Bags:
- Metric Unit Definitions:
1\text{ Metric Tonne (MT)} = 1,000\text{ Kilograms (kg)}1\text{ Quintal (Qtl)} = 100\text{ Kilograms (kg)} = 0.100\text{ MT}1\text{ Metric Tonne (MT)} = 10.0\text{ Quintals (Qtl)}
- Gross Trade Value Formula:
Example:\text{Value (INR)} = \text{Quantity (MT)} \times 10 \times \text{Rate (₹/Qtl)}24.0\text{ MT}of Coriander seed at₹4,486\text{ / Qtl} \implies 24.0 \times 10 \times 4486 = ₹1,076,640. - Bag Packing Standard:
Standard nominal packing is 50 kg or 100 kg per bag.\text{Average Bag Weight (kg)} = \frac{\text{Net Weight (MT)} \times 1000}{\text{Bag Count}}
3.2 Inward Weighbridge & Bag Tare Deduction (Bardana Katai)
- Net Truck Weight:
\text{Gross Truck Weight (kg)} - \text{Tare Truck Weight (kg)} = \text{Unloaded Gross Commodity Weight (kg)} - Bag Tare Deduction (Bardana Katai):
(Default standard: 1.0 kg per gunny/jute bag, 0.2 kg per HDPE/plastic bag).\text{Tare Bag Deduction (kg)} = \text{Bag Count} \times \text{Tare Weight Per Bag (kg)} - Net Payable Weight:
\text{Net Weight (MT)} = \frac{\text{Unloaded Gross Commodity Weight (kg)} - \text{Tare Bag Deduction (kg)}}{1000} - Weighment Shortage / Variance Calculation:
\text{Variance \%} = \frac{\text{Actual Net Weighbridge MT} - \text{Booked Purchase MT}}{\text{Booked Purchase MT}} \times 100- If
|\text{Variance \%}| \le 0.5\%: Auto-accepted within normal mandi weighment tolerance. - If
\text{Variance \%} < -0.5\%: Shortage flagged; net payable MT adjusted to actual weighbridge receipt.
- If
3.3 Customer Credit Exposure & Risk Engine
\text{Current Exposure (INR)} = \text{Total Outstanding Unpaid Receivables (INR)} + \text{Unbilled Confirmed Orders (INR)}
\text{Exposure Ratio \%} = \frac{\text{Current Exposure (INR)}}{\text{Sanctioned Credit Limit (INR)}} \times 100
- Normal Zone (
\le 80\%): Sales orders and dispatches proceed without restriction. - Watch Warning Zone (
>80\%and\le 100\%): System issues an automated Warning Alert; sales entry flags account on Watch. - Breach Block Zone (
>100\%): System enforces a Hard Block; order cannot transition toConfirmedorDispatchedwithout recorded Partner / MD approval.
4. Finite State Machines (FSMs) & Lifecycle Contracts
4.1 Purchase Sauda FSM
[Draft] ──► [Booked] ──► [Gate Inward] ──► [Under QC] ──► [Received / Closed]
│ │
▼ ▼
[Cancelled] [Rejected]
Draft: Initial booking entered by Mandi Buyer.Booked: Sauda confirmed with supplier and market rate locked.Gate Inward: Truck arrived at godown gate; weighbridge gross weight captured.Under QC: Commodity unloaded; lot minted; awaiting lab test sign-off.Received / Closed: QC accepted; net tare calculated; GRN posted; inventory credited.Rejected: Commodity failed quality thresholds; gate pass issued for return to supplier.
4.2 Commodity Lot FSM
[Generated] ──► [Under QC] ──┬──► [Released] (Available for Allocation & Dispatch)
│
└──► [QC Hold] ──► [Released] (Post Remediation/Approval)
│
└──► [Rejected / Disposal]
Under QC: Initial state upon godown unloading. Cannot be linked to sales orders.QC Hold: Flagged for excessive moisture, foreign matter, or quality dispute. Hard-locked against sales reservation and loading.Released: Lab approved. Eligible for sales order allocation and dispatch board loading.Rejected: Unfit for trade; flagged for return or discounted salvage.
4.3 Sales Order & Dispatch Board FSM
[Draft] ──► [Confirmed] ──► [Allocated] ──► [Loading] ──► [In Transit] ──► [Delivered]
│ │
▼ ▼
[Cancelled] [Order Hold]
Draft: Customer inquiry and pricing quote.Confirmed: Credit check passed; sales contract ratified.Allocated: Released inventory lot(s) tagged to order.Loading: Transport vehicle assigned; bags being loaded onto truck.In Transit: Outward weighbridge completed; dispatch bilty generated; truck en route.Delivered: Consignee proof of delivery (POD) acknowledged; sales invoice finalized.
5. Comprehensive Granular Feature Inventory (BRD-FR-xxx)
Every discrete requirement carries a unique BRD-FR-xxx root ID, detailed operational statement, input/output data attributes, validation rules, and failure modes.
5.1 Module 1: Market Desk & Daily Mandi Intelligence
BRD-FR-001: Daily APMC Mandi Arrival Ingestion & Tracking
- Owning Module: Market Desk
- Primary Persona: Procurement Executive / Mandi Buyer
- Priority: P0
- Operational Statement: The system must record daily physical arrival volumes at APMC mandi yards across target commodities (Chana, Coriander, Cumin, Fenugreek, Groundnut, Isabgol, Jaggery, Maize, Mustard, Soybean, Turmeric, Wheat) across monitored markets (Neemuch, Mandsaur, Ratlam, Kota, Indore, Jaora, Ujjain, Chittorgarh).
- Data Attributes: Observation Date, Market Yard, Commodity, Variety, Grade, Arrival Quantity in MT, Internal Stock Position in MT, Observation Source, Timestamp.
- Validation Rules: Observation date cannot be in the future. Arrival quantity must be
\ge 0.0\text{ MT}. Duplicate observation for same market, commodity, variety, and date must be blocked. - Failure / Exception Flow: If arrival data is unavailable for a holiday/strike, system must allow flagging the market as
Closed / Mandi Holiday.
BRD-FR-002: Daily Modal & Range Pricing Tracking (₹/Qtl)
- Owning Module: Market Desk
- Primary Persona: Procurement Executive / Purchase Manager
- Priority: P0
- Operational Statement: For each daily mandi arrival record, the system must capture the quoted price range (Min Rate ₹/Qtl, Max Rate ₹/Qtl) and the official modal clearing price (Modal Rate ₹/Qtl).
- Data Attributes: Quoted Min Rate (₹/Qtl), Quoted Max Rate (₹/Qtl), Modal Clearing Rate (₹/Qtl).
- Validation Rules:
\text{Min Rate} \le \text{Modal Rate} \le \text{Max Rate}. All rates must be> 0. - Failure / Exception Flow: If user inputs Modal Rate outside the Min-Max range, validation must reject save with an explicit arithmetic constraint error.
BRD-FR-003: Intraday Price Trend Analysis & 20-Day Benchmark Analytics
- Owning Module: Market Desk
- Primary Persona: Purchase Manager / Partner
- Priority: P0
- Operational Statement: The system must provide interactive visual charts and trend tables comparing the 20-day historical modal rate trend per commodity across markets, computing 20-day moving averages, 20-day highs/lows, and price velocity.
- Data Attributes: Historical Date Range, Commodity Filter, Market Filter, 20-Day SMA (Simple Moving Average), Price Spread.
- Validation Rules: Calculations must dynamically update upon new observation save. Execution time
\le 500\text{ms}.
BRD-FR-004: Procurement Price Variance Alert vs. Modal Rate
- Owning Module: Market Desk & Procurement
- Primary Persona: Purchase Manager
- Priority: P1
- Operational Statement: When booking a purchase sauda, the system must compare the offered trade rate against the latest modal clearing rate for that commodity/mandi. If the offered rate exceeds the modal rate by
>5\%, the system must display an inline warning and require confirmation. - Data Attributes: Offered Rate, Benchmark Modal Rate, Variance %.
- Validation Rules: Informational alert only; does not hard-block procurement unless configured in company policy.
5.2 Module 2: Mandi Procurement & Auction Purchases (Sauda)
BRD-FR-005: Mandi Auction & Direct Purchase Sauda Booking
- Owning Module: Procurement
- Primary Persona: Procurement Executive / Purchase Manager
- Priority: P0
- Operational Statement: The system must record purchase contracts (saudas) negotiated in mandi auctions or directly with suppliers. Each sauda must capture supplier code, sourcing market, commodity, variety, trade rate (₹/Qtl), estimated bag count, and booked quantity in MT. The system must support multi-truck partial delivery: a sauda may be fulfilled across multiple trucks/GRNs over consecutive delivery days, tracking cumulative received MT and remaining balance MT until fully fulfilled.
- Data Attributes: Sauda ID (
PUR-YYYYMM-xxx), Sauda Date, Supplier ID, Sourcing Mandi, Commodity, Variety, Booked Qty MT, Estimated Bags, Trade Rate (₹/Qtl), Gross Value INR, Cumulative Received MT, Remaining Balance MT, Status. - Validation Rules: Supplier must be an active master record. Booked MT must be
> 0. Trade rate must be> 0. Gross value must equal\text{Booked MT} \times 10 \times \text{Rate}. Status remainsPartially Receiveduntil cumulative received MT reaches booked MT (within tolerance) or explicitly closed by Purchase Manager. - Failure / Exception Flow: If supplier is deactivated or blacklisted, booking must be blocked.
BRD-FR-006: Supplier Credit Terms & Due Date Computation
- Owning Module: Procurement & Finance
- Primary Persona: Purchase Manager / Accounts Executive
- Priority: P0
- Operational Statement: The system must automatically compute the supplier payment due date by adding the supplier's contractual credit days (e.g., 7, 15, or 21 days) to the sauda or GRN receipt date.
- Data Attributes: Supplier Credit Days, Transaction Date, Computed Due Date, Payment Status (
Pending,Paid). - Validation Rules: Default credit days inherited from Supplier master; editable only by Purchase Manager.
BRD-FR-007: Mandi Cess & Statutory Levies Apportioning
- Owning Module: Procurement & Finance
- Primary Persona: Accounts Executive
- Priority: P1
- Operational Statement: The system must calculate statutory mandi cess (e.g., 1.5% APMC market fee + 0.2% Nirashrit fee) based on the gross sauda value and append it to the total procurement cost.
- Data Attributes: Mandi Cess Rate %, Cess Amount INR, Total Landed Procurement Cost INR.
- Validation Rules: Configurable per commodity and market jurisdiction.
5.3 Module 3: Inward Weighbridge & Goods Receipt (GRN)
BRD-FR-008: Inward Vehicle Gate Entry & Verification
- Owning Module: Goods Receipt
- Primary Persona: Yard Supervisor
- Priority: P0
- Operational Statement: Upon vehicle arrival at the godown, the Yard Supervisor must log gate entry linking the vehicle registration number and driver details to an active booked sauda.
- Data Attributes: Gate Entry ID, Inward Date/Time, Vehicle Reg No, Driver Name, Contact No, Linked Sauda ID, Supplier Name, Gate Pass No.
- Validation Rules: Linked sauda must be in state
Booked.
BRD-FR-009: Weighbridge Gross & Tare Weighment Logging
- Owning Module: Goods Receipt
- Primary Persona: Yard Supervisor
- Priority: P0
- Operational Statement: The system must record dual-phase weighbridge measurements for incoming trucks: (1) Gross Weighment (truck + commodity) upon arrival, and (2) Tare Weighment (empty truck) after unloading.
- Data Attributes: Gross Weight kg, Gross Timestamp, Tare Weight kg, Tare Timestamp, Gross Net Weight kg (
Gross - Tare), Weighbridge Slip No. - Validation Rules:
\text{Gross Weight} > \text{Tare Weight} > 0. Weighbridge slip number mandatory. - Failure / Exception Flow: If Tare Weight
\geGross Weight, system must hard-block submission with an error.
BRD-FR-010: Bag Tare Deduction (Bardana Katai) & Final Net MT
- Owning Module: Goods Receipt
- Primary Persona: Yard Supervisor
- Priority: P0
- Operational Statement: The system must deduct the weight of packaging bags from the gross commodity weight using the defined tare deduction factor (default 1.0 kg/gunny bag) to calculate true Net Payable MT.
- Data Attributes: Physical Bag Count, Packaging Type (
Gunny/Jute,HDPE/Plastic), Bag Tare Deduction Rate kg/bag, Total Bag Tare kg, Final Net Weight MT. - Validation Rules: Formula:
\text{Net MT} = (\text{Gross kg} - \text{Tare kg} - (\text{Bags} \times \text{Bag Tare Rate})) / 1000. Net MT must be> 0.
BRD-FR-011: Weighment Tolerance & Transit Shortage Verification
- Owning Module: Goods Receipt
- Primary Persona: Yard Supervisor / Purchase Manager
- Priority: P0
- Operational Statement: The system must compare the Final Net Weighbridge MT against the Booked Sauda MT. If shortage exceeds
0.5\%, the system must flag aTransit Shortage Warningand adjust the final payable amount to the actual net received weight. - Data Attributes: Shortage MT, Shortage Value INR, Variance %, Shortage Status (
Normal,Disputed). - Validation Rules: If shortage exceeds
2.0\%, the GRN requires mandatory Purchase Manager approval before stock posting.
BRD-FR-012: Goods Receipt Note (GRN) Posting & Warehouse Stack Placement
- Owning Module: Goods Receipt & Inventory
- Primary Persona: Yard Supervisor
- Priority: P0
- Operational Statement: Upon weighment completion, the system must generate a formal GRN document, allocate the physical goods to a specific warehouse/godown and stack location, credit the warehouse stock book, and mint an inward Commodity Lot.
- Data Attributes: GRN ID (
GRN-YYYYMM-xxx), Receiving Warehouse ID, Stack/Chamber No, Accepted Bags, Accepted Net MT. - Validation Rules: GRN submission atomically updates inventory and creates Lot record in state
Under QC.
5.4 Module 4: Quality Inspection & Lot Control
BRD-FR-013: Mandatory Lot & Batch Identity Generation
- Owning Module: Quality & Inventory
- Primary Persona: Yard Supervisor / Quality Officer
- Priority: P0
- Operational Statement: The system must automatically generate a globally unique, immutable Lot ID (
LOT-YYYYMM-xxx) for every inward consignment processed through a GRN. - Data Attributes: Lot ID, Inward Date, Origin Market, Supplier ID, Commodity, Variety, Receiving Warehouse, Net MT, Bag Count, Quality Status.
- Validation Rules: Initial status must be
Under QC. Lot ID must be permanent and traceable through all sales and dispatches.
BRD-FR-014: Inward Quality Inspection Parameter Recording
- Owning Module: Quality Control
- Primary Persona: Quality Officer
- Priority: P0
- Operational Statement: The Quality Officer must log laboratory/physical test parameters for the lot: Moisture %, Foreign Matter / Dust %, Admixture (other grains) %, Damaged / Discolored %, and Weevil count.
- Data Attributes: Inspection Date, Quality Officer ID, Moisture %, Foreign Matter %, Admixture %, Damaged %, Weevil Infestation (
None,Mild,Severe), Assigned Commercial Grade (FAQ,Premium,Below FAQ). - Validation Rules: Percentage values must be between
0.00\%and100.00\%.
BRD-FR-015: Quality Deduction / Rebate Calculation
- Owning Module: Quality Control & Finance
- Primary Persona: Quality Officer / Accounts Executive
- Priority: P1
- Operational Statement: If moisture or foreign matter exceeds standard contract baselines (e.g., standard moisture baseline 10.0%), the system must automatically compute a quality price deduction (e.g., ₹10 deduction per quintal for each 0.5% moisture above baseline).
- Data Attributes: Base Contract Rate ₹/Qtl, Quality Penalty Rate ₹/Qtl, Adjusted Final Rate ₹/Qtl, Net Purchase Adjustment INR.
- Validation Rules: Deductions cannot reduce rate below 50% of base rate without partner authorization.
BRD-FR-016: Finite State Machine Enforcement for QC Hold vs. Released
- Owning Module: Quality Control
- Primary Persona: Quality Officer
- Priority: P0
- Operational Statement: The system must enforce strict FSM transitions on the Lot record. If moisture
>12\%or foreign matter>2\%, the lot must be transitioned toQC Hold. A lot onQC Holdis programmatically blocked from sales order allocation and dispatch loading. - Data Attributes: Previous Status, New Status (
QC Hold,Released), Hold Reason, Action Plan (Drying,Cleaning,Re-testing), Release Timestamp. - Validation Rules: Only users with
Quality OfficerorPartnerroles can transition a lot fromQC HoldtoReleased. System must hard-block dispatch of unreleased lots.
BRD-FR-017: Lot Splitting & Blending Traceability
- Owning Module: Quality & Inventory
- Primary Persona: Yard Supervisor / Quality Officer
- Priority: P1
- Operational Statement: The system must support splitting a parent lot into sub-lots (e.g., when dividing a consignment across two warehouses) or blending multiple lots, maintaining parent-child lineage in the traceability graph.
- Data Attributes: Parent Lot ID, Child Lot ID(s), Split Qty MT, Split Bag Count, Linage Tree.
- Validation Rules: Sum of child lot quantities must exactly equal parent quantity deducted.
5.5 Module 5: Multi-Godown Warehouse Inventory
BRD-FR-018: Multi-Godown Dual-Unit Stock Ledger
- Owning Module: Inventory
- Primary Persona: Yard Supervisor / Management
- Priority: P0
- Operational Statement: The system must maintain a real-time, double-entry stock ledger tracking commodity positions across warehouses (WH-01 Neemuch Main Yard, WH-02 Neemuch North Godown, WH-03 Mandsaur Transit Godown, WH-04 Indore Buffer Depot). For each commodity, variety, and grade, it must maintain Opening Stock MT, Received MT, Dispatched MT, Closing Stock MT, and physical Bag counts. The system must support Periodic Physical Stock Audits: recording physical tally counts against book balances and generating supervisor-authorized Stock Adjustment Vouchers capturing natural storage loss/gain (ghat / nami due to moisture evaporation or seasonal humidity) or handling spillage with mandatory reason codes.
- Data Attributes: Stock Entry ID, Date, Warehouse ID, Commodity, Variety, Grade, Opening MT, Inward MT, Outward MT, Closing MT, Bag Delta, Closing Bags, Physical Count MT, Adjustment Variance MT, Variance Reason Code (
Moisture Loss / Ghat,Handling Spillage,Bag Burst,Seasonal Humidity Gain). - Validation Rules: Closing stock MT and bags must never be negative (
\ge 0). Adjustments exceeding\pm 1.0\%of godown balance require mandatory Partner electronic sign-off.
BRD-FR-019: Godown Capacity & Volume Utilization Tracking
- Owning Module: Inventory
- Primary Persona: Yard Supervisor / Partner
- Priority: P0
- Operational Statement: The system must track the physical storage capacity of each warehouse in Metric Tonnes and calculate real-time percentage utilization:
\text{Utilisation \%} = \frac{\text{Current Closing Stock (MT)}}{\text{Storage Capacity (MT)}} \times 100 - Data Attributes: Warehouse ID, Name, City, Capacity MT, Current Stock MT, Utilisation %.
- Validation Rules: Warning status triggered when Utilisation exceeds 85%.
BRD-FR-020: Godown-to-Godown Internal Stock Transfer
- Owning Module: Inventory & Logistics
- Primary Persona: Yard Supervisor / Logistics Coordinator
- Priority: P0
- Operational Statement: The system must support recording stock transfers between godowns (e.g., from Mandsaur Transit Godown to Neemuch Main Yard), logging origin outward deduction, in-transit state, destination weighment, and destination inward credit.
- Data Attributes: Transfer ID, Origin Warehouse, Destination Warehouse, Commodity, Lot ID, Transfer Qty MT, Transfer Bags, Vehicle Reg No, Transit Status.
- Validation Rules: Outward and inward entries must reconcile within
\pm 0.2\%transfer tolerance.
5.6 Module 6: Customer Sales Contracts & Orders
BRD-FR-021: Customer Sales Contract Booking
- Owning Module: Sales
- Primary Persona: Sales Manager / Sales Executive
- Priority: P0
- Operational Statement: The system must record customer sales orders/contracts specifying customer code, destination city, customer segment (
Wholesale,Processor,Institutional,Distributor), commodity, variety, grade, contracted quantity in MT, contract rate in ₹/Qtl, and delivery timeline. - Data Attributes: Sales Order ID (
SAL-YYYYMM-xxx), Order Date, Customer ID, Destination City, Commodity, Variety, Grade, Contract Qty MT, Contract Rate ₹/Qtl, Total Sales Value INR, Payment Terms, Status. - Validation Rules: Total Sales Value must equal
\text{Contract Qty MT} \times 10 \times \text{Rate ₹/Qtl}.
BRD-FR-022: Customer Credit Limit & Pre-Order Exposure Verification
- Owning Module: Sales & Finance
- Primary Persona: Sales Manager / Accounts Executive
- Priority: P0
- Operational Statement: Prior to confirming a sales order, the system must evaluate the customer's current outstanding receivables plus the value of the new order against their sanctioned credit limit.
- Data Attributes: Sanctioned Credit Limit INR, Current Outstanding INR, New Order Value INR, Projected Exposure INR, Projected Exposure Ratio %.
- Validation Rules: If Projected Exposure Ratio
>80\%, display inline warning. If Projected Exposure Ratio>100\%, system must prevent order confirmation unless authorized by Partner.
BRD-FR-023: Sales Order Inventory Allocation
- Owning Module: Sales & Inventory
- Primary Persona: Sales Manager / Yard Supervisor
- Priority: P0
- Operational Statement: The Sales Manager must allocate specific available inventory lot(s) from a warehouse to a confirmed sales order. The system must verify that selected lots are in
Releasedstate and have sufficient unreserved balance. - Data Attributes: Sales Order ID, Allocated Lot ID, Allocated Qty MT, Allocated Bags, Warehouse ID.
- Validation Rules: Allocation fails if Lot status is
QC HoldorUnder QC, or if available lot unreserved MT<allocated MT.
5.7 Module 7: Outbound Logistics & Dispatch Board
BRD-FR-024: Outbound Dispatch Board Console
- Owning Module: Logistics
- Primary Persona: Logistics Coordinator
- Priority: P0
- Operational Statement: The system must provide a visual dispatch management board displaying scheduled, loading, and in-transit consignments, matching confirmed sales orders to allocated warehouse lots and transport vehicles.
- Data Attributes: Dispatch ID (
DISP-YYYYMM-xxx), Dispatch Date, Linked Sales Order ID, Customer Name, Destination City, Commodity, Dispatch Qty MT, Assigned Vehicle Reg No, Driver Details, Status (Scheduled,Loading,In Transit,Delivered). - Validation Rules: Dispatch cannot be created without an approved sales order and assigned vehicle.
BRD-FR-025: Outbound Weighbridge & Dispatch Bilty/Manifest
- Owning Module: Logistics & Weighbridge
- Primary Persona: Yard Supervisor / Logistics Coordinator
- Priority: P0
- Operational Statement: The system must capture outward weighbridge weights for loaded dispatch trucks (Tare truck before loading, Gross truck after loading), verify loaded weight against order MT, and generate a printable transport manifest / Bilty.
- Data Attributes: Dispatch ID, Outward Tare kg, Outward Gross kg, Net Loaded MT, Loaded Bag Count, Transporter Bilty No, e-Way Bill No.
- Validation Rules: Net loaded MT must match allocated order MT within
\pm 1.0\%loading tolerance.
BRD-FR-026: In-Transit Tracking & Proof of Delivery (POD)
- Owning Module: Logistics
- Primary Persona: Logistics Coordinator
- Priority: P0
- Operational Statement: The system must track dispatch states from
In TransittoDelivered. Upon consignee receipt, the Logistics Coordinator logs confirmation date, destination weighment, and uploads POD document reference. If destination weighment or quality parameters reveal a transit shortage or damage acknowledged by the buyer, the system must allow recording a Consignee Shortage Note and automatically generating a compensating Sales Credit Note against the customer ledger without altering the immutable outbound dispatch manifest. - Data Attributes: Transit Status, Departure Date/Time, Expected Delivery Date, Actual Delivery Date, Destination Weighbridge Net MT, Transit Loss MT, Consignee Acknowledgement Note, POD Ref, Credit Note ID (if applicable).
- Validation Rules: Setting status to
Deliveredtriggers automatic generation of finalized Sales Invoice. Consignee shortage deductions exceeding 2.0% require mandatory Sales Manager approval before issuing Credit Note.
5.8 Module 8: Fleet & Vehicle Management
BRD-FR-027: Transport Fleet Registry
- Owning Module: Logistics & Fleet
- Primary Persona: Logistics Coordinator
- Priority: P1
- Operational Statement: The system must maintain a registry of transport trucks (owned and contract carriers) including registration number, vehicle model, gross payload capacity in MT, ownership type (
OwnvsContract), insurance/fitness expiry dates, and operational status (Available,On Route,Maintenance). - Data Attributes: Vehicle Reg No, Make/Model, Payload Capacity MT, Ownership Type, Transporter Name, Status, Fitness Expiry Date.
- Validation Rules: Vehicles with status
Maintenancecannot be assigned to dispatches.
5.9 Module 9: Customer Receivables & Exposure Management
BRD-FR-028: Customer Ledger & Aging Statement
- Owning Module: Finance
- Primary Persona: Accounts Executive / Sales Manager
- Priority: P0
- Operational Statement: The system must maintain an immutable party sub-ledger for each customer, debiting finalized sales invoices, crediting payment receipts, and presenting a real-time outstanding balance and aging schedule (0–7 days, 8–15 days, 16–30 days, >30 days).
- Data Attributes: Customer ID, Posting Date, Voucher Type (
Sales Invoice,Payment Receipt), Voucher No, Debit Amount INR, Credit Amount INR, Running Outstanding INR. - Validation Rules: Sub-ledger entries are immutable; corrections require credit/debit adjustment vouchers.
BRD-FR-029: Automated Customer Credit Exposure Watch & Threshold Alert
- Owning Module: Finance & Alerts
- Primary Persona: Accounts Executive / Partner
- Priority: P0
- Operational Statement: The system must continuously recompute the customer exposure ratio (
\text{Outstanding} / \text{Credit Limit}). If exposure>80\%, the account must be automatically tagged with a visualWatchbadge, and an operational warning alert generated on the Executive Dashboard. - Data Attributes: Customer Code, Customer Name, Sanctioned Credit Limit INR, Outstanding INR, Exposure %, Risk Flag (
Normal,Watch,Critical). - Validation Rules: Evaluated in real time upon every sales invoice post and payment receipt post.
BRD-FR-030: Credit Breach Dispatch Lock & Partner Override
- Owning Module: Sales & Finance
- Primary Persona: Partner / Managing Director
- Priority: P0
- Operational Statement: If a customer's outstanding receivables exceed 100% of their sanctioned credit limit, all pending dispatches for that customer must be locked. Only a Partner user can record an explicit electronic approval override with mandatory justification notes to release the lock.
- Data Attributes: Lock Status (
Active,Overridden), Override Approved By, Override Reason, Timestamp. - Validation Rules: Override action permanently logged in audit trail.
5.10 Module 10: Payments, Payables & Expense Vouchers
BRD-FR-031: Customer Payment Receipt Posting
- Owning Module: Finance
- Primary Persona: Accounts Executive
- Priority: P0
- Operational Statement: The system must record customer payments capturing payment date, customer code, received amount in INR, payment instrument mode (
NEFT,RTGS,Cheque,Cash,UPI), bank reference/UTR number, and payment status (Pending Clearance,Cleared,Bounced). The system must enforce automatic reversal upon Cheque/Instrument Bounce: if an instrument status transitions toBounced, the system must immediately reverse the credit entry on the customer sub-ledger, restore the previous outstanding debt, recompute exposure ratio %, reinstate credit locks if exposure>100\%, and trigger an urgent financial alert. - Data Attributes: Receipt ID (
PAY-YYYYMM-xxx), Date, Customer ID, Amount INR, Payment Mode, UTR/Cheque No, Bank Name, Clearance Status, Bounce Reason, Reversal Voucher ID. - Validation Rules: Amount must be
> 0. Credit applied to customer ledger immediately uponClearedstatus. Reversal action generates immutable audit trail entry and notifies Accounts Executive and Sales Manager.
BRD-FR-032: Supplier Payables Aging & Balance Snapshots
- Owning Module: Finance
- Primary Persona: Accounts Executive / Partner
- Priority: P0
- Operational Statement: The system must track supplier payables arising from accepted GRNs, applying supplier credit days, generating aging schedules, and providing daily aggregate payables snapshots.
- Data Attributes: Supplier ID, GRN No, Invoice Amount INR, Due Date, Days Overdue, Payment Status (
Unpaid,Partially Paid,Paid). - Validation Rules: Automated calculation of due date based on GRN date + credit days.
BRD-FR-033: Mandi Operating Expense Classification & Recording
- Owning Module: Finance
- Primary Persona: Accounts Executive
- Priority: P1
- Operational Statement: The system must record operational expenses incurred in mandi and godown operations categorizing entries under: Labor / Hamali (loading/unloading), Freight / Cartage, Weighbridge Fees, Godown Rent, Mandi Cess, Pest Control/Fumigation, and Office Expenses.
- Data Attributes: Expense ID (
EXP-YYYYMM-xxx), Date, Category, Amount INR, Payee / Vendor, Linked Consignment / Sauda (if applicable), Payment Mode, Status. - Validation Rules: Expense vouchers must balance against cash/bank ledger accounts.
5.11 Module 11: Real-Time Operational Alerts & Executive Analytics
BRD-FR-034: Real-Time Operational Alerts Engine
- Owning Module: Management & Alerts
- Primary Persona: Partner / Operations Supervisor
- Priority: P0
- Operational Statement: The system must evaluate active business data and publish automated proactive alerts across four critical categories:
- QC Pending Alert: Lots in state
Under QCfor>24hours or currently onQC Hold. - Warehouse Capacity Alert: Godowns exceeding 85% storage capacity utilization.
- Credit Risk Alert: Customer accounts exceeding 80% or 100% of sanctioned credit limit.
- Active Procurement Window Alert: Mandis with open buying orders during active trading hours.
- QC Pending Alert: Lots in state
- Data Attributes: Alert ID, Severity (
Info,Warning,Critical), Category, Title, Detail Text, Timestamp, Dismissed Status. - Validation Rules: Evaluated synchronously upon transaction mutations and refreshed periodically.
BRD-FR-035: Executive Control Centre Dashboard
- Owning Module: Management
- Primary Persona: Partner / Managing Director
- Priority: P0
- Operational Statement: The system must provide a unified operational dashboard displaying real-time metrics: Total Stock on Hand (MT), Total Active Stock Lines, Intraday Purchase Value INR, Intraday Sales Revenue INR, Total Customer Receivables INR, Top 10 Stock Lines by Volume, Top Recent Sales, and Warehouse Utilization Barometers.
- Data Attributes: KPI Metric Cards, Warehouse Position Table, Top Stock Grid, Recent Sales Feed, Active Alerts Feed.
- Validation Rules: Dashboard must load within
\le 1.5\text{s}.
BRD-FR-036: 20-Day Consolidated Trading Trend Reporting
- Owning Module: Management & Reporting
- Primary Persona: Partner / Managing Director
- Priority: P0
- Operational Statement: The system must compile daily management snapshots across a rolling 20-day trading window, tabulating: Date, Purchases MT, Sales MT, Closing Stock MT, Total Receivables INR, and Total Payables INR.
- Data Attributes: Daily Snapshot Array (Date, Purchases MT, Sales MT, Stock MT, Receivables INR, Payables INR).
- Validation Rules: Dynamically calculated from transaction ledgers; sub-second query performance.
5.12 Cross-Cutting & Governance Modules
BRD-FR-037: Agricultural Commodity Master Data Management
- Owning Module: Master Data
- Primary Persona: System Administrator
- Priority: P0
- Operational Statement: Maintain authoritative master catalogs for: Commodities (Chana, Soybean, Mustard, Wheat, Coriander, Cumin, Fenugreek, Groundnut, Isabgol, Jaggery, Maize, Turmeric), Varieties per commodity (e.g., Lokwan, Pusa, Eagle/Badami), and Commercial Quality Grades (
FAQ,Premium,Below FAQ). - Data Attributes: Commodity Code, Commodity Name, Category (
Grains,Pulses,Oilseeds,Spices), Varieties List, Standard Bag Weight kg. - Validation Rules: Commodity code must be unique; cannot delete commodities with active stock ledger entries.
BRD-FR-038: Trading Counterparty Masters (Suppliers, Customers & Godowns)
- Owning Module: Master Data
- Primary Persona: System Administrator / Accounts Executive
- Priority: P0
- Operational Statement: Maintain registries for: (1) Suppliers (Code, Name, City, Segment, Credit Days: 7/15/21), (2) Customers (Code, Name, City, Segment, Credit Limit INR, Contact), and (3) Godowns/Warehouses (Code, Name, City, Capacity MT).
- Data Attributes: Entity Code, Name, Address, GSTIN/PAN, Bank Details, Status (
Active,Inactive). - Validation Rules: Tax IDs validated where applicable.
BRD-FR-039: Site-Based Multi-Tenancy (database_per_tenant)
- Owning Module: Architecture & Security
- Primary Persona: System Administrator
- Priority: P0
- Operational Statement: Multi-tenancy must be enforced via Frappe site architecture (
database_per_tenant). Each trading enterprise runs on an independent MariaDB database within the shared Frappe Bench environment, ensuring strict cryptographic and database isolation of transactions, ledgers, and master data. - Data Attributes: Frappe Site Name, MariaDB Database Name, Tenant Admin Account.
- Validation Rules: No cross-database queries or shared connection pools permitted.
BRD-FR-040: Role-Based Access Control (RBAC) & Permission Scoping
- Owning Module: Security
- Primary Persona: System Administrator
- Priority: P0
- Operational Statement: Access to custom DocTypes, list views, and actions must be governed by Frappe Role Permission Manager across defined roles:
Mandi Buyer,Purchase Manager,Yard Supervisor,Quality Officer,Sales Executive,Sales Manager,Logistics Coordinator,Accounts Executive,Partner / MD, andSystem Manager. - Data Attributes: Role Name, DocType Permission Matrix (
Read,Write,Create,Delete,Submit,Cancel,Amend). - Validation Rules: Segregation of duties enforced: Quality Officers cannot edit prices; Yard Supervisors cannot confirm sales; Sales Executives cannot override credit locks.
BRD-FR-041: Immutable Transaction Audit Logging
- Owning Module: Governance
- Primary Persona: System Administrator
- Priority: P0
- Operational Statement: All submitted business documents (GRNs, Sales Orders, Dispatches, Payment Receipts) must be immutable. Amendments require Frappe document versioning (
amended_from). The system must record audit logs capturing user ID, timestamp, IP address, and old vs. new values for all mutations. - Data Attributes: Audit Trail Log ID, Document Type, Document Name, Modified By, Modified Timestamp, Field Diff JSON.
- Validation Rules: Audit logs cannot be deleted or modified through the user interface.
6. Non-Functional Requirements & Constraints (BRD-NFR-xxx)
| NFR ID | Requirement Area | Statement & Quantitative Metric | Priority |
|---|---|---|---|
BRD-NFR-001 |
Commercial Calculation Integrity | Dual-unit mathematical conversions (\text{Value} = \text{MT} \times 10 \times \text{Rate}_{\text{Qtl}}) and bag tare deductions must maintain decimal precision to 3 decimal places for weight and 2 decimal places for currency without rounding drift. |
P0 |
BRD-NFR-002 |
UI Rendering Performance | Frappe Desk views, forms, and executive dashboards must achieve page load rendering times \le 1.5\text{ seconds} on standard broadband (10 Mbps). |
P0 |
BRD-NFR-003 |
API Latency SLAs | Standard resource CRUD endpoints and list filter queries must achieve response latencies \le 250\text{ ms} (p95) under normal operating load. |
P0 |
BRD-NFR-004 |
High-Volume Reporting SLA | 20-day trading trend snapshots and multi-godown stock position reports must generate in \le 1.0\text{ second} across historical ledgers containing \ge 50,000 transaction rows. |
P0 |
BRD-NFR-005 |
Programmatic FSM Invariant Protection | Finite State Machines for Lot Quality (Under QC \rightarrow QC Hold / Released) and Outbound Dispatches must be enforced in Python backend controller hooks (validate, on_submit), preventing client-side script or API bypass. |
P0 |
BRD-NFR-006 |
Tenant Data Isolation | Each tenant firm must reside in a dedicated MariaDB database via Frappe sites (database_per_tenant), guaranteeing zero possibility of cross-tenant leakage. |
P0 |
BRD-NFR-007 |
Offline Sandbox Testability | All third-party integration adapters (Identity, Payment Gateway) must provide deterministic local mock adapters under sandbox/ capable of 100% offline, reproducible CI/CD execution without external network access. |
P0 |
BRD-NFR-008 |
Automated Test Coverage Budgets | Code must meet UP-AI differentiated coverage budgets: \ge 95\% statement/branch coverage for backend domain services and FSMs, \ge 90\% for sandbox adapters, and \ge 80\% for frontend components. |
P0 |
7. Scope Boundaries & Explicit Anti-Scope
7.1 In Scope for Version 1.0 (MVP)
- All 41 functional features (
BRD-FR-001throughBRD-FR-041) and 8 NFRs across the 11 operational modules. - Standalone custom Frappe application architecture (
agri_app) with dedicated custom DocTypes. - Complete operational workflows matching the RamDayal prototype demonstration dataset.
- Responsive Frappe Desk UI accessible on desktop and mobile godown tablets.
- Automated multi-path test suites (
\ge 95\%domain coverage) and 21-sheet Excel QA Workbook compilation.
7.2 Explicit Anti-Scope (Deferred to Future Releases)
- Direct ERPNext Core Ledger Coupling: No dependency on standard ERPNext
Stock Ledger EntryorGL Entryin v1.0. - Hardware Serial Weighbridge Drivers: Manual entry and supervisor verification of weighbridge tickets; direct COM port/IP serial driver ingestion deferred.
- Continuous GPS Vehicle Telematics: Vehicle transit state managed via Dispatch Board FSM; live satellite map streaming deferred.
- National e-NAM Bidding API: Electronic auction bidding with national government portals deferred.
- Multi-Currency / Forex Settlement: Transactions strictly denominated in Indian National Rupees (INR / ₹).
- Lab Spectrometry Hardware Ingestion: Quality Officer enters physical test parameters manually after inspection.
8. Requirements Traceability Root Matrix
| Module | Granular Feature IDs | Priority | Target Use Cases (Stage 5) |
|---|---|---|---|
| Market Desk | BRD-FR-001, BRD-FR-002, BRD-FR-003, BRD-FR-004 |
P0 / P1 | UC-001 (Market Intelligence & Price Tracking) |
| Procurement (Sauda) | BRD-FR-005, BRD-FR-006, BRD-FR-007 |
P0 / P1 | UC-002 (Mandi Auction Purchase Sauda Booking) |
| Goods Receipt (GRN) | BRD-FR-008, BRD-FR-009, BRD-FR-010, BRD-FR-011, BRD-FR-012 |
P0 | UC-003 (Weighbridge Inward & Godown Intake) |
| Quality & Lots | BRD-FR-013, BRD-FR-014, BRD-FR-015, BRD-FR-016, BRD-FR-017 |
P0 / P1 | UC-004 (Commodity Lot QC Inspection & FSM) |
| Warehouse Inventory | BRD-FR-018, BRD-FR-019, BRD-FR-020 |
P0 | UC-005 (Multi-Godown Stock Ledger & Transfers) |
| Sales Orders | BRD-FR-021, BRD-FR-022, BRD-FR-023 |
P0 | UC-006 (Customer Sales Contract & Allocation) |
| Logistics & Dispatch | BRD-FR-024, BRD-FR-025, BRD-FR-026 |
P0 | UC-007 (Outbound Dispatch Board & Transport) |
| Fleet Management | BRD-FR-027 |
P1 | UC-008 (Transport Fleet & Vehicle Master) |
| Customer Receivables | BRD-FR-028, BRD-FR-029, BRD-FR-030 |
P0 | UC-009 (Customer Receivables & Credit Limit Watch) |
| Payments & Expenses | BRD-FR-031, BRD-FR-032, BRD-FR-033 |
P0 / P1 | UC-010 (Payment Receipts & Mandi Expenses) |
| Alerts & Dashboard | BRD-FR-034, BRD-FR-035, BRD-FR-036 |
P0 | UC-011 (Executive Control Centre & Analytics) |
| Master Data & Security | BRD-FR-037, BRD-FR-038, BRD-FR-039, BRD-FR-040, BRD-FR-041 |
P0 | UC-012 (Master Data, Multi-Tenancy & RBAC) |