-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
49 lines (37 loc) · 1.74 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import fly_er
import database_qry
"""
Description: evaluates closest airfeld to the user's location and
one closest to user's to his destination (within Uganda)
source: argument that represents user's location/origin
destination: argument representing user's destination
returns - JSON object containing closest airstrips the user's location/origin
and user's desired destination
"""
#obtaining user inputs
origin = str(input("Whats your location? (city center, town, village, road, district, or any landmark you can identify)\n"))
final_destination = str(input("Where are you going? (Town, village, district or any landmark place you may know)\n"))
def main(source = None, destination = None):
#getting location data for source
src_data = fly_er.get_location_data(source)
#getting closest airports for the source from database
src_afs = database_qry.database_sync(src_data)
#getting nearest airport for the source
src_nearest_af = fly_er.closest_airfield(src_data, src_afs)
print(f"\nThe closest airstrip to your location ({source}) is:")
for i,j in src_nearest_af.items():
print(f"\t{i}: {j}")
print("\n")
#getting location data for the desiation
dest_data = fly_er.get_location_data(destination)
#getting closest airports to the destination from database
dest_afs = database_qry.database_sync(dest_data)
#getting nearest airport for the destination
dest_nearest_af = fly_er.closest_airfield(dest_data, dest_afs)
print(f"\nThe closest airstrip to your destination ({destination}) is;")
for m,n in dest_nearest_af.items():
print(f"\t{m}: {n}")
print("\nfly safe\n")
return ([src_nearest_af, dest_nearest_af])
main(origin, final_destination)
input("Press Enter to Exit")