Skip to content

Latest commit

Β 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Maharashtra Smart AI Travel Itinerary Planner πŸ›οΈβœ¨

An Academic AI/ML Mini-Project for Intelligent Tourism Recommendation & Constraint-Based Itinerary Optimization

Python 3.11 Flask Scikit-Learn Leaflet.js


🌟 Executive Summary

Maharashtra Smart AI Travel Itinerary Planner is a full-stack, genuine Python AIML-powered travel technology application designed for academic demonstration and real-world utility.

Unlike conventional static tourism websites that present hardcoded lists, this application executes a Multi-Dimensional Content-Based Filtering Algorithm using Cosine Similarity, weighted multi-criteria heuristic scoring, and constraint-based timeline scheduling across 10 authoritative Maharashtra tourism destinations, 80 attractions, 30 activities, 33 verified routes, 30 restaurants, and 30 hotels.


πŸš€ Key Features

  1. Genuine Python AIML Recommendation Engine:
    • Computes Cosine Similarity in an 11-Dimensional Feature Space (nature, adventure, history, religious, beach, wildlife, food, shopping, photography, relaxation, family).
    • Dynamically vectorizes user preferences and applies travel-group heuristic biases (Solo, Couple, Family, Friends).
  2. Explainable AI (XAI) Rationales:
    • Generates transparent natural language explanations and match percentages for why each attraction is recommended.
  3. Constraint-Based Chronological Itinerary Optimizer:
    • Auto-generates structured day-by-day vertical timelines adhering to user pace, opening/closing hours, transit buffers, and meal breaks.
  4. 5-Category Budget Optimization Engine:
    • Calculates expenses across Stay, Dining, Entry Fees, Activities, and Local Transport, auto-suggesting budget optimizations when user budget constraints are exceeded.
  5. Interactive Mapping & Geospatial Visualization:
    • Dynamic Leaflet.js route maps showing numbered attraction pins, interactive popups, and route connecting polyline segments.
  6. Executive PDF & JSON Export:
    • Generates downloadable high-resolution formatted PDF reports using reportlab.
  7. Administrative Dashboard & Full Entity CRUD:
    • Manage destinations, attractions, hotels, restaurants, routes, and update ML feature vector matrices with live slider controls.
  8. Feedback & Recommender Tuning Loop:
    • Logs 1-to-5 star user ratings to refine feature weights.

πŸ“ AIML Mathematical Formulation

1. Vector Space Representation

Each attraction ( j ) is characterized by an 11-dimensional feature vector (\vec{A}_j \in [0, 1]^{11}). The user profile is transformed into a normalized preference vector (\vec{U} \in [0, 1]^{11}) adjusted by travel companion biases:

$$\text{Cosine Similarity}(\vec{U}, \vec{A}_j) = \frac{\vec{U} \cdot \vec{A}_j}{|\vec{U}|_2 |\vec{A}_j|_2} = \frac{\sum_{i=1}^{11} u_i \cdot a_{j,i}}{\sqrt{\sum_{i=1}^{11} u_i^2} \sqrt{\sum_{i=1}^{11} a_{j,i}^2}}$$

2. Multi-Criteria Composite Score Formulation

The total attraction fitness score ( S_j ) blends content similarity with empirical signals:

$$S_j = W_{\text{sim}} \cdot \text{Sim}_j + W_{\text{rate}} \cdot \text{Rating}_j + W_{\text{pop}} \cdot \text{Pop}_j + W_{\text{bud}} \cdot \text{Budget}_j + W_{\text{time}} \cdot \text{Pace}_j + W_{\text{route}} \cdot \text{Prox}_j$$

Factor Weight ($W$) Description
Interest Similarity 35% (0.35) Cosine similarity on 11-D preference vector
Attraction Rating 20% (0.20) Normalized visitor review rating ($[0.0, 1.0]$)
Budget Fitness 15% (0.15) Entry fee compatibility with daily per-person budget
Popularity Fit 10% (0.10) High (1.0), Medium (0.70), Low (0.40) weight
Duration Fit 10% (0.10) Compatibility with travel pace (Relaxed, Moderate, Fast-paced)
Route Proximity 10% (0.10) Regional cluster corridor proximity score

πŸ—οΈ System Architecture

                                +-----------------------------+
                                |      Web Client (Browser)    |
                                |  (Tailwind UI, Leaflet, JS) |
                                +--------------+--------------+
                                               | HTTP / REST
                                               v
                                +-----------------------------+
                                |      Flask Application      |
                                |   (App Factory & Blueprints)|
                                +---+-------+-------+-----+---+
                                    |       |       |     |
         +--------------------------+       |       |     +--------------------------+
         |                                  |       |                                |
         v                                  v       v                                v
