Skip to content

sangsaist/codelens

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

23 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸŽ“ CodeLens

Open-Source Student Coding Performance Analytics Platform

License: MIT Python 3.10+ Flask 3.1.2 PostgreSQL 15 React 18 Docker PRs Welcome

Features β€’ Quick Start β€’ Documentation β€’ Contributing


πŸ“– Table of Contents


🌟 Overview

CodeLens is a comprehensive analytics platform designed for educational institutions to track, analyze, and improve students' coding proficiency through structured performance snapshots, data-driven insights, and dynamic leaderboards.

🎯 Mission

Transform manual, inconsistent coding performance tracking into a structured, measurable, transparent system that enables data-driven student development and mentoring at institutional scale.

πŸ›οΈ Deployment Model

  • Self-Hosted: Each college deploys its own instance
  • Single-Tenant: Complete data isolation per institution
  • Scalable: Handles 500–5000+ students per deployment

πŸ’‘ The Problem

Most educational institutions face critical challenges in coding education management:

❌ Current State

  • βœ— Manual spreadsheet tracking
  • βœ— No historical performance data
  • βœ— Inconsistent measurement across departments
  • βœ— No visibility into student progress
  • βœ— Time-consuming data collection
  • βœ— No analytics-driven mentoring

βœ… With CodeLens

  • βœ“ Automated performance tracking
  • βœ“ Complete historical timeline
  • βœ“ Standardized metrics institution-wide
  • βœ“ Real-time dashboards for all stakeholders
  • βœ“ One-time setup, continuous tracking
  • βœ“ Data-driven insights and recommendations

πŸš€ Our Solution

Snapshot-Driven Architecture

graph LR
    A[Student] --> B[Performance Snapshot]
    B --> C[Approval Workflow]
    C --> D[Analytics Engine]
    D --> E[Leaderboards]
    D --> F[Growth Metrics]
    D --> G[Insights]
    
    style A fill:#667eea
    style B fill:#764ba2
    style C fill:#f093fb
    style D fill:#4facfe
    style E fill:#00f2fe
    style F fill:#43e97b
    style G fill:#38f9d7
Loading

Core Philosophy

Snapshots are the source of truth.
Analytics are computed from snapshots.
Leaderboards are generated from analytics.

This separation ensures scalability, clarity, and long-term maintainability.


✨ Features

πŸ” Authentication πŸ‘₯ Role Management πŸ“Š Analytics πŸ† Leaderboards
JWT-based auth 5-tier hierarchy Growth tracking Class/Dept/Institution
Secure password hashing Multi-role support Weekly/Monthly metrics Real-time rankings
Session management Permission enforcement Historical trends Multi-platform aggregation

πŸŽ“ For Students

  • πŸ“ˆ Track progress across multiple platforms (LeetCode, Codeforces, etc.)
  • πŸ“Š View personal analytics and growth metrics
  • πŸ… See class/department rankings
  • πŸ“… Historical performance timeline

πŸ‘¨β€πŸ« For Advisors

  • πŸ‘€ Monitor assigned students' progress
  • βœ… Approve/reject performance snapshots
  • πŸ“‰ Identify struggling students early
  • πŸ“‹ Batch approval workflows

πŸ§‘β€πŸ’Ό For Counsellors

  • 🏒 Department-wide analytics
  • πŸ“Š Comparative performance analysis
  • 🎯 Identify at-risk students
  • πŸ“ˆ Track cohort improvement

πŸ‘” For HODs

  • πŸ›οΈ Department management
  • πŸ‘₯ Staff & student assignment
  • πŸ“Š Department-level insights
  • πŸ“ˆ Placement readiness tracking

πŸ›‘οΈ For Admins

  • βš™οΈ System configuration
  • πŸ‘€ User management
  • 🏒 Department setup
  • πŸ” Institution-wide analytics

πŸ—οΈ System Architecture

High-Level Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     Client Layer (React SPA)                 β”‚
β”‚  Components β€’ Pages β€’ Routes β€’ State Management β€’ API Client β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                         β”‚ HTTPS/REST API
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  Application Layer (Flask)                   β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚   Auth   β”‚ Students β”‚ Snapshotsβ”‚ Analyticsβ”‚  Admin   β”‚  β”‚
β”‚  β”‚ Blueprintβ”‚ Blueprintβ”‚ Blueprintβ”‚ Blueprintβ”‚ Blueprintβ”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  Business Logic β€’ Authorization β€’ Validation         β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                         β”‚ SQLAlchemy ORM
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  Database Layer (PostgreSQL)                 β”‚
β”‚  Users β€’ Students β€’ Departments β€’ Snapshots β€’ Analytics     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Data Flow

