Skip to content

ZoroTech/flutter_app

Repository files navigation

Mini Project Approval System

📋 Project Abstract

A comprehensive Flutter-based mobile and web application designed to streamline the mini project submission, review, and approval process for educational institutions. The system provides role-based interfaces for students, teachers, and administrators, featuring intelligent project similarity detection using TF-IDF algorithms, automated domain classification, and a three-tier approval workflow. Built with Firebase backend services, the application ensures real-time data synchronization, secure authentication, and scalable cloud infrastructure.

🎯 Problem Statement

Traditional academic project approval processes face several critical challenges:

  • Manual Duplication Detection: No systematic way to identify similar or duplicate project proposals
  • Inefficient Review Process: Time-consuming manual review and approval workflows
  • Poor Record Management: Lack of centralized database for historical project references
  • Limited Feedback Mechanism: Inadequate communication between students and faculty
  • Inconsistent Domain Classification: No standardized categorization of project types

💡 Proposed Solution

The Mini Project Approval System addresses these challenges through:

  • Automated Similarity Detection: TF-IDF and cosine similarity algorithms for duplicate prevention
  • Streamlined Digital Workflow: Three-tier approval system (approve/decline/reject) with feedback
  • Centralized Project Repository: Cloud-based storage with public access for historical projects
  • Intelligent Domain Assignment: AI-powered categorization based on project content analysis
  • Multi-Role Architecture: Dedicated interfaces for students, teachers, and administrators

📋 Table of Contents


🎯 Project Overview

Purpose

The Mini Project Approval System solves the problem of manually managing student project submissions, reviews, and approvals in academic institutions. It addresses several key challenges:

  • Duplicate Project Prevention: Automatically detects similar projects to prevent duplication
  • Streamlined Approval Process: Three-stage approval system (approve, decline for resubmission, reject permanently)
  • Historical Project Archive: Maintains a searchable database of approved projects for reference
  • Smart Domain Classification: Automatically suggests project domains based on content analysis
  • Multi-Role Access: Separate interfaces for students, teachers, and administrators

Problem Solved

Traditional project approval processes are time-consuming, prone to duplicates, and lack proper tracking. This system:

  • Reduces manual effort in detecting similar projects
  • Provides transparent feedback to students
  • Maintains an organized archive of approved projects
  • Enables data-driven decision making with similarity metrics
  • Limits project submissions to 4 per student to ensure quality over quantity

✨ Features

🎓 Student Features

  1. Student Registration

    • Email-based registration with @pvppcoe.ac.in domain validation
    • Team formation with leader and members
    • Year and semester selection
    • Teacher/guide selection from available faculty
  2. Project Submission

    • Submit up to 4 project proposals
    • Automatic similarity check against past approved projects
    • Real-time domain suggestion based on project content
    • Similarity score display with color-coded warnings
    • Rich text description support
  3. Project Tracking

    • Real-time status updates (pending, approved, declined, rejected)
    • Teacher feedback viewing
    • Resubmission capability for declined projects
    • Project search and filtering by status
    • Pull-to-refresh for latest updates
  4. Dashboard

    • Overview of all submitted projects
    • Status indicators and submission count
    • Quick access to resubmit declined projects
    • Offline status indicator

👨‍🏫 Teacher Features

  1. Teacher Dashboard

    • View all projects assigned to them
    • Projects grouped by team leader
    • Quick statistics on pending reviews
    • Real-time updates via Firebase streams
  2. Project Review

    • Detailed project view with all information
    • Team member listing
    • Similarity score visualization
    • Domain classification review
  3. Three-Stage Approval System

    • Approve: Final approval with optional feedback
    • Decline: Request resubmission with mandatory feedback
    • Reject: Permanent rejection with mandatory feedback (cannot resubmit)
  4. Filtering & Search

    • Filter by project status
    • Search by topic, description, or student name
    • Sort by date, topic, or similarity score

🔧 Admin Features

  1. Teacher Management

    • Add new teachers to the system
    • View all registered teachers
    • Secondary Firebase authentication for safe teacher creation
    • Email validation for institutional domain
  2. Past Projects Archive

    • Access complete database of approved projects
    • Advanced filtering by year, semester, domain, academic year
    • Statistics dashboard
    • Public viewing capability
  3. System Overview

    • Teacher count and statistics
    • Quick navigation to project archives
    • System-wide management capabilities

📚 Public Features

  1. Past Projects Gallery
    • Browse approved projects from previous years
    • No authentication required for viewing
    • Filter by multiple criteria (year, semester, domain, academic year)
    • Search functionality
    • Detailed project information display

🏗️ System Architecture & Design

Overall System Architecture

The Mini Project Approval System follows a Client-Server Architecture with Firebase Backend-as-a-Service (BaaS) model:

┌─────────────────────────────────────────────────────────────────────────────┐
│                           PRESENTATION LAYER                                │
│  ┌─────────────────┐  ┌─────────────────┐  ┌─────────────────────────────┐ │
│  │   Flutter Web   │  │  Flutter Mobile │  │    Flutter Desktop          │ │
│  │   (Chrome,      │  │   (Android/iOS) │  │    (Windows/Mac/Linux)      │ │
│  │    Firefox)     │  │                 │  │                             │ │
│  └─────────────────┘  └─────────────────┘  └─────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘
                                       │
                                       │ HTTPS/WebSocket
                                       ▼
┌─────────────────────────────────────────────────────────────────────────────┐
│                           BUSINESS LOGIC LAYER                              │
│  ┌─────────────────┐  ┌─────────────────┐  ┌─────────────────────────────┐ │
│  │  Auth Service   │  │Similarity Service│  │   Database Service          │ │
│  │  - Login/Logout │  │  - TF-IDF Algo  │  │   - CRUD Operations         │ │
│  │  - Registration │  │  - Cosine Sim.  │  │   - Real-time Queries       │ │
│  │  - Role Mgmt    │  │  - Domain Class. │  │   - Data Validation         │ │
│  └─────────────────┘  └─────────────────┘  └─────────────────────────────┘ │
│  ┌─────────────────┐  ┌─────────────────┐  ┌─────────────────────────────┐ │
│  │ Network Service │  │  Error Service  │  │      UI Widgets             │ │
│  │ - Connectivity  │  │ - Error Handling│  │  - Loading Components       │ │
│  │ - Offline Mgmt  │  │ - Exception Mgmt│  │  - Search & Filter          │ │
│  └─────────────────┘  └─────────────────┘  └─────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘
                                       │
                                       │ Firebase SDK
                                       ▼
┌─────────────────────────────────────────────────────────────────────────────┐
│                           FIREBASE BACKEND LAYER                            │
│  ┌─────────────────┐  ┌─────────────────┐  ┌─────────────────────────────┐ │
│  │ Authentication  │  │   Firestore     │  │     Firebase Functions      │ │
│  │ - Email/Password│  │   Database      │  │     (Future Enhancement)     │ │
│  │ - User Roles    │  │ - Collections   │  │   - Notifications           │ │
│  │ - Security      │  │ - Real-time Sync│  │   - Advanced Analytics      │ │
│  └─────────────────┘  └─────────────────┘  └─────────────────────────────┘ │
│  ┌─────────────────┐  ┌─────────────────┐  ┌─────────────────────────────┐ │
│  │ Security Rules  │  │   Analytics     │  │       Hosting               │ │
│  │ - Access Control│  │ - Usage Metrics │  │   - Web App Deployment      │ │
│  │ - Data Security │  │ - Performance   │  │   - Static Content          │ │
│  └─────────────────┘  └─────────────────┘  └─────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘

Class Diagram Information

Core Data Models

ProjectModel Class

class ProjectModel {
  // Primary Key
  final String? id;                    // Firestore document ID
  
