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/readme.md b/Web Development/Basic/virtual-classes-attendance-automation-system/readme.md new file mode 100644 index 000000000..ae49e0241 --- /dev/null +++ b/Web Development/Basic/virtual-classes-attendance-automation-system/readme.md @@ -0,0 +1,13 @@ +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. +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. 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 @@ + + +
+Roll No | +Name | +Total Duration (hh:mm:ss) | +
---|---|---|
{{ record['roll_no'] }} | +{{ record['name'] }} | +{{ record['total_duration'] }} | +