Acknowledgement
Acknowledgement
Apart from the efforts of us, the success of any project depends
largely on the encouragement and guidelines of many others. I take
this opportunity to express my gratitude to the people who have
been instrumental in the successful completion of this project.
Objective:
The Attendance Management System is a comprehensive Python
application designed to efficiently handle and manage student
attendance records. The program allows users to add, update, and
remove student information, as well as to mark attendance,
generate various attendance reports, and export data to a CSV file.
It uses JSON for data storage and PrettyTable for displaying tabular
data, making it user-friendly and suitable for educational
institutions.
Key Features:
1. Add Student: Allows the addition of new students to the
system by specifying a unique student ID and name. This feature
ensures that each student is recorded with an identifier and their
name for easy reference.
2. Update Student Name: Enables the updating of a student's
name based on their student ID. This function is useful for
correcting or updating student information as needed.
3. Remove Student: Provides the ability to remove students
from the system using their student ID. This feature ensures that
outdated or incorrect student records can be managed effectively.
4. Mark Attendance: Facilitates the marking of student
attendance on a specific date. Users can record whether a student
was present or absent, allowing for accurate tracking of attendance
over time.
5. View Attendance: Displays a comprehensive table of
attendance records for all students. This view includes student IDs,
names, dates, and their attendance status, providing a quick
overview of attendance data.
6. Generate Report: Creates a summary report showing the
number of present and absent days for each student. This report
helps in evaluating student attendance patterns over a period.
7. Generate Daily Report: Produces a report detailing
attendance for a specific date. This feature allows users to view
which students were present or absent on any given day.
8. Generate Monthly Report: Compiles a report of attendance
for a particular month, summarizing the number of present and
absent days for each student. This is useful for monthly
assessments and record-keeping.
9. Search Student: Allows users to search for students by their
name or ID. This functionality helps in quickly locating and
retrieving specific student information from the system.
10. Export to CSV: Exports all attendance records to a CSV file
format. This feature provides a way to back up data and perform
further analysis using spreadsheet software.
Technical Details:
➢ Data Storage: Attendance records are stored in a JSON file,
ensuring easy data manipulation and retrieval.
➢ Reporting: Reports and attendance views are generated
using the PrettyTable module, which formats data into
readable tables.
➢ CSV Export: Data is exported to a CSV file for easy sharing
and analysis using standard spreadsheet tools.
➢ Error Handling: Includes basic error handling for file
operations and date formatting to ensure smooth operation.
Usage:
The system is designed to be operated through a console-based
menu, where users can select various options to manage student
attendance. It is suitable for educational institutions, training
centers, or any organization that requires a systematic approach to
tracking attendance.
Benefits:
➢ Simplifies the management of attendance records.
➢ Provides clear and comprehensive reports on student
attendance.
➢ Allows for easy data export and integration with other tools
for further analysis.
Conclusion:
The Attendance Management System is a practical and efficient tool
for handling attendance records, offering essential functionalities
needed for effective attendance tracking and reporting. Its simple
interface and key features make it a valuable asset for managing
student attendance in an organized manner.
SOurCE CODE
import json
import os
import csv
from datetime import datetime
from prettytable import PrettyTable
table = PrettyTable()
table.field_names = ["Student ID", "Name", "Date", "Status"]
print("\nAttendance Records:")
print(table)
table = PrettyTable()
table.field_names = ["Student ID", "Name", "Present Days", "Absent Days"]
table = PrettyTable()
table.field_names = ["Student ID", "Name", "Status"]
table = PrettyTable()
table.field_names = ["Student ID", "Name", "Present Days", "Absent Days"]
table = PrettyTable()
table.field_names = ["Student ID", "Name"]
try:
with open('attendance_management_system_report.csv', 'w', newline='') as
csvfile:
fieldnames = ['Student ID', 'Name', 'Date', 'Status']
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writeheader()
if choice == '1':
student_id = input("Enter student ID: ").strip()
student_name = input("Enter student name: ").strip()
add_student(student_id, student_name)
elif choice == '2':
student_id = input("Enter student ID: ").strip()
new_name = input("Enter new student name: ").strip()
update_student_name(student_id, new_name)
elif choice == '3':
student_id = input("Enter student ID: ").strip()
remove_student(student_id)
elif choice == '4':
student_id = input("Enter student ID: ").strip()
date = input("Enter date (YYYY-MM-DD): ").strip()
status = input("Enter 'P' for present or 'A' for absent: ").strip()
mark_attendance(student_id, date, present=(status.upper() == 'P'))
elif choice == '5':
view_attendance()
elif choice == '6':
generate_report()
elif choice == '7':
date = input("Enter date (YYYY-MM-DD): ").strip()
generate_daily_report(date)
elif choice == '8':
month = input("Enter month (YYYY-MM): ").strip()
generate_monthly_report(month)
elif choice == '9':
query = input("Enter student name or ID to search: ").strip()
search_student(query)
elif choice == '10':
export_to_csv()
elif choice == '11':
print("\nExiting the system. Goodbye!")
break
else:
print("\nInvalid choice. Please enter a number between 1 and 11.")
if __name__ == "__main__":
main()
OuTPuT
===================================================================
Attendance Management System
===================================================================
1. Add Student
2. Update Student Name
3. Remove Student
4. Mark Attendance
5. View Attendance
6. Generate Report
7. Generate Daily Report
8. Generate Monthly Report
9. Search Student
10. Export to CSV
11. Exit
===================================================================
Enter your choice (1-11): 1
Enter student ID: 12b01
Enter student name: Suhail
===================================================================
Attendance Management System
===================================================================
1. Add Student
2. Update Student Name
3. Remove Student
4. Mark Attendance
5. View Attendance
6. Generate Report
7. Generate Daily Report
8. Generate Monthly Report
9. Search Student
10. Export to CSV
11. Exit
===================================================================
Enter your choice (1-11): 2
Enter student ID: 12b16
Enter new student name: Mifraz
===================================================================
Attendance Management System
===================================================================
1. Add Student
2. Update Student Name
3. Remove Student
4. Mark Attendance
5. View Attendance
6. Generate Report
7. Generate Daily Report
8. Generate Monthly Report
9. Search Student
10. Export to CSV
11. Exit
===================================================================
Enter your choice (1-11): 3
Enter student ID: 12b17
===================================================================
Attendance Management System
===================================================================
1. Add Student
2. Update Student Name
3. Remove Student
4. Mark Attendance
5. View Attendance
6. Generate Report
7. Generate Daily Report
8. Generate Monthly Report
9. Search Student
10. Export to CSV
11. Exit
===================================================================
Enter your choice (1-11): 4
Enter student ID: 12b09
Enter date (YYYY-MM-DD): 2024-08-06
Enter 'P' for present or 'A' for absent: p
===================================================================
Attendance Management System
===================================================================
1. Add Student
2. Update Student Name
3. Remove Student
4. Mark Attendance
5. View Attendance
6. Generate Report
7. Generate Daily Report
8. Generate Monthly Report
9. Search Student
10. Export to CSV
11. Exit
===================================================================
Enter your choice (1-11): 5
Attendance Records:
+---------------+-------------+----------------+------------+
| Student ID | Name | Date | Status |
+---------------+-------------+----------------+------------+
| 12B01 | Suhail | 2024-08-05 | Present |
| 12B01 | Suhail | 2024-08-06 | Present |
| 12B02 | Farhaan | 2024-08-05 | Present |
| 12B02 | Farhaan | 2024-08-06 | Absent |
| 12B06 | Kaif | 2024-08-05 | Absent |
| 12B07 | Hameed | 2024-08-05 | Present |
| 12B07 | Hameed | 2024-08-06 | Present |
| 12B09 | Anas | 2024-08-05 | Absent |
| 12B09 | Anas | 2024-08-06 | Present |
| 12B15 | Khaja | 2024-08-05 | Absent |
| 12B15 | Khaja | 2024-08-06 | Present |
| 12B16 | Mifraz | 2024-08-05 | Absent |
| 12B16 | Mifraz | 2024-08-06 | Present |
+---------------+-------------+-----------------+------------+
===================================================================
Attendance Management System
===================================================================
1. Add Student
2. Update Student Name
3. Remove Student
4. Mark Attendance
5. View Attendance
6. Generate Report
7. Generate Daily Report
8. Generate Monthly Report
9. Search Student
10. Export to CSV
11. Exit
===================================================================
Enter your choice (1-11): 6
===================================================================
Attendance Management System
===================================================================
1. Add Student
2. Update Student Name
3. Remove Student
4. Mark Attendance
5. View Attendance
6. Generate Report
7. Generate Daily Report
8. Generate Monthly Report
9. Search Student
10. Export to CSV
11. Exit
===================================================================
Enter your choice (1-11): 9
Enter student name or ID to search: 12b07
===================================================================
Attendance Management System
===================================================================
1. Add Student
2. Update Student Name
3. Remove Student
4. Mark Attendance
5. View Attendance
6. Generate Report
7. Generate Daily Report
8. Generate Monthly Report
9. Search Student
10. Export to CSV
11. Exit
===================================================================
Enter your choice (1-11): 10
===================================================================
Attendance Management System
===================================================================
1. Add Student
2. Update Student Name
3. Remove Student
4. Mark Attendance
5. View Attendance
6. Generate Report
7. Generate Daily Report
8. Generate Monthly Report
9. Search Student
10. Export to CSV
11. Exit
===================================================================
Enter your choice (1-11): 11
➢https://www.geeksforgeeks.org
➢https://www.pythonforall.com
➢https://www.scribd.com