Airport Management
Airport Management
1. Abstract 2
2. Introduction 3
3. System requirements 7
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
3
2.2. Overview of Python modules, Django and files:
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.
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
5
2.2.3. Overview of MySQL Concept:
6
3. SYSTEM REQUIREMENTS
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
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
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]
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=['|']
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:
2.USER MENU
24
PNR status under user menu:
3.STAFF MENU
Security number
25
Choices to select
Ticket cancellation
26
Runway display
27
6.2. TABLES:
Airlines table:
28
Passenger details table:
Flight id table:
29
Employee table: (part 2)
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.
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