Skip to content

πŸ“š Simplify attendance tracking with Snappy! πŸŽ“ Manage classes, verify attendance with dynamic codes, and empower students and professors alike. Built with Django, Azure, and a touch of efficiency. πŸš€βœ¨

Notifications You must be signed in to change notification settings

rorosaga/snappy-attendance

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Snappy


Overview Google Slides

Snappy is a digital platform designed to enhance the management and tracking of students' attendance. It's inspired by the "Qwickly" application but with several advancements for accuracy and user experience.



Features

  • Account Creation & Authentication: Users create accounts authenticated via university email, ensuring secure access.
  • Manual Attendance Adjustment: Teachers can manually alter attendance records for flexibility and accuracy.
  • Dynamic Verification Code: Uses a serverless function to generate a new verification code every 30 seconds for enhanced security.
  • Time Tracking: Marks students late based on their entry time into the classroom.


The System Architecture:

architecture (1) (1)

Django backend deployed on Azure App Service.
Three serverless functions: code generation, code deletion, code validation.
API endpoint to connect to MySQL database and to perform CRUD operations
Dead Letter Queue for logging errors
AJAX used to dynamically update the page.



How to Navigate the System:


Homescreen


Screenshot 13

Snappy's homescreen presents itself as symplistic although efficient. It displays three possible paths: Login, Professor Dashboard and Student Dashboard. The user then logs in and starts the systems navigation.



Script to poulate the model:



Section Description
Django Setup Sets the default Django settings module and initializes the Django environment.
Import Statements Imports required modules and models from Django (User, Professor, Student, Course).
Function create_user - Takes parameters: username, email, password, role, name, and courses.
- Creates a new user using User.objects.create_user.
- Creates a role-specific profile (Professor or Student).
- Assigns courses to the user profile based on the specified role.



Professor's Navigation through the System


Screenshot 6

When the professor logs in the following screen is presented, displaying a successfull login and the name of the user.



Screenshot 7

The professor has the possibility to check the attendance status of a student for any specific session of the term.

Screenshot 8

Once the query is sent, snappy will present the following page displaying the Name and Surname of the student, and the status of the attendance for the specific session. In this case Rodrigo in session 1 was in fact present.

Screenshot 9

It is not uncommon for a professor to be teaching more than one class throughout the semester, therefore in the case of Edoardo, the professor will select the class he is teaching and start the attendance process by pressing the button "Display Code"

Generate Codes Functions:



Code Explanation
def main(req: func.HttpRequest) -> func.HttpResponse: Defines the main function, the entry point for the Azure Function. Takes an HTTP request as input and returns an HTTP response.
six_digit_code = str(random.randint(100000, 999999)) Generates a random six-digit code.
table_service = TableService(connection_string=os.environ['AzureWebJobsStorage'])
table_name = 'TempCodes'
Establishes a connection to Azure Cosmos DB table using the provided connection string. Sets the table name to 'TempCodes'.
entity = Entity()
entity.PartitionKey = 'Codes'
entity.RowKey = six_digit_code
entity.Timestamp = datetime.datetime.utcnow()
Creates an Entity object representing a record in Azure Cosmos DB table. Sets partition key to 'Codes', row key to the generated code, and timestamp to current UTC time.
table_service.insert_entity(table_name, entity) Inserts the created entity into 'TempCodes' table in Azure Cosmos DB.
response_body = json.dumps({"code": six_digit_code}) Prepares a JSON response body containing the generated six-digit code.
return func.HttpResponse(response_body, mimetype="application/json") Returns an HTTP response with the JSON response body containing the generated code, sent back to the client.




Screenshot 10


The following page will show displaying the code necessary for the students to complete the attendance process



Delete Codes Functions:



Code Explanation
table_service = TableService(connection_string=os.environ['AzureWebJobsStorage']) Initializes a connection to Azure Cosmos DB table using the provided connection string.
table_name = "TempCodes" Specifies the table name as "TempCodes".
partition_key = "Codes" Sets the partition key as "Codes".
entities = table_service.query_entities(...) Queries entities (codes) from the table with the specified partition key.
current_time = datetime.datetime.utcnow()... Gets the current time in UTC.
if entities.items: Checks if entities (codes) are found.
for entity in entities: Iterates over the retrieved entities.
if time_difference.total_seconds() > 30: Checks if the code has expired (more than 30 seconds old).
delete_code_from_table(...) Deletes the expired code from the table.
log_msg = f"Deleted code: {entity.RowKey}" Logs a message for each deleted code.
return func.HttpResponse("Cleanup completed... Returns a success message if cleanup is successful, else an error message.




Screenshot 11


In the case of 'orange status' students, the professor has the possibility to change manually the attendance. This would also be useful in the case in which a student has attended a seminar/presentation with IE which excuses the absences of a student.

Screenshot 12


Once all the students have inserted the code displayed, the professor can officially submit the attendance record of the session.



Student's Navigation through the System

Screenshot 1

When the student logs in the following screen is presented, displaying a successfull login and the name of the user.


Screenshot 3

The student will want to have the possibility to check their own attendance for a determined class, thus the student can select the course of interest and query the attendance log. The log is presented in a easy user-friendly style displaying the date of the session, the session number and the status of presenece (present/absent)


Screenshot 4

The student will have to insert the generated code for the attendance process to be complete.



Snappy's Error Handling System

Screenshot 2


Once the login is done, the system is informed of the position the user holds, therefore if a student were to try and enter the professors dashboard he would recieve the following error message.

Screenshot 5


In the case in which the student submits an incorrect code the system will notify them with an error message and ask them to try again.

Validate Code Function:

Code Explaination
main(req: func.HttpRequest) -> func.HttpResponse: Defines the main function, which is the entry point for the Azure Function. It takes an HTTP request as input and returns an HTTP response.
Try-Except Block: Catches exceptions that may occur during the execution of the function.
JSON Content Retrieval: Attempts to get the JSON content from the HTTP request. If there's no 'code' in the request body, it returns a 400 Bad Request response asking for the 'code'.
Azure Cosmos DB Setup: Establishes a connection to Azure Cosmos DB. Defines the names of tables and queues to be used (TempCodes, LogAttempts, log-error-attempts).
Entity Querying: Queries entities in the 'TempCodes' table where the partition key is 'Codes'.
Entity Matching Loop: Checks if the received code matches any of the codes in the 'TempCodes' table. If a match is found, logs the attempt as successful in the 'LogAttempts' table and returns a 200 OK response with "true". If no match is found, logs the attempt as unsuccessful and sends an error message to the 'log-error-attempts' queue. Returns a 400 Bad Request response with "false".
No Entities Found: If there are no entities in the 'TempCodes' table, returns a 400 Bad Request response with "No code found in the table."
Exception Handling: Catches any exceptions that occur during the execution. Logs the traceback and returns a 500 Internal Server Error response with the error message.



Acknowledgments

  • Credits to the original "Qwickly" application for inspiration.
  • Thanks to all contributors who have invested their time in improving this project.

About

πŸ“š Simplify attendance tracking with Snappy! πŸŽ“ Manage classes, verify attendance with dynamic codes, and empower students and professors alike. Built with Django, Azure, and a touch of efficiency. πŸš€βœ¨

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published