diff --git a/docs/METRIC-CATALOGUE.md b/docs/METRIC-CATALOGUE.md index 6898f7f..b05feca 100644 --- a/docs/METRIC-CATALOGUE.md +++ b/docs/METRIC-CATALOGUE.md @@ -1,11 +1,20 @@ # Analytics Metric Catalogue -- Status: Draft — listed definitions approved +- Status: Approved specification — implementation not yet authorized - Version: 0.4.0 - Last updated: 2026-08-20 Every merchant-facing number identifies its grain, formula, source fields, filters, Tehran-local period, unit, missing-data behavior, trace path, and definition version. +## Physical source mapping + +- Session-grain metrics read `payment_sessions`, scoped by `merchant_id` and the approved half-open `created_at` period. +- Attempt-grain diagnostics and timings join `payment_attempts.payment_session_id` to the already merchant-scoped session set. +- Money uses `payment_sessions.amount_rial` and `payment_sessions.fee_amount_rial` exactly once per session. +- Terminal filters join the session's `terminal_id`; peer cohorts join the merchant's `category_id` and exclude the active merchant. +- The sole completed `import_runs` row identifies the immutable MVP dataset snapshot included in cache/result metadata. +- `calendar_dates` defines Saturday–Friday weeks, Jalali months, and Persian seasons; no holiday dimension exists. + ## Bank-paid sessions - Canonical id: `bank_paid_sessions` @@ -49,7 +58,7 @@ Every merchant-facing number identifies its grain, formula, source fields, filte ## Paid volume - Canonical id: `bank_paid_amount_rial` -- Formula: sum session `amount` once where `session_status IN ('Paid', 'Verified')` +- Formula: sum session `amount_rial` once where `session_status IN ('Paid', 'Verified')` - Unit: Rial - Subsets: `verified_amount_rial` uses `Verified`; `unverified_paid_amount_rial` uses `Paid`