How shushilshah/student-depression-prediction-system works
Major Components
• Frontend/UI: Represented by the Streamlit app (app.py), which acts as the user interface where users enter information.
• Machine Learning Pipeline:
• Data Ingestion (src/components/data_ingestion.py) to load and structure data (with dependencies on the dataset in the data/ folder).
• Data Transformation (src/components/data_transformation.py) that processes the raw data.
• Data Validation (src/components/data_validation.py) ensuring consistency and quality.
• Model Trainer (src/components/model_trainer.py) that trains the prediction model.
• Model Evaluation (src/components/model_evaluation.py) which assesses model performance.
• Pipeline Orchestration: The training pipeline (src/pipeline/training_pipeline.py) that strings together these components in sequence.
• Database Integration: MongoDB Atlas used to both fetch whole data for training dynamically and to save prediction history.
• Utility and Support Modules: Including configurations (src/configuration/ db_connection.py for database settings), logging (src/logger/ for standardized logging), and utilities (src/utils/main_utils.py) that support various operations.
• Exception Handling: Modules under src/exception help capture and manage errors.
• Testing: Several “test” files in the components folder (e.g., test_data_ingestion.py) showcase the emphasis on validation and unit testing of the components.
Relationships and Data Flow
• The Streamlit UI (app.py) collects user input. Once the user submits data, the application calls the prediction module which makes use of the pre-trained model (model.pkl) or triggers the training pipeline (via src/pipeline/training_pipeline.py).
• The ML pipeline components form a sequential flow: starting with data ingestion, then transformation, validation, model training, and finally evaluation. Each stage feeds its output to the next.
• MongoDB Atlas is integrated for:
• Reading the entire dataset for training (dynamic due to each new user input).
• Storing each prediction result.
• Utility modules provide supporting functions while configuration files set up connections (e.g., db_connection.py in src/configuration).
Architectural Patterns and Design Principles
• Modular Design: The code is broken up into multiple components (e.g., ingestion, transformation, training), following a microservices-like approach within the same project.
• Separation of Concerns: There is a clear boundary between the UI (app.py), backend processing (ML pipeline), and database operations (MongoDB integration).
• Reusability & Testability: With dedicated test modules for each main component, the design supports robust testing and reliability.
• Configuration Management: Database connectivity and potentially other environment settings are handled through specific modules and a .env file.