pawan 2
pawan 2
1. Introduction
2. Project Requirements
o Hardware Requirements
o Software Requirements
3. System Design
o Flowchart
o Data Flow Diagram (DFD)
o Entity Relationship Diagram (ERD)
4. Modules and Features
o Admin/Teacher Login
o Student Management
o Attendance Management
o Attendance Reports
5. Database Design
o Tables and Structure
6. Technology Stack
o Python
o MySQL/SQLite
7. Step-by-Step Implementation
o Setting up the Database
o Coding the Application
8. Testing
9. Conclusion
1. Introduction
The Attendance Management System helps automate the attendance-taking process. It stores data
about students, tracks their attendance for each subject, and generates reports for teachers and
administrative staff. The system aims to save time and reduce the chances of errors that occur
when managing attendance manually.
2. Project Requirements
Hardware Requirements:
Software Requirements:
Python 3.x
MySQL or SQLite (for database management)
Pandas (optional, for report generation)
MySQL Workbench or any other SQL client (for database management)
3. System Design
Flowchart:
1. Start
2. Login Page:
o Teacher/Admin enters username and password.
o Verify credentials from database.
3. Main Dashboard:
o Admin can add/update student details.
o Admin can manage attendance.
o Admin can view attendance reports.
4. Attendance Management:
o Teacher selects the date and subject.
o Teacher marks attendance (Present/Absent).
5. Generate Reports:
o Attendance report for the selected student(s).
o Export reports to CSV or Excel format.
6. End
Entities involved:
Relationships:
Student to Attendance: One student can have multiple attendance records.
Teacher to Attendance: A teacher marks the attendance for students.
Admin/Teacher Login
Functionality: Secure login page for teachers or admins. Allows only authorized
personnel to access the system.
Fields: Username, Password.
Student Management
Attendance Management
Functionality: Teachers can mark attendance for students for a specific day and subject.
Fields: Student ID, Date, Subject, Status (Present/Absent).
Attendance Reports
Functionality: Admin or teacher can generate reports to view student attendance over a
period.
Fields: Student ID, Date Range, Subject, Attendance Status.
Sql code :
-- Create the database
CREATE DATABASE attendance_db;
import mysql.connector
from getpass import getpass
import datetime
# Login System
def login():
print("=== Login ===")
username = input("Enter username: ")
password = getpass("Enter password: ")
connection = connect_db()
cursor = connection.cursor()
cursor.execute("SELECT * FROM teachers WHERE username=%s AND
password=%s", (username, password))
result = cursor.fetchone()
if result:
print("\nLogin successful!\n")
return True
else:
print("\nInvalid credentials!\n")
return False
connection = connect_db()
cursor = connection.cursor()
cursor.execute("INSERT INTO students (name, class, roll_number,
contact_number) VALUES (%s, %s, %s, %s)",
(name, student_class, roll_number, contact_number))
connection.commit()
if result:
for student in result:
print(f"ID: {student[0]}, Name: {student[1]}, Class: {student[2]}, Roll
Number: {student[3]}, Contact: {student[4]}")
else:
print("No students found.")
connection = connect_db()
cursor = connection.cursor()
cursor.execute("""
SELECT date, subject, status FROM attendance
WHERE student_id=%s AND subject=%s AND date BETWEEN %s AND %s
""", (student_id, subject, start_date, end_date))
result = cursor.fetchall()
if result:
print("\nAttendance Report:")
for record in result:
print(f"Date: {record[0]}, Subject: {record[1]}, Status: {record[2]}")
else:
print("No records found for this student in the given date range.")
# Main menu
def main():
while True:
print("\n=== Attendance Management System ===")
print("1. Login")
print("2. Add Student")
print("3. View Students")
print("4. Mark Attendance")
print("5. View Attendance Report")
print("6. Exit")
if choice == '1':
if login():
logged_in = True
else:
logged_in = False
elif choice == '2':
add_student()
elif choice == '3':
view_students()
elif choice == '4':
if logged_in:
mark_attendance()
else:
print("\nPlease log in first!")
elif choice == '5':
if logged_in:
view_report()
else:
print("\nPlease log in first!")
elif choice == '6':
print("Exiting the system...")
break
else:
print("\nInvalid choice. Please try again.")
# Run the program
if __name__ == "__main__":
logged_in = False
main()
Explanation of Code