  // Student Information
  final String studentUid;             // Firebase Auth UID (FK)
  final String studentName;            // Team leader name
  final List<String> teamMembers;      // Team member names
  
  // Teacher Information  
  final String teacherUid;             // Assigned teacher UID (FK)
  final String teacherName;            // Teacher display name
  
  // Project Details
  final String topic;                  // Project title
  final String description;            // Project abstract
  final String domain;                 // Auto-assigned category
  
  // Academic Information
  final String year;                   // Student year (FE/SE/TE/BE)
  final String semester;               // Semester number (1-8)
  
  // Status & Workflow
  final String status;                 // pending/approved/declined/rejected
  final String? feedback;              // Teacher's review feedback
  final DateTime submittedAt;          // Submission timestamp
  final DateTime? reviewedAt;          // Review completion timestamp
  
  // Similarity Analysis
  final double similarityScore;        // 0.0-1.0 similarity to existing projects
  
  // Methods
  Map<String, dynamic> toMap()         // Firestore serialization
  factory fromMap(Map<String, dynamic>)// Firestore deserialization  
  ProjectModel copyWith(...)           // Immutable updates
}

StudentModel Class

class StudentModel {
  final String uid;                    // Firebase Auth UID (PK)
  final String email;                  // Institutional email
  final String teamLeaderName;         // Student's full name
  final List<String> teamMembers;      // Team composition
  final String year;                   // Academic year
  final String semester;               // Current semester
  final String teacherUid;             // Assigned guide (FK)
  final String teacherName;            // Guide's display name
  
  Map<String, dynamic> toMap()
  factory fromMap(Map<String, dynamic>)
}

TeacherModel Class

class TeacherModel {
  final String uid;                    // Firebase Auth UID (PK)
  final String email;                  // Institutional email
  final String name;                   // Full name
  
  Map<String, dynamic> toMap()
  factory fromMap(Map<String, dynamic>)
}

Service Layer Classes

AuthService Class

class AuthService {
  // Authentication Methods
  Future<User?> signInWithEmailPassword(String email, String password)
  Future<User?> createUserWithEmailPassword(String email, String password)
  Future<void> signOut()
  User? getCurrentUser()
  Stream<User?> authStateChanges()
  
  // Role Management
  Future<String?> getUserRole(String email)
}

DatabaseService Class

class DatabaseService {
  // Student Operations
  Future<void> registerStudent(StudentModel student)
  Future<StudentModel?> getStudent(String uid)
  
  // Teacher Operations
  Future<void> addTeacher(TeacherModel teacher)
  Future<List<TeacherModel>> getAllTeachers()
  
  // Project Operations
  Future<void> submitProject(ProjectModel project)
  Future<void> updateProjectStatus(String projectId, String status, {String? feedback})
  Stream<List<ProjectModel>> getStudentProjects(String studentUid)
  Stream<List<ProjectModel>> getTeacherProjects(String teacherUid)
  
  // Similarity & Analytics
  Future<SimilarityCheckResult> checkProjectSimilarity({...})
  Future<List<Map<String, dynamic>>> getApprovedProjects()
}

SimilarityService Class

class SimilarityService {
  // Core Algorithm
  static SimilarityCheckResult calculateSimilarity({...})
  
  // Text Processing
  static String _preprocessText(String text)
  static List<String> _tokenize(String text)
  static Map<String, double> _calculateTermFrequency(List<String> words)
  static double _calculateCosineSimilarity(List<String> words1, List<String> words2)
  
  // Domain Classification
  static DomainSuggestion _calculateDomainSuggestion(...)
  static DomainSuggestion _getSmartDefaultDomain(String title, String description)
  
  // Utility Methods
  static String getFormattedSimilarity(double similarity)
  static bool isHighSimilarity(double similarity)
  static String getSimilarityLevel(double similarity)
}

Data Transfer Objects

SimilarityResult Class

class SimilarityResult {
  final double similarity;             // Similarity score (0.0-1.0)
  final String projectId;              // Reference project ID
  final String projectTitle;           // Project title
  final String projectDescription;     // Project description
  final String domain;                 // Project domain
  final String studentName;            // Original author
  final String? year;                  // Academic year
  final String? semester;              // Semester
}

DomainSuggestion Class

class DomainSuggestion {
  final String domain;                 // Suggested domain
  final double confidence;             // Confidence level (0.0-1.0)
  final List<SimilarityResult> supportingProjects; // Evidence projects
}

SimilarityCheckResult Class

class SimilarityCheckResult {
  final List<SimilarityResult> topSimilarProjects; // Top 3 similar projects
  final DomainSuggestion suggestedDomain;          // AI-suggested domain
  final bool hasHighSimilarity;                    // >70% similarity flag
  final double maxSimilarity;                      // Highest similarity score
}

Class Relationships

                    StudentModel
                         │
                         │ (1:N)
                         ▼
      TeacherModel ←── ProjectModel
            │               │
            │ (1:N)         │ (uses)
            │               ▼
            │        SimilarityService
            │               │
            │               │ (creates)
            │               ▼
            │        SimilarityCheckResult
            │               │
            └───────────────┼──────────────┐
                            │              │
                            ▼              ▼
                   DomainSuggestion   SimilarityResult
                                           (List)

Services Layer:
AuthService ────────────── DatabaseService
     │                          │
     │                          │ (uses)
     ▼                          ▼
Firebase Auth          Firestore Database
     │                          │
     └──── Security Rules ──────┘

Use Case Diagram Information

System Actors

1. Student (Primary Actor)

  • Role: Team leader who submits project proposals
  • Goals: Submit unique project proposals, track approval status, receive feedback
  • Characteristics: Limited to 4 project submissions, can resubmit declined projects
  • Authentication: Self-registration with institutional email

2. Teacher/Faculty (Primary Actor)

  • Role: Project guide and reviewer
  • Goals: Review assigned projects, provide feedback, make approval decisions
  • Characteristics: Can approve, decline, or reject projects with mandatory feedback
  • Authentication: Admin-created accounts only

3. Administrator (Primary Actor)

  • Role: System administrator
  • Goals: Manage teachers, view system statistics, access project archives
  • Characteristics: Full system access, teacher account creation privileges
  • Authentication: Hardcoded admin email

4. Public User (Secondary Actor)

  • Role: General public or prospective students
  • Goals: Browse approved projects for reference
  • Characteristics: Read-only access to approved projects gallery
  • Authentication: No authentication required

5. Firebase System (Supporting Actor)

  • Role: Backend service provider
  • Goals: Handle authentication, data storage, real-time synchronization
  • Characteristics: Cloud-based, automatic scaling, security rule enforcement

Core Use Cases

Student Use Cases

  1. Register as Student

    • Preconditions: Valid institutional email (@pvppcoe.ac.in)
    • Main Flow:
      • Enter personal details (name, email, password)
      • Select academic year and semester
      • Choose team members (optional)
      • Select guide teacher from dropdown
      • Submit registration
    • Postconditions: Student account created, can login and submit projects
    • Alternative Flows:
      • Email already exists → Show error, redirect to login
      • Invalid email domain → Show validation error
    • Business Rules:
      • Maximum 4 team members per project
      • Must have institutional email domain
  2. Submit Project Proposal

    • Preconditions: Authenticated student, less than 4 submissions
    • Main Flow:
      • Enter project title and description
      • System performs automatic similarity check
      • Display similarity results and domain suggestion
      • Student reviews warnings and confirms submission
      • System saves project with "pending" status
    • Postconditions: Project stored in database, assigned to teacher
    • Alternative Flows:
      • High similarity detected → Show warning, allow override
      • Submission limit reached → Block submission, show error
      • Network error → Queue for retry, show offline indicator
    • Business Rules:
      • Maximum 4 projects per student
      • Similarity check mandatory before submission
      • Auto-assign domain based on content analysis
  3. Track Project Status

    • Preconditions: Authenticated student with submitted projects
    • Main Flow:
      • View dashboard with all submitted projects
      • Check status (pending/approved/declined/rejected)
      • Read teacher feedback if available
      • Navigate to project details for full information
    • Postconditions: Student aware of current project status
    • Alternative Flows:
      • No projects submitted → Show empty state with submit button
      • Network error → Show cached data with offline indicator
  4. Resubmit Declined Project

    • Preconditions: Project status is "declined"
    • Main Flow:
      • Select declined project from dashboard
      • Modify title and/or description based on feedback
      • System performs new similarity check
      • Resubmit with updated content
      • Status changes back to "pending"
    • Postconditions: Updated project queued for review
    • Alternative Flows:
      • Project is rejected → Cannot resubmit, show error
      • No modifications made → Warning about unchanged content

