How abdullahlali/sugarsage works
Project Type and Purpose
• SugarSage is clearly a full-stack web application that integrates machine learning (for diabetes prediction) and natural language processing (for the chatbot).
• The backend is built with Flask (Python) and leverages Scikit-Learn, Pandas, and NLP libraries (including NLTK), while the frontend uses Tailwind CSS and JavaScript.
• Key functionalities include RESTful API interactions between the frontend and backend, real-time model predictions (via a regression model) and a chatbot powered by TF-IDF vectorization with SVM classification.
Analyzing the File Structure
• The top-level directories and files indicate separation of concerns:
• The “app” directory hosts the back-end application code (app.py), machine learning models (model.pkl, vectorizer.pkl, xtrainvectors.pkl), dataset files (cleaned_diabetes_dataset.csv, dataset.pkl), and supporting scripts (makeDataset.py, saveModel.py, download_nltk_data.py). It also contains NLTK data necessary for NLP functionality.
• The “assets” and “index.html” together with “script.js” indicate the front-end components, providing the user interface.
• The “tests” directory (with Selenium tests) and “.github/workflows” (for CI tests like selenium-tests.yml) show that testing and continuous integration processes are incorporated.
• Configuration and deployment files like “Procfile” indicate deployment on Heroku.
Key Architectural Components
• Frontend: Includes static files (index.html, script.js, assets) styled with Tailwind CSS. This layer deals with user interactions and presents a responsive UI.
• Backend API: The Flask application (app/app.py) acts as the server that handles RESTful API endpoints. It bridges requests from the frontend to the business logic.
• Machine Learning & NLP Components:
• Model Components: The diabetes prediction model (model.pkl, vectorizer.pkl, xtrainvectors.pkl, dataset files) and supporting scripts (makeDataset.py, saveModel.py) handle data preparation and predictions.
• Chatbot Component: Utilizes TF-IDF and SVM (as described in the README) along with NLTK resources for natural language processing (data stored in app/nltk_data).
• Deployment & CI/CD: The “Procfile” and GitHub workflows indicate automated deployment (Heroku) and testing routines (Selenium testing).