Travel Companion is a Python-based mobile application designed to assist users in planning and managing their travel experiences while visiting Montreal. The application utilizes context-awareness, knowledge representation, and adaptive user interfaces to provide personalized recommendations.
By integrating real-time data (Location, Weather, Time) with a semantic Ontology, the app dynamically suggests restaurants, attractions, and activities that fit the user's immediate environment and personal preferences.
The application detects and adapts to four key user contexts:
- 📍 Location: Uses
Geopyto detect the user's current coordinates to provide nearby recommendations. - ⏰ Time of Day: Automatically detects the current time to suggest appropriate meal phases (Breakfast, Lunch, Dinner) or activities.
- 🌤️ Weather: Fetches real-time forecasts via the OpenWeather API to influence activity suitability (e.g., suggesting indoor museums during rain).
- 👤 User Preferences: Adapts to user inputs regarding cuisine types, preferred activities (indoor/outdoor), and attraction interests.
- Knowledge Representation: Uses Protégé and Owlready2 to model travel knowledge.
- Smart Filtering: The system reasons against the ontology to filter out activities unsuitable for the current weather (e.g., excluding parks during snow) or time (e.g., excluding closed venues at night).
- Live Notifications: The app monitors context changes in the background. If the time shifts from "Lunch" to "Afternoon," the app notifies the user and refreshes recommendations.
- Preference Management: Users can update their profile preferences at any time, instantly triggering new, adaptive recommendations.
| Component | Tool / Library | Usage |
|---|---|---|
| UI Framework | KivyMD (Python) | Material Design mobile interface. |
| Logic/Backend | Python | Core application logic. |
| Knowledge Base | Owlready2 | Loading and querying the .owl ontology file. |
| Data Source | Google Places API | Fetching real-world restaurants and attractions. |
| Weather | OpenWeatherMap API | Real-time weather conditions. |
| Database | SQLite | Local storage for user profiles and preferences. |
| Auth | Google OAuth 2.0 | Secure user sign-in. |
This project fulfills the core requirements as follows:
| Requirement | Implementation Detail |
|---|---|
| User Contexts | Implemented in context_module.py (Location/Weather) and main.py (Time logic). |
| Meal Recommendations | main.py calculates the current "Meal Phase" and queries Google Places for cuisines matching the user's DB profile. |
| Weather-Based Recs | ontology_module.py checks the is_good_for_weather property in the ontology to validate suggestions against current conditions. |
| Time Constraints | The app prevents recommendations for inappropriate times (e.g., parks at 4 AM) via ontology reasoning. |
| LLM Assistance | Large Language Models were used as assistive systems during development. |
main.py: Entry point. Handles UI navigation, the dashboard lifecycle, and the background clock scheduler for real-time updates.context_module.py: Interface for external APIs (Geopy, OpenWeather, Google Maps).ontology_module.py: Loads thetravel_ontology.owlfile and performs semantic reasoning to filter recommendations.auth_module.py: Manages the Google Login flow.database_setup.py: Initializes the SQLite database for local storage.app_layout.kv: Kivy design file containing the UI layout and styles.
-
Install Dependencies:
pip install kivymd google-auth-oauthlib requests geopy owlready2 python-dotenv
-
Environment Variables: Create a
.envfile in the root directory and add your API keys:OPENWEATHER_API_KEY=your_key_here GOOGLE_MAPS_API_KEY=your_key_here
-
Authentication: Place your Google Cloud
client_secret.jsonfile in theassets/folder. -
Run the Application:
python main.py
- Time Travel Mode: For demonstration purposes, a manual time variable (
HOUR) is implemented inmain.pyto simulate time passing (e.g., switching from Lunch to Dinner) to test adaptive notifications without waiting for real-time hours.