Metadata-Version: 2.4
Name: travelpurpose
Version: 1.0.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("Istanbul")
print(result.primary_tag)   # MEDICAL
print(result.tags)          # ['MEDICAL', 'BUSINESS', 'LEISURE']
print(result.country)       # Turkey
print(result.region)        # Europe

# Boolean helpers
print(result.is_business())  # True
print(result.is_leisure())   # True
print(result.is_medical())   # True

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

# Search by region
europe = tp.search_by_region("Europe")
print(len(europe))  # 163+

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

## 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 |

Cities can have multiple tags (e.g. Istanbul = MEDICAL + BUSINESS + LEISURE).

## Regional Coverage

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

## Use Cases

- **Travel apps** — filter destinations by trip purpose
- **Insurance** — categorize policies by destination type
- **Analytics** — segment booking data by city purpose
- **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]
result.primary_tag   # str (most specific tag)
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
