From efead0a6a03bb76b33aa952cddb3e3bcad57e92c Mon Sep 17 00:00:00 2001 From: Kapileswarapu Ram Satya Sai Date: Fri, 10 May 2024 22:11:05 +0530 Subject: [PATCH 1/3] Add files via upload --- .../main.py | 51 +++++++++ .../templates/index.html | 101 ++++++++++++++++++ .../templates/report.html | 70 ++++++++++++ 3 files changed, 222 insertions(+) create mode 100644 Web Development/Basic/virtual-classes-attendance-automation-system/main.py create mode 100644 Web Development/Basic/virtual-classes-attendance-automation-system/templates/index.html create mode 100644 Web Development/Basic/virtual-classes-attendance-automation-system/templates/report.html diff --git a/Web Development/Basic/virtual-classes-attendance-automation-system/main.py b/Web Development/Basic/virtual-classes-attendance-automation-system/main.py new file mode 100644 index 000000000..ceb993811 --- /dev/null +++ b/Web Development/Basic/virtual-classes-attendance-automation-system/main.py @@ -0,0 +1,51 @@ +from flask import Flask, render_template, request +import pandas as pd + +app = Flask(__name__, template_folder='templates') + +@app.route('/') +def index(): + return render_template('index.html') + +@app.route('/generate_report', methods=['POST']) +def generate_report(): + try: + # Get form data + students_file = request.files['students_file'] + attendance_file = request.files['attendance_file'] + threshold = int(request.form['threshold'])/100 + + def convert_to_seconds(duration_str): + h, m, s = map(int, duration_str.split(':')) + return h * 3600 + m * 60 + s + + # Read CSV files + students_df = pd.read_csv(students_file) + attendance_df = pd.read_csv(attendance_file) + + # Convert 'Time in Call' to total seconds + attendance_df['total_seconds'] = attendance_df['Time in Call'].apply(convert_to_seconds) + + # Calculate threshold duration + max_duration = attendance_df['total_seconds'].max() + threshold_duration = max_duration * threshold + + # Filter attendance data based on threshold + filtered_attendance = attendance_df[attendance_df['total_seconds'] > threshold_duration] + + # Merge attendance data with student data + merged_data = pd.merge(filtered_attendance, students_df, left_on='Full Name', right_on='Student Name', how='left') + + # Prepare report data + report_data = merged_data[['Roll No', 'Full Name', 'Time in Call']] + report_data.columns = ['roll_no', 'name', 'total_duration'] + report_data = report_data.to_dict(orient='records') + + return render_template('report.html', report_data=report_data) + + except Exception as e: + error_message = f"Error: {str(e)}" + return render_template('index.html', error=error_message) + +if __name__ == '__main__': + app.run(debug=True) diff --git a/Web Development/Basic/virtual-classes-attendance-automation-system/templates/index.html b/Web Development/Basic/virtual-classes-attendance-automation-system/templates/index.html new file mode 100644 index 000000000..d83c8c17d --- /dev/null +++ b/Web Development/Basic/virtual-classes-attendance-automation-system/templates/index.html @@ -0,0 +1,101 @@ + + + + Attendance Automation System + + + +
+

Attendance Automation System

+
+ + + + + + + + + + + +
+ + {% if error %} +

{{ error }}

+ {% endif %} +
+ + diff --git a/Web Development/Basic/virtual-classes-attendance-automation-system/templates/report.html b/Web Development/Basic/virtual-classes-attendance-automation-system/templates/report.html new file mode 100644 index 000000000..869d63f0c --- /dev/null +++ b/Web Development/Basic/virtual-classes-attendance-automation-system/templates/report.html @@ -0,0 +1,70 @@ + + + + Attendance Report + + + +

Attendance Report

