Validation Logic
This document describes the validation logic for user validated the mandi receipts in the bolbhav application.
Validation Queues
The system maintains two queues: a user queue and a team member queue.
The user queue has a limit of 50 pending receipts.
New receipts are sent to the team member queue if the user queue is full.
When the user queue has less than 50 receipts, pending receipts (where validation statuses are "not done") are added to the user queue.
Receipt Validation Workflow
The receipt validation process involves two stages:
Stage 1: User validation
User validation stage requires getting a receipt validated by two users. Each receipt that gets marked for user validation goes into a "user validation queue" where the validation output from both the users assigned are calculated.
For more details about how user validation queue is structured, visit the user_validation_queue table.
Receipt Selection for User Validation
When a user enters the receipt validation flow from the app, an API call is triggered that is responsible to find an eligible receipt for validation. The system prioritizes showing receipts from mandis where the user is not a follower (not present in the mandi_crop_follower
table).
The system creates a list of mandis sorted by the count of times prices have been viewed by the user (ascending order).
A receipt is selected
User validation workflow
A receipt is assigned to two validators.
Each validator is presented with nine questions about the receipt.
The first question is a knockout question: "क्या फोटो में मंडी नीलामी पर्ची साफ़ नज़र आ रही है?" (Is the mandi receipt visible in the photo?).
If the answer is "नहीं" (No), the remaining questions are skipped, and the user receives one silver token (explained later).
If the answer is "हाँ" (Yes), all nine questions must be answered.
Each question, except the first, has three options:
"हाँ" (Yes)
"नहीं" (No)
"दिख नहीं रहा है" (Not visible)
Response Recording
Validator responses are recorded in the user_sale_receipt_validations
table with question IDs and corresponding answer codes (A, B, or C).
Outcome Determination
Based on the output of the two validators, the following can happen:
If both receipt validators approve the receipt by answering "हाँ" (yes) to all questions, the system automatically approves the receipt. This is called Auto-Approval. After that, the system also rewards the contributor with the promised tokens. See the table below for reference.
If there is a mismatch in any of the question response between the two user validators, then the receipt goes into team member validation queue. That is Stage 2 of the validation process.
क्या फोटो में मंडी नीलामी पर्ची साफ़ नज़र आ रही है?
हाँ
हाँ
क्या ये {{receipt_date}} तारीख़ की नीलामी पर्ची है?
हाँ
हाँ
क्या ये {{mandi_name_hi}} मंडी की नीलामी पर्ची है?
हाँ
हाँ
क्या इस पर्ची पर {{crop_name_hi}} फ़सल का नाम लिखा हुआ है?
हाँ
हाँ
इस पर्ची का पुस्तिका क्रमांक {{booklet_number}} है?
हाँ
हाँ
इस पर्ची का अनुबंध क्रमांक {{receipt_id}} है?
हाँ
हाँ
क्या इस पर्ची {{price}} प्रति क्विंटल भाव लिखा है?
हाँ
हाँ
क्या इस पर्ची में अनुमानित वजन {{quantity}} क्विंटल लिखा है?
हाँ
हाँ
क्या पर्ची के पीछे {{crop_name_hi}} फसल साफ़ से दिख रही है?
हाँ
हाँ
Stage 2: Bolbhav team member validation
The team member reviews the receipt and validator responses.
The team member can:
Approve the receipt.
Reject the receipt, specifying one or more reasons from a predefined list.
Edit specific fields on the receipt before approving or rejecting.
Outcome Determination:
Team Member Approval: If the team member approves, the contributor receives tokens and the receipt validator also receives the token if the validator responses match to the team member responses according to the below-mentioned table then token has been granted to the corresponding validator.
Team Member Rejection: If a team member rejects a receipt and specifies rejection IDs during the rejection process, and if any validator's answers correspond with the responses provided in the table for each question, it indicates a match between the team member's and the validator's responses, confirming the validator's accurate validation of the receipt. Validators whose responses align with the team member will be granted a token.
To access details regarding reasons for receipt rejection based on ID, please check the rejection IDs table provided here.
Receipt Approve & Rejection Logic Table
क्या फोटो में मंडी नीलामी पर्ची साफ़ नज़र आ रही है?
Approves the receipt
If reject the receipt and mark one or more of the following reason_id: 6, 10, 11, 12, 13, 15, 16
NA
क्या ये {{receipt_date}} तारीख़ की नीलामी पर्ची है?
Approves the receipt
If reject the receipt and choose reason_id = 2
If reject the receipt and choose reason_id = 19
क्या ये {{mandi_name_hi}} मंडी की नीलामी पर्ची है?
If does not edit the mandi name
If edits the mandi's name
If reject the receipt and choose
reason_id = 3
क्या इस पर्ची पर {{crop_name_hi}} फ़सल का नाम लिखा हुआ है?
If does not edit the crop name
If edits the crop name
If reject the receipt and choose
reason_id = 20
इस पर्ची का पुस्तिका क्रमांक {{booklet_number}} है?
If does not edit the booklet number
If edits the booklet number
If reject the receipt and choose
reason_id = 5
इस पर्ची का अनुबंध क्रमांक {{receipt_id}} है?
If does not edit the receipt id
If the receipt id
If reject the receipt and choose
reason_id = 4
क्या इस पर्ची {{price}} प्रति क्विंटल भाव लिखा है?
If does not edit the price
If edits the price
If reject the receipt and choose
reason_id = 19
क्या इस पर्ची में अनुमानित वजन {{quantity}} क्विंटल लिखा है?
If does not edit the quantity
If edits the quantity
If reject the receipt and choose
reason_id = 19
क्या पर्ची के पीछे {{crop_name_hi}} फसल साफ़ से दिख रही है?
if approves the receipt
If reject the receipt and mark one or more of the following reason_id: 7 or 8
NA
What happens to validated_by and validated_time for a sale receipt when it is auto-approved?
Reward Recording in the user wallet ledger
Rewards are recorded as wallet ledger entries:
Tokens are debited from the
bank_membership_wallet
and credited to theuser_membership_wallet
.Reason: "पर्ची चेक करने पर" (For receipt validation)
Ref ID: user_sale_receipt_validations_id
For Reference below-mentioned is the ref_id of the user wallet. In this
32826
is the sale receipt ID.user_sale_receipt_validations_32826
Last updated