Absentee Generator Project Report
Absentee Generator Project Report
GENERATOR
PROJECT REPORT SUBMITTED BY:
Aditya Amit Kinjawadekar
Akash Amit Kinjawadekar
ACKNOWLEDGEMENT
Page | 2
INDEX
1 About 4
2 Introduction 5
3 Theory 6
4 Project Flowchart 8
5 Project Algorithm 10
6 Source Code 15
7 Output 22
8 Journey of the Project 28
9 Precautions 31
10 Requirements 31
11 Bibliography 32
Page | 3
ABOUT
Page | 4
INTORDUCTION
Page | 5
THEORY
Page | 6
We are using the same programming language because
Python’s design philosophy emphasizes code readability
with its notable use of significant whitespace. Its language
constructs and object-oriented approach aim to help
programmers write clear, logical code for small and large-
scale projects
THE MODULES USED
Page | 7
PROJECT FLOWCHART
DETAILED ABSENTEE GENERATOR
Page | 8
QUICK ABSENTEE GENERATOR
Page | 9
PROJECT ALGORITHM
DETAILED ABSENTEE GENERATOR
I. Create a folder called Detailed Absentee Generator and create a file
called main.py
II. Inside the main.py import the modules tkinter, pandas, subprocess, os,
datetime, xlwt and filedialog from tkinter
III. Using os get the current working directory and store in a variable folder
IV. Create an empty list called mainlist and two dictionaries called
absentee_check_dictionary and absentee_dictionary
V. Get todays date using datetime and store in today
VI. Store time_of_class as 60
VII. Create a function called time_calculate that converts a time_string to
seconds and returns the value
VIII. Create a function called print_to_excel that takes in the data as
dictionary and creates an Excel file with today as its name
IX. Create a function called open_file that uses subprocess to open the file
with the file_path given as the parameter
Page | 10
absentee_dictionary and adds the list absentee as the value with the
date of class as the key in the following format:
{date: absentees}
The the print to excel is called in which the absentee_dictionary is
passed as the parameter
XI. Create a function called file_open that uses filedialog to get the file
path and check the type of file. If the file is mainlist then it use pandas
to read the csv file and extract the data under the column ‘Names’ and
append the list to mainlist. If the file is absentee file then create three
lists called joined_list , left_list, absentee_check_list. Use pandas to read
cav of the file and extract data under the column ‘Name’ and append
it to absentee_check_list. Extract the data under the column ‘User
Action’ and get the joined list by checking if the action is joined or left
list if the user action is left. It also checks if two consecutive actions are
joined for different students then it appends the left time as
‘100:100:100’ which means the student left the class after the
attendance was taken. After this it takes date of class from the first
index of the Timestamp column and stores it as date. Finally this data
is exported to absentee_check_dictionary in the following format:-
{date:
{
"date": date,
"absentee_check_list":absentee_check_list,
"joined_list": joined_list,
"left_list": left_list
}
}
XII. Now use Python classes to create a body class that has a method called
create button that creates a tkinter button at given position and with
the given function
Page | 11
XIII. Start a tkinter window as root
XIV. Create a button with a text called “Choose Main File”. When pressed
the button the file_open function is called and mainfile parameter is
given
XV. Now create a Label and an Option menu with values from 1 to 10
asking the user for number of absentee files. Create an enter button
which when pressed stores the user input as an integer and starts the
function given below
XVI. Use an for loop to iterate the number of times given by the user and
creating as many buttons using the create button method of the Body
class and giving the function of file_open with the parameter of
absentee file. Display the file name on respective buttons using tkinter
grid and Labels
XVII. Create another Enter button which when clicked starts the entry
function.
XVIII. End the program using root.mainloop() which helps it run till close
button is clicked
XIX. If the program is successful then create a button that allows user to
open the file directly by calling the open_file function
Page | 12
QUICK ABSENTEE GENERATOR
Step 1. Create a folder called Quick Absentee Generator and create a file called
main.py
Step 2. Inside the main.py import the modules tkinter, pandas, and filedialog
from tkinter
Step 3. Create two empty lists called mainlist and absentee_list and a
dictionary called absentee_check_dictionary
Step 4. Store time_of_class as 60
Step 5. Create a function called time_calculate that converts a time_string to
seconds and returns the value
Step 6. Create a function called print_to_window that takes in the data as list
and displays it as tkinter Labels on the output screen
Step 7. Create a function called entry that takes the absentee_check_dictionary
and checks for the student in absentee_check_list which are not in the
main_list and adds it to a list called absentee. It also checks if the
attendance time of students is less than half of time_of_class. This is
done by converting the time_strings in the joined_list and left_list to
seconds by the time_calculate function and subtracting the left_time
by the joined time and checking it with half the time_of_class in
seconds. These students are considered as absent and appends it to
the same list. After the checking is completed the print_to_window is
called in which the absentee_list is passed as the parameter
Step 8. Create a function called file_open that uses filedialog to get the file
path and check the type of file. If the file is mainlist then it use pandas
to read the csv file and extract the data under the column ‘Names’ and
append the list to mainlist. If the file is absentee file then create three
lists called joined_list , left_list, absentee_check_list. Use pandas to read
cav of the file and extract data under the column ‘Name’ and append
Page | 13
it to absentee_check_list. Extract the data under the column ‘User
Action’ and get the joined list by checking if the action is joined or left
list if the user action is left. It also checks if two consecutive actions are
joined for different students then it appends the left time as
‘100:100:100’ which means the student left the class after the
attendance was taken. After this it takes date of class from the first
index of the Timestamp column and stores it as date. Finally this data
is exported to absentee_check_dictionary in the following format:-
{date:
{
"date": date,
"absentee_check_list":absentee_check_list,
"joined_list": joined_list,
"left_list": left_list
}
}
Step 9. Now use Python classes to create a body class that has a method called
create button that creates a tkinter button at given position and with
the given function
Step 10. Start a tkinter window as root
Step 11. Create a button with a text called “Choose Main File”. When pressed
the button the file_open function is called and mainfile parameter is
given
Step 12. Create a button asking for absentee file using the create button
method of the Body class and giving the function of file_open with the
parameter of absentee file. Display the file name on button using grid
and Label
Step 13. Create an Enter button which when clicked starts the entry function.
Step 14. End the program using root.mainloop() which helps it run till close
button is clicked
Page | 14
SOURCE CODE
DETAILED ABSENTEE GENERATOR
import tkinter as tk
import pandas as pd
import xlwt
import datetime
import os
import subprocess
folder = str(os.getcwd())
main_list = []
absent_check_dictionary = {}
absentee_dictionary = {}
time_of_class = 60
today = datetime.datetime.now().strftime("%d-%m-%Y")
def time_calculate(time_string):
time_string = time_string[:-2]
time_list = str(time_string).split(":")
return time
Page | 15
def print_to_excel(data):
pass
def open_file(file_path):
def entry():
main_dictionary = absent_check_dictionary
for d in main_dictionary:
absentees = []
date = main_dictionary[d]['date']
joined_list = main_dictionary[d]['joined_list']
left_list = main_dictionary[d]['left_list']
absentee_check_list = main_dictionary[d]['absentee_check_list']
join_time = time_calculate(joined_list[i])
leave_time = time_calculate(left_list[i])
absentees.append(absentee_check_list[i])
absentees.append(student)
absentee_dictionary.update({date: absentees})
print_to_excel(absentee_dictionary)
Page | 16
def file_open(query, row, column, column_span=1):
pass
class Body:
def __init__(self):
self.button = None
if enter:
else:
if self.button['state'] == tk.ACTIVE:
self.button['relief'] = tk.FLAT
body = Body()
root = tk.Tk()
def number_of_files_entry():
row = 2
enter_number_of_files.destroy()
Page | 17
for file in range(int(number_of_files.get())):
row += 1
number_of_files = tk.StringVar()
number_of_files.set(1)
number_of_files_option_menu.config(font=font)
root.mainloop()
Page | 18
QUICK ABSENTEE GENERATOR
import tkinter as tk
import pandas as pd
main_list = []
absent_check_dictionary = {}
absentee_list = []
time_of_class = 60
def time_calculate(time_string):
time_string = time_string[:-2]
time_list = str(time_string).split(":")
return time
def print_to_window(data):
pass
def entry():
main_dictionary = absent_check_dictionary
absentees = []
Page | 19
for d in main_dictionary:
joined_list = main_dictionary[d]['joined_list']
left_list = main_dictionary[d]['left_list']
absentee_check_list = main_dictionary[d]['absentee_check_list']
join_time = time_calculate(joined_list[i])
leave_time = time_calculate(left_list[i])
absentees.append(absentee_check_list[i])
absentees.append(student)
print_to_window(absentees)
pass
class Body:
def __init__(self):
self.button = None
if enter:
else:
Page | 20
self.button = tk.Button(text=text, font=font, command=lambda:
file_open(text, row, column, column_span))
if self.button['state'] == tk.ACTIVE:
self.button['relief'] = tk.FLAT
def button_destroy(self):
self.button.destroy()
if __name__ == '__main__':
body = Body()
root = tk.Tk()
def number_of_files_entry():
body.button_create("Enter", 2 + 1, 0, 3, True)
number_of_files_entry()
root.mainloop()
Page | 21
OUTPUT
DETAILED ABSENTEE GENERATOR
The default Screen after Running the App which asks for
main file and number of Absentee Files.
Page | 22
Three Files are chosen
Page | 23
Screen after 1.csv, 2.csv and 3.csv are chosen
Page | 24
The excel file with the column names as the date of class
Page | 25
QUICK ABSENTEE GENERATOR
The default Screen after Running the App which asks for
main file and absente File.
Page | 26
Screen after 1.csv is chosen
After the Enter button is clicked the absentees are displayed and
the total number of absentees are also shown.
Page | 27
JOURNEY OF THE PROJECT
Page | 28
The app received many positive responses
Page | 29
The app has undergone three updates since its launching.
The first update helped it solve the encoding error which
occurred due to different encoding of Teams file. The
second update helped find the students who were present
for less than half the time of a class and considered them
as absent. The third update helped to make the app more
efficient by enhancing the visual appearance and
refactoring the code. Tr.Saatyavati encouraged me to
send this project to ATL Marathon 2020
Page | 30
PRECAUTIONS
REQUIREMENTS
Windows PC / Laptop
Python 3 with pip installed
Page | 31
BIBLIOGRAPHY
https://www.udemy.com/course/100-days-of-
code/
The course taken by me to learn the basics of python.
https://www.youtube.com/watch?v=vmEHCJofslg
More about pandas python package
https://www.youtube.com/watch?v=FbWnuO7GG
BQ
About xlwt module of python
https://www.youtube.com/watch?v=YXPyB4XeYLA
Information about python tkinter
Page | 32