# Phase 12.8 — Analytics

| Field | Value |
| --- | --- |
| Status | Complete |
| Module | hospitality |
| Commercial Product | Torbat Food |
| Version | 0.12.8.0 |
| Database | `hospitality_db` |
| API Port | 8009 |
| ADR | ADR-001, ADR-003, ADR-006, ADR-017 |
| Prior phase | [12.7 Connectors](hospitality-phase-12-7.md) |

## Goal

Add a local analytics reporting shell that counts rows in this service's own tables only
(venues, menus, POS tickets, reservations, kitchen tickets, connector activity) — no external
analytics engine and no cross-service reads.

## Scope (In)

- Aggregates: AnalyticsReportDefinition, AnalyticsSnapshot
- APIs under `/api/v1/analytics-reports`, `/api/v1/analytics-snapshots` (+ `/refresh`)
- `POST /analytics-snapshots/refresh` computes a `metrics` JSON payload via simple local
  `COUNT(*)` queries for each `metric_key` on the report definition
- Permissions + publish-only events
- Alembic `0009_phase_128_analytics`
- Capability `analytics`; version `0.12.8.0`

## Out of Scope

- AI Assistant (12.9)
- Cross-service / warehouse analytics, BI dashboards, scheduled jobs

## Quality Gates

Passed (architecture, dependency, migration, tenant, API, permissions, docs). See handover.

## Related Documents

- [Hospitality Roadmap](hospitality-roadmap.md)
- [Phase Handover 12.8](phase-handover/phase-12-8.md)
- [ADR-017](architecture/adr/ADR-017.md)
- [Module Registry](module-registry.md#hospitality)
- [Service Snapshot](service-snapshots/hospitality.yaml)
