A modern web-based library attendance system built with Flask, designed to streamline student attendance management in libraries. This application provides an intuitive interface for students to check in via ID and offers comprehensive admin tools for viewing attendance metrics, generating reports, and managing user data.
- Student Check-In: Quick ID-based attendance tracking with real-time student information display
- Modern Admin Dashboard: Interactive dashboard with real-time analytics and visual charts
- User Role Management: Separate authentication for students and administrators
- Real-time Notifications: Flash message system with modern pop-up notifications using Notiflix
- Comprehensive Dashboard:
- Interactive visitor statistics charts with course-based filtering
- Real-time attendance data with customizable time ranges (weekly, monthly, yearly, custom)
- Location-based visitor analytics
- Recently logged-in students tracking
- Student Management: Complete CRUD operations for student records
- Course Management: Add, edit, and delete courses with enrollment tracking
- Profile Management: Admin profile settings with image upload support
- Advanced Filtering: Filter data by time periods, courses, and locations
- Multiple Export Formats: CSV and PDF export options with custom date ranges
- Advanced Analytics:
- Attendance by course, age group, and residence
- Peak hours analysis
- Monthly/weekly trends
- Comprehensive Backup System: Automatic backup of deleted records in both CSV and SQLite formats
- Location Management: Hierarchical location system (Province > Municipality > Barangay)
- Password Reset System: Email-based password recovery with verification codes
- Secure Admin Authentication: Role-based access control
- Session Management: Secure session handling with proper logout functionality
- Responsive Design: Mobile-friendly interface that works on all devices
- Modern UI: Clean, intuitive design with Bootstrap 5
- Real-time Updates: Live dashboard updates and notifications
- Flash Message System: Consistent notification system across all pages
- Loading Indicators: Visual feedback for all operations
Library-Attendance-Management/
βββ app.py # Main Flask application
βββ config.py # Configuration settings
βββ init_db.py # Database initialization
βββ requirements.txt # Python dependencies
βββ models/ # Database models
β βββ __init__.py
β βββ attendance.py # Attendance tracking model
β βββ course.py # Course management model
β βββ location.py # Location hierarchy model
β βββ student.py # Student information model
β βββ user.py # User authentication model
βββ routes/ # Application routes
β βββ __init__.py
β βββ admin_routes.py # Admin dashboard and management
β βββ graph_routes.py # Chart and analytics endpoints
β βββ student_routes.py # Student check-in functionality
βββ templates/ # HTML templates
β βββ base.html # Base template
β βββ login.html # Student login page
β βββ _flash_messages.html # Flash message component
β βββ admin_new/ # Modern admin interface
β βββ ae_base.html # Admin base template
β βββ ae_dashboard.html # Interactive dashboard
β βββ ae_login.html # Admin login
β βββ ae_manage.html # Student management
β βββ ae_user.html # Admin profile management
β βββ ae_forgot_password.html # Password recovery
β βββ ae_reset_password.html # Password reset
β βββ ae_verify_code.html # Email verification
β βββ ae_download.html # Export interface
βββ utils/ # Utility functions
β βββ backup.py # Record backup system
β βββ email_verification.py # Email verification utilities
β βββ ensure_dirs.py # Directory management
β βββ export.py # Data export functionality
β βββ graph_export.py # Chart generation and export
βββ static/ # Static assets
βββ assets/ # UI framework assets
βββ uploads/ # User uploaded files
βββ js/ # Custom JavaScript
- Python 3.8 or higher
- Git
- (Optional) Docker for containerized deployment
-
Clone the Repository:
git clone https://github.com/kents00/Library-Attendance.git cd Library-Attendance-Management -
Set Up Virtual Environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install Dependencies:
pip install -r requirements.txt
-
Environment Configuration: Create a
.envfile in the root directory:SECRET_KEY=your-secret-key-here DEBUG=True DATABASE_URL=sqlite:///instance/attendance.db UPLOAD_FOLDER=static/uploads # Email Configuration (Optional - for password reset) MAIL_SERVER=smtp.gmail.com MAIL_PORT=587 MAIL_USE_TLS=True MAIL_USERNAME=your-email@gmail.com MAIL_PASSWORD=your-app-password
-
Initialize Database:
python init_db.py
-
Run the Application:
python app.py
Access the application at http://localhost:5000
# Pull and run the latest image
docker pull kents00/library-access-monitor:latest
docker run -d -p 5000:5000 --name library-access-monitor kents00/library-access-monitor:latest
# Access the application
# Navigate to http://localhost:5000# Build and start with docker-compose
docker-compose up -d
# View logs
docker-compose logs -f
# Stop the application
docker-compose down# Stop the container
docker stop library-access-monitor
# Remove the container
docker rm library-access-monitor
# View container logs
docker logs library-access-monitor
# Access container shell
docker exec -it library-access-monitor /bin/bash- Check-In Process:
- Navigate to the main page
- Enter your student ID
- View your profile information and confirm attendance
- Receive confirmation of successful check-in
- First-Time Login:
- Default admin credentials are created during database initialization
- Access admin panel at
/admin/login - Update admin profile and change default password
-
Analytics Dashboard:
- View real-time visitor statistics with interactive charts
- Filter data by time periods (weekly, monthly, yearly, custom)
- Monitor attendance trends by course and location
- Track recently logged-in students
-
Student Management:
- Add new students with complete profile information
- Edit existing student records
- Upload student profile images
- Manage student-course assignments
- Bulk operations and search functionality
-
Course Management:
- Create and manage academic courses
- View enrollment statistics
- Track course-specific attendance patterns
-
Data Export & Reports:
- Export attendance data in CSV or PDF formats
- Generate custom reports with date range filtering
- Download visual charts and analytics
- Access historical attendance data
-
System Administration:
- Manage admin profiles and permissions
- Configure system settings
- Access backup and recovery tools
- Monitor system health and performance
- Forgot Password:
- Use the "Forgot Password" link on admin login
- Enter email address associated with admin account
- Check email for 6-digit verification code
- Enter verification code and set new password
For password reset functionality, configure email settings in your .env file:
MAIL_SERVER=smtp.gmail.com
MAIL_PORT=587
MAIL_USE_TLS=True
MAIL_USERNAME=your-email@gmail.com
MAIL_PASSWORD=your-app-password # Use app-specific password for GmailUPLOAD_FOLDER=static/uploads
MAX_CONTENT_LENGTH=16777216 # 16MB max file size# SQLite (default)
DATABASE_URL=sqlite:///instance/attendance.db
# PostgreSQL (for production)
DATABASE_URL=postgresql://username:password@localhost/dbname
# MySQL
DATABASE_URL=mysql://username:password@localhost/dbname- Deletion Backups: Automatic backup creation when records are deleted
- Multiple Formats: CSV and SQLite backup formats
- Timestamped Files: Unique backup files with creation timestamps
- Organized Storage: Backups stored in
utils/backups/directory
# Create manual database backup
python -c "from utils.backup import create_manual_backup; create_manual_backup()"
# Export all data
python -c "from utils.export import export_all_data; export_all_data()"-
Create Feature Branch:
git checkout -b feature/new-feature-name
-
Database Changes:
- Update model files in
models/ - Run database migrations
- Test changes thoroughly
- Update model files in
-
Frontend Updates:
- Modify templates in
templates/ - Update static assets in
static/ - Ensure responsive design
- Modify templates in
-
Backend Logic:
- Add routes in appropriate
routes/files - Create utility functions in
utils/ - Implement proper error handling
- Add routes in appropriate
# Run application in debug mode
export FLASK_ENV=development
export FLASK_DEBUG=1
python app.py
# Test database operations
python -c "from models import db; db.create_all()"- β Modern Admin Interface: Complete UI overhaul with responsive design
- β Interactive Dashboard: Real-time charts and analytics
- β Flash Message System: Consistent notifications across all pages
- β Password Recovery: Email-based password reset functionality
- β Course Management: Complete course CRUD operations
- β Enhanced Security: Improved authentication and session management
- β Location Management: Hierarchical location system
- β Advanced Filtering: Custom date ranges and multi-criteria filtering
- β Export Improvements: Enhanced PDF and CSV export capabilities
- β Backup System: Comprehensive data backup and recovery
We welcome contributions! Please follow these steps:
- Fork the Repository
- Create Feature Branch:
git checkout -b feature/amazing-feature - Commit Changes:
git commit -m 'Add amazing feature' - Push to Branch:
git push origin feature/amazing-feature - Open Pull Request
- Follow PEP 8 style guidelines
- Write comprehensive tests
- Update documentation
- Ensure backward compatibility
- Test across different browsers and devices
This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: GitHub Issues
- Discussions: GitHub Discussions
