0% found this document useful (0 votes)
21 views32 pages

Airport Management

The document outlines a project focused on airport management, detailing its objectives, system requirements, and the use of Python and MySQL for implementation. It describes functionalities for both users and airport staff, including ticket management and real-time flight tracking. The project aims to create a simplified airport database model, specifically for 'Pollachi International Airport'.

Uploaded by

Kavitha
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)
21 views32 pages

Airport Management

The document outlines a project focused on airport management, detailing its objectives, system requirements, and the use of Python and MySQL for implementation. It describes functionalities for both users and airport staff, including ticket management and real-time flight tracking. The project aims to create a simplified airport database model, specifically for 'Pollachi International Airport'.

Uploaded by

Kavitha
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/ 32

TABLE OF CONTENTS

SR.NO INDEX PG.NO

1. Abstract 2

2. Introduction 3
3. System requirements 7

4. Objective of the project 8

5. Purpose of Modules, Tables and 9


Coding
6. Results and Discussion 28

7. Conclusion and future enhancement 35

8. Bibliography 36

1
1. ABSTRACT

This project represents airport management and a minimized version of the necessary
and daily activities in an airport. This project aids to both the customer, here termed
as the user as well as the airport staff. To access the staff category one must enter
their staff security number whereas the user category requires the flight code. Many
underlying features such as the description of the runway, reports of the delays and
duration, the enlistment of the staff as well as the general flight available board. This
program allows the admin to update, delete and alter the information. The user can
view their ticket details and personal name record here referred as ‘PNR status’. The
project aims to depict a typical airport database model in a small scale. The model
airport taken here is name sake “POLLACHI INTERNATIONAL AIRPORT”.

2
2. INTRODUCTION

2.1. About Python

Python is an interpreted, high-level, general-purpose programming language.


Created by Guido van Rossum and first released in 1991, 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.
Python is dynamically typed and garbage-collected. It supports multiple
programming paradigms, including procedural, object-oriented, and functional
programming. Python is often described as a "batteries included" language due
to its comprehensive standard library.
Python was conceived in the late 1980s as a successor to the ABC language.
Python 2.0, released in 2000, introduced features like list comprehensions and
a garbage collection system capable of collecting reference cycles. Python 3.0,
released in 2008, was a major revision of the language that is not completely
backward-compatible, and much Python 2 code does not run unmodified on
Python 3.
The Python 2 language, i.e. Python 2.7.x, is "sunsetting" on January 1, 2020
(after extension; first planned for 2015), and the Python team of volunteers will
not fix security issues, or improve it in other ways after that date. With the end-
of-life, only Python 3.5.x and later will be supported.
Python interpreters are available for many operating systems. A global
community of programmers develops and maintains CPython, an open source
reference implementation. A non-profit organization, the Python Software
Foundation, manages and directs resources for Python and CPython
development.

3
2.2. Overview of Python modules, Django and files:

2.2.1. Overview of Python Modules:

The Python interpreter has a number of built-in functions. They are loaded
automatically as the interpreter starts and are always available. For example, print()
and input() for I/O, number conversion functions int(),float(),complex(), data type
conversions list(),tuple(), set(), etc.

In addition to built-in functions, a large number of pre-defined functions are also


available as a part of libraries bundled with Python distributions. These functions are
defined in modules. A module is a file containing definitions of functions, classes,
variables, constants or any other Python objects. Contents of this file can be made
available to any other program.

Built-in modules are written in C and integrated with the Python interpreter. Each
built-in module contains resources for certain system-specific functionalities such as
OS management, disk IO, etc. The standard library also contains many Python scripts
(with the .py extension) containing useful utilities.

4
2.2.1.1 Some Predefined Modules of Python

These include trigonometric functions, representation


Math functions, logarithmic functions, angle conversion functions,
etc. In addition, two mathematical constants are also defined
in this module.
MySQL Python needs a MySQL driver to access the MySQL database.
datetime The datetime module supplies classes for manipulating dates
and times in both simple and complex ways.
keyboard It helps to enter keys, record the keyboard activities and block
the keys until a specified key is entered and simulate keys.
Os The OS module in python provides functions for interacting
with the operating system. OS comes under python’s standard
utility modules.
Time Python time module allows to work with time in Python. It
allows functionality like getting the current time, pausing the
Program from executing, etc.
Random Functions in the random module depend on a pseudo-random
number generator function random(), which generates a
random float number between 0.0 and 1.0.

