Skip to content

Implement SQLite-based product mapping persistence & scraped metadata #5

Description

@ddvlamin

Summary

Integrate a persistent SQLite database for resolving recipe ingredients to specific Colruyt product IDs using rapidfuzz for string similarity lookup, and scraping detailed product specifications from the Colruyt RTI portal.

Motivation

  • Persist User Choices: Store associations between a cleaned ingredient name and a specific Colruyt product.
  • Fuzzy Search Lookup: Query the database using fuzzy matching (rapidfuzz) before hitting the live APIs or asking the user.
  • Scrape Rich Metadata: Dynamically fetch product details (description, content, conservation info, usage info) from rti.colruytgroup.com so the AI assistant can auto-resolve ambiguities before prompting the user.
  • MCP API Refactoring: Keep the server interface clean and focused by exposing high-level resolution and mapping tools.

Proposed Solution

  1. Database Storage and Schema:
    • Database File: resources/colruyt_mappings.db.
    • Table product_mappings: cleaned_ingredient (TEXT PRIMARY KEY), product_id (TEXT NOT NULL), product_name (TEXT NOT NULL), product_brand (TEXT), product_description (TEXT), conservation_info (TEXT), usage_info (TEXT), content (TEXT), created_at (TIMESTAMP DEFAULT CURRENT_TIMESTAMP).
  2. Fuzzy Matching:
    • Install rapidfuzz as a dependency.
    • Use rapidfuzz.process.extractOne to check the database before executing search (threshold >= 80/100, token_sort_ratio).
  3. Scraping Strategy:
    • Fetch specifications from rti.colruytgroup.com/nl/product-info/{technicalArticleNumber} matching the first GTIN or first available barcode block.
  4. MCP Tools changes:
    • Expose new resolve_ingredient and save_product_mapping tools.
    • Keep add_recipe_to_list and add_items_to_list.
    • Remove get_most_bought_products and search_products from public tools.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions