#Pensive Passport
Pensive Passport is a travel app that assists the indecisive traveler in making data-driven decisions. Once the user has chosen travel options, PP gathers airfare, weather, cost of living, and Michelin star data. Based on this, PP’s scoring algorithm suggests an initial destination. The user may then adjust the relative importance of food/weather/cost, and PP’s algorithm will interactively recalculate her destination. Once satisfied, the user can explore the “winning” city through a selection of prominent city attractions, as well as peruse PP’s additional featured recommendations.
###Technology Stack
- Backend: Python, Flask, SQLAlchemy, Postgres
- Python Libaries: nltk, scikit-learn, scipy
- Frontend: JavaScript, jQuery, AJAX, Bootstrap
- APIs: Flickr, Google Flights, Google Maps, Google Places, World Weather Online, Wikipedia
###Control Flow
###Overview
- Search Form
- Search destination of interest.
- Typeahead pre-populates from DB.
- Preference Form
- Connect to DB for airport dropdown selection.
- If city images are not already cached in DB, call Flickr API to gather relevant photos.
- Data Table & Algo Results
- Data Collection
- Call Google Flights API to gather airfare.
- Call World Weather Online API to gather weather data for the same travel dates in the previous year.
- Query database for static data including cost-of-living and Michelin stars.
- Flight, weather, and static data passed through to the frontend for the scoring algorithm.
- Destination Decision Algorithm
- Calculate a weighted average for the data delta between cities:
- Calculate the wow factor delta:
- Sign (+/-) on the sum of the data delta and wow delta determines the winning city:
- The user is able to adjust sliders to change the relative importance of cost, food, and weather and then the algorithm will recalculate the destination.
- Data Collection
- Winning City Details
- Map
- Connect to Google Maps API for map of winning city.
- Map
###Set Up PP on Your Machine
Clone or fork this repo:
https://github.com/sadiew/pensive_passport.git
Create and activate a virtual environment inside your project directory:
virtualenv env
source env/bin/activate
Install the requirements:
pip install -r requirements.txt
Get your own secret keys for Google, Flickr, and World Weather Online and save them to a file secrets.sh. You should also set your own secret key for Flask. Your file should look something like this:
export APP_KEY="YOUR_APP_KEY"
export FLICKR_KEY="YOUR_API_KEY"
export FLICKR_SECRET="YOUR_API_SECRET"
export WEATHER_KEY="YOUR_API_KEY"
export GOOGLE_KEY="YOUR_API_KEY"
Source your secret keys:
source secrets.sh
Create ORM:
python -i model.py
db.create_all()
Seed data:
python seed.py
python nltk_helper.py
Run the app:
python server.py
Navigate to localhost:5000
to decide upon your next vacation!