Teacher Use Cases

  1. Review Assigned Projects

    • Preconditions: Authenticated teacher with pending projects
    • Main Flow:
      • View dashboard showing projects assigned to them
      • Projects grouped by team leader
      • Click on project for detailed review
      • View all project information including similarity analysis
    • Postconditions: Teacher ready to make approval decision
    • Alternative Flows:
      • No pending projects → Show empty state
      • Network error → Show cached data
  2. Approve Project

    • Preconditions: Project status is "pending"
    • Main Flow:
      • Review all project details and similarity analysis
      • Optionally provide positive feedback
      • Click approve button
      • System updates status to "approved"
      • Project copied to approved_projects collection
    • Postconditions: Project approved, available in public gallery
    • Alternative Flows:
      • Network error → Queue action for retry
    • Business Rules:
      • Approval is final - cannot be reversed
      • Approved projects become public
  3. Decline Project for Resubmission

    • Preconditions: Project status is "pending"
    • Main Flow:
      • Review project and identify issues
      • Enter mandatory feedback explaining concerns
      • Click decline button
      • System updates status to "declined"
    • Postconditions: Student can resubmit with modifications
    • Alternative Flows:
      • No feedback provided → Show error, require feedback
    • Business Rules:
      • Feedback is mandatory for decline action
      • Student can resubmit unlimited times
  4. Reject Project Permanently

    • Preconditions: Project status is "pending"
    • Main Flow:
      • Review project and determine it's not viable
      • Enter mandatory feedback explaining rejection
      • Confirm permanent rejection in dialog
      • System updates status to "rejected"
    • Postconditions: Student cannot resubmit this project
    • Alternative Flows:
      • Teacher cancels confirmation → No action taken
      • No feedback provided → Show error, require feedback
    • Business Rules:
      • Rejection is permanent and final
      • Feedback mandatory to help student understand

Administrator Use Cases

  1. Add New Teacher

    • Preconditions: Authenticated admin user
    • Main Flow:
      • Navigate to teacher management section
      • Click "Add Teacher" button
      • Enter teacher details (name, email)
      • System validates email domain
      • Create Firebase Auth account
      • Add teacher to database
    • Postconditions: New teacher can login and review projects
    • Alternative Flows:
      • Email already exists → Show error
      • Invalid domain → Show validation error
      • Firebase error → Show error message
    • Business Rules:
      • Only admin can create teacher accounts
      • Teacher emails must use institutional domain
  2. View System Statistics

    • Preconditions: Authenticated admin user
    • Main Flow:
      • Access admin dashboard
      • View teacher count and list
      • Navigate to past projects archive
      • View project statistics and trends
    • Postconditions: Admin informed about system usage
    • Alternative Flows:
      • No data available → Show empty states

Public User Use Cases

  1. Browse Past Projects
    • Preconditions: None (public access)
    • Main Flow:
      • Navigate to past projects gallery
      • Browse approved projects from previous years
      • Filter by year, semester, domain, academic year
      • Search by keywords
      • View detailed project information
    • Postconditions: User informed about past project examples
    • Alternative Flows:
      • No projects match filter → Show "no results" message
      • Network error → Show offline message

System Use Cases

  1. Perform Similarity Analysis

    • Preconditions: New project submitted
    • Main Flow:
      • Extract and preprocess project text (title + description)
      • Tokenize and remove stop words
      • Calculate TF-IDF vectors
      • Compute cosine similarity with all approved projects
      • Sort and filter results (>10% similarity)
      • Return top 3 similar projects
    • Postconditions: Similarity score assigned, similar projects identified
    • Business Rules:
      • Only compare against approved projects
      • Minimum 10% similarity threshold for reporting
      • Maximum 3 similar projects shown
  2. Classify Project Domain

    • Preconditions: New project submitted
    • Main Flow:
      • Analyze project content for domain keywords
      • Score each domain based on keyword matches
      • Consider similar projects' domains
      • Select highest scoring domain
      • Assign confidence level
    • Postconditions: Project assigned to appropriate domain
    • Business Rules:
      • Default to "Web Development" if no keywords match
      • Higher confidence for similarity-based suggestions
      • Keyword-based suggestions get medium confidence

Use Case Relationships

Include Relationships

  • Submit Project → Perform Similarity Analysis
  • Submit Project → Classify Project Domain
  • Resubmit Project → Perform Similarity Analysis
  • Resubmit Project → Classify Project Domain

Extend Relationships

  • Track Project Status ← View Project Details
  • Review Projects ← Filter Projects
  • Browse Past Projects ← Search Projects
  • Browse Past Projects ← Filter Projects

Generalization Relationships

  • Decline Project ← Provide Feedback
  • Reject Project ← Provide Feedback
  • Login ← Authenticate User (Student, Teacher, Admin)

Application Flow Diagram

┌─────────────────────────────────────────────────────────────────┐
│                        App Launch                                │
│                    (main.dart)                                   │
└────────────────────────┬────────────────────────────────────────┘
                         │
                         ▼
┌─────────────────────────────────────────────────────────────────┐
│                   Role Selection Screen                          │
│              Choose: Student / Teacher / Admin                   │
└───────┬─────────────────┬────────────────────┬───────────────────┘
        │                 │                    │
    Student           Teacher               Admin
        │                 │                    │
        ▼                 ▼                    ▼
┌──────────────┐  ┌──────────────┐  ┌──────────────────┐
│ Login Screen │  │ Login Screen │  │  Login Screen    │
│  (Student)   │  │  (Teacher)   │  │   (Admin)        │
└──────┬───────┘  └──────┬───────┘  └──────┬───────────┘
       │                 │                  │
       │ New Student?    │                  │
       ├──────────┐      │                  │
       │          │      │                  │
       ▼          ▼      ▼                  ▼
┌──────────┐  ┌──────────────┐  ┌──────────────────┐  ┌──────────────────┐
│ Student  │  │   Student    │  │    Teacher       │  │     Admin        │
│Dashboard │  │Registration  │  │   Dashboard      │  │   Dashboard      │
└────┬─────┘  └──────┬───────┘  └────┬─────────────┘  └────┬─────────────┘
     │               │               │                      │
     │               │               │                      │
     ▼               ▼               ▼                      ▼
┌──────────────────────┐  ┌──────────────────┐  ┌────────────────────┐
│ Submit Project       │  │ View Projects    │  │ Add Teachers       │
│ - Enter Topic/Desc   │  │ - Grouped by     │  │ - Past Projects    │
│ - Similarity Check   │  │   Team           │  │   Archive          │
│ - Domain Suggestion  │  │ - Review Details │  │ - Statistics       │
│ - View Feedback      │  │                  │  │                    │
└──────────────────────┘  └────┬─────────────┘  └────────────────────┘
                               │
                               ▼
                     ┌──────────────────────┐
                     │ Project Detail       │
                     │ - Full Information   │
                     │ - Approve/Decline/   │
                     │   Reject             │
                     │ - Provide Feedback   │
                     └──────────────────────┘