5
2.2.3. Overview of MySQL Concept:

MySQL is a Relational Database Management System (RDBMS) whereas the


Structured Query Language (SQL) is the language used for handling the RDBMS using
commands, i.e. Creating, Inserting, Updating and Deleting the data from the
databases. SQL commands are case insensitive, i.e. CREATE and create signify the same
command.

1.2.3.1 Some Functions of MySQL:

 mysql.connector.connect():This method sets up a connection, establishing a session


with the MySQL server.

 Mysqlconnection.cursor() : This method returns a MySQLCursor() object,or a


subclass of it depending on the passed arguments. The returned object is a
cursor.CursorBase instance.

 Mysqlcursor.execution() : This method executes the given database operation


(query or command). The parameters found in the tuple or dictionary parameters are
bound to the variables in the operation..

6
3. SYSTEM REQUIREMENTS

1. Operating system: Windows 7, 8 and 10


2. Processor: Dual Core 1.4 GHz Processor
3. RAM: Minimum 1 GB
4. Hard Disk Space: 814 KB
5. Software: Python 3.7.0, MySQL 5.5

7
4. OBJECTIVE OF THE PROJECT

The project aims to assist both the user and the airport staff. The project stores all the
records and the desired records are accessed by both the user and the staff with
personalized directory. The user and staff have differing requirements thereby for
security purposes the staff must enter their staff security code to proceed.

The user can access their ticket details such as Name, Address, Date of booking, Seat
number, Class, Source and Destination. The user is posed with a menu which allows
the user to choose viewing ticket details as well as tracking PNR status.

The staff can access privileges such as Viewing current status, Ticket cancellation,
Updating flight delays and viewing the live runway. If the entered staff security number
does not exist then the staff is intimated with ‘Invalid password’ message.

8
5. MODULES PURPOSES, TABLES AND CODING

5.1. Modules used


 MySQL.Connector
 Random
 OS
 Time
 Datetime
 Keyboard
 Math

5.1.2 Modules Purposes:


 MySQL.Connector: MySQL Connector/ Python enables Python programs to
access MySQL databases, using an API that is compliant with the Python
Database.
 Random: Generates random values. This module can be used to perform
random actions such as generating random numbers, printing a random value
for a list or string, etc.
 OS: The OS module in python provides functions for interacting with the
operating system. OS comes under python’s standard utility modules.
 Time: Python time module allows to work with time in Python. It can do actions
such as retrieving the current time, waiting during code execution, and
measuring the efficiency of code.
 Datetime: The datetime module supplies classes for manipulating dates and
times in both simple and complex ways.
 Keyboard: It helps to enter keys, record the keyboard activities and block the
keys until a specified key is entered and simulate keys.

9
 Math: These include trigonometric functions, representation functions,
logarithmic functions, angle conversion functions, etc. In addition, two
mathematical constants are also defined in this module.

10
5.2. SOURCE CODE

import mysql.connector as m
import os
import time as t
import datetime
from datetime import datetime,time
import random
import keyboard
import math

con=m.connect(user="root",host="localhost",database='hat_project',passwd='12345')
cur=con.cursor()
def runway():
l=["| || || || |"]
l1=["| || || || |"]
runways=[]
justnow=[]
flight_pos_arr=0
flight_pos_dep=39

for i in range(39):
l.append(l[0])
l.append(' 19L 18L 18R 19R ')
global cou
global coun
cou_arr=0

11
coun_ab_arr=0
cou_dep=0
coun_ab_dep=0
air_list=[]
air_list_dep=[]
depnum=random.randint(0,1)
arrnum=random.randint(0,1)
while True:
if keyboard.is_pressed('q'):
break
os.system("CLS")
print("\n RUNWAY REPORT \n")
for i in l:
print(" "*54,end='')
print(i)
cur.execute('select * from flight')
runway_flights=cur.fetchall()

for j in runway_flights:
if j[3][0].isdigit():
Table_num=int(j[3][0]+j[3][1]+j[3][3]+j[3][4])
Cur_num=datetime.now().hour*100+datetime.now().minute
if Table_num-Cur_num==0 or Cur_num-Table_num<4 and Cur_num-
Table_num>0:
cou_arr+=1
air_list.append(j[0])
if Table_num-Cur_num<=10 and Cur_num-Table_num<0:
coun_ab_arr+=1
if keyboard.is_pressed('q'):

