Application to find lowest price, shortest distance, or duration of connecting flights through Floyd-Warshall algorithm. Presentation slides of the project can be found here.
Python version 3.7 is used.
Modules:
- pymongo (3.8.0 or higher)
- flask (0.14.2 or higher)
- flask-wtf (0.14.2 or higher)
- wtforms
- pytest
Install with pip: In project directory run pip install -r requirements.txt
Install with pipenv: In project directory run pipenv install
Before running, make sure you have a MongoDB v4 running on localhost:27017
and all the dependencies installed.
To run console interface: In project directory, run
python start.py
To run web interface: In project directory, run
python run_webapp.py
and go to localhost:5000
on your browser to access the web interface.
Note: no data will be shown in query before data are added or imported using the console interface.
Sample data import_ready.csv can be found in the resources directory. It can be imported through the "Use CSV" option in the program's console interface by putting "./resources/import_ready.csv" as path to file when importing.
About import_ready.csv: It is generated by scaling down the file raw_data.csv, which is the raw 2019 Jan data downloaded from US Bureau of Transportation. The script scale_down_csv.py
we created was used to generate the file. raw_data.csv is not recommended to be imported since the data size is too big and with no price information avaliable.
Sample quaries to try to get more than one flight in shortest-path:
- SEA to ATL, price
- SFO to MIA, price
- SFO to ATL, distance, price
US Bureau of Transportation Statistics's Reporting Carrier On-Time Performance data can be downloaded as CSV to be used with the program. Check the fields Reporting_Airline
, Flight_Number_Reporting_Airline
, Origin
, Dest
, CRSElapsedTime
, and Distance
when downloading CSV. The downloaded CSV is NOT ideally ready to be imported and manipulation to the data is required.
To make the raw data ready for import, run python ./shortest/scale_down_csv.py
to scale down the raw data and to add random price information. You can also do it manually by deleteing rows of data and populating a new price
column in the CSV.