Skip to content

Unified Data Models - Build Summary

Date: August 14, 2026 Status: Complete Build Time: ~1 hour


What Was Built

The foundation for Marchay Intelligence Architecture: shared base types, schema system, SQLite storage, and CLI.

Files Created

marchay-intelligence/
├── intelligence/
│   ├── __init__.py
│   ├── __main__.py
│   ├── cli.py
│   ├── config/
│   │   ├── __init__.py
│   │   └── settings.py
│   ├── models/
│   │   ├── __init__.py
│   │   ├── base.py          # Location, Contact, VerticalBase
│   │   ├── dmc.py           # DMC model
│   │   ├── dining.py        # Restaurant model
│   │   ├── experiences.py   # Experience model
│   │   ├── transportation.py # Transportation model
│   │   ├── hotels.py        # Hotel model
│   │   ├── flights.py       # Flight model
│   │   └── spa_wellness.py  # SpaWellness model
│   └── storage/
│       ├── __init__.py
│       ├── sqlite_store.py  # SQLite + FTS5
│       └── schema.py        # Schema registry & versioning
├── tests/
│   ├── conftest.py
│   ├── test_models/
│   │   ├── test_base.py
│   │   └── test_verticals.py
│   └── test_storage/
│       ├── test_schema.py
│       └── test_sqlite_store.py
├── migrations/versions/
├── pyproject.toml
├── Makefile
├── Dockerfile
├── docker-compose.yml
└── README.md

Models Implemented

ModelVertical KeyFields
Location-id, name, address, city, region, country, country_code, postal_code, latitude, longitude, timezone, created_at, updated_at
Contact-id, entity_type, entity_id, email, phone, phone_e164, website, social, created_at, updated_at
VerticalBase-id, vertical, name, location, contact, source, source_url, confidence, created_at, updated_at
DMCdmc+ services, specialties, destinations, advisor_network, languages
Restaurantdining(inherits VerticalBase)
Experienceexperiences(inherits VerticalBase)
Transportationtransportation(inherits VerticalBase)
Hotelhotels(inherits VerticalBase)
Flightflights(inherits VerticalBase)
SpaWellnessspa_wellness(inherits VerticalBase)

Features

  • Pydantic v2 models with validation (country_code 2-char, confidence 0-1, lat/lng bounds)
  • Schema registry - maps vertical names to model classes
  • Schema versioning - tracks semver per vertical with migration references
  • SQLite store - async via aiosqlite with FTS5 full-text search
  • CLI - intelligence version and intelligence info commands
  • Docker - Dockerfile + docker-compose with SQLite volume

Test Results

44 passed in 0.20s
ruff: All checks passed
mypy: No issues found in 17 source files

Python Compatibility

Adjusted from Python 3.11+ to Python 3.9+ due to system environment. Uses Optional[str] instead of str | None for Pydantic compatibility.


Acceptance Criteria Met

  • ☑ Initialize marchay-intelligence repo with pyproject.toml
  • ☑ Create intelligence/ package structure
  • ☑ Set up pytest for testing
  • ☑ Set up ruff for linting
  • ☑ Set up mypy for type checking
  • ☑ Create Docker Compose with SQLite volume
  • ☑ Define Location model
  • ☑ Define Contact model
  • ☑ Define VerticalBase model
  • ☑ Define DMC model extending VerticalBase
  • ☑ Define Restaurant model extending VerticalBase
  • ☑ Define Experience model extending VerticalBase
  • ☑ Define Transportation model extending VerticalBase
  • ☑ Define Hotel model extending VerticalBase
  • ☑ Define Flight model extending VerticalBase
  • ☑ Define SpaWellness model extending VerticalBase
  • ☑ Build schema registry (vertical -> model mapping)
  • ☑ Implement version tracking per vertical
  • ☑ Implement SQLite store with FTS5 support
  • ☑ Build base table creation from models
  • ☑ Implement CRUD operations for all base types
  • ☑ Unit tests for all base models
  • ☑ Unit tests for vertical models
  • ☑ Unit tests for schema validation
  • ☑ Unit tests for versioning
  • ☑ Unit tests for SQLite store

Next Steps

  • ☐ Extend vertical models with domain-specific fields
  • ☐ Implement JSON export functionality
  • ☐ Build Alembic-style migration system
  • ☐ Add schema diff utility
  • ☐ Add schema documentation generation

Marchay Platform Documentation