+------------------+             +----------------------+                 +--------------------+
|  Public & Auth   |             |  AIML Recommender    |                 | Itinerary Engine   |
|  - Login / Reg   |             |  - 11-D Vectorizer   |                 | - Chrono Scheduler |
|  - Explore / Det |             |  - Cosine Similarity |                 | - Route Calculator |
|  - Admin CRUD    |             |  - XAI Rationale Gen |                 | - Budget Optimizer |
+--------+---------+             +----------+-----------+                 +---------+----------+
         |                                  |                                       |
         +----------------------------------+---------------------------------------+
                                            |
                                            v
                                +-----------------------+
                                |   SQLAlchemy Engine   |
                                | (SQLite / MySQL DB)   |
                                +-----------+-----------+
                                            |
                                            v
                                +-----------------------+
                                | Authoritative Dataset |
                                | (JSON Tourism Matrix) |
                                +-----------------------+

πŸ“‚ Project Structure

maharashtra_travel_planner/
β”œβ”€β”€ config.py                     # Configuration & ML Weights
β”œβ”€β”€ app.py                        # Application factory & Blueprint loader
β”œβ”€β”€ seed_database.py              # Standalone DB seeder CLI
β”œβ”€β”€ test_app_endpoints.py         # 7-module automated test suite
β”œβ”€β”€ test_recommender.py           # ML Recommender unit test
β”œβ”€β”€ test_demo_scenario.py         # Mahabaleshwar demo scenario test
β”œβ”€β”€ requirements.txt              # Production dependencies
β”œβ”€β”€ .env.example                  # Environment configuration template
β”œβ”€β”€ data/
β”‚   └── maharashtra_travel_data.json  # Authoritative 10-destination dataset
β”œβ”€β”€ database/
β”‚   β”œβ”€β”€ db.py                     # SQLAlchemy db instance
β”‚   └── seed_data.py              # Comprehensive seeder script
β”œβ”€β”€ models/
β”‚   β”œβ”€β”€ __init__.py               # Model exports
β”‚   β”œβ”€β”€ tourism.py                # Destination, Attraction, Route, Hotel, Restaurant
β”‚   β”œβ”€β”€ ml_features.py            # 11-D ML Feature Vectors
β”‚   β”œβ”€β”€ user.py                   # User, UserPreference, Favorite
β”‚   └── trip.py                   # Trip, Itinerary, ItineraryItem, UserFeedback
β”œβ”€β”€ ml/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ feature_engineering.py    # Vector normalization & companion bias
β”‚   β”œβ”€β”€ model_utils.py            # Cosine similarity & subscore math
β”‚   β”œβ”€β”€ explanations.py           # Explainable AI (XAI) generator
β”‚   └── recommender.py            # Multi-criteria recommendation engine
β”œβ”€β”€ itinerary/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ router.py                 # Transit distances, travel times, transport costs
β”‚   β”œβ”€β”€ scheduler.py              # Chronological timeline & meal insertion
β”‚   β”œβ”€β”€ budget.py                 # 5-category budget breakdown & optimizer
β”‚   └── optimizer.py              # Master end-to-end optimizer orchestrator
β”œβ”€β”€ routes/
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ auth_routes.py            # Authentication & preference updates
β”‚   β”œβ”€β”€ public_routes.py          # Landing, Explore, Details, About
β”‚   β”œβ”€β”€ planner_routes.py         # 3-step Planner flow & feedback
β”‚   β”œβ”€β”€ api_routes.py             # REST JSON endpoints & AJAX
β”‚   β”œβ”€β”€ admin_routes.py           # Admin control panel & entity CRUD
β”‚   └── export_routes.py          # ReportLab PDF & JSON exporter
β”œβ”€β”€ static/
β”‚   β”œβ”€β”€ css/                      # style.css, timeline.css, animations.css, admin.css
β”‚   └── js/                       # main.js, planner.js, map.js, recommendations.js, admin.js
└── templates/
    β”œβ”€β”€ base.html                 # Master layout with navbar & footer
    β”œβ”€β”€ index.html                # Landing page with hero & counters
    β”œβ”€β”€ explore.html              # Destination catalog
    β”œβ”€β”€ destination_detail.html   # Destination deep-dive guide
    β”œβ”€β”€ about.html                # AIML documentation & formula
    β”œβ”€β”€ 404.html & 500.html       # Error pages
    β”œβ”€β”€ auth/                     # login.html, register.html
    β”œβ”€β”€ planner/                  # create_trip.html, recommendations.html, itinerary.html, edit_itinerary.html
    β”œβ”€β”€ trips/                    # my_trips.html
    └── admin/                    # dashboard.html, crud_list.html, edit_*.html

