How celiksa/analytics-ai works
The Analytics AI project is a full-stack application designed to allow users to query PostgreSQL databases using natural language through an intelligent chat interface. The system leverages a React & TypeScript frontend along with a Python FastAPI backend that integrates with GPT-4o for query translation and result visualization.
Main Components
• Frontend: Represent the React-based application (located under the src directory), which manages chat UI, visualizations, and database selection.
• Backend: Show the FastAPI service (files located in the api directory) that processes API requests such as translating natural language questions to SQL, handling database connections, query processing, and generating visualizations.
• External Services: Include the LLM integration (OpenAI API) as an external dependency for query translation and analytics.
Their Relationships and Interactions
• Interaction between the backend and external services (OpenAI API) for natural language processing and query conversion.
Important Architectural Patterns and Design Principles
• Separation of concerns: Ensure a clear separation between the presentation layer (frontend UI) and business logic (backend FastAPI service).
• API Design: Illustrate the RESTful or WebSocket endpoints provided by FastAPI, as noted in the README.
• Modularization: Emphasize that the project is split into clearly defined directories (e.g., api for backend and src for frontend) to simplify development, testing, and deployment.
• Visualization handling: Note that the backend is responsible for processing query results and generating visualizations when applicable.
Relevant Technologies and Frameworks
• Frontend: React, TypeScript, TailwindCSS.
• Backend: Python, FastAPI, and a few supporting files such as pydantic_documentation.pdf, configuration files, and scripts (crawl.py, psql_agent.py, etc.).
• Database: PostgreSQL (with connection credentials managed via .env files).