Screen Flow Details

  1. Initial Launch: App opens to Role Selection screen
  2. Authentication: User selects role → Login screen (or Registration for new students)
  3. Dashboard Access: After successful authentication, users see role-specific dashboards
  4. Student Flow:
    • Submit new project → Automatic similarity check → View status → Resubmit if declined
  5. Teacher Flow:
    • View assigned projects → Select project → Review details → Approve/Decline/Reject
  6. Admin Flow:
    • Manage teachers → View system statistics → Access past projects archive

Data Flow

Student Submission → Similarity Check → Domain Assignment → Teacher Queue
                                                                  │
                                                                  ▼
                                                      Teacher Reviews Project
                                                                  │
                              ┌───────────────────────────────────┼──────────────────────────────┐
                              │                                   │                              │
                              ▼                                   ▼                              ▼
                         Approved                            Declined                        Rejected
                              │                                   │                              │
                              ▼                                   ▼                              │
                    Saved to approved_projects    Student Resubmits (status: pending)          │
                    Public Gallery Access          Goes back to Teacher Queue                   │
                                                                                                 ▼
                                                                               Student Cannot Resubmit

🗄️ Database Structure

The application uses Firebase Firestore with the following collections:

1. students Collection

Purpose: Store registered student information

Fields:

{
  uid: String,              // Firebase Auth UID (Document ID)
  email: String,            // Student email (@pvppcoe.ac.in)
  teamLeaderName: String,   // Name of team leader
  teamMembers: List<String>, // List of team member names
  year: String,             // Academic year (FE, SE, TE, BE)
  semester: String,         // Semester number (1-8)
  teacherUid: String,       // Assigned teacher's UID
  teacherName: String       // Assigned teacher's name
}

Access: Authenticated students can read their own data


2. teachers Collection

Purpose: Store teacher/faculty information

Fields:

{
  uid: String,              // Firebase Auth UID (Document ID)
  email: String,            // Teacher email (@pvppcoe.ac.in)
  name: String              // Teacher's full name
}

Access:

  • Public read (for student registration dropdown)
  • Admin write only

3. projects Collection

Purpose: Store all project submissions (pending, approved, declined, rejected)

Fields:

{
  id: String,                    // Document ID
  studentUid: String,            // Student's Firebase UID
  studentName: String,           // Team leader name
  teacherUid: String,            // Assigned teacher's UID
  teacherName: String,           // Teacher's name
  topic: String,                 // Project title
  description: String,           // Project description/abstract
  status: String,                // 'pending', 'approved', 'declined', 'rejected'
  feedback: String?,             // Optional teacher feedback
  submittedAt: Timestamp,        // Submission timestamp
  reviewedAt: Timestamp?,        // Review timestamp (null if pending)
  year: String,                  // Student's year (FE, SE, TE, BE)
  semester: String,              // Semester (1-8)
  teamMembers: List<String>,     // Team member names
  domain: String,                // Auto-assigned domain
  similarityScore: double        // 0.0 to 1.0 (similarity to past projects)
}

Access:

  • Students can read/write their own projects
  • Teachers can read projects assigned to them and update status/feedback
  • Admin has full access

Status Flow:

  • pending → Initial submission status
  • approved → Teacher approves (final, copied to approved_projects)
  • declined → Teacher requests changes (student can resubmit)
  • rejected → Teacher permanently rejects (student cannot resubmit)

4. approved_projects Collection

Purpose: Archive of approved projects for historical reference and similarity checking

Fields:

{
  topic: String,                 // Project title
  description: String,           // Project description
  domain: String,                // Project domain
  year: String,                  // Student year (FE, SE, TE, BE)
  semester: String,              // Semester number
  studentName: String,           // Team leader name
  teacherName: String,           // Guide teacher name
  teamMembers: List<String>,     // Team members
  approvedAt: Timestamp,         // Approval timestamp
  academicYear: int              // Year of approval (e.g., 2024)
}

Access:

  • Public read (no authentication required)
  • Write only when project is approved by teacher

Purpose in System:

  • Used for similarity checking during new submissions
  • Displayed in Past Projects Gallery
  • Helps prevent duplicate project submissions

Collection Relationships

students (1) ─── (many) projects
    │
    │ (references)
    ▼
teachers (1) ─── (many) projects

projects (on approval) ──→ copied to ──→ approved_projects

Firestore Security Considerations

Read Access:

  • students: User reads own document only
  • teachers: Public read access (needed for registration)
  • projects: Users read their own or assigned projects
  • approved_projects: Public read access

Write Access:

  • students: User writes own document during registration
  • teachers: Admin only
  • projects: Students create/update own; Teachers update status/feedback
  • approved_projects: System writes on approval (automatic)

🧮 Algorithms

1. Project Similarity Check Algorithm

Purpose: Detect similar projects to prevent duplicates and maintain originality

Algorithm: TF-IDF with Cosine Similarity

Implementation Location: lib/services/similarity_service.dart

How It Works:

Step 1: Text Preprocessing

Input: Project title + description
↓
Convert to lowercase
↓
Remove punctuation and special characters
↓
Normalize whitespace
↓
Output: Cleaned text

Step 2: Tokenization & Stop Word Removal

Input: Cleaned text
↓
Split into individual words
↓
Remove common stop words (a, an, the, is, etc.)
↓
Filter words with length < 3 characters
↓
Output: List of meaningful terms

Step 3: Term Frequency (TF) Calculation

For each term in document:
TF(term) = (count of term in document) / (total terms in document)

Step 4: Cosine Similarity Calculation

Given two documents A and B:

1. Create unified vocabulary from both documents
2. Create frequency vectors for each document
   Vector_A = [tf_1, tf_2, ..., tf_n]
   Vector_B = [tf_1, tf_2, ..., tf_n]

3. Calculate dot product:
   dot_product = Σ(Vector_A[i] × Vector_B[i])

4. Calculate magnitudes:
   magnitude_A = √(Σ(Vector_A[i]²))
   magnitude_B = √(Σ(Vector_B[i]²))

5. Cosine Similarity:
   similarity = dot_product / (magnitude_A × magnitude_B)

   Result: 0.0 (completely different) to 1.0 (identical)

Step 5: Similarity Scoring

For each past approved project:
  - Calculate similarity score (0.0 to 1.0)
  - Filter out scores < 0.1 (10% threshold)
  - Sort by similarity (highest first)
  - Return top 3 similar projects

Similarity Levels:
  - High: > 70% (red warning)
  - Medium: 40-70% (orange warning)
  - Low: < 40% (green, acceptable)

Example:

New Project:

  • Title: "Machine Learning Based Stock Price Prediction"
  • Description: "Using neural networks and historical data to predict stock prices"

Past Project:

  • Title: "Stock Market Prediction using AI"
  • Description: "Predicting stock prices with machine learning algorithms"

Similarity Calculation:

Common terms: machine, learning, stock, predict/prediction, price
Unique terms: neural, networks, historical, data, market, ai, algorithms

TF vectors calculated for both
Cosine similarity = 0.78 (78%)
Result: HIGH SIMILARITY WARNING

2. Domain Assignment Algorithm

Purpose: Automatically classify projects into technical domains

Algorithm: Keyword-Based Scoring with Weighted Matching

Implementation: lib/services/similarity_service.dart_getSmartDefaultDomain()

How It Works:

Step 1: Domain Keyword Definition

Predefined domains with keywords:

AI/ML: [ai, artificial intelligence, machine learning, neural,
        deep learning, classification, prediction, model, etc.]

Web Development: [web, website, html, css, javascript, react,
                 vue, angular, node, backend, frontend, etc.]

Mobile Development: [android, ios, mobile, app, flutter,
                    react native, kotlin, swift, etc.]

IoT: [iot, internet of things, sensor, arduino, raspberry pi,
      embedded, automation, smart home, etc.]