sequenceDiagram
    participant S as Student
    participant P as Platform API
    participant A as Advisor/Counsellor
    participant D as Database
    participant L as Leaderboard

    S->>P: Submit Snapshot
    P->>D: Store (status: pending)
    A->>D: Review Snapshot
    D->>D: Update (status: approved)
    D->>L: Trigger Analytics
    L->>D: Compute Rankings
    D->>S: Display Analytics
Loading

πŸ› οΈ Technology Stack

Backend

Python Flask PostgreSQL SQLAlchemy JWT

Frontend

React Vite TailwindCSS React Router

DevOps

Docker Docker Compose Nginx Git

Layer Technology Purpose
Runtime Python 3.10+ Server-side language
Framework Flask 3.1.2 Web application framework
Database PostgreSQL 15 Relational data storage
ORM SQLAlchemy 2.0 Database abstraction
Migration Alembic Schema versioning
Auth Flask-JWT-Extended JWT token management
Password bcrypt Password hashing
Frontend React 18 + Vite UI library + build tool
Styling Tailwind CSS Utility-first CSS
Charts Recharts Data visualization
Container Docker + Compose Containerized deployment
Proxy Nginx Reverse proxy (production)

πŸš€ Quick Start

Option 1: Docker (Recommended) β€” 5 Minutes

# 1. Clone the repository
git clone https://github.com/sangsaist/codelens.git
cd codelens

# 2. Configure environment
cp .env.example .env
# Edit .env with your settings (DB password, JWT secret, etc.)

# 3. Start all services
docker-compose -f docker-compose.dev.yml up -d --build

# 4. Initialize database
docker-compose -f docker-compose.dev.yml exec backend flask db upgrade

# 5. Seed roles
docker-compose -f docker-compose.dev.yml exec backend python -c \
  "from app import create_app; from app.auth.seed import seed_roles; app = create_app(); app.app_context().push(); seed_roles()"

# 6. Generate & import test data
docker-compose -f docker-compose.dev.yml exec backend python scripts/generate_all_data.py
docker-compose -f docker-compose.dev.yml exec backend python scripts/seed_data.py

# 7. Open the app
# Frontend: http://localhost:5173
# Backend:  http://localhost:5000

Option 2: Manual Setup

See the full Setup Guide for step-by-step manual installation.

Default Credentials

Role Email Password
Admin admin@college.edu Admin@12345
HOD (CSE) hod.cse@college.edu Hod@12345
Student See backend/data/students.csv Student@123

πŸ“ Student emails are randomly generated. Check backend/data/students.csv for exact emails.


πŸ“š API Documentation

Core Endpoints

Method Endpoint Description Auth
POST /auth/register Register new user No
POST /auth/login Login and receive JWT No
GET /analytics/my-summary Student dashboard data Student+
GET /analytics/institution-summary Institution overview Admin/HOD
GET /platforms/my Linked platform accounts Student+
POST /platforms/link Link coding platform Student+
POST /snapshots Submit performance snapshot Student+
GET /counsellor/pending-snapshots Review queue Advisor+
PUT /counsellor/snapshots/<id>/approve Approve snapshot Advisor+
POST /staff/create Create staff member Admin/HOD
GET /staff/my-team View team hierarchy Staff+
GET /academics/departments List departments Any
πŸ“– API Request/Response Examples

Login:

curl -X POST http://localhost:5000/auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "admin@college.edu",
    "password": "Admin@12345"
  }'

Response:

{
  "success": true,
  "message": "Login successful",
  "data": {
    "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
    "user": {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "email": "admin@college.edu",
      "full_name": "System Administrator",
      "roles": ["admin"]
    }
  }
}

πŸ”’ Security

  • βœ… JWT Authentication – Stateless, token-based auth
  • βœ… Password Hashing – bcrypt with salt
  • βœ… Role-Based Access Control – 5-tier hierarchical permissions (Admin β†’ HOD β†’ Counsellor β†’ Advisor β†’ Student)
  • βœ… SQL Injection Prevention – SQLAlchemy ORM parameterized queries
  • βœ… CORS Protection – Configurable origin restrictions
  • βœ… Non-root Docker containers – Least-privilege execution
  • βœ… Secrets via environment variables – No hardcoded credentials in code
⚠️ Production Security Checklist
  • Generate strong JWT secret: openssl rand -hex 32
  • Set strong database password
  • Restrict CORS to your institution's domain
  • Configure HTTPS with valid SSL certificates
  • Implement rate limiting (Flask-Limiter)
  • Enable audit logging
  • Set up database backups
  • Keep dependencies updated