⚑ Quick Start Installation

Prerequisites

  • Python 3.10+ installed
  • Git (optional)

1. Clone or Navigate to Directory

cd "C:\Users\Atharva Mane\.gemini\antigravity\scratch\maharashtra_travel_planner"

2. Install Dependencies

pip install -r requirements.txt

3. Initialize & Seed Database

Populates all 10 destinations, 80 attractions, 80 ML feature vectors, 30 activities, 33 routes, 30 hotels, 30 restaurants, and default accounts:

python seed_database.py

4. Run Application

python app.py

Open http://127.0.0.1:5000 in your browser.


πŸ”‘ Default Credentials

Account Role Email Address Password Privileges
System Admin admin@maharashtra.ai Admin@12345 Full CRUD, ML feature editor, Analytics
Demo Traveler traveler@example.com Traveler@123 Create trips, Save itineraries, Feedback

(Or click the 1-click Quick Login buttons on the Sign In page!)


🎯 Academic Demonstration Scenario

To demonstrate the system live for academic reviewers:

  1. Click "Run Mahabaleshwar Demo" or navigate to Plan Itinerary.
  2. Click "✨ Load Demo Preset (Mahabaleshwar Friends Trip)":
    • Destination: Mahabaleshwar (Western Maharashtra)
    • Duration: 3 Days
    • Budget: β‚Ή12,000
    • Group: Friends (4 Travelers)
    • Interests: Nature + Adventure + Photography
    • Daily Window: 08:00 – 20:00
    • Hotel Preference: Mid-range
  3. Click "Run AIML Recommender & Generate Itinerary".
  4. Observe the Animated Multi-Step AI Processing Screen simulating vector analysis.
  5. Review top recommendations (Pratapgad Fort, Arthur's Seat, Elephant's Head Point, Venna Lake) with 94%+ match scores and Explainable AI (XAI) rationale badges.
  6. Click "Build Complete Timeline Itinerary" to view:
    • Chronological vertical timeline with breakfast, lunch, and dinner stops.
    • Interactive Leaflet map with route pins.
    • 5-category budget breakdown chart.
    • 1-click "Download PDF Itinerary".

πŸ§ͺ Automated Verification Suite

Run all automated unit and integration tests:

# Run Recommender Engine Unit Test
python test_recommender.py

# Run Demonstration Scenario Test
python test_demo_scenario.py

# Run Full 7-Module Flask Test Suite
python test_app_endpoints.py

πŸ“œ Authoritative Tourism Coverage

The dataset covers 10 diverse tourism regions across Maharashtra:

  1. Lonavala (Western Maharashtra / Pune) β€” Hill station, Forts, Caves, Waterfalls
  2. Mahabaleshwar (Western Maharashtra / Satara) β€” Sahyadri viewpoints, Strawberries, Heritage forts
  3. Matheran (Konkan / Raigad) β€” Eco-sensitive hill station, Forest trails, Heritage Toy Train
  4. Alibaug (Konkan / Raigad) β€” Coastal beaches, Sea forts, Water sports
  5. Tarkarli (Konkan / Sindhudurg) β€” Scuba diving, Coral reefs, Pristine backwaters
  6. Ratnagiri–Ganpatipule (Konkan) β€” Coastal temples, Mango orchards, Forts
  7. Nashik (North Maharashtra) β€” Vineyards, Godavari Ghats, Jyotirlinga pilgrimage
  8. Kolhapur (Southern Maharashtra) β€” Mahalakshmi Temple, Palace architecture, Cuisine
  9. Chhatrapati Sambhajinagar (Marathwada) β€” UNESCO World Heritage Ajanta & Ellora Caves
  10. Tadoba–Andhari Tiger Reserve (Vidarbha / Chandrapur) β€” Tiger safaris, Wildlife sanctuary

Β© 2026 Maharashtra Smart AI Travel Planner. Built with Python, Flask, Scikit-Learn & ReportLab.

About

Maharashtra Smart AI Travel Itinerary Planner is a full-stack, genuine Python AIML-powered travel technology application designed for academic demonstration and real-world utility. Multi-Dimensional Content-Based Filtering Algorithm. Cosine Similarity, 10 authoritative Maharashtra tourism destinations, 80 attractions, 30 activities and much more.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages