GithubHelp home page GithubHelp logo

sharadashehan / automated_attendance_system Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 0.0 18.77 MB

Face recognition based automated attendance management system

Python 64.79% Rich Text Format 0.34% Shell 2.60% Kotlin 0.04% Swift 0.63% Objective-C 0.01% Dart 15.82% CMake 6.59% C++ 8.06% C 0.48% HTML 0.63%
django-rest-framework postgresql django flutter face-recognition image-processing mqtt-protocol numpy opencv amqp mosquitto-mqtt-broker rabbitmq

automated_attendance_system's Introduction

⚡Automated Attendance System⚡

🏢System Architecture🛠️

sysArchi

Cam Stream Application

Camera Stream Application provides User Interface to initialize system with credentials, register new users into system and configure camera input devices. Image processing techniques were employed with help of OpenCv and Numpy modules, to detect changes in image flow and thus optimize performance by minimizing API calls to backend server.

Additionally, the subscription to relevant MQTT topic, enables the application to receive real-time attendance updates from processing application. The application utilizes python text-to-speech module to enhance user experience by verbally greeting the user with a message, crafted by processing the data received from MQTT broker.

Backend

The Django Rest Framework is used for developing the backend infrastructure of the application. This backend application is tasked with managing incoming requests from both the frontend and the camera stream application. Its functionalities encompass the registration of company and employees, as well as the facilitation of attendance updates through processing requests received from the camera stream application.

Token-based authentication mechanisms are employed to verify the legitimacy of requests arriving from both the frontend and camera stream application. Once authenticated, images associated with these requests are sent into a queue within the Advanced Message Queuing Protocol (AMQP) broker for subsequent processing.

NGINX is used as a reverse proxy server to efficiently route HTTP traffic to the Django server.

Processing Application

A Face Recognition model operates within a processing application, consuming messages from an AMQP broker and analyzing the images contained within. Its primary function is to identify employees' faces by generating encodings for each input image and comparing them against registered user encodings. This comparison process identifies the best matching user and verifies the accuracy of the match. Additionally, a Convolutional Neural Network (CNN) pretrained for spoof detection is employed to ensure the input image is not a spoof.

Following the identification process, the model determines whether the user's attendance needs updating by referencing the user's latest attendance records, thus preventing immediate detections from being marked as multiple attendance instances. Upon updating the database, the model publishes a message to an MQTT broker for real-time communication with the Camera Stream Application.

Furthermore, the application is integrated with Google Cloud Monitoring to monitor its performance. Custom metric values are regularly pushed to the Google Cloud Monitoring Dashboard, providing real-time insights into the application's operation and efficiency.

Frontend

The Flutter Application offers intuitive interfaces for both employees and administrators. Employees can securely log in to access their attendance records, allowing them to review their historical attendance data.

Administrators, on the other hand, are empowered with comprehensive insights into attendance management. They can effortlessly monitor the attendance of individual employees, discerning their current attendance status—whether they are present, absent, or even physically in the office. Additionally, administrators have access to a summarized overview of all attendance records for each date, facilitating efficient management and oversight of attendance data.

Security Features

The system was deployed within a Virtual Private Cloud (VPC) on the Google Cloud Platform (GCP) to establish secure communication channels between applications. Robust firewall rules are implemented to strictly control unauthorized access to the system.

To ensure secure communication between the backend and the Camera Stream Application, multiple layers of security measures are employed. This includes enforcing a stringent password policy, utilizing authentication access tokens, and encrypting communication channels using Fernet (Symmetric Encryption).

The AMQP broker is configured to permit message production and consumption solely from applications within the private network. Additionally, it employs basic authentication mechanisms to guarantee secure communication between the backend and processing application.

For communication between the processing application and the Camera Stream Application, the MQTT broker employs a combination of token-based and basic authentication methods, further enhancing security measures.