+ + + + + + + {% for record in report_data %} + + + + + + {% endfor %} +
Roll NoNameTotal Duration (hh:mm:ss)
{{ record['roll_no'] }}{{ record['name'] }}{{ record['total_duration'] }}
+
+ +
+ + From 281c973fef82ec9bdadac57d2fd4004ee6a1e0f2 Mon Sep 17 00:00:00 2001 From: Kapileswarapu Ram Satya Sai Date: Mon, 13 May 2024 23:25:52 +0530 Subject: [PATCH 2/3] Update virtual-classes-attendance-automation-system --- .../readme.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 Web Development/Basic/virtual-classes-attendance-automation-system/readme.md diff --git a/Web Development/Basic/virtual-classes-attendance-automation-system/readme.md b/Web Development/Basic/virtual-classes-attendance-automation-system/readme.md new file mode 100644 index 000000000..49679a343 --- /dev/null +++ b/Web Development/Basic/virtual-classes-attendance-automation-system/readme.md @@ -0,0 +1,10 @@ +The Virtual Classes Attendance Automation System is a web-based application developed using Flask, a Python web framework, to automate the process of generating attendance reports for virtual classes. This system allows users to upload two CSV files containing student information and attendance records, specify a minimum duration threshold for attendance, and generate a detailed report based on the provided criteria. + +Key features of the system include: +File Upload: Users can upload CSV files containing student information (`students_file`) and attendance records (`attendance_file`) directly through the web interface. +Threshold Setting: The system allows users to specify a minimum duration threshold (in seconds) for considering a student's attendance as valid. This threshold helps filter out short attendance durations. +Data Processing: Upon form submission, the system processes the uploaded CSV files, converts the 'Time in Call' duration to total seconds, and filters the attendance data based on the specified threshold. +Data Merge and Reporting: The system merges the filtered attendance data with student information based on matching names. It then generates a report containing relevant details such as roll number, student name, and total duration of attendance in hours, minutes, and seconds format. +User Interaction: After generating the report, users can view the attendance details in a formatted HTML table (`report.html`). The report page includes a button that allows users to reset and return to the initial form (`index.html`) for further processing. +This system streamlines the attendance tracking process for virtual classes, providing educators and administrators with a convenient tool to analyze student participation and ensure accurate attendance records. The use of Flask enables rapid development and deployment of the web application, making it accessible and user-friendly for both teachers and students. +By leveraging Python's pandas library for data manipulation and Flask for web development, the Virtual Classes Attendance Automation System offers a practical solution to enhance efficiency in managing virtual class attendance. \ No newline at end of file From ec2d9fd474dd460a31163a5ce8217a5b4866b928 Mon Sep 17 00:00:00 2001 From: Kapileswarapu Ram Satya Sai Date: Wed, 15 May 2024 13:41:03 +0530 Subject: [PATCH 3/3] Update readme.md --- .../virtual-classes-attendance-automation-system/readme.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Web Development/Basic/virtual-classes-attendance-automation-system/readme.md b/Web Development/Basic/virtual-classes-attendance-automation-system/readme.md index 49679a343..ae49e0241 100644 --- a/Web Development/Basic/virtual-classes-attendance-automation-system/readme.md +++ b/Web Development/Basic/virtual-classes-attendance-automation-system/readme.md @@ -1,4 +1,7 @@ The Virtual Classes Attendance Automation System is a web-based application developed using Flask, a Python web framework, to automate the process of generating attendance reports for virtual classes. This system allows users to upload two CSV files containing student information and attendance records, specify a minimum duration threshold for attendance, and generate a detailed report based on the provided criteria. +## Deployment + +Check out the live deployment of this project [here](https://virtual-classes-attendance-automation.onrender.com). Key features of the system include: File Upload: Users can upload CSV files containing student information (`students_file`) and attendance records (`attendance_file`) directly through the web interface. @@ -7,4 +10,4 @@ Data Processing: Upon form submission, the system processes the uploaded CSV fil Data Merge and Reporting: The system merges the filtered attendance data with student information based on matching names. It then generates a report containing relevant details such as roll number, student name, and total duration of attendance in hours, minutes, and seconds format. User Interaction: After generating the report, users can view the attendance details in a formatted HTML table (`report.html`). The report page includes a button that allows users to reset and return to the initial form (`index.html`) for further processing. This system streamlines the attendance tracking process for virtual classes, providing educators and administrators with a convenient tool to analyze student participation and ensure accurate attendance records. The use of Flask enables rapid development and deployment of the web application, making it accessible and user-friendly for both teachers and students. -By leveraging Python's pandas library for data manipulation and Flask for web development, the Virtual Classes Attendance Automation System offers a practical solution to enhance efficiency in managing virtual class attendance. \ No newline at end of file +By leveraging Python's pandas library for data manipulation and Flask for web development, the Virtual Classes Attendance Automation System offers a practical solution to enhance efficiency in managing virtual class attendance.