Epic 1 - Knowledge Graph

LWKG Knowledge Graph Platform

Comprehensive health and wellness knowledge base with semantic search and intelligent recommendations

Test Coverage
90%
20+ Unit Tests
Foods Database
5,120+
Nutrition Data
Recipes
2,500+
Pre-Made Plans
Activities
100+
Exercise Types

Core Capabilities

Food Database Features

Comprehensive Nutrition Data

Each food item includes:

  • Calories per 100g
  • Protein, carbs, fat, fiber
  • Micronutrients (vitamins, minerals)
  • Glycemic index/load
  • Allergen information

Food Classification

Organized by:

  • Food groups
  • Diet types (vegan, keto, etc.)
  • Cultural cuisines
  • Processing level
  • Health considerations

Semantic Embeddings

pgvector integration:

  • 1536-dimensional embeddings
  • Similarity-based search
  • Fast retrieval (<100ms)
  • Nearest neighbor queries
  • Custom similarity scoring

Data Freshness

Maintained by:

  • Regular nutrition database sync
  • Version tracking
  • Change history audits
  • Expert review workflows
  • User feedback integration

Recipe System

Recipe Management: Complete recipe management system with automated nutrition calculation from ingredient composition. Each recipe includes preparation time, difficulty level, cuisine type, and serving information. Recipes are automatically tagged with allergens based on ingredients.

Recipe Features:

Activity & Exercise Database

Activity Metrics

Each activity includes:

  • MET value for calorie burn
  • Intensity level
  • Duration range
  • Equipment needed
  • Difficulty classification

Activity Categories

  • Aerobic exercises
  • Strength training
  • Flexibility & stretching
  • Sports & recreation
  • Occupational activities

Search Capabilities

SEMANTIC Vector similarity search with configurable thresholds

KEYWORD Full-text search across names, descriptions, and tags

FILTER Advanced filtering by nutrition, allergens, diet type, and more

COMBINATION Hybrid search combining semantic and keyword approaches

API Endpoints

GET /api/v1/foods?q=chicken&limit=10 - Search foods

GET /api/v1/foods/{food_id} - Get food details

GET /api/v1/recipes?cuisine=indian&limit=20 - Search recipes

GET /api/v1/recipes/{recipe_id} - Get recipe details

GET /api/v1/activities?mets=5-7 - Search activities by intensity

GET /api/v1/activities/{activity_id} - Get activity details

POST /api/v1/foods/semantic-search - Semantic search endpoint

GET /api/v1/foods/allergens/{allergen} - Find foods with specific allergen

Performance Metrics