12
break
if j[4][0].isdigit():
Table_num_dep=int(j[4][0]+j[4][1]+j[4][3]+j[4][4])
Cur_num=datetime.now().hour*100+datetime.now().minute
if Table_num_dep-Cur_num==0 or Cur_num-Table_num_dep<2 and
Cur_num-Table_num_dep>0:
cou_dep+=1
air_list_dep.append(j[0])
if Table_num_dep-Cur_num<=10 and Cur_num-Table_num_dep<0:
coun_ab_dep+=1
if keyboard.is_pressed('q'):
break

print("No. of Flights in the runway(Arrived):",cou_arr)


print("No. of Flights about to Arrive:",coun_ab_arr)
print("No. of Flights in the runway about to depart:",coun_ab_dep)
print("No. of Flights departed:",cou_dep)
print(" Enter q to exit ")
l.clear()

for i in range(40): l+=l1


l+=[' 19L 18L 18R 19R ']
if cou_arr>0 and flight_pos_arr==39:
flight_pos_arr=39

l_arr=[l[flight_pos_arr][0:3]+air_list[0]+l[flight_pos_arr][9:],l[flight_pos_arr][
0:27]+air_list[0]+l[flight_pos_arr][33:]]
l[flight_pos_arr]=l_arr[arrnum]

elif cou_arr>0 and flight_pos_arr<40:

13
l_arr=[l[flight_pos_arr][0:3]+air_list[0]+l[flight_pos_arr][9:],l[flight_pos_arr][
0:27]+air_list[0]+l[flight_pos_arr][33:]]
l[flight_pos_arr]=l_arr[arrnum]
flight_pos_arr+=1
else:
flight_pos_arr=0
if keyboard.is_pressed('q'):
break
if cou_dep>0 and flight_pos_dep==0:
l[flight_pos_dep]=l1[0]
if cou_dep>0 and flight_pos_dep<40 and flight_pos_dep>0:

l_dep=[l[flight_pos_dep][0:15]+air_list_dep[0]+l[flight_pos_dep][21:],l[flight_
pos_dep][0:39]+air_list_dep[0]+l[flight_pos_dep][45:]]
l[flight_pos_dep]=l_dep[depnum]
flight_pos_dep-=1

cou_arr=0
coun_ab_arr=0
cou_dep=0
coun_ab_dep=0
air_list=[]
air_list_dep=[]
t.sleep(0.5)
if keyboard.is_pressed('q'):
break
def pnr():
os.system('CLS')
print("\n PNR STATUS \n\n\n")

14
fcode=input('\n\nEnter the flight code:')
tabe=cur.execute('select * from ticket1 t,passenger3 p where t.pid=p.pid')
table=cur.fetchall()
dur=cur.execute('select * from flight')
dura=cur.fetchall()
for j in dura:
if fcode.lower()==j[0].lower():
while True:
timelapsed=0
timeleft=0
recur_list=[]
os.system('CLS')
print("\n PNR STATUS \n\n\n")
prog=['|']
prog1=['|']

for i in range(41): prog+=prog1


for i in table:
if i[11].lower()==fcode.lower() and fcode.lower() not in recur_list:
recur_list.append(fcode.lower())
prog[41]='Source '+prog[41]+i[1]
prog[0]='Destination '+prog[0]+i[2]
duration=int(j[6][0:2])
if int(j[4][3:])<30:
timelapsed=datetime.now().hour-int(j[4][0:2])
timeleft=duration-timelapsed

15
if timelapsed>0:
percent=(timelapsed/duration)*100
position=41-(int(round(0.4*percent))+1)
prog[position]='|'+fcode
else:
percent=0
position=40
prog[position]='|'+fcode
elif int(j[4][3:])>=30:
timelapsed=datetime.now().hour-(int(j[4][0:2])+1)
timeleft=duration-timelapsed
if timelapsed>0:
percent=(timelapsed/duration)*100
position=41-(int(round(0.4*percent))+1)
prog[position]='|'+fcode
else:
percent=0
position=40
prog[position]='|'+fcode
for i in prog:
c=0
for hulk in i:
if hulk!='|':
c+=1
else:
break
print(" "*(54-c),end='')
print(i)
print('\n\n'+" "*54+'No. of hours remaining to reach:',timeleft)

16
t.sleep(0.5)
if keyboard.is_pressed('q'):
print('Exiting....')
t.sleep(2)
break
else:
print('Invalid Flight code!!')

#main
while True:
os.system("CLS")
print("\n--------------------------------------------------------------------------POLLACHI
International Airport---------------------------------------------------------------------------")
print('''Please enter your role

[1]USER
[2]STAFF''')
a=int(input('->'))
if a==1:
print('''\n\n[1]Viewing Ticket Details
[2]Tracking PNR status''')
chz=int(input("\n\nEnter your choice:"))
if chz==1:
tick_num=int(input('Enter Ticket Number:'))
print()
r='select * from ticket1 t,passenger2 p where t.passportno=p.passportno and
ticket_number={}'.format(tick_num)
cur.execute(r)
a=cur.fetchone()

17
cur.execute('select * from passenger3')
b=cur.fetchall()

if a is not None:
print("Name: ",a[11],'.',a[12],'.',a[13],sep='')
print("Address:",a[14].split(',')[0]+'\n',' '+a[14].split(',')[1]+'\n','
'+a[14].split(',')[2])
print("Date of booking:",a[3])
print('Seat No.:',a[5])
print('Class:',a[6])
print('Source:',a[1])
print('Destination:',a[2])
for i in b:
if i[0]==a[8]:
cur.execute("select * from airline where airlineid='{}'".format(i[1][:2]))
c=cur.fetchone()
print('Airlines:',c[1])
print("\n Enter q to exit")
else:
print('Ticket Not Found!!')
while True:
if keyboard.is_pressed('q'):
break
elif chz==2:
pnr()
elif a==2:

os.system('CLS')
print('\n'*10+' '*70+"Enter your security number:",end='')

18
severus_snape=int(input())
cur.execute('select ssn from employee1')
te=cur.fetchall()
print("Verifying....")
t.sleep(2)
if (severus_snape,) in te:
print("\nEntry permitted!!\n")
while True:
os.system("CLS")
print('''\n\n[1]View Current Status
[2]Ticket cancellation
[3]Update flight delays
[4]View Live Runway''')
z=int(input('\nEnter your choice:'))

if z==1:
print('''+-------------+--------+-------------+---------+-----------+---------+------
----+------------+--------------+-------------+-----------+
| FLIGHT_CODE | SOURCE | DESTINATION | ARRIVAL | DEPARTURE |
STATUS | DURATION | FLIGHTTYPE | LAYOVER_TIME | NO_OF_STOPS |
AIRLINEID |
+-------------+--------+-------------+---------+-----------+---------+----------+------------+----
----------+-------------+-----------+''')
q='select * from flight'
cur.execute(q)
l=cur.fetchall()

for i in l:

19
print('''| ''',i[0],''' | ''',i[1],''' | ''',i[2],''' | ''',i[3],''' | ''',i[4],''' |
''',i[5],''' | ''',i[6]+(9-len(i[6]))*' ','''| ''',i[7]+(11-len(i[7]))*' ','''| ''',i[8]+(13-len(i[8]))*' ','''|
''',i[9],''' | ''',i[10],''' |''',sep='')
print('''+-------------+--------+-------------+---------+-----------+---------+------
----+------------+--------------+-------------+-----------+''')
print('\n\n'+' '*54+'Enter q to exit')
while True:
if keyboard.is_pressed('q'):
print('Exiting.....')
t.sleep(2)
break
elif z==2:
tick_no=int(input("Enter your ticket number for cancellation: "))
print()
r='select * from ticket1 t,passenger2 p where t.passportno=p.passportno
and ticket_number={}'.format(tick_no)
cur.execute(r)
a=cur.fetchone()
cur.execute('select * from passenger3')
b=cur.fetchall()
if a is not None:
print("Name: ",a[11],'.',a[12],'.',a[13],sep='')
print("Address:",a[14].split(',')[0]+'\n',' '+a[14].split(',')[1]+'\n','
'+a[14].split(',')[2])
print("Date of booking:",a[3])
print('Seat No.:',a[5])
print('Class:',a[6])
print('Source:',a[1])
print('Destination:',a[2]
for i in b:

20
if i[0]==a[8]:
cur.execute("select * from airline where
airlineid='{}'".format(i[1][:2]))
c=cur.fetchone()
print('Airlines:',c[1])
canyes=input("To confirm cancellation enter 'yes': ")
if canyes.lower()=='yes':
hatter="delete from ticket1 where
TICKET_NUMBER={}".format(tick_no)
cur.execute(hatter)
con.commit()
print("Ticket is cancelled")
t.sleep(2)
else:
print("Cancellation interrupted")
else:
print('Ticket Not Found!!')

elif z==3:
fn=input("Enter the Flight code:")
cur.execute('select * from flight')
oink=cur.fetchall()
for u in oink:
if u[0].lower()==fn.lower():
new_status="Delayed"
print("Flight details")
print("\n","Arrival airport:",u[1],'\nReaching airport:',u[2],'\nTime of
Arrival:',u[3],"\nTime of Departure:",u[4])
choi=input("Is this the flight that got delayed?(yes/no):")
chai=input("Is the delay time known?(yes/no):")

21
if choi.lower()=="yes" and chai.lower()=="yes":
if u[3][0].isdigit():
delay_time=int(input('Enter delay duration(in mins):'))
depat_time=input('Enter departure time(HH:MM):')
new_arrival_hr=int(u[3][0:2])+delay_time//60
new_arrival_time=str(new_arrival_hr)+':'+str(delay_time%60)
if new_arrival_hr>24:
new_arrival_time="Next_day"
cur.execute('update flight set arrival="{}" where
flight_code="{}"'.format(new_arrival_time,u[0]))
cur.execute('update flight set departure="{}" where
flight_code="{}"'.format(depat_time,u[0]))
con.commit()
else:
new_time=input('Enter the arrival time(HH:MM):')
depat_time=input('Enter departure time(HH:MM):')
cur.execute('update flight set arrival="{}" where
flight_code="{}"'.format(new_time,u[0]))
cur.execute('update flight set departure="{}" where
flight_code="{}"'.format(depat_time,u[0]))
con.commit()
print('Successfully changed')
t.sleep(3)
break
elif choi.lower()=="yes" and chai.lower()=="no":
vt=input("Is the flight redirected?(yes/no):")
if vt.lower()=="yes":
cur.execute('update flight set arrival="Redirected" where
flight_code="{}"'.format(u[0]))

22
cur.execute('update flight set status="{}" where
flight_code="{}"'.format(new_status,u[0]))
con.commit()
else:
cur.execute('update flight set arrival="Unknown" where
flight_code="{}"'.format(u[0]))
cur.execute('update flight set status="{}" where
flight_code="{}"'.format(new_status,u[0]))
con.commit()
print('Successfully changed')
t.sleep(3)
break
elif z==4:
runway()
else:
print("Invalid password!!")
t.sleep(3)

else:
print('Invalid Choice')
t.sleep(3)

23
6. RESULTS AND DISCUSSION

6.1. RESULTS:

1.THE SELECTION MENU

2.USER MENU

24
 PNR status under user menu:

3.STAFF MENU
 Security number

25
 Choices to select

 Viewing current status

 Ticket cancellation

 Flight delay updation

26
 Runway display

27
6.2. TABLES:

 Current flight table:

 Employee details table:

 Airlines table:

28
 Passenger details table:

 Flight id table:

 Employee details table: (part1)

29
 Employee table: (part 2)

 Employee classification details:

 Security passkey table:

30
7. CONCLUSION AND FUTURE ENHANCEMENT

7.1. CONCLUSION

This project fulfills the primary purpose of airport management with Limited
reach. It could further be developed and enhanced to serve an actual airport. The
project helps in tracking airports, managing staffs, managing airlines or aircrafts,
maintain the runway, an aid the users for tracking their ticket status and several more.
The project fulfills its objective to manage a database successfully.

7.2. FUTURE ENHANCEMENT

1. This project can work ideally with further enhancements to actually serve an
airport
2. More addition or systems such as food management, ground crew etc can
complete the whole project to serve a large scale airport.
3. GUI can be added.
4. Actual Live flight details can be given to the program for real life use.

31
8. BIBLIOGRAPHY

1. https://github.com/sanchit2107/Flight-Management-System
2. https://www.geeksforgeeks.org
3. https://google.com
4. https://www.wikipedia.org

32

You might also like