πŸ—ΊοΈ Roadmap

Project started: February 2025 β€” currently in active development.

βœ… v1.0 – Foundation (Current)

  • βœ… JWT authentication & role-based access control
  • βœ… 5-tier role hierarchy (Admin, HOD, Counsellor, Advisor, Student)
  • βœ… Department & academic structure management
  • βœ… Student profile management
  • βœ… Manual performance snapshot entry
  • βœ… Snapshot approval workflow
  • βœ… Basic analytics & growth metrics
  • βœ… Leaderboard generation
  • βœ… React frontend with role-based dashboards
  • βœ… Docker dev & production deployment
  • βœ… Bulk data import via CSV
  • 🚧 HOD student-to-advisor assignment (in progress)

πŸ”œ v1.5 – Platform Integration (Planned)

  • πŸ”„ Automated LeetCode data sync
  • πŸ”„ Automated GitHub activity tracking
  • πŸ”„ Background job processing (Celery/Redis)
  • πŸ”„ Snapshot auto-generation from synced data
  • πŸ”„ Email notifications

πŸ“Š v2.0 – Advanced Analytics (Planned)

  • πŸ“Š Placement readiness scoring
  • πŸ“Š At-risk student detection
  • πŸ“Š Performance trend visualization
  • πŸ“Š Department comparative analysis
  • πŸ“Š Custom report builder

πŸ€– v3.0 – Intelligent Insights (Future)

  • πŸ€– Personalized learning recommendations
  • πŸ€– Predictive analytics
  • πŸ€– Smart mentoring suggestions
  • πŸ€– Automated risk alerts

πŸ“ Project Structure

codelens/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ auth/           # Login, Register, Roles
β”‚   β”‚   β”œβ”€β”€ staff/          # Staff Profiles (HOD, Advisor, Counsellor)
β”‚   β”‚   β”œβ”€β”€ academics/      # Departments & Batches
β”‚   β”‚   β”œβ”€β”€ students/       # Student Profiles
β”‚   β”‚   β”œβ”€β”€ platforms/      # External Account Linking
β”‚   β”‚   β”œβ”€β”€ snapshots/      # Progress Tracking
β”‚   β”‚   β”œβ”€β”€ analytics/      # Data Aggregation
β”‚   β”‚   β”œβ”€β”€ counsellor/     # Review Dashboards
β”‚   β”‚   β”œβ”€β”€ review/         # Approval Logic
β”‚   β”‚   β”œβ”€β”€ common/         # Utilities (RBAC, Responses)
β”‚   β”‚   β”œβ”€β”€ setup/          # Bootstrapping Scripts
β”‚   β”‚   └── __init__.py     # App Factory
β”‚   β”œβ”€β”€ scripts/            # Data generation & seeding
β”‚   β”œβ”€β”€ migrations/         # Alembic DB migrations
β”‚   β”œβ”€β”€ data/               # Generated CSV test data
β”‚   β”œβ”€β”€ Dockerfile
β”‚   β”œβ”€β”€ requirements.txt
β”‚   └── run.py
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ api/            # Axios API clients
β”‚   β”‚   β”œβ”€β”€ context/        # React context (Auth)
β”‚   β”‚   β”œβ”€β”€ hooks/          # Custom hooks
β”‚   β”‚   β”œβ”€β”€ pages/          # Page components
β”‚   β”‚   β”œβ”€β”€ routes/         # Route definitions
β”‚   β”‚   └── utils/          # Utility functions
β”‚   β”œβ”€β”€ Dockerfile
β”‚   β”œβ”€β”€ nginx.conf
β”‚   └── package.json
β”œβ”€β”€ nginx/                  # Reverse proxy (production)
β”œβ”€β”€ docs/                   # Documentation
β”œβ”€β”€ docker-compose.dev.yml  # Development environment
β”œβ”€β”€ docker-compose.prod.yml # Production environment
β”œβ”€β”€ .env.example            # Environment template
└── .gitignore

🀝 Contributing

Contributions are welcome! Whether it's bug reports, feature requests, or code β€” your input helps make CodeLens better.

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

πŸ“„ License

This project is licensed under the MIT License β€” see the LICENSE file for details.


πŸ“– Documentation


Built with ❀️ for Education

Making Coding Education Data-Driven, One Institution at a Time

⬆ Back to Top


Β© 2025 CodeLens. Open Source Project under MIT License.

About

Open-source student coding performance analytics platform for colleges.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors