0% found this document useful (0 votes)
6 views

Python Project Report

The document outlines a project report on a 'File Tracking System' developed using Python, aimed at modernizing the file approval process in government engineering departments. It features a secure, role-based login system and a structured three-tier approval workflow to enhance transparency, accountability, and efficiency while reducing paperwork and administrative delays. The system architecture includes a frontend built with HTML/CSS, a backend using Django, and a SQLite database for storage, with various user roles defined for effective task management.

Uploaded by

denimworld12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Python Project Report

The document outlines a project report on a 'File Tracking System' developed using Python, aimed at modernizing the file approval process in government engineering departments. It features a secure, role-based login system and a structured three-tier approval workflow to enhance transparency, accountability, and efficiency while reducing paperwork and administrative delays. The system architecture includes a frontend built with HTML/CSS, a backend using Django, and a SQLite database for storage, with various user roles defined for effective task management.

Uploaded by

denimworld12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

Department of Computer Engineering

Mini Project
Subject: Skill base Lab course: Python Programming
SE SEM-IV

A PROJECT REPORT ON
“File Tracking System”

by

Name Roll No.


Gayatri Gupta A429
Nikhil Gupta A430
Umed Indulkar A437

under the guidance of


Prof. Deepak Gaikar
Abstract

The File Tracking System is a Python-based application designed to streamline and digitize the file approval

process in government engineering departments. It introduces a secure, role-based login system to ensure

proper access control and task delegation. The approval workflow follows a structured three-tier hierarchy

where files are initially reviewed by Assistant Engineers, then forwarded to Deputy Engineers, and finally

approved by Executive Engineers. This systematic process maintains the official chain of command and

promotes accountability at every level. The system offers several key benefits, including real-time tracking

of file status, a paperless and faster workflow, secure document storage, and transparent decision-making.

By reducing manual errors and administrative workload, the File Tracking System modernizes traditional

file management and enhances operational efficiency across departments.


Problem Definition:

Traditional file management systems in government engineering departments are typically paper-based,

leading to slow processing, frequent misplacement of documents, and significant delays. The lack of

transparency in tracking file progress and the reliance on manual approvals contribute to administrative

inefficiencies. Moreover, without a centralized system, it becomes difficult to monitor who accessed or

approved a file, making record-keeping and accountability a challenge. To address these issues, this project

proposes the development of a digital File Tracking System using Python. The system offers secure, role-

based access for Admins and Employees and supports real-time file tracking through a structured three-

level approval hierarchy involving Assistant Engineers, Deputy Engineers, and Executive Engineers. This

digital workflow not only enhances transparency and accountability but also significantly reduces

paperwork, administrative overhead, and processing delays. With features like centralized monitoring,

automated approval logs, and secure document handling, the system aims to modernize traditional file

management, making the entire process faster, more reliable, and easier to audit.
Design/Methodology:

The File Tracking System is developed using a structured and modular approach, ensuring smooth
functionality, scalability, and ease of maintenance. The system is designed with a three-tier
architecture: Frontend (UI), Backend (Logic and APIs), and Database (Storage and Retrieval). It
includes distinct modules for login, file processing, and approval workflows.

1. System Architecture Design:


• Frontend:
Developed using HTML, CSS, and JavaScript (optionally with Bootstrap). Provides user interfaces
for Admin and Employee logins, dashboards, file submission, and tracking.
• Backend:
Implemented using Python with Django. It handles request processing, routing, session
management, and application logic.
• Database:
SQLite is used for storing user details, file records, status logs, and approval history.

2. User Roles and Permissions:


• Admin:
o Manage employee accounts
o Upload and assign files
o Monitor file status and generate reports
• Employee (Three Types):
o Assistant Engineer: Initial reviewer of files
o Deputy Engineer: Mid-level approval
o Executive Engineer: Final approval authority
Each role has restricted access based on responsibilities, enforced through role-based access control.

3. Workflow Methodology:
1. Login Module: Authenticates users and redirects based on their role.
2. Dashboard Module: Displays relevant information such as assigned files, status, and pending
tasks.
3. File Upload & Assignment (Admin): Admin uploads files and assigns them to the first-level
reviewer.
4. Approval Chain:
▪ Files are reviewed by Assistant Engineer.
▪ Upon approval, forwarded to Deputy Engineer.
▪ Then, passed to Executive Engineer for final approval.
▪ At each step, status and timestamps are recorded.
5. Tracking & Logs: Every file’s status, reviewer, and approval time are logged and available in
real-time.

4. Development Methodology:
The system is developed using the Incremental Model:
• Phase 1: Set up basic login and role-based redirection.
• Phase 2: Implement file upload and assignment features.
• Phase 3: Add multi-level approval process.
• Phase 4: Integrate tracking, logs, and admin dashboard.
• Phase 5: Final testing, deployment, and user feedback loop.

5. Security Features:
• Password hashing for login credentials
• Session management for secure access
• Input validation to prevent SQL injection and form misuse
Figure:
Hardware Requirements:

• Hardware Specification: - Processor Intel Pentium V or higher


• Clock Speed: - 1.7 GHz or more
• System Bus: - 64 bits
• RAM: 4 GB
• HDD: 512 GB
• Monitor: LCD Monitor
• Keyboard: Standard keyboard
• Mouse: Compatible mouse

Software Requirements:

• Operating System: Windows 10/11, macOS, or any Linux distribution (Ubuntu preferred for
production)

• Python: Version 3.11.11

• Python Dependencies: Installed via requirements.txt, typically includes: Django, gunicorn (for
deployment), whitenoise (for static files)

• Database: SQLite3 (default, comes with Django)

• Web Server (for Deployment): Gunicorn (WSGI HTTP Server), Render (for hosting), GitHub
(code repository & CI/CD)

• Frontend Libraries: HTML, CSS, JavaScript, Bootstrap (for responsive UI)

• Admin Panel: Comes with Django, with built-in password hashing + salting

• Browser: Any modern browser: Chrome, Firefox, Edge


Source Code:

# manage.py
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'file_tracking.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError("Couldn't import Django. Are you sure it's installed?") from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()

# settings.py
import os
from pathlib import Path
BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = os.environ.get('SECRET_KEY', 'dev-secret-key')
DEBUG = True
ALLOWED_HOSTS = ['*']
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'app',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'file_tracking.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'file_tracking.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
AUTH_PASSWORD_VALIDATORS = [
{'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator'},
{'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator'},
{'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator'},
{'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator'},
]
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'Asia/Kolkata'
USE_I18N = True
USE_TZ = True
STATIC_URL = '/static/'
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
LOGIN_URL = 'login'

# urls.py
from django.urls import path
from . import views
urlpatterns = [
path('', views.home, name='home'),
path('about/', views.about, name='about'),
path('contact/', views.contact, name='contact'),
path('login/', views.user_login, name='login'),
path('logout/', views.user_logout, name='logout'),
path('admin/dashboard/', views.admin_dashboard, name='admin_dashboard'),
path('admin/add-employee/', views.add_employee, name='add_employee'),
path('admin/view-employees/', views.view_employees, name='view_employees'),
path('employee/dashboard/', views.employee_dashboard, name='employee_dashboard'),
path('employee/upload-file/', views.upload_file, name='upload_file'),
path('employee/view-requests/', views.view_requests, name='view_requests'),
path('employee/view-status/', views.view_status, name='view_status'),
path('employee/change-password/', views.change_password, name='change_password'),
path('employee/file/<int:file_id>/review/', views.approve_reject_file, name='approve_reject_file'),
]

# admin.py
from django.contrib import admin
from .models import EmployeeProfile, File, ApprovalHistory
@admin.register(EmployeeProfile)
class EmployeeProfileAdmin(admin.ModelAdmin):
list_display = ('user', 'designation', 'department', 'gender', 'mobile')
list_filter = ('designation', 'department', 'gender')
search_fields = ('user__username', 'user__email', 'user__first_name', 'user__last_name', 'department')
@admin.register(File)
class FileAdmin(admin.ModelAdmin):
list_display = ('title', 'uploaded_by', 'status', 'date_uploaded')
list_filter = ('status',)
search_fields = ('title', 'description', 'uploaded_by__username')
date_hierarchy = 'date_uploaded'
@admin.register(ApprovalHistory)
class ApprovalHistoryAdmin(admin.ModelAdmin):
list_display = ('file', 'approved_by', 'status', 'approved_at')
list_filter = ('status',)
search_fields = ('file__title', 'approved_by__username')
date_hierarchy = 'approved_at'

#app.py
from django.apps import AppConfig
class AppConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'app'
#forms.py
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm, PasswordChangeForm
from .models import EmployeeProfile, File

class EmployeeCreationForm(forms.ModelForm):
name = forms.CharField(max_length=100)
email = forms.EmailField()
password = forms.CharField(widget=forms.PasswordInput())

class Meta:
model = EmployeeProfile
fields = ['gender', 'dob', 'designation', 'department', 'mobile']
widgets = {
'dob': forms.DateInput(attrs={'type': 'date'}),
}

def save(self, commit=True):


user_data = {
'username': self.cleaned_data['email'],
'email': self.cleaned_data['email'],
'first_name': self.cleaned_data['name'].split()[0],
'last_name': ' '.join(self.cleaned_data['name'].split()[1:]) if len(self.cleaned_data['name'].split()) > 1
else '',
}
user = User.objects.create_user(**user_data, password=self.cleaned_data['password']
profile = super().save(commit=False)
profile.user = user
if commit:
profile.save()
return profile
class FileUploadForm(forms.ModelForm):
class Meta:
model = File
fields = ['title', 'description', 'file_upload']
widgets = {
'description': forms.Textarea(attrs={'rows': 4}),
)
def __init__(self, *args, **kwargs):
self.user = kwargs.pop('user', None)
super().__init__(*args, **kwargs)
def clean_file_upload(self):
file = self.cleaned_data.get('file_upload')
if file:
file_extension = file.name.split('.')[-1].lower()
if file_extension not in ['pdf', 'doc', 'docx']:
raise forms.ValidationError("Only PDF or DOC files are allowed.")
return file
def save(self, commit=True):
instance = super().save(commit=False)
instance.uploaded_by = self.user
# Find an assistant engineer to review
from django.db.models import Q
from .models import EmployeeProfile
assistant = User.objects.filter(
profile__designation='assistant',
profile__department=self.user.profile.department
).first()
instance.current_reviewer = assistant
instance.status = 'pending_assistant'
if commit:
instance.save()
return instance
class CustomPasswordChangeForm(PasswordChangeForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields['old_password'].widget.attrs.update({'class': 'form-control'})
self.fields['new_password1'].widget.attrs.update({'class': 'form-control'})
self.fields['new_password2'].widget.attrs.update({'class': 'form-control'})

Hosted Website: https://orion-cl0p.onrender.com/

All Profiles:
Gayatri 123456gg (assistant engineer)
Nikhil 123456ng (Deputy Engineer)
Umed 123456ui (Executive Engineer
Paul 123456pa(assistant engineer)
Anakin 123456dv(Deputy Engineer)
Eren 123456ey (Executive Engineer
#models.py
from django.db import models
from django.contrib.auth.models import User
from django.utils import timezone
class EmployeeProfile(models.Model):
GENDER_CHOICES = (
('M', 'Male'),
('F', 'Female'),
('O', 'Other'),
)
DESIGNATION_CHOICES = (
('assistant', 'Assistant Engineer'),
('deputy', 'Deputy Engineer'),
('executive', 'Executive Engineer'),
)
user = models.OneToOneField(User, on_delete=models.CASCADE, related_name='profile')
gender = models.CharField(max_length=1, choices=GENDER_CHOICES)
dob = models.DateField()
designation = models.CharField(max_length=20, choices=DESIGNATION_CHOICES)
department = models.CharField(max_length=100)
mobile = models.CharField(max_length=15)
def __str__(self):
return f"{self.user.get_full_name()} - {self.get_designation_display()}"
class File(models.Model):
STATUS_CHOICES = (
('pending_assistant', 'Pending Approval (Assistant)'),
('pending_deputy', 'Pending Approval (Deputy)'),
('pending_executive', 'Pending Approval (Executive)'),
('approved', 'Approved'),
('rejected', 'Rejected'),
)
title = models.CharField(max_length=200)
description = models.TextField()
file_upload = models.FileField(upload_to='files/')
uploaded_by = models.ForeignKey(User, on_delete=models.CASCADE,
related_name='uploaded_files')
status = models.CharField(max_length=20, choices=STATUS_CHOICES, default='pending_assistant')
current_reviewer = models.ForeignKey(User, on_delete=models.SET_NULL, null=True, blank=True,
related_name='files_to_review')
date_uploaded = models.DateTimeField(default=timezone.now)
def __str__(self):
return self.title
class ApprovalHistory(models.Model):
file = models.ForeignKey(File, on_delete=models.CASCADE, related_name='approvals')
approved_by = models.ForeignKey(User, on_delete=models.CASCADE)
approved_at = models.DateTimeField(default=timezone.now)
status = models.CharField(max_length=20, choices=(('approved', 'Approved'), ('rejected', 'Rejected')))
comments = models.TextField(blank=True, null=True)
def __str__(self):
return f"{self.file.title} - {self.status} by {self.approved_by.get_full_name()}"

#views.py
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.auth.decorators import login_required, user_passes_test
from django.contrib.auth import authenticate, login, logout
from django.contrib import messages
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.models import User
from django.db.models import Q
from .models import EmployeeProfile, File, ApprovalHistory
from .forms import EmployeeCreationForm, FileUploadForm, CustomPasswordChangeForm

def is_admin(user):
return user.is_superuser

def home(request):
return render(request, 'home.html')

def about(request):
return render(request, 'about.html')

def contact(request):
return render(request, 'contact.html')

def user_login(request):
if request.method == 'POST':
form = AuthenticationForm(request, data=request.POST)
if form.is_valid():
username = form.cleaned_data.get('username')
password = form.cleaned_data.get('password')
user = authenticate(username=username, password=password)
if user is not None:
login(request, user)
if user.is_superuser:
return redirect('admin_dashboard')
else:
return redirect('employee_dashboard')
else:
messages.error(request, "Invalid username or password.")
else:
messages.error(request, "Invalid username or password.")
else:
form = AuthenticationForm()
return render(request, 'login.html', {'form': form})

def user_logout(request):
logout(request)
return redirect('home')

# Admin views
@login_required
@user_passes_test(is_admin)
def admin_dashboard(request):
return render(request, 'admin/admin_home.html')

@login_required
@user_passes_test(is_admin)
def add_employee(request):
if request.method == 'POST':
form = EmployeeCreationForm(request.POST)
if form.is_valid():
form.save()
messages.success(request, "Employee added successfully!")
return redirect('view_employees')
else:
form = EmployeeCreationForm()
return render(request, 'admin/add_employee.html', {'form': form})

@login_required
@user_passes_test(is_admin)
def view_employees(request):
employees = EmployeeProfile.objects.all()
return render(request, 'admin/view_employees.html', {'employees': employees})

# Employee views
@login_required
def employee_dashboard(request):
if request.user.is_superuser:
return redirect('admin_dashboard')
return render(request, 'employee/dashboard.html')

@login_required
def upload_file(request):
if request.method == 'POST':
form = FileUploadForm(request.POST, request.FILES, user=request.user)
if form.is_valid():
form.save()
messages.success(request, "File uploaded successfully and sent for approval.")
return redirect('view_status')
else:
form = FileUploadForm()
return render(request, 'employee/upload_file.html', {'form': form})

@login_required
def view_requests(request):
user_profile = request.user.profile

# Get files that this user needs to review based on designation


if user_profile.designation == 'assistant':
files = File.objects.filter(status='pending_assistant', current_reviewer=request.user)
elif user_profile.designation == 'deputy':
files = File.objects.filter(status='pending_deputy', current_reviewer=request.user)
elif user_profile.designation == 'executive':
files = File.objects.filter(status='pending_executive', current_reviewer=request.user)
else:
files = File.objects.none()

return render(request, 'employee/view_requests.html', {'files': files})

@login_required
def view_status(request):
files = File.objects.filter(uploaded_by=request.user)
return render(request, 'employee/view_status.html', {'files': files})

@login_required
def change_password(request):
if request.method == 'POST':
form = CustomPasswordChangeForm(request.user, request.POST)
if form.is_valid():
form.save()
messages.success(request, "Your password was successfully updated!")
return redirect('employee_dashboard')
else:
messages.error(request, "Please correct the error below.")
else:
form = CustomPasswordChangeForm(request.user)
return render(request, 'employee/change_password.html', {'form': form})

@login_required
def approve_reject_file(request, file_id):
file = get_object_or_404(File, id=file_id)

if request.method == 'POST':
action = request.POST.get('action')
comments = request.POST.get('comments', '')

if action not in ['approve', 'reject']:


messages.error(request, "Invalid action.")
return redirect('view_requests')

# Record the approval/rejection


ApprovalHistory.objects.create(
file=file,
approved_by=request.user,
status='approved' if action == 'approve' else 'rejected',
comments=comments
)

if action == 'reject':
file.status = 'rejected'
file.current_reviewer = None
file.save()
messages.success(request, "File has been rejected.")
return redirect('view_requests')

# If approved, move to next level


user_profile = request.user.profile

if user_profile.designation == 'assistant':
# Find a deputy engineer to review
deputy = User.objects.filter(
profile__designation='deputy',
profile__department=user_profile.department
).first()
if deputy:
file.status = 'pending_deputy'
file.current_reviewer = deputy
else:
messages.error(request, "No deputy engineer found to review this file.")
return redirect('view_requests')

elif user_profile.designation == 'deputy':


# Find an executive engineer to review
executive = User.objects.filter(
profile__designation='executive',
profile__department=user_profile.department
).first()

if executive:
file.status = 'pending_executive'
file.current_reviewer = executive
else:
messages.error(request, "No executive engineer found to review this file.")
return redirect('view_requests')

elif user_profile.designation == 'executive':


# Final approval
file.status = 'approved'
file.current_reviewer = None

file.save()
messages.success(request, "File has been approved and moved to the next stage.")
return redirect('view_requests')

return render(request, 'employee/approve_reject.html', {'file': file})


Snapshot of Output (Result):

Fig. Home Page

Fig. Login Page


Fig. Help Page

Fig. database page 1


Fig. database page 2

Fig. database page 3


Fig. Dashboard page

Fig. Admin Dashboard


Fig. View Request Page

Fig. Review File Page


Fig. Approve Page
Conclusion:

The File Tracking System is a significant step forward in transforming traditional, paper-based workflows
into an efficient and transparent digital process within government engineering departments. Developed
using Python and Django, the system addresses major challenges faced by public sector offices, such as
delays, lack of transparency, misplacement of documents, and high administrative overhead.

Through its role-based authentication system, the application ensures that users (Admins and Engineers)
have access only to the features they need, safeguarding sensitive information and preventing
unauthorized file handling. By introducing a structured three-level approval hierarchy—Assistant
Engineer, Deputy Engineer, and Executive Engineer—the system enforces proper delegation and
accountability, replicating the real-world chain of command digitally.

The system’s modular architecture, built on the Django framework, supports clear separation of
concerns—handling user sessions, file uploads, role-based dashboards, and approval logs seamlessly. The
use of SQLite as the backend database ensures fast local development, while integration with deployment
platforms like Render and GitHub allows the system to be hosted and maintained reliably in production
environments. Furthermore, the inclusion of real-time file tracking and logging mechanisms adds an extra
layer of transparency and auditability.

Security is a cornerstone of the system, with features like password hashing, session validation, and input
sanitization implemented to protect data integrity. Additionally, the responsive frontend using HTML,
CSS, and Bootstrap makes the platform accessible across devices, enhancing user experience.

In conclusion, the File Tracking System not only reduces the reliance on physical paperwork but also
fosters a culture of digital efficiency, traceability, and transparency. It minimizes delays and errors while
providing a scalable solution for government departments aiming to modernize their internal workflows.
With future enhancements such as notifications, analytics, and document versioning, this system can
evolve into a comprehensive document lifecycle management platform suitable for any public sector
organization.
References:

• Django Documentation: https://docs.djangoproject.com/


• Bootstrap Documentation: https://getbootstrap.com/
• SQLite Documentation: https://www.sqlite.org/docs.html
• Python Official Site – https://www.python.org/

You might also like