Skip to content

Saket8538/QR-Attendance-Rotation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Smart Attendance Management System with real-time sync and QR rotation

A comprehensive web-based attendance management system built with Python Flask, featuring real-time QR code scanning, dynamic QR rotation, cloud synchronization, and real-time updates via WebSocket.

πŸš€ Quick Start

Prerequisites

  • Python 3.8+
  • pip (Python package manager)

Installation

  1. Navigate to the project directory:

    cd python_attendance_system
  2. Create and activate virtual environment:

    python -m venv venv
    
    # Windows
    venv\Scripts\activate
    
    # macOS/Linux
    source venv/bin/activate
  3. Install dependencies:

    pip install -r requirements.txt
  4. Run the application:

    python run.py
  5. Open in browser:

Test Credentials

Role Email Password
Professor professor@acem.ac.in password123
Student student@acem.ac.in password123

✨ Features

For Professors

  • βœ… Create and manage classes
  • βœ… Start/stop attendance sessions
  • βœ… Generate dynamic QR codes (rotate every 30 seconds)
  • βœ… View real-time attendance
  • βœ… Enroll students in classes
  • βœ… Update attendance status
  • βœ… View analytics and reports
  • βœ… Complete sessions (auto-mark absent)
  • βœ… Cancel sessions

For Students

  • βœ… View enrolled classes
  • βœ… Scan QR codes to mark attendance
  • βœ… View attendance history
  • βœ… Receive notifications
  • βœ… Track attendance rate per class
  • βœ… Update profile

Security Features

  • πŸ” HMAC-SHA256 signed QR codes
  • πŸ” 30-second QR expiration
  • πŸ” Nonce to prevent replay attacks
  • πŸ” Device fingerprinting
  • πŸ” IP address logging
  • πŸ” Email domain restriction (@acem.ac.in)

πŸ“ Project Structure

python_attendance_system/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ __init__.py           # Flask app factory
β”‚   β”œβ”€β”€ models.py             # SQLAlchemy database models
β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ auth.py           # Authentication routes
β”‚   β”‚   β”œβ”€β”€ main.py           # Home and common pages
β”‚   β”‚   β”œβ”€β”€ student.py        # Student dashboard and features
β”‚   β”‚   β”œβ”€β”€ professor.py      # Professor dashboard and features
β”‚   β”‚   └── api.py            # API endpoints
β”‚   β”œβ”€β”€ templates/            # Jinja2 HTML templates
β”‚   β”‚   β”œβ”€β”€ base.html
β”‚   β”‚   β”œβ”€β”€ auth/
β”‚   β”‚   β”œβ”€β”€ main/
β”‚   β”‚   β”œβ”€β”€ student/
β”‚   β”‚   └── professor/
β”‚   └── utils/
β”‚       β”œβ”€β”€ qr_generator.py   # QR code generation & validation
β”‚       β”œβ”€β”€ session_generator.py
β”‚       └── seed_data.py      # Initial database data
β”œβ”€β”€ config.py                 # Configuration settings
β”œβ”€β”€ run.py                    # Application entry point
β”œβ”€β”€ requirements.txt          # Python dependencies
└── FEATURES_DOCUMENTATION.md # Complete feature documentation

πŸ”§ Configuration

Edit config.py to modify:

# QR Code settings
QR_EXPIRY_SECONDS = 30  # QR codes expire in 30 seconds
QR_ROTATION_INTERVAL = 30

# Email domain restriction
ALLOWED_EMAIL_DOMAIN = '@acem.ac.in'

# Attendance settings
LATE_THRESHOLD_MINUTES = 5  # Students marked late after 5 minutes

🎯 How It Works

QR Code Attendance Flow:

  1. Professor starts session β†’ Dynamic QR code generated
  2. QR code displayed β†’ Rotates every 30 seconds
  3. Student scans QR β†’ Using phone camera or web scanner
  4. System validates β†’ Checks signature, expiration, enrollment
  5. Attendance recorded β†’ Present or Late (based on time)
  6. Professor ends session β†’ Absent students auto-marked

QR Code Security:

{
  "sessionId": "uuid-string",
  "timestamp": 1736697600000,
  "nonce": "random-16-byte-hex",
  "signature": "hmac-sha256-hex",
  "expiresAt": "2026-01-12T12:00:30Z"
}

πŸ“± Supported Browsers

  • Chrome (recommended)
  • Firefox
  • Safari
  • Edge

Camera access required for QR scanning.

🀝 API Endpoints

Authentication

  • POST /auth/login - General login
  • POST /auth/student/register - Student registration
  • POST /auth/professor/register - Professor registration
  • GET /auth/logout - Logout

Student

  • GET /student/dashboard - Dashboard
  • GET /student/classes - Class list
  • GET /student/scan - QR scanner
  • POST /student/scan/process - Process scan
  • GET /student/attendance - Attendance history

Professor

  • GET /professor/dashboard - Dashboard
  • GET /professor/classes - Class list
  • POST /professor/classes/create - Create class
  • GET /professor/sessions - All sessions
  • POST /professor/sessions/<id>/activate - Start session
  • POST /professor/sessions/<id>/complete - End session

API

  • GET /api/health - System health check
  • GET /api/sessions/<id>/qr - Get QR code
  • GET /api/sessions/<id>/attendance - Get attendance

πŸ“„ Documentation

For complete feature documentation, see FEATURES_DOCUMENTATION.md

πŸ› οΈ Development

Database

SQLite database stored in instance/attendance.db

Real-time Updates

Flask-SocketIO for WebSocket connections

Templates

Jinja2 templates with Tailwind CSS styling

πŸ“ License

This project is for educational purposes.


Smart Attendance Management System - Making attendance tracking modern, secure, and efficient.

About

A comprehensive web-based attendance management system built with Python Flask, featuring real-time QR code scanning, dynamic QR rotation, cloud synchronization, and real-time updates via WebSocket.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors