A modern, beautiful web-based attendance management system integrated with IoT biometric devices. Built with Flask, Bootstrap 5, and Chart.js featuring glassmorphism UI design.
- Glassmorphism design with blur effects
- Gradient backgrounds with animated elements
- Fully responsive - works on mobile, tablet, and desktop
- Interactive charts using Chart.js
- Smooth animations and transitions
- View personal attendance statistics
- See attendance percentage and trends
- Interactive charts (line graph & pie chart)
- Last 30 days attendance visualization
- Performance indicators
- View all students and their attendance
- Mark/edit attendance manually
- Search and filter students
- View class analytics
- Export attendance data
- RESTful API endpoint for biometric devices
- Automatic attendance marking via HTTP POST
- Real-time data synchronization
- Duplicate entry prevention
Biometric_Attendance_System/
βββ app.py # Main Flask application
βββ requirements.txt # Python dependencies
βββ attendance.db # SQLite database (auto-generated)
βββ iot_simulator.py # IoT device simulator
βββ README.md # This file
βββ templates/ # HTML templates
β βββ base.html # Base template with navbar
β βββ login.html # Login page
β βββ student_dashboard.html # Student dashboard
β βββ teacher_dashboard.html # Teacher dashboard
βββ static/ # Static files
βββ css/
β βββ style.css # Custom CSS with glassmorphism
βββ js/
β βββ script.js # JavaScript utilities
βββ images/ # Image assets
- Python 3.8 or higher
- pip (Python package manager)
-
Clone or navigate to the project directory:
cd Biometric_Attendance_System -
Create a virtual environment (recommended):
# macOS/Linux python3 -m venv venv source venv/bin/activate # Windows python -m venv venv venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Run the application:
python app.py
-
Open your browser and go to:
http://127.0.0.1:5000
- Email:
john@student.com - Password:
password123 - Role: Student
- Email:
teacher@school.com - Password:
password123 - Role: Teacher
jane@student.com- Jane Smithalice@student.com- Alice Johnsonbob@student.com- Bob Williamscharlie@student.com- Charlie Brown
All accounts use password: password123
POST /api/attendance
{
"student_id": 1,
"student_name": "John Doe",
"timestamp": "2024-01-15 10:30:00"
}Success (200):
{
"success": true,
"message": "Attendance marked for John Doe on 2024-01-15",
"student_name": "John Doe",
"date": "2024-01-15",
"timestamp": "2024-01-15 10:30:00"
}Error (400/404/500):
{
"success": false,
"message": "Error description"
}Run the included IoT simulator to test the API:
python iot_simulator.pyThis will simulate biometric scans and send attendance data to the server.
curl -X POST http://127.0.0.1:5000/api/attendance \
-H "Content-Type: application/json" \
-d '{
"student_id": 1,
"student_name": "John Doe",
"timestamp": "2024-01-15 10:30:00"
}'CREATE TABLE users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
email TEXT UNIQUE NOT NULL,
password TEXT NOT NULL,
role TEXT NOT NULL CHECK(role IN ('student', 'teacher'))
);CREATE TABLE attendance (
id INTEGER PRIMARY KEY AUTOINCREMENT,
student_id INTEGER NOT NULL,
date DATE NOT NULL,
status TEXT NOT NULL CHECK(status IN ('present', 'absent')),
timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (student_id) REFERENCES users(id),
UNIQUE(student_id, date)
);- Translucent cards with backdrop blur
- Soft shadows and borders
- Gradient overlays
- Smooth hover effects
- Primary: Purple gradient (
#667eeaβ#764ba2) - Success: Green gradient (
#43e97bβ#38f9d7) - Danger: Pink gradient (
#fa709aβ#fee140) - Info: Blue gradient (
#4facfeβ#00f2fe)
- Password hashing using SHA-256
- Session-based authentication
- Role-based access control (RBAC)
- SQL injection prevention
- CSRF protection (Flask built-in)
- Statistics Cards: Total days, present, absent, percentage
- Line Chart: 30-day attendance trend
- Pie Chart: Present vs Absent distribution
- Progress Bar: Visual attendance percentage
- Status Indicators: Performance feedback
- Class Statistics: Total students, good/poor attendance, average
- Student Table: Searchable, sortable list
- Quick Actions: Mark attendance, view details
- Filters: Search by name or email
- Export: Download attendance data
Edit app.py:
app.secret_key = 'your_new_secret_key_here'Use Python shell:
import sqlite3
import hashlib
conn = sqlite3.connect('attendance.db')
cursor = conn.cursor()
password_hash = hashlib.sha256('yourpassword'.encode()).hexdigest()
cursor.execute(
'INSERT INTO users (name, email, password, role) VALUES (?, ?, ?, ?)',
('New Student', 'new@student.com', password_hash, 'student')
)
conn.commit()
conn.close()Edit static/css/style.css and change CSS variables:
:root {
--gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
/* Add more gradients */
}The system is fully responsive and works on:
- π± Mobile devices (320px+)
- π± Tablets (768px+)
- π» Desktops (1024px+)
- π₯οΈ Large screens (1440px+)
If you encounter database errors, delete attendance.db and restart the app. It will automatically recreate with sample data.
rm attendance.db
python app.pyChange the port in app.py:
app.run(debug=True, host='0.0.0.0', port=5001) # Change to 5001Make sure you're in the virtual environment and have installed requirements:
source venv/bin/activate # or venv\Scripts\activate on Windows
pip install -r requirements.txt- Email notifications for low attendance
- PDF report generation
- Multi-semester support
- Facial recognition integration
- Mobile app (React Native)
- Real-time WebSocket updates
- Advanced analytics dashboard
- Bulk attendance upload (CSV)
- Parent portal access
- QR code attendance marking
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Built with β€οΈ using Flask, Bootstrap 5, and Chart.js
If you encounter any issues or have questions:
- Check the troubleshooting section
- Review the code comments
- Check Flask documentation: https://flask.palletsprojects.com/
Happy Coding! π
Remember to change default passwords and secret key in production!