Data Science: [data science, analytics, visualization, statistics,
              big data, dashboard, pandas, matplotlib, etc.]

Blockchain: [blockchain, cryptocurrency, bitcoin, ethereum,
            smart contract, decentralized, crypto, etc.]

And more...

Step 2: Content Analysis

Input: Project title + description (combined)
↓
Convert to lowercase
↓
For each domain:
  score = 0
  For each keyword in domain:
    If keyword found in text:
      score += (keyword length > 5) ? 3 : 1
↓
Select domain with highest score

Step 3: Confidence Calculation

If score > 0:
  confidence = 0.5 (medium confidence)
Else:
  confidence = 0.0
  Default domain = "Web Development"

Step 4: Similarity-Based Enhancement

If similar past projects exist:
  - Group similar projects by domain
  - Calculate weighted scores (similarity² × count)
  - Domain = Most common domain among similar projects
  - Confidence = Highest similarity score

Decision Flow:

New Project Submission
        │
        ▼
    Are there similar past projects?
        │
        ├─── Yes ───→ Use similarity-based domain suggestion
        │             (domain from most similar project)
        │             Confidence = similarity score
        │
        └─── No ────→ Use keyword-based analysis
                      (scan for domain keywords)
                      Confidence = 0.5 if keywords found

Example:

New Project:

  • Title: "Android Food Delivery App with Firebase"
  • Description: "Building a mobile application for food delivery using Flutter and Firebase backend"

Keyword Matching:

AI/ML: 0 points
Web Development: 0 points (backend found but not dominant)
Mobile Development: 15 points
  - "android" (3 points)
  - "mobile" (3 points)
  - "app" (1 point)
  - "application" (3 points)
  - "flutter" (3 points)
  - "firebase" (2 points)
IoT: 0 points
...

Result: Mobile Development (15 points)
Confidence: 0.5

🔐 Authentication & Permissions

Authentication System

Provider: Firebase Authentication (Email/Password)

Supported Roles:

  1. Student: Self-registration allowed
  2. Teacher: Admin-created accounts only
  3. Admin: Hardcoded email (admin@pvppcoe.ac.in)

Email Validation

All users must have @pvppcoe.ac.in email domain (institutional requirement)

Role Detection Logic

Location: lib/services/database_service.dart → getUserRole()

If email == 'admin@pvppcoe.ac.in':
    return 'admin'
Else if email exists in 'teachers' collection:
    return 'teacher'
Else if email exists in 'students' collection:
    return 'student'
Else:
    return null (redirect to registration)

Firestore Security Rules (Recommended)

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {

    // Helper function to check authentication
    function isAuthenticated() {
      return request.auth != null;
    }

    // Helper function to check if user is admin
    function isAdmin() {
      return isAuthenticated() && request.auth.token.email == 'admin@pvppcoe.ac.in';
    }

    // Students collection
    match /students/{studentId} {
      // Users can read their own student document
      allow read: if isAuthenticated() && request.auth.uid == studentId;
      // Users can create their own student document during registration
      allow create: if isAuthenticated() && request.auth.uid == studentId;
      // Users can update their own student document
      allow update: if isAuthenticated() && request.auth.uid == studentId;
      // Only admin can delete
      allow delete: if isAdmin();
    }

    // Teachers collection
    match /teachers/{teacherId} {
      // Public read access (needed for student registration dropdown)
      allow read: if true;
      // Only admin can write
      allow write: if isAdmin();
    }

    // Projects collection
    match /projects/{projectId} {
      // Students can read their own projects
      // Teachers can read projects assigned to them
      allow read: if isAuthenticated() && (
        resource.data.studentUid == request.auth.uid ||
        resource.data.teacherUid == request.auth.uid ||
        isAdmin()
      );

      // Students can create their own projects
      allow create: if isAuthenticated() &&
        request.resource.data.studentUid == request.auth.uid;

      // Students can update their own pending/declined projects
      // Teachers can update status and feedback of assigned projects
      allow update: if isAuthenticated() && (
        (resource.data.studentUid == request.auth.uid &&
         resource.data.status in ['pending', 'declined']) ||
        (resource.data.teacherUid == request.auth.uid) ||
        isAdmin()
      );

      // Only admin can delete
      allow delete: if isAdmin();
    }

    // Approved projects collection
    match /approved_projects/{projectId} {
      // Public read access (no authentication required for gallery)
      allow read: if true;
      // Only system/admin can write (created automatically on approval)
      allow write: if isAdmin();
    }
  }
}

Permission Matrix

Collection Student Read Student Write Teacher Read Teacher Write Admin Public Read
students Own only Own only No No Full No
teachers Yes No Yes No Full Yes
projects Own only Own only Assigned only Status/Feedback Full No
approved_projects Yes No Yes No Full Yes

Network Security

Service: lib/services/network_service.dart

  • Periodic connectivity checks (every 30 seconds)
  • Offline mode detection
  • Graceful error handling for network failures
  • User feedback via snackbars

🎨 UI/UX Design

Design Principles

  1. Material Design 3: Modern, clean interface with consistent components
  2. Role-Based Navigation: Tailored interfaces for each user role
  3. Responsive Layouts: Adapts to different screen sizes
  4. Visual Feedback: Loading states, error messages, success confirmations
  5. Color-Coded Status: Instant visual understanding of project states

Color Scheme

Primary: Blue (#2196F3) - Trust, professionalism Status Colors:

  • 🟢 Green: Approved projects
  • 🟠 Orange: Pending/Declined (action needed)
  • 🔴 Red: Rejected projects
  • 🔵 Blue: General information

Similarity Score Colors:

  • 🟢 Green (<30%): Low similarity, good to go
  • 🟠 Orange (30-60%): Medium similarity, review needed
  • 🔴 Red (>60%): High similarity, warning

Key UI Components

1. Enhanced Loading Widget

  • Multiple loading types: circular, linear, dots, skeleton
  • Customizable size, color, and messages
  • Smooth animations for better UX

2. Search & Filter Widget

  • Real-time search across multiple fields
  • Multiple filter options (status, date, domain)
  • Sort capabilities (newest, oldest, topic, similarity)
  • Collapsible advanced filters

3. Status Chips

  • Color-coded status indicators
  • Icon + text for clarity
  • Consistent across all screens

4. Similarity Check Display

  • Progress bar visualization
  • Percentage display
  • Color-coded risk levels
  • List of similar projects with details

User Interaction Flow

Student Submission:

  1. Enter project details in clean form
  2. Real-time validation feedback
  3. Submit button with loading state
  4. Automatic similarity check with animated loading
  5. Results displayed with clear recommendations
  6. Success/error snackbar confirmation

Teacher Review:

  1. Dashboard with grouped projects
  2. Expandable cards for team details
  3. One-tap navigation to full details
  4. All project information on single scrollable screen
  5. Three clear action buttons with confirmation dialogs
  6. Feedback text field with validation

Admin Management:

  1. Teacher list with profile cards
  2. Floating action button for quick add
  3. Modal dialog for new teacher form
  4. Real-time validation and error handling
  5. Success confirmation and list refresh

Accessibility Features

  • High contrast text on all backgrounds
  • Clear, readable fonts (Material Design Typography)
  • Icon + text labels for important actions
  • Loading states for all async operations
  • Error messages with actionable guidance
  • Pull-to-refresh for manual data updates

🚀 Installation & Setup

Prerequisites

  • Flutter SDK (3.0.0 or higher)
  • Dart SDK (>=3.0.0 <4.0.0)
  • Firebase account
  • Android Studio / VS Code with Flutter extensions
  • Git

Step 1: Clone the Repository

git clone <repository-url>
cd mini_project_approval

Step 2: Install Flutter Dependencies

flutter pub get

Step 3: Firebase Configuration

3.1 Create Firebase Project

  1. Go to Firebase Console
  2. Click "Add Project"
  3. Enter project name: "Mini Project Approval"
  4. Follow the setup wizard

3.2 Add Android App

  1. In Firebase Console, click "Add App" → Android
  2. Enter package name: com.example.mini_project_approval
  3. Download google-services.json
  4. Place file in android/app/ directory

3.3 Add iOS App (Optional)

  1. In Firebase Console, click "Add App" → iOS
  2. Enter bundle ID: com.example.miniProjectApproval
  3. Download GoogleService-Info.plist
  4. Place file in ios/Runner/ directory

3.4 Add Web App (Optional)

  1. In Firebase Console, click "Add App" → Web
  2. Register app and copy configuration

3.5 Enable Authentication

  1. Go to Firebase Console → Authentication
  2. Click "Get Started"
  3. Enable "Email/Password" provider
  4. Save changes

3.6 Create Firestore Database

  1. Go to Firebase Console → Firestore Database
  2. Click "Create Database"
  3. Choose "Start in production mode" (or test mode for development)
  4. Select location closest to your users
  5. Click "Enable"

3.7 Configure Firestore Security Rules

In Firestore Console → Rules tab, paste the security rules from the Authentication & Permissions section above.

3.8 Generate Firebase Options File

# Install FlutterFire CLI
dart pub global activate flutterfire_cli

# Configure Firebase for your Flutter project
flutterfire configure

This will create lib/firebase_options.dart automatically.

Step 4: Update Configuration

4.1 Update Email Domain (Optional)

If your institution uses a different email domain, update validation in:

  • lib/screens/login_screen.dart
  • lib/screens/student_registration_screen.dart
  • lib/screens/admin_dashboard_screen.dart

Find and replace @pvppcoe.ac.in with your domain.

4.2 Update Admin Email

In lib/services/database_service.dart, update admin email:

if (email == 'admin@pvppcoe.ac.in') {  // Change this
  return 'admin';
}

Step 5: Run the Application

Run on Android Emulator

flutter run

Run on Chrome (Web)

flutter run -d chrome

Build Release APK

flutter build apk --release

Step 6: Initial Setup

Create Admin Account

  1. Go to Firebase Console → Authentication
  2. Click "Add User"
  3. Email: admin@pvppcoe.ac.in (or your configured admin email)
  4. Password: Set a strong password
  5. Click "Add User"

First Login

  1. Launch app
  2. Select "Admin" role
  3. Login with admin credentials
  4. Add first teacher through admin dashboard

📦 Dependencies

Core Dependencies

dependencies:
  flutter:
    sdk: flutter

  # Firebase
  firebase_core: ^3.6.0          # Firebase initialization
  firebase_auth: ^5.3.1          # Authentication
  cloud_firestore: ^5.4.4        # Database

  # State Management
  provider: ^6.1.1               # Simple state management

  # Utilities
  collection: ^1.17.0            # Extended collection utilities
  cupertino_icons: ^1.0.2        # iOS style icons

Dev Dependencies

dev_dependencies:
  flutter_test:
    sdk: flutter
  flutter_lints: ^3.0.0          # Linting rules

Package Descriptions

  1. firebase_core: Initializes Firebase services
  2. firebase_auth: Handles user authentication (email/password)
  3. cloud_firestore: NoSQL cloud database for real-time data sync
  4. provider: Efficient state management without boilerplate
  5. collection: Utility functions for working with collections

External Services

  • Firebase Authentication: User management and authentication
  • Cloud Firestore: Real-time NoSQL database
  • Firebase Hosting (optional): For web deployment

🧪 Testing Framework & Strategies

Testing Architecture

The Mini Project Approval System implements a comprehensive testing strategy covering multiple testing levels and types:

┌───────────────────────────────────────────────────────────────────────────┐
│                               TESTING PYRAMID                                 │
│                                                                               │
│                            ┌─────────────────┐                            │
│                            │   E2E TESTS    │                            │
│                            │  (Manual/Auto) │                            │
│                            │ User Journeys  │                            │
│                            └─────────────────┘                            │
│                       ┌──────────────────────────────┐                       │
│                       │      INTEGRATION TESTS       │                       │
│                       │   Flutter Widget Tests      │                       │
│                       │   Firebase Integration      │                       │
│                       └──────────────────────────────┘                       │
│                 ┌──────────────────────────────────────────┐                 │
│                 │             UNIT TESTS                │                 │
│                 │       Business Logic Testing         │                 │
│                 │       Service Layer Testing          │                 │
│                 │       Algorithm Testing              │                 │
│                 └──────────────────────────────────────────┘                 │
└───────────────────────────────────────────────────────────────────────────┘

Black Box Testing

Functional Testing

1. User Authentication Testing

Test Case ID Test Scenario Input Data Expected Output Test Type
AUTH_001 Valid Student Login Email: student@pvppcoe.ac.in
Password: ValidPass123
Successful login, redirect to student dashboard Positive
AUTH_002 Invalid Email Domain Email: student@gmail.com
Password: ValidPass123
Error: "Invalid email domain" Negative
AUTH_003 Empty Credentials Email: ""
Password: ""
Error: "Please fill all fields" Boundary
AUTH_004 Teacher Login Email: teacher@pvppcoe.ac.in
Password: ValidPass123
Successful login, redirect to teacher dashboard Positive
AUTH_005 Admin Login Email: admin@pvppcoe.ac.in
Password: AdminPass123
Successful login, redirect to admin dashboard Positive
AUTH_006 SQL Injection Attempt Email: "'; DROP TABLE users; --"
Password: "any"
Error: "Invalid credentials" (Firebase handles) Security

2. Project Submission Testing

Test Case ID Test Scenario Input Data Expected Output Test Type
PROJ_001 Valid Project Submission Title: "AI Chatbot"
Description: "Building an AI chatbot..."
Project submitted, similarity check performed Positive
PROJ_002 Empty Title Title: ""
Description: "Valid description"
Error: "Title cannot be empty" Boundary
PROJ_003 Long Title (>100 chars) Title: "A" * 101
Description: "Valid description"
Error: "Title too long" or truncation Boundary
PROJ_004 5th Project Submission Submit when user has 4 existing Error: "Maximum 4 projects allowed" Business Rule
PROJ_005 High Similarity Project Title: "Machine Learning Stock Prediction"
Description: Similar to existing
Warning displayed, submission allowed Positive
PROJ_006 Special Characters in Title Title: "Project <script>alert('XSS')</script>" Sanitized input, no script execution Security

3. Teacher Review Testing

Test Case ID Test Scenario Input Data Expected Output Test Type
REVIEW_001 Approve Project Click approve, optional feedback Status: "approved", project in public gallery Positive
REVIEW_002 Decline with Feedback Click decline, enter feedback Status: "declined", student can resubmit Positive
REVIEW_003 Decline without Feedback Click decline, no feedback Error: "Feedback required for decline" Negative
REVIEW_004 Reject with Confirmation Click reject, confirm in dialog Status: "rejected", cannot resubmit Positive
REVIEW_005 Reject Cancel Click reject, cancel in dialog No status change, remains "pending" Negative

4. Similarity Algorithm Testing

Test Case ID Test Scenario Input Data Expected Output Test Type
SIM_001 Identical Projects Title/Desc same as existing Similarity: ~100% Boundary
SIM_002 Completely Different Title/Desc with no common words Similarity: <10% Boundary
SIM_003 Medium Similarity Some common keywords Similarity: 30-60% Positive
SIM_004 Empty Database No existing projects No similar projects found Edge Case
SIM_005 Stop Words Only Title: "The and or but" Low/no similarity (stop words filtered) Edge Case
SIM_006 Special Characters Title with symbols, punctuation Cleaned text processed correctly Edge Case

Performance Testing

Test Case ID Test Scenario Load Condition Expected Response Test Type
PERF_001 Login Response Time 1 user < 2 seconds Performance
PERF_002 Similarity Check Time 1000 existing projects < 5 seconds Performance
PERF_003 Concurrent Submissions 10 simultaneous users All submissions processed Stress
PERF_004 Large Project Database 5000+ approved projects Similarity check completes Volume
PERF_005 Mobile Performance Mobile device, 3G network App remains responsive Performance

Usability Testing

Test Case ID Test Scenario User Action Success Criteria Test Type
UX_001 First-time Student Registration Complete registration flow < 5 minutes, no confusion Usability
UX_002 Project Submission Flow Submit first project Clear progress indication Usability
UX_003 Teacher Review Interface Review 5 projects Efficient workflow Usability
UX_004 Mobile Interface Use on smartphone All features accessible Responsive
UX_005 Error Message Clarity Trigger various errors Clear, actionable messages Usability

White Box Testing

Unit Testing Framework

Test Structure

// Example test file structure
test/
  unit/
    models/
      project_model_test.dart
      student_model_test.dart
      teacher_model_test.dart
    services/
      auth_service_test.dart
      database_service_test.dart
      similarity_service_test.dart
      network_service_test.dart
    utils/
      validators_test.dart
  widget/
    screens/
      login_screen_test.dart
      student_dashboard_test.dart
      project_detail_screen_test.dart
    widgets/
      similarity_check_widget_test.dart
      search_filter_widget_test.dart
  integration/
    user_journey_test.dart
    firebase_integration_test.dart

Algorithm Testing (Similarity Service)

1. Text Preprocessing Testing

group('Text Preprocessing', () {
  test('converts to lowercase', () {
    expect(SimilarityService._preprocessText('HELLO WORLD'), 'hello world');
  });
  
  test('removes punctuation', () {
    expect(SimilarityService._preprocessText('Hello, World!'), 'hello world');
  });
  
  test('normalizes whitespace', () {
    expect(SimilarityService._preprocessText('hello    world'), 'hello world');
  });
  
  test('handles empty string', () {
    expect(SimilarityService._preprocessText(''), '');
  });
  
  test('handles special characters', () {
    expect(SimilarityService._preprocessText('hello@world#123'), 'hello world 123');
  });
});

2. Tokenization Testing

group('Tokenization', () {
  test('filters stop words', () {
    List<String> tokens = SimilarityService._tokenize('the quick brown fox');
    expect(tokens, ['quick', 'brown', 'fox']); // 'the' filtered out
  });
  
  test('filters short words', () {
    List<String> tokens = SimilarityService._tokenize('a big elephant');
    expect(tokens, ['big', 'elephant']); // 'a' filtered out (length < 3)
  });
  
  test('handles empty input', () {
    expect(SimilarityService._tokenize(''), []);
  });
});

3. Cosine Similarity Testing

group('Cosine Similarity', () {
  test('identical texts return 1.0', () {
    List<String> words1 = ['machine', 'learning', 'project'];
    List<String> words2 = ['machine', 'learning', 'project'];
    expect(SimilarityService._calculateCosineSimilarity(words1, words2), 1.0);
  });
  
  test('completely different texts return 0.0', () {
    List<String> words1 = ['machine', 'learning'];
    List<String> words2 = ['cooking', 'recipe'];
    expect(SimilarityService._calculateCosineSimilarity(words1, words2), 0.0);
  });
  
  test('partially similar texts return value between 0 and 1', () {
    List<String> words1 = ['machine', 'learning', 'project'];
    List<String> words2 = ['machine', 'learning', 'system'];
    double similarity = SimilarityService._calculateCosineSimilarity(words1, words2);
    expect(similarity, greaterThan(0.0));
    expect(similarity, lessThan(1.0));
  });
  
  test('empty lists return 0.0', () {
    expect(SimilarityService._calculateCosineSimilarity([], []), 0.0);
  });
});

Database Service Testing

1. Mock Firebase Testing

group('DatabaseService', () {
  late DatabaseService dbService;
  late MockFirestore mockFirestore;
  
  setUp(() {
    mockFirestore = MockFirestore();
    dbService = DatabaseService();
    // Inject mock dependency
  });
  
  test('registerStudent creates document', () async {
    StudentModel student = StudentModel(
      uid: 'test123',
      email: 'test@pvppcoe.ac.in',
      teamLeaderName: 'Test User',
      teamMembers: [],
      year: 'TE',
      semester: '5',
      teacherUid: 'teacher123',
      teacherName: 'Test Teacher',
    );
    
    await dbService.registerStudent(student);
    
    verify(mockFirestore.collection('students')
      .doc('test123')
      .set(student.toMap())).called(1);
  });
  
  test('submitProject with similarity check', () async {
    // Setup mock approved projects
    when(mockFirestore.collection('approved_projects').get())
      .thenAnswer((_) async => mockQuerySnapshot);
    
    ProjectModel project = ProjectModel(
      studentUid: 'student123',
      studentName: 'Test Student',
      teacherUid: 'teacher123',
      teacherName: 'Test Teacher',
      topic: 'Test Project',
      description: 'Test Description',
      submittedAt: DateTime.now(),
      year: 'TE',
      semester: '5',
      teamMembers: [],
    );
    
    await dbService.submitProject(project);
    
    // Verify similarity check was performed
    // Verify project was saved
    verify(mockFirestore.collection('projects').add(any)).called(1);
  });
});

Code Coverage Requirements

Component Target Coverage Critical Areas
Models 95% Serialization/Deserialization
Services 90% Business Logic, Error Handling
Algorithms 95% Similarity Calculation, Domain Classification
Widgets 80% User Interactions, State Management
Screens 70% Navigation, Form Validation
Overall 85% All critical business paths

Integration Testing

1. Firebase Integration Tests

group('Firebase Integration', () {
  testWidgets('complete user registration flow', (tester) async {
    // Setup test Firebase project
    await Firebase.initializeApp(options: testFirebaseOptions);
    
    await tester.pumpWidget(MyApp());
    
    // Navigate to registration
    await tester.tap(find.byKey(Key('student_role')));
    await tester.pumpAndSettle();
    
    await tester.tap(find.text('Register'));
    await tester.pumpAndSettle();
    
    // Fill registration form
    await tester.enterText(find.byKey(Key('email_field')), 'test@pvppcoe.ac.in');
    await tester.enterText(find.byKey(Key('password_field')), 'TestPass123');
    await tester.enterText(find.byKey(Key('name_field')), 'Test Student');
    
    // Submit registration
    await tester.tap(find.byKey(Key('register_button')));
    await tester.pumpAndSettle();
    
    // Verify registration success
    expect(find.text('Student Dashboard'), findsOneWidget);
    
    // Cleanup test data
    await cleanupTestData();
  });
});

2. End-to-End User Journey Tests

group('Complete User Journeys', () {
  testWidgets('student submission to teacher approval', (tester) async {
    // 1. Student registers and logs in
    await performStudentRegistration(tester);
    
    // 2. Student submits project
    await submitTestProject(tester, 'AI Chatbot', 'Building chatbot with NLP');
    
    // 3. Verify project appears in teacher dashboard
    await loginAsTeacher(tester);
    expect(find.text('AI Chatbot'), findsOneWidget);
    
    // 4. Teacher approves project
    await approveProject(tester);
    
    // 5. Verify project in public gallery
    await navigateToPublicGallery(tester);
    expect(find.text('AI Chatbot'), findsOneWidget);
    
    // 6. Verify student sees approval
    await loginAsStudent(tester);
    expect(find.byIcon(Icons.check_circle), findsOneWidget);
  });
});

Test Data Management

Test Data Sets

1. Sample Projects for Similarity Testing

class TestDataSets {
  static List<Map<String, dynamic>> similarityTestProjects = [
    {
      'topic': 'Machine Learning Stock Prediction',
      'description': 'Using neural networks to predict stock market trends',
      'domain': 'AI/ML',
      'studentName': 'John Doe',
    },
    {
      'topic': 'AI-based Stock Market Analysis',
      'description': 'Analyzing stock prices using artificial intelligence',
      'domain': 'AI/ML',
      'studentName': 'Jane Smith',
    },
    {
      'topic': 'Flutter Food Delivery App',
      'description': 'Mobile application for ordering food online',
      'domain': 'Mobile Development',
      'studentName': 'Bob Wilson',
    },
    // ... more test data
  ];
  
  static List<String> stopWordsTest = ['the', 'and', 'or', 'but', 'in', 'on'];
  
  static Map<String, List<String>> domainKeywordsTest = {
    'AI/ML': ['machine learning', 'neural', 'artificial intelligence'],
    'Web Development': ['html', 'css', 'javascript', 'web'],
    'Mobile Development': ['android', 'ios', 'mobile', 'app'],
  };
}

Automated Test Execution

CI/CD Pipeline Testing

# .github/workflows/test.yml
name: Test Suite
on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: subosito/flutter-action@v2
        with:
          flutter-version: '3.0.0'
      
      # Unit Tests
      - name: Run Unit Tests
        run: flutter test test/unit/
      
      # Widget Tests
      - name: Run Widget Tests
        run: flutter test test/widget/
      
      # Integration Tests
      - name: Run Integration Tests
        run: flutter test test/integration/
      
      # Code Coverage
      - name: Generate Coverage
        run: |
          flutter test --coverage
          genhtml coverage/lcov.info -o coverage/html
      
      # Upload Coverage
      - name: Upload to Codecov
        uses: codecov/codecov-action@v3
        with:
          file: coverage/lcov.info

Test Reporting

Coverage Reports

  • Line Coverage: Percentage of code lines executed during tests
  • Branch Coverage: Percentage of decision branches tested
  • Function Coverage: Percentage of functions called during tests
  • Statement Coverage: Percentage of statements executed

Performance Benchmarks

  • Similarity Algorithm: < 5 seconds for 1000 projects
  • Database Queries: < 2 seconds average response time
  • UI Rendering: < 100ms for screen transitions
  • Memory Usage: < 100MB on mobile devices

Quality Metrics

  • Bug Density: < 1 bug per 1000 lines of code
  • Test Execution Time: < 10 minutes for full suite
  • Flaky Test Rate: < 5% test instability
  • Code Maintainability Index: > 75/100

⚠️ Known Issues & Limitations

Current Limitations

  1. Email Domain Restriction

    • Only @pvppcoe.ac.in emails are accepted
    • Hardcoded in multiple files
    • Impact: Not usable by other institutions without code changes
  2. Submission Limit

    • Students limited to 4 project submissions maximum
    • No way to increase limit without code modification
    • Impact: May be restrictive for some scenarios
  3. Similarity Algorithm

    • Basic TF-IDF cosine similarity
    • No advanced NLP or semantic understanding
    • Threshold of 70% for "high similarity" may not be optimal
    • Impact: May miss conceptually similar projects with different wording
  4. No Image/File Attachments

    • Projects are text-only (title + description)
    • No support for uploading diagrams, documents, or presentations
    • Impact: Limited project documentation capability
  5. Single Teacher Assignment

    • Students can only select one guide teacher
    • No support for co-guides or project committees
    • Impact: Doesn't reflect some academic structures
  6. Admin Account

    • Single hardcoded admin email
    • No role-based admin hierarchy
    • Impact: Difficult to scale admin access
  7. Network Dependency

    • Requires constant internet connection
    • No offline mode or local caching
    • Limited offline error handling
    • Impact: Unusable without internet
  8. Manual Teacher Creation

    • Admin must create each teacher account individually
    • No bulk import functionality
    • Impact: Time-consuming initial setup
  9. No Analytics Dashboard

    • No visual charts or statistics
    • Limited reporting capabilities
    • Impact: Hard to analyze trends
  10. No Notification System

    • No push notifications for status updates
    • No email notifications
    • Users must manually check for updates
    • Impact: Delayed awareness of project status changes

Known Bugs

  1. Context Async Gap Warnings

    • Some BuildContext usage after async operations may show warnings
    • Mitigated with mounted checks but not completely eliminated
  2. Dropdown Reset Issue

    • Dropdowns may not reset properly after form submission errors
    • Workaround: User must manually clear selections

Performance Considerations

  1. Large Dataset Performance

    • Similarity checking becomes slow with >1000 approved projects
    • No pagination on past projects screen
    • Recommendation: Archive old projects periodically
  2. Real-time Stream Updates

    • Multiple simultaneous users may cause increased Firebase reads
    • Impact: Higher Firebase costs

🔮 Future Improvements

High Priority

  1. Enhanced Similarity Detection

    • Implement semantic similarity using word embeddings (Word2Vec, BERT)
    • Use more sophisticated NLP techniques
    • Add configurable similarity thresholds
    • Consider project structure similarity (not just text)
  2. File Attachments

    • Support PDF, images, and document uploads
    • Integrate Firebase Storage
    • Preview functionality for uploaded files
    • Version control for resubmissions
  3. Push Notifications

    • Firebase Cloud Messaging integration
    • Email notifications via SendGrid/Firebase Functions
    • Notify students of status changes
    • Notify teachers of new submissions
  4. Offline Support

    • Implement local database (Hive/SQLite)
    • Cache approved projects locally
    • Queue submissions for when online
    • Sync strategy for conflict resolution
  5. Advanced Analytics

    • Dashboard with charts (submission trends, approval rates)
    • Domain distribution visualizations
    • Teacher workload statistics
    • Student success metrics

Medium Priority

  1. Bulk Operations

    • CSV import for teachers
    • Bulk student registration
    • Export projects to Excel/PDF
  2. Advanced Search

    • Full-text search with Firebase or Algolia
    • Search within project descriptions
    • Advanced filters (date ranges, multiple domains)
  3. Multi-Language Support

    • Internationalization (i18n)
    • Support for regional languages
  4. Role Enhancements

    • Multiple admin accounts
    • HOD/Department head role
    • Project committee review workflow
    • Co-guide support
  5. Project Templates

    • Pre-defined project proposal templates
    • Required sections enforcement
    • Format validation

Low Priority

  1. Dark Mode

    • Theme switching capability
    • Persist user preference
  2. Student Portfolio

    • Public profile for students
    • Showcase approved projects
    • Skills and achievements section
  3. Collaboration Features

    • Team chat for project discussions
    • Shared document editing
    • Version history tracking
  4. API Integration

    • RESTful API for external systems
    • Webhook support for automated workflows
    • Export to learning management systems
  5. Mobile Optimization

    • Improve tablet layouts
    • Optimize for large screens
    • Gesture controls

Technical Improvements

  1. Code Quality

    • Increase test coverage (unit, widget, integration)
    • Add continuous integration (GitHub Actions)
    • Code documentation improvements
    • Performance profiling and optimization
  2. Security Enhancements

    • Two-factor authentication
    • Rate limiting for submissions
    • CAPTCHA for registration
    • Audit logging for all actions
  3. DevOps

    • Automated deployment pipeline
    • Environment management (dev, staging, prod)
    • Error tracking (Sentry, Firebase Crashlytics)
    • Performance monitoring

👥 Contributing

Contributions are welcome! Please follow these guidelines:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License

This project is created for educational purposes as part of an academic project management system.


🙏 Acknowledgments

  • Flutter team for the excellent framework
  • Firebase for backend infrastructure
  • Material Design for UI components
  • The academic institution for project requirements

📞 Support

For issues, questions, or suggestions:


Built with ❤️ using Flutter and Firebase

About

new app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •