Metadata-Version: 2.4
Name: travelpurpose
Version: 2.5.0
Summary: City travel purpose classification — BUSINESS, LEISURE, MEDICAL, CRUISE and more for 400+ destinations worldwide
Author-email: teyfikoz <teyfikoz@yahoo.com>
License: MIT
Project-URL: Homepage, https://github.com/teyfikoz/travelpurpose
Project-URL: Repository, https://github.com/teyfikoz/travelpurpose
Keywords: travel,city,classification,destination,aviation,tourism
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: GIS
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# TravelPurpose

**City travel purpose classification** — instantly know whether a destination is primarily a BUSINESS, LEISURE, MEDICAL, RELIGIOUS, CRUISE or SECONDHOME city. Covers 417 destinations across Europe, Asia, Americas, Africa and the Middle East. Zero dependencies.

[![PyPI version](https://badge.fury.io/py/travelpurpose.svg)](https://pypi.org/project/travelpurpose/)
[![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![GitHub Sponsors](https://img.shields.io/github/sponsors/teyfikoz?label=Sponsor&logo=GitHub)](https://github.com/sponsors/teyfikoz)

## Installation

```bash
pip install travelpurpose
```

## Quick Start

```python
from travelpurpose import TravelPurpose

tp = TravelPurpose()

# Classify a single city
result = tp.classify("Antalya")
print(result.primary_tag)   # LEISURE
print(result.tags)          # ['LEISURE']
print(result.country)       # Turkey
print(result.region)        # Europe
print(result.is_leisure())  # True

# A business-dominant city
biz = tp.classify("Frankfurt")
print(biz.primary_tag)      # BUSINESS
print(biz.is_business())    # True

# A religious destination
mecca = tp.classify("Medina")
print(mecca.primary_tag)    # RELIGIOUS
print(mecca.is_religious()) # True

# Search by tag
leisure_cities = tp.search("LEISURE")
print(len(leisure_cities))  # 123

# Search by region
africa = tp.search_by_region("Africa")
print(len(africa))          # 61

# Dataset statistics
stats = tp.stats()
# {'total_cities': 417, 'tags': {'BUSINESS': 249, 'LEISURE': 123, ...}, ...}
print(len(tp))              # 417
```

## Travel Purpose Tags

| Tag | Description | Count |
|-----|-------------|-------|
| `BUSINESS` | Commercial hub, corporate travel | 249 |
| `LEISURE` | Tourism, vacation, recreation | 123 |
| `SECONDHOME` | Expat communities, retirement, long stays | 31 |
| `RELIGIOUS` | Pilgrim destinations, holy sites | 7 |
| `MEDICAL` | Medical tourism, healthcare travel | 3 |
| `CRUISE` | Cruise port destinations | 2 |
| `SEAMAN` | Maritime crew destinations | 2 |

Each city carries exactly one primary tag reflecting its dominant travel purpose in the dataset.

## Regional Coverage

- **Europe**: 163 cities
- **Asia**: 92 cities
- **Americas**: 65 cities
- **Africa**: 61 cities
- **Middle East**: 36 cities

## Data Source

The classification reflects **airline-industry destination taxonomy** — how the aviation sector categorizes cities by the dominant reason passengers fly there. This means some classifications differ from general tourist expectations:

- A city tagged `MEDICAL` has significant medical-tourism traffic in airline data (e.g. Istanbul, Ankara)
- A city tagged `SECONDHOME` has high long-stay/expat passenger volume (e.g. Paris, Frankfurt, Hamburg)
- `BUSINESS` covers commercial hubs where corporate travel dominates

This makes the dataset well-suited for travel tech, booking analytics, and insurance segmentation where the **aviation-industry perspective** is relevant.

## Use Cases

- **Travel apps** — filter destinations by trip purpose
- **Insurance** — categorize policies by destination type
- **Booking analytics** — segment data by city purpose in airline/OTA context
- **Marketing** — target campaigns by travel motivation
- **GIS tools** — enrich geospatial datasets with travel context

## API Reference

### `TravelPurpose()`

```python
tp = TravelPurpose()

tp.classify(city: str) → CityResult
tp.search(tag: str) → List[CityResult]
tp.search_by_region(region: str) → List[CityResult]
tp.stats() → dict
tp.all_tags() → List[str]
len(tp)  # number of cities in dataset
```

### `CityResult`

```python
result.city          # str
result.country       # str
result.region        # str
result.tags          # List[str]  — one tag per city
result.primary_tag   # str (dominant purpose)
result.is_known      # bool (False for unrecognized cities)
result.is_business() → bool
result.is_leisure()  → bool
result.is_medical()  → bool
result.is_religious()→ bool
result.to_dict()     → dict
```

## Support the Project

If TravelPurpose powers your app, consider [sponsoring on GitHub](https://github.com/sponsors/teyfikoz).

## License

MIT
