# Channel analytics database provider

`channel_analytics` implements BI Schema 1.2 and paginated channel detail directly from the current ARR daily facts. It does not read a monthly workbook, `dashboard.json`, `report_versions`, or a frozen report manifest.

Read model:

- Dashboard responses now expose the earliest and latest ARRIVAL coverage dates from the same current daily-version
  snapshot, so the UI can show actual data coverage instead of inferring a full calendar month.

- available months and source pins: `finance.current_daily_versions`;
- channels/order/counts: `finance.daily_channel_metrics` for those current versions;
- aggregates and detail: `finance.v_active_daily_facts` (`current + retained` only);
- projection identity: deterministic SHA-256 over the selected business date, current daily version ID and source artifact SHA-256.

Dashboard rules:

- sold rooms = `sum(NO_OF_ROOMS)`;
- total price = `sum(TOTAL PRICE)` without multiplying again;
- room nights = `sum(NIGHTS * NO_OF_ROOMS)`;
- room types sort by sold rooms descending, then name;
- channels follow first current business date/order, then channel name;
- the channel × room-type matrix and company totals use the same current facts.

The detail response contains only arrival, departure, nights, room count, company, rate code, room type, real price, and total price. It never returns guest name, confirmation number, displayed room number, comments, traces, products, source coordinates, credentials, or object keys.

`DASHBOARD_DATABASE_URL` may use a dedicated read-only role; otherwise it falls back to `ARR_DATABASE_URL`. Transactions are `REPEATABLE READ READ ONLY`, and this validation build rejects any database other than `booking_test`.