The PostgreSQL database, hosted on Google Cloud SQL, adheres to rigorous encryption protocols both at rest and in transit. Access to the database is rigorously controlled, allowing only virtual machines running the backend and processing application to interact with it, thus fortifying data integrity and confidentiality.


Refer dev branch for development and deployment guidelines.

automated_attendance_system's People

Contributors

sharadashehan avatar

Stargazers

Sasika Amarasinghe avatar Robert avatar Chamika Jayasinghe avatar Chathura De Silva avatar

Watchers

Kostas Georgiou avatar  avatar

automated_attendance_system's Issues

Executive View Employee API

GET /api/executive/view/employee/<user_id>

Requires an Authentication Token with edit or read permission.

Response data : {
"id": 1,
"email": "[email protected]",
"role_name": "CEO",
"is_manager": true,
"is_executive": true,
"first_name": "Sam",
"last_name": "Convoy",
"picture": null,
"attendance": "{"2024": {"01": {"01": {"entrance": ["10-00", "13-00"], "leave": ["12-00", "17-00"]}, "02": {"entrance": ["10-00", "13-00"], "leave": ["12-00", "17-00"]}, "03": {"entrance": ["10-00", "13-00"], "leave": ["12-00", "17-00"]}}}}"
}

success status code : 200

Executive View Role API

GET /api/executive/view/role/<user_id>

Requires an Authentication Token with edit permission.

Response data : {
"id": 6,
"name": "AI Engineer",
"has_read_permission": false,
"has_edit_permission": false
}

success status code : 200

Executive View Attendance API

GET /api/executive/view/attendance/<year_>/<month_>/<day_>

Requires an Authentication Token with edit or read permission.

Response data : [
{
"entrance": [
"10-00",
"13-00"
],
"leave": [
"12-00",
"17-00"
],
"id": 1,
"first_name": "Sam",
"last_name": "Convoy"
},
{
"id": 3,
"first_name": "Emma",
"last_name": "Johnson",
"entrance": [],
"leave": []
},
...
]

success status code : 200

Executive View All Roles API

GET /api/executive/list-view/role/

Requires an Authentication Token with edit permission.

Response data : [
{
"id": 1,
"name": "Employee",
"has_read_permission": false,
"has_edit_permission": false
},
{
"id": 2,
"name": "CEO",
"has_read_permission": true,
"has_edit_permission": true
},
{
"id": 3,
"name": "CTO",
"has_read_permission": true,
"has_edit_permission": false
},
...
]

success status code : 200

Executive View All Employees API

GET /api/employee/list-view/employee/

Requires an Authentication Token with edit or read permission.

Response data : [
{
"id": 11,
"email": "[email protected]",
"role_name": "AI Engineer",
"has_read_permission": false,
"has_edit_permission": false,
"first_name": "Lily",
"last_name": "Sanders",
"picture": null,
"attendance": "{"2024": {"01": {"01": {"entrance": ["09-30"], "leave": ["15-30"]}, "02": {"entrance": ["10-03"], "leave": ["14-30"]}, "03": {"entrance": ["15-37"], "leave": ["14-00"]}}}}"
},
{
"id": 3,
"email": "[email protected]",
"role_name": "Marketing Manager",
"has_read_permission": true,
"has_edit_permission": false,
"first_name": "Emma",
"last_name": "Johnson",
"picture": null,
"attendance": "{}"
},
...
]

success status code : 200

Get Auth Token API

POST /api/auth/

Request data : {
"email": "[email protected]",
"password": "Secret123"
}

Response data : {
'token': 'f298fecf8b7ebdcde3aca41537756c3d5e68deb4'
}

success status code : 200

Update User Leave Attendance API

GET /middleware/update/user-leave/<user_id>/hour/minute

Requires hub secret key hashed in sha256 in header 'hub-secret-key' .

Response data : {
"message": "Leave updated successfully",
"firstName": "Sam",
"lastName": "Convoy",
"time": "10-41"
}

