She Codes learning project for python course using PostgreSQL and PGadmin
- In terminal run:
docker-compose up --detach
. - Install dependencies using
pipenv install
. - Open shell by
pipenv shell
(useexit
to close). - Run
python empsys/data/init_database.py
to setup your database. - Use
python main.py
to start the GUI.
- Main - Used to start the program.
- Employees - includes the Employee class and all related methods and functions.
- Attendances - includes the Attendance class and all related functions.
- Gui - Used to set up the GUI for the program including menus and widgets.
- db_connect - includes all the SQL queries that are used to communicate with the database
- database.ini - stores basic variables as host, user, password, database. Used by
config.py
. - config.py - starts the connection with the database. Used in
main.py
andinit_database.py
. - init_database.py - initialises the tables in the database. Sould run it before running
main.py
for the first time.
- Employees - stores data about the employees, includes (ID, name, phone number and birthday).
- Attendance - stores the attendance data of the company, includes (date, time, ID).
-
Employees:
1.1. Uses Employees table with 5 fields:
- ID - 9 digits.
- Name - a string, can include two words or more.
- Title - Manager, Senior or Junior.
- Phone - 9/10 digits, can include a
-
after the prefix(2/3 first digits). - Birthday - uses the template dd/mm/yyyy.
1.2. ID is key. 1.3. Employee class instance is used when reading from the employee data table.
-
Attendance Log:
2.1. Uses Attendance table with 3 fields:
- ID - 9 digits
- Date - uses the template dd/mm/yyyy (auto update on creation)
- Time - uses the template HH:MM (auto update on creation)
2.2. Date and Time are used as key (timestamp).
Each function updates employees table.
- Add employee manually - uses an add employee menu with proper fields, includes verification and checks for doubles based on ID.
- Add employee from file - accepts a
.csv
file, adds the employees only if all the data in the rows is valid. Prompts the user about the first encountered invalid data. - Delete employee manually - deletes an employee by ID, prompts if the employee doesn't exist or invalid ID.
- Delete employees from file - accepts a
.csv
file, deletes the employees by ID only if all the supplied data is valid (only ID's in the file). Prompts the user with number of deleted users or first invalid row.
- Mark attendance - given an ID, creates a new Attendance record and updates the database.
- Generate attendance report of an employee - user enters ID and gets his attendance report(file). Prompts if the employee ID doesn't exist/invalid or has no attendance registered.
- Print an attendance report for a chosen month for all employees (active only) - prompts for month, will use current month as default and last year, generates a file.
- Print an attendance report for all employees who were late (choose arrival time limit) - prompts for hour and start date, generates a report for all attendances after chosen hour from chosen date till now (file).
- Print an attendance report by dates - prompts for dates and checks validity, creates a file.
- Exit the program - exits the program, prompts the user farewell.