Skip to content

Intelligence Project Structure

Separate repository (marchay-intelligence) for all Intelligence Architecture services. This document defines the repo layout, tech stack, and conventions.


Repository Layout

marchay-intelligence/
├── intelligence/                   # Main package
│   ├── __init__.py
│   ├── cli.py                      # CLI orchestrator (typer)
│   ├── config/
│   │   ├── __init__.py
│   │   ├── settings.py             # Settings via pydantic-settings
│   │   └── sources.yaml            # Per-vertical source config
│   │
│   ├── models/                     # Pydantic data models
│   │   ├── __init__.py
│   │   ├── base.py                 # Shared base types (Location, Contact)
│   │   ├── dmc.py                  # DMC vertical models
│   │   ├── dining.py               # Dining vertical models
│   │   ├── experiences.py          # Experiences vertical models
│   │   ├── transportation.py       # Transportation vertical models
│   │   ├── hotels.py               # Hotels vertical models
│   │   ├── flights.py              # Flights vertical models
│   │   └── spa_wellness.py         # Spa & Wellness vertical models
│   │
│   ├── crawlers/                   # Per-vertical crawlers
│   │   ├── __init__.py
│   │   ├── base.py                 # Abstract BaseCrawler (shared)
│   │   ├── dmc/
│   │   │   ├── __init__.py
│   │   │   ├── inside_travel.py
│   │   │   ├── traveller_made.py
│   │   │   └── dmc_travel.py
│   │   ├── dining/
│   │   │   ├── __init__.py
│   │   │   ├── resy.py
│   │   │   ├── opentable.py
│   │   │   ├── yelp.py
│   │   │   └── tock.py
│   │   ├── experiences/
│   │   │   ├── __init__.py
│   │   │   ├── viator.py
│   │   │   ├── getyourguide.py
│   │   │   └── klook.py
│   │   ├── transportation/
│   │   │   ├── __init__.py
│   │   │   ├── uber.py
│   │   │   ├── lyft.py
│   │   │   └── blacklane.py
│   │   ├── hotels/
│   │   │   ├── __init__.py
│   │   │   ├── booking.py
│   │   │   ├── expedia.py
│   │   │   └── virtuoso.py
│   │   ├── flights/
│   │   │   ├── __init__.py
│   │   │   ├── amadeus.py
│   │   │   ├── skyscanner.py
│   │   │   └── google_flights.py
│   │   └── spa_wellness/
│   │       ├── __init__.py
│   │       ├── mindbody.py
│   │       └── spafinder.py
│   │
│   ├── extractors/                 # Shared extraction logic
│   │   ├── __init__.py
│   │   ├── contact.py              # Email/phone/social extraction
│   │   ├── website.py              # Deep-crawl extraction
│   │   └── structured.py           # Structured data extraction
│   │
│   ├── storage/                    # Per-vertical storage
│   │   ├── __init__.py
│   │   ├── sqlite_store.py         # SQLite + FTS5 (shared)
│   │   ├── json_store.py           # JSON export (shared)
│   │   ├── migrations/             # Schema migrations
│   │   │   ├── __init__.py
│   │   │   └── versions/
│   │   └── schema.py               # Schema definitions
│   │
│   ├── mcp_server/                 # MCP server
│   │   ├── __init__.py
│   │   ├── server.py               # MCP server entry point
│   │   ├── tools/                  # Per-vertical MCP tools
│   │   │   ├── __init__.py
│   │   │   ├── dmc.py
│   │   │   ├── dining.py
│   │   │   ├── experiences.py
│   │   │   ├── transportation.py
│   │   │   ├── hotels.py
│   │   │   ├── flights.py
│   │   │   └── spa_wellness.py
│   │   └── resources/              # MCP resources
│   │       ├── __init__.py
│   │       └── verticals.py
│   │
│   └── cross_vertical/             # Cross-vertical features
│       ├── __init__.py
│       ├── search.py               # search_destination tool
│       ├── entity_resolver.py      # Entity resolution
│       └── itinerary.py            # suggest_itinerary tool

├── tests/
│   ├── __init__.py
│   ├── conftest.py
│   ├── test_models/
│   ├── test_crawlers/
│   ├── test_extractors/
│   ├── test_storage/
│   ├── test_mcp/
│   └── test_cross_vertical/

├── migrations/                     # Alembic migrations
│   ├── alembic.ini
│   └── versions/

├── docker/
│   ├── Dockerfile
│   └── docker-compose.yml

├── pyproject.toml
├── Makefile
├── .gitlab-ci.yml
└── README.md

Tech Stack

ComponentChoiceRationale
LanguagePython 3.12+Proven in spike, LangChain ecosystem
CLItyperFast, type-safe CLI
ModelsPydantic v2Validation, serialization, JSON Schema
StorageSQLite + FTS5Lightweight, full-text search, no infra
Crawlershttpx + BeautifulSoupAsync HTTP, HTML parsing
JS RenderingPlaywrightFor JS-rendered pages
MCP Servermcp (Python SDK)Official MCP implementation
Testingpytest + pytest-asyncioAsync test support
LintingruffFast, comprehensive
Type Checkingmypy (strict)Catch errors early
MigrationsAlembicStandard for SQLite/Postgres + Python

Naming Conventions

  • Python: snake_case for files, functions, variables. PascalCase for classes.
  • Files: base_crawler.py, contact_extractor.py, test_store.py
  • Tables: snake_case plural (dmc, restaurant, experience)
  • MCP Tools: search_{vertical}, get_{vertical}_details, list_{vertical}_types
  • Metrics: intelligence_crawler_requests_total, intelligence_records_created_total
  • Git branches: feat/dmc-crawler, fix/resy-rate-limit, chore/update-deps

Repo Relationship

This repo (marchay-intelligence) is separate from the architecture docs repo (marchay-docs) and other service repos.

RepoPurposeContents
marchay-docsArchitecture planningDesign docs, build briefs, roadmaps
marchay-agentAgent servicesOrchestrator, research agents
marchay-integrationIntegration servicesAPI Gateway, connectors
marchay-intelligenceIntelligence servicesCrawlers, storage, MCP server

The build brief in marchay-docs serves as the spec. Implementation lives in marchay-intelligence.


Makefile

makefile
.PHONY: dev test lint typecheck crawl migrate

dev:
	python -m intelligence.cli --help

test:
	pytest tests/ -v --cov=intelligence --cov-report=term-missing

lint:
	ruff check intelligence/ tests/

typecheck:
	mypy intelligence/

crawl:
	python -m intelligence.cli crawl --vertical $(VERTICAL) --source $(SOURCE)

migrate:
	alembic upgrade head

build:
	docker compose build

prod:
	docker compose -f docker-compose.prod.yml up -d

Marchay Platform Documentation