How ankrutee/nexturn-projectelective works
Main Components
• Terminal Application (main.py): Handles user input, SQL query generation, and database connectivity.
• Web Application (app.py): A Streamlit-based interface that offers user-friendly interactive features.
• Database: Represented by bank.sql (the database schema), schemaBank.txt (schema details), and trialQueries.txt (tested queries). This component manages the banking data.
• NLP / GPT Integration: Although not shown as a separate file, both main.py and app.py integrate with OpenAI’s GPT model (and Mistral AI) for processing natural language queries.
• Dependency Management: requirements.txt ensures that all necessary libraries are installed.
Relationships and Interactions
• The Terminal and Web interfaces serve as entry points for users. Both collect queries from the user.
• User queries are sent to the query generation component that uses embedded schema details (from schemaBank.txt) and tested SQL samples (trialQueries.txt) to generate analytical SQL queries.
• The generated SQL queries are then executed against the banking database (whose structure is defined in bank.sql).
• NLP components interact with the query generation logic by using OpenAI and Mistral AI APIs to process natural language into SQL.
• Database connectivity is handled within main.py (and potentially in app.py) where the connect_to_mysql() function is updated with relevant credentials.
Architectural Patterns and Technologies
• Separation of Concerns: Two distinct frontends (terminal and web) clearly separate user interaction layers from the back-end query generation.
• Integration with External APIs: The project uses external services (OpenAI API, Mistral AI). Their role in enriching the NLP capabilities must also be represented.