How naveen-thomas-george/nlp works
SportMind AI answers questions about sports participation, department records, policies, and statistics. A user logs in, submits a query, and receives a routed answer; ambiguous queries can pause for clarification and resume. The supervisor normalizes and classifies the query, extracts entities, decomposes it, then dispatches to SQL, document, analytics, cross-agent, or safe-decline handling. Document and SQL agents use model services; document processing also supports OCR. The UI displays results and can export CSV. Some subsystem links reflect explicit documentation or the source index; unsampled API-client wiring is left unverified.
Main entry points: nodes.py Pipeline and dispatch nodes · router.py Model router · sql_agent.py SQL agent · routes.py HTTP routes
Components 30
User interface
- Query UI
frontend/src/App.tsx - API client
frontend/src/api.ts
API and access
- FastAPI app
backend/app/main.py - HTTP routes
backend/app/api/routes.py - Demo authentication
backend/app/core/auth.py - CSV reporting
backend/app/agents/reporting_agent.py
Query orchestration
- Query entry and resume
backend/app/graph/run.py - Supervisor graph
backend/app/graph/supervisor_graph.py - Pipeline and dispatch nodes
backend/app/graph/nodes.py - Query state
backend/app/graph/state.py
Answer agents
- SQL agent
backend/app/agents/sql_agent.py - Document agent
backend/app/agents/document_agent.py - Analytics agent
backend/app/agents/analytics_agent.py - Schema context
backend/app/agents/schema_context.py - OCR processing
backend/app/ocr/ocr_agent.py - OCR preprocessing
backend/app/ocr/preprocess.py
NLP, models and data
- Intent classifier
backend/app/nlp/intent/predict.py - Intent labels
backend/app/nlp/intent/labels.py - Entity extraction
backend/app/nlp/ner/extractor.py - Query normalization
backend/app/nlp/normalization.py - Model router
backend/app/llm/router.py - Database sessions
backend/app/db/session.py - Database models
backend/app/db/models.py - ORM base
backend/app/db/base.py - Structured logging
backend/app/core/logging_config.py
Other components
- User
- Groq
- Gemini
- Ollama
- PostgreSQL database
Connections 34
- User → Query UI: submits query
frontend/src/App.tsx - Query UI → API client: calls
frontend/src/App.tsx - API client → FastAPI app: HTTP requests
- FastAPI app → HTTP routes: mounts routes
backend/app/main.py - HTTP routes → Demo authentication: checks access
backend/app/api/routes.py - HTTP routes → Query entry and resume: invokes query
backend/app/api/routes.py - HTTP routes → CSV reporting: exports CSV
backend/app/api/routes.py - Query entry and resume → Supervisor graph: builds graph
backend/app/graph/run.py - Supervisor graph → Pipeline and dispatch nodes: registers and routes
backend/app/graph/supervisor_graph.py - Supervisor graph → Query state: uses state
backend/app/graph/supervisor_graph.py - Pipeline and dispatch nodes → Query state: reads and updates
backend/app/graph/nodes.py - Pipeline and dispatch nodes → Query normalization: normalizes query
backend/app/graph/nodes.py - Pipeline and dispatch nodes → Intent classifier: classifies intent
backend/app/graph/nodes.py - Pipeline and dispatch nodes → Entity extraction: extracts entities
backend/app/graph/nodes.py - Pipeline and dispatch nodes → SQL agent: dispatches to
backend/app/graph/nodes.py - Pipeline and dispatch nodes → Document agent: dispatches to
backend/app/graph/nodes.py - Pipeline and dispatch nodes → Analytics agent: dispatches to
backend/app/graph/nodes.py - Pipeline and dispatch nodes → Model router: decomposes query
backend/app/graph/nodes.py - Pipeline and dispatch nodes → Document agent: calls for cross-agent
backend/app/graph/nodes.py - Pipeline and dispatch nodes → SQL agent: calls for cross-agent
backend/app/graph/nodes.py - SQL agent → Schema context: uses schema context
backend/app/agents/sql_agent.py - SQL agent → Database sessions: queries through
backend/app/agents/sql_agent.py - SQL agent → Model router: generates SQL with
backend/app/agents/sql_agent.py - Document agent → OCR processing: uses OCR
backend/app/agents/document_agent.py - Document agent → Model router: uses model
backend/app/agents/document_agent.py - OCR processing → OCR preprocessing: preprocesses with
backend/app/ocr/ocr_agent.py - Analytics agent → Database sessions: reads database
backend/app/agents/analytics_agent.py - Intent classifier → Intent labels: uses labels
backend/app/nlp/intent/predict.py - Database models → ORM base: extends
backend/app/db/models.py - Database sessions → PostgreSQL database: connects to
backend/app/db/session.py - Model router → Groq: calls provider
backend/app/llm/router.py - Model router → Gemini: falls back to
backend/app/llm/router.py - Model router → Ollama: falls back to
backend/app/llm/router.py - FastAPI app → Structured logging: configures
backend/app/main.py