Quinto Trade Document Validation

    by Rajasekhar Vedula

    1

    Automate OCR extraction and cross-document validation for international trade documents in FastAPI.

    Free

    Security scanned

    Works with the AI Agents you already use

    Quinto Trade Document Validation

    Example session with this skill installed

    Add support for a 'Packing List' document type. It needs to extract the TotalWeight and TotalPackages fields and validate them against the Master Registry.

    • Read your context and instructions
    • Compiled the quinto trade document

    I have updated the Quinto pipeline to support the 'Packing List' document type. This involved adding the new enum to the extractor, defining OCR-tolerant labels for weight and package counts, and updating the Master Registry to enable cross-document validation with the Bill of Lading.

    Implementation Details

    
    # extractor.py additions
    class DocumentType(str, Enum):
        # ... existing types
        PACKING_LIST = "packing_list"
    
    PACKING_LIST_KEYWORDS = ["packing list", "lista de empaque", "p/l"]
    
    # main_input.py mapping
    DOC_TYPE_LABELS = {
        DocumentType.PACKING_LIST: "Packing List",
        # ...
    }
    
    # field_checker.py Registry Update
    MASTER_REGISTRY = {
        "Packing List": {
            "TotalWeight": {"type": "numeric", "required": True},
            "TotalPackages": {"type": "numeric", "required": True}
        }
    }
    
    FIELD_ALIASES = {
        "TotalWeight": ["gross weight", "total mass", "gw"],
        "TotalPackages": ["total pkgs", "number of parcels", "qty"]
    }
    

    Next steps

    1. Add a sample PDF to samples/packing_list.pdf to test OCR extraction accuracy.
    2. Run pytest tests/test_extractor.py to verify the new keyword classification.
    3. Update output.html if you need to display the new fields in a specific sub-section of the report.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Inconsistent data across shipping manifests, bills of lading, and invoices creates massive bottlenecks in trade finance. This skill extends or repairs the Quinto FastAPI pipeline to automate OCR extraction and cross-document validation for international trade paperwork.

    What it does

    • Document classification defines and extracts specific DocumentType values from raw PDF scans.
    • Cross-document validation checks extracted fields against a Master Registry to find discrepancies between related documents.
    • OCR-tolerant extraction utilizes Tesseract and Poppler with specific keyword normalization for noisy scans.
    • Semantic review implements Gemini for text-heavy comparisons like addresses, ports, and entity names.
    • Deterministic checking maintains local logic for quantities, weights, and HS codes to ensure reliability.
    • Report generation flattens extraction results and validation issues into UI-ready API responses.

    How it works

    1. Define extraction logic in extractor.py to handle new document types or OCR-tolerant labels.
    2. Map labels in main_input.py to ensure the extractor output aligns with validation requirements.
    3. Configure the Registry in field_checker.py to set the rules for cross-document field comparisons.
    4. Update the UI contract to reflect new report keys or validation categories in the web frontend.

    Frameworks & tools

    Built for FastAPI backends using Poppler, pdf2image, and Tesseract for the OCR layer. It uses Google Gemini for LLM-based semantic validation and pytest for integration coverage.

    Why this beats prompting it yourself

    Generic prompts fail to maintain the strict document-to-registry mapping required for trade compliance. This skill ensures changes are applied across all layers, from extraction enums to validation aliases, preventing breaking changes in the reporting schema.

    Use cases

    • Add a new trade document type like a Certificate of Origin to the pipeline.
    • Implement specialized validation rules for HS code consistency across an invoice and packing list.
    • Repair OCR extraction failures for specific shipping line document formats.
    • Integrate Gemini for smarter address matching between different document issuers.

    Known limitations

    OCR integration tests require Tesseract and Poppler to be installed on the host system. Gemini validation requires environment-configured credentials and falls back to local logic if unavailable.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free to use

    No account required to browse

    Frequently Asked Questions

    This skill automates the extraction and cross-referencing of data between trade documents like bills of lading and invoices, identifying discrepancies that usually cause delays in trade finance and customs clearance.

    The skill is designed specifically for FastAPI-based AI agents and requires Python, Tesseract OCR, and Poppler to be installed on your host system for document processing.

    Yes, the logic is highly modular; you can add new document types like Certificates of Origin or modify validation rules for specific HS codes within the provided script structure.

    The purchase includes the core OCR extraction layer, the semantic validation engine powered by Gemini, the deterministic field-checking logic, and a standardized API reporting schema.

    It uses a hybrid approach: Tesseract handles the raw text extraction, while Gemini performs semantic reviews for complex fields like varying address formats or entity names that deterministic logic might miss.

    The skill includes built-in fallback logic that reverts to local, deterministic checking if the Gemini API is unreachable, ensuring your trade pipeline doesn't come to a total halt.

    New in APIs & Backend

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for APIs & Backend.

    Free