success status code : 200

Executive Update Employee API

PATCH /api/executive/update/employee/<user_id>

Requires an Authentication Token with edit permission.

Request data : {
"role": 6
}

Response data : {
"id": 5,
"role": 6,
"role_name": "AI Engineer",
"has_read_permission": false,
"has_edit_permission": false,
"attendance": "{"2024": {"01": {"01": {"entrance": ["08-05", "13-00"], "leave": ["12-05", "16-07"]}, "02": {"entrance": ["07-55", "12-50"], "leave": ["12-42", "16-37"]}, "03": {"entrance": ["08-55", "12-55"], "leave": ["12-32", "16-05"]}}}}"
}

success status code : 200

An executive user can edit either role or attendance of any employee through this API.

Get User Encodings API

GET /middleware/get/user-encodings

Requires hub secret key hashed in sha256 in header 'hub-secret-key' .

Response data : {
"users": [
{
"id": 1,
"encodings": "[-0.18338929116725922, 0.1511330008506775, 0.06779976934194565, -0.0018241307698190212, ... ]"
}
]
}

success status code : 200

User Login API

POST /api/login/

Request data : {
"email":"[email protected]",
"password":"Secret123"
}

Response data : {
"message": "Welcome, Olivia!"
}

success status code : 200

Executive Delete Employee API

DELETE /api/executive/delete/employee/<user_id>

Requires an Authentication Token with edit permission.

success status code : 204

User Logout API

GET /api/logout/

Response data : {
"message": "Logout successful!"
}

success status code : 200

User Update API

PATCH /api/employee/update/employee/

Requires Authentication Token of user ( currently logged in )

Request data : {
"last_name": "Austine",
"notifications": true
}

Response data : {
"first_name": "Olvia",
"last_name": "Austine",
"picture": null,
"notifications": true
}

success status code : 200

first_name, last_name, picture, notifications, password fields' values can be changed through this API. When updating password, following data will be required.
{
"current_password" : "Secret124",
"new_password" : "Secret122"
}

Update User Entrance Attendance API

GET /middleware/update/user-entrance/<user_id>/hour/minute

Requires hub secret key hashed in sha256 in header 'hub-secret-key' .

Response data : {
"message": "Entrance updated successfully",
"firstName": "Sam",
"lastName": "Convoy",
"time": "10-41"
}

success status code : 200

Executive update Role API

PATCH /api/executive/update/role/<user_id>

Requires an Authentication Token with edit permission.

Request data : {
"name": "Security Engineer",
"has_read_permission": true
}

Response data : {
"id": 8,
"name": "Security Engineer",
"has_read_permission": true,
"has_edit_permission": false
}

success status code : 200

Executive Delete Role

DELETE /api/executive/delete/role/<user_id>

Requires an Authentication Token with edit permission.

success status code : 204

Get User Details

GET /api/employee/view/employee/

Requires Authentication Token of user ( currently logged in )

Response data : {
"id": 5,
"email": "[email protected]",
"role_name": "DevOps Engineer",
"has_read_permission": false,
"has_edit_permission": false,
"first_name": "Olivia",
"last_name": "Harrison",
"picture": null,
"attendance": "{"2024": {"01": {"01": {"entrance": ["08-05", "13-00"], "leave": ["12-05", "16-07"]}, "02": {"entrance": ["07-55", "12-50"], "leave": ["12-42", "16-37"]}, "03": {"entrance": ["08-55", "12-55"], "leave": ["12-32", "16-05"]}}}}",
"notifications": true
}

success status code : 200

Executive create Role API

POST /api/executive/create/role/

Requires an Authentication Token with edit permission.

Request data : {
"name": "UI Designer",
"has_read_permission": false,
"has_edit_permission": false
}

Response data : {
"id": 9,
"name": "UI Designer",
"has_read_permission": false,
"has_edit_permission": false
}

success status code : 201

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.