How mahendrasingh2003/project works
Project type and purpose
• This is a monolithic full-stack web application for logging employee attendance via facial recognition.
• The README confirms it’s built with Python/Flask, uses OpenCV, dlib, face_recognition and deepface for face-matching, and SQLite for storage.
File structure
• Top-level files:
• app.py – the Flask application entry point (routes, controllers, business logic)
• EmployeeDB.db – SQLite database file
• msenv.yml – conda environment spec
• Directories:
• /static – client assets (CSS, JS, audio, training images, CSV output files)
• /templates – Jinja2 HTML templates (login, signup, OTP, record pages, recognition page)
• Patterns:
• MVC-style separation: templates = views, app.py = controller & business logic, EmployeeDB.db = model/data store
• File-based datastore for training images and CSV exports
Key insights from README
• Technologies & libraries: Flask, SQLite, OpenCV, dlib, face_recognition, deepface
• Workflows: user signup/login → webcam capture → face encoding/recognition → attendance marking → report generation
• No external microservices or messaging queues—purely server-side monolith
Main components
a. Client Layer (Browser)
• Static UI (HTML/CSS/JS in /templates & /static)
• Camera integration via JS to capture images
b. Web Server Layer (Flask app.py)
• HTTP API endpoints for login, signup, reset password, record insertion, recognition
• Controller logic invoking face recognition routines
c. Face Recognition Engine
• OpenCV/dlib preprocessing
• face_recognition & deepface libraries for encoding & matching
d. Data Layer
• SQLite database (EmployeeDB.db storing user profiles & attendance records)
• File storage (/static/TrainingImages for reference face images; /static/records.csv and todayAttendance.csv for exports)
e. External Libraries & Environment
• conda environment (msenv.yml)
• Python runtime
• External dependencies (OpenCV, dlib, face_recognition, deepface)
Relationships and data flows
• Browser → Flask HTTP request → Flask Route
• Flask → Database read/write (SQLite queries)
• Flask → Face Recognition Engine (image in → encoding/matching → result)
• Flask → File System for reading training images & writing CSV exports
• Flask → Browser HTTP response / real-time marking feedback
Architectural patterns & design principles
• MVC pattern (Views in templates, Controllers in app.py, Model as SQLite)
• Single-process synchronous request handling (no queueing or async microservices)
• Modularization by feature: authentication, attendance, reporting, recognition
• Separation of concerns: static assets served separately from dynamic routes