├── Attendance.xlsx ├── Final_Attendance.xlsx ├── README.md ├── Students.xlsx ├── a ├── attend.py ├── b ├── c └── d /Attendance.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshakalluri1403/Attendance-Notification-System-Using-AWS/aa68f94330b3547571ed2297760154437fc592b4/Attendance.xlsx -------------------------------------------------------------------------------- /Final_Attendance.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshakalluri1403/Attendance-Notification-System-Using-AWS/aa68f94330b3547571ed2297760154437fc592b4/Final_Attendance.xlsx -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Attendance Notification System 2 | 3 | This project implements an attendance notification system that reads student attendance records from AWS S3 and sends notifications via AWS Simple Email Service (SES). The system checks each student's attendance status for the day and sends an appropriate email notification. 4 | 5 | ![](https://github.com/harshakalluri1403/Attendance-Notification-System-Using-AWS/blob/02f902c92cc6ca3038ae7c55d2209db699994e83/a) 6 | 7 | ![](https://github.com/harshakalluri1403/Attendance-Notification-System-Using-AWS/blob/02f902c92cc6ca3038ae7c55d2209db699994e83/d) 8 | 9 | ## Features 10 | 11 | - Reads student information and attendance records from Excel files stored in an AWS S3 bucket. 12 | - Sends attendance notifications to students via email using AWS SES. 13 | - Supports attendance status notifications for both present and absent students. 14 | - Uploads the final attendance status back to S3 for record-keeping. 15 | 16 | ## Requirements 17 | 18 | - Python 3.x 19 | - `pandas` library 20 | - `boto3` library 21 | 22 | ## Setup 23 | 24 | 1. **Install Required Libraries** 25 | 26 | Make sure you have the necessary libraries installed. You can install them using pip: 27 | 28 | ```bash 29 | pip install pandas boto3 30 | ``` 31 | 2. AWS Configuration 32 | - Ensure you have an AWS account and have configured your AWS credentials. You can do this by setting up the AWS CLI and running aws configure. 33 | - The email used as the sender in the SES must be verified in the AWS SES console. 34 | 35 | 3. S3 Bucket Setup 36 | - Create an S3 bucket (e.g., food-delivery-app-assets). 37 | - Upload the following Excel files to the S3 bucket: 38 | - Students.xlsx: Contains student IDs and their email addresses. 39 | 40 | ![](https://github.com/harshakalluri1403/Attendance-Notification-System-Using-AWS/blob/02f902c92cc6ca3038ae7c55d2209db699994e83/b) 41 | 42 | - Attendance.xlsx: Contains attendance records with student IDs and dates. 43 | 44 | ![](https://github.com/harshakalluri1403/Attendance-Notification-System-Using-AWS/blob/02f902c92cc6ca3038ae7c55d2209db699994e83/c) 45 | 46 | ## Usage 47 | 1. Update the following constants in the script to match your configuration: 48 | ```python 49 | BUCKET_NAME = 'food-delivery-app-assets' # Your S3 bucket name 50 | STUDENTS_FILE_KEY = 'Students.xlsx' # Path to Students.xlsx in S3 51 | ATTENDANCE_FILE_KEY = 'Attendance.xlsx' # Path to Attendance.xlsx in S3 52 | ``` 53 | 2. Replace the Source email address in the send_email function with your verified email in SES: 54 | ```python 55 | Source='pbot6789@gmail.com', # Replace with your verified email in SES 56 | ``` 57 | 3. Run the script: 58 | ```bash 59 | python attend.py 60 | ``` 61 | -------------------------------------------------------------------------------- /Students.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshakalluri1403/Attendance-Notification-System-Using-AWS/aa68f94330b3547571ed2297760154437fc592b4/Students.xlsx -------------------------------------------------------------------------------- /a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshakalluri1403/Attendance-Notification-System-Using-AWS/aa68f94330b3547571ed2297760154437fc592b4/a -------------------------------------------------------------------------------- /attend.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import boto3 3 | from datetime import datetime 4 | from io import BytesIO 5 | 6 | # Initialize AWS SES client and S3 client 7 | ses_client = boto3.client('ses', region_name='ap-south-1') # Replace with your AWS region 8 | s3_client = boto3.client('s3') 9 | 10 | # Constants for S3 11 | BUCKET_NAME = 'food-delivery-app-assets' # Replace with your S3 bucket name 12 | STUDENTS_FILE_KEY = 'Students.xlsx' # Path to Students.xlsx in S3 13 | ATTENDANCE_FILE_KEY = 'Attendance.xlsx' # Path to Attendance.xlsx in S3 14 | 15 | # Function to read Excel files from S3 16 | def read_excel_from_s3(bucket_name, file_key): 17 | response = s3_client.get_object(Bucket=bucket_name, Key=file_key) 18 | return pd.read_excel(BytesIO(response['Body'].read())) 19 | 20 | # Load Excel files from S3 21 | students_df = read_excel_from_s3(BUCKET_NAME, STUDENTS_FILE_KEY) 22 | attendance_df = read_excel_from_s3(BUCKET_NAME, ATTENDANCE_FILE_KEY) 23 | 24 | # Get today's date in the correct format 25 | today = datetime.now().strftime('%d-%m-%Y') 26 | 27 | # Check attendance and send emails 28 | for _, student in students_df.iterrows(): 29 | student_id = student['student_id'] 30 | student_email = student['email'] 31 | 32 | # Check attendance for today 33 | attendance_record = attendance_df[(attendance_df['date'] == today) & (attendance_df['student_id'] == student_id)] 34 | 35 | if not attendance_record.empty: 36 | status = attendance_record['status'].values[0] 37 | if status == 'Present': 38 | message = (f"Dear Student,\n\n" 39 | f"We are pleased to inform you that you were present for the class on {today}.\n" 40 | f"Thank you for your commitment to your studies. Keep up the great work!\n\n" 41 | f"Best regards,\n" 42 | f"Your Attendance Team") 43 | else: 44 | message = (f"Dear Student,\n\n" 45 | f"This is a reminder that you were absent for the class on {today}.\n" 46 | f"Please make sure to catch up on any missed materials and reach out if you have any questions.\n\n" 47 | f"Best wishes,\n" 48 | f"Your Attendance Team") 49 | else: 50 | message = (f"Dear Student,\n\n" 51 | f"We were unable to find an attendance record for you today ({today}).\n" 52 | f"If you believe this is an error, please contact us as soon as possible.\n\n" 53 | f"Thank you,\n" 54 | f"Your Attendance Team") 55 | 56 | # Send email using AWS SES 57 | response = ses_client.send_email( 58 | Source='pbot6789@gmail.com', # Replace with your verified email in SES 59 | Destination={ 60 | 'ToAddresses': [student_email], 61 | }, 62 | Message={ 63 | 'Subject': { 64 | 'Data': f'Attendance Notification for {today}', 65 | }, 66 | 'Body': { 67 | 'Text': { 68 | 'Data': message, 69 | }, 70 | }, 71 | } 72 | ) 73 | print(f"Sent email to {student_email}: {message}") 74 | 75 | # Optionally, save the final attendance status to S3 76 | final_attendance_file_key = 'Final_Attendance.xlsx' # Path to save the final attendance status 77 | attendance_df.to_excel('Final_Attendance.xlsx', index=False) 78 | 79 | # Upload the final attendance status back to S3 80 | s3_client.upload_file('Final_Attendance.xlsx', BUCKET_NAME, final_attendance_file_key) 81 | print("Final attendance status saved to S3 at path:", final_attendance_file_key) 82 | -------------------------------------------------------------------------------- /b: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshakalluri1403/Attendance-Notification-System-Using-AWS/aa68f94330b3547571ed2297760154437fc592b4/b -------------------------------------------------------------------------------- /c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshakalluri1403/Attendance-Notification-System-Using-AWS/aa68f94330b3547571ed2297760154437fc592b4/c -------------------------------------------------------------------------------- /d: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harshakalluri1403/Attendance-Notification-System-Using-AWS/aa68f94330b3547571ed2297760154437fc592b4/d --------------------------------------------------------------------------------