How iofaraz/rag works
Nutrix is a nutrition question-answering application. A user submits a question in the chat; the frontend requests an answer, and the backend runs vector and knowledge-graph retrieval before returning an AI-generated response and nutrition sources for display. The graph also supports category and curated nutrient–goal knowledge. The README provides no capability details, and some frontend-to-backend wiring and storage setup were not excerpted; uncertain connections are omitted or marked unverified.
Main entry points: graph_builder.py Graph builder · ChatInterface.js Chat interface · rag_pipeline.py RAG pipeline · main.py Query endpoint
Components 20
Question interface
- Chat interface
frontend/src/components/chat/ChatInterface.js - Chat views
frontend/src/components/chat - Retrieved sources
frontend/src/components/results/RetrievedSources.js - Source card
frontend/src/components/results/SourceCard.js - API client
frontend/src/services/api.js
Backend API
- Query endpoint
backend/app/main.py - Query schemas
backend/schemas/query.py - Response adapter
backend/services/rag.py
Answer retrieval
- RAG pipeline
rag/rag_pipeline.py - Vector retrieval
rag/retriever.py - Chroma store
rag/create_vector_db.py - LLM client
rag/llm_client.py
Nutrition knowledge
- Graph retrieval
graph/graph_retriever.py - Neo4j graph
- Graph builder
graph/graph_builder.py - Category resolver
graph/category_resolver.py - Graph schema
graph/schema.py - Curated knowledge
graph/seed_knowledge.py
Other components
- User
- Groq service
Connections 20
- User → Chat interface: asks
frontend/src/components/chat/ChatInterface.js - Chat interface → Chat views: renders
frontend/src/components/chat/ChatInterface.js - Chat interface → API client: requests answer
frontend/src/components/chat/ChatInterface.js - API client → Query endpoint: sends query
- Query endpoint → Query schemas: validates and shapes
backend/app/main.py - Query endpoint → Response adapter: calls
backend/app/main.py - Response adapter → RAG pipeline: calls
backend/services/rag.py - RAG pipeline → Vector retrieval: retrieves foods
rag/rag_pipeline.py - RAG pipeline → Graph retrieval: retrieves graph data
rag/rag_pipeline.py - RAG pipeline → LLM client: generates answer
rag/rag_pipeline.py - Vector retrieval → Chroma store: queries
rag/retriever.py - LLM client → Groq service: sends prompt
rag/llm_client.py - Graph retrieval → Neo4j graph: queries
graph/graph_retriever.py - Graph builder → Graph schema: uses schema
graph/graph_builder.py - Graph builder → Category resolver: resolves categories
graph/graph_builder.py - Graph builder → Curated knowledge: seeds curated data
graph/graph_builder.py - Graph builder → Neo4j graph: writes graph
graph/graph_builder.py - Curated knowledge → Neo4j graph: writes curated links
graph/seed_knowledge.py - Chat interface → Retrieved sources: displays records
frontend/src/components/chat/ChatInterface.js - Retrieved sources → Source card: renders cards
frontend/src/components/results/RetrievedSources.js