ForkFit Docs
ServerDatabase

Database Seeding (Indian Food & Prices)

Overview of the database seeding mechanism using the Indian Food Dataset CSV and initial costs.

Database Seeding (Indian Food & Prices)

This section explains the ingestion process for seeding the ForkFit database with standard Indian recipe and nutrition datasets, pricing structures, and RAG search embeddings.

Ingestion script: seed_database.py
Source datasets:


1. Raw Seeding Datasets

The raw data is stored in the following source files:

  • initial_food_costs.json: Key-value listing mapping food name patterns (e.g. 'paneer') to baseline costs per 100 grams.
  • IndianFoodDatasetCSV.csv: Contains details of ingredients, cuisines, preparation times, instructions, courses, and source URLs for thousands of Indian recipes.

2. Ingestion Flow

The Python ingestion script performs the following operations inside a single transactional block:

Start seed_database.py Seed raw_food_costs from initial_food_costs.json Parse IndianFoodDatasetCSV.csv Seed food_items and auto-link to matching raw_food_costs Insert recipes and map food item quantities Generate/cache 1536-dim recipe embeddings via Ollama Commit Transaction

Environment Configuration

The script reads connection parameters from a .env file loaded from the path directories:

  • DATABASE_URL: PostgreSQL connection string.
  • CSV_PATH: Path to the raw recipes CSV.
  • OLLAMA_HOST / OLLAMA_BASE_URL: Base address of your local Ollama server (for generating text embeddings).
  • EMBEDDING_MODEL: Name of the text embedding model (e.g., 'nomic-embed-text').

3. How to Run the Seeding Script

Make sure you have your virtual environment activated and dependencies installed, then run the python script:

# Ensure environment variables are loaded or declare them inline
python server/intelligence/scripts/seed_database.py

On this page