execute_metrics_query
ChatGPTExecute a metrics query against the ADECI backend API. Fetches sales and forecast data by selecting a metric and optional grouping dimensions. Use for direct data retrieval: revenue, units, clients, tickets, discount, cancellation. Pass ordinary named historical periods such as last_week and last_month unchanged; do not translate them into wall-clock ISO dates. ADECI resolves them from the selected restaurant's sales reference date, which may be its latest available sales date based on data recency, and returns the exact effective dates in data.metadata. Comparison periods previous_week and previous_month are resolved relative to the main period. Historical revenue, units, clients, and tickets can be broken into bounded 10-, 15-, 20-, or 30-minute intervals. Sub-hourly chronological output preserves dates and is limited to 1,008 potential buckets; time-of-day profiles collapse recurring clock slots and support up to 400 inclusive days. For sub_hourly use explicit start/end dates, source='sales', and no grouping, filters, comparison, ranking, or objectives. The shared client normalizes explicit sub-hourly dates to the authenticated restaurant's known sales bounds and reports that adjustment. Use covered_calendar_day_count only as a calendar-day denominator. Buckets contain whole eligible checks attributed by sale opening time, not revenue accrued during the interval. A zero may be an unobserved bucket or an observed net zero and does not distinguish closure, zero demand, returns/offsets, or missing imports. Opening-time results are descriptive, not causal or proof of profit. Supports multi-dimensional grouping via
group_by array, including product taxonomy groupings, filtering, comparison, and ranking (top-N / bottom-N). The backend resolves the data source (sales vs forecast) from the timeframe automatically — use source only when you need to override this behaviour. Discount and cancellation are historical sales metrics only. Call search_catalog first when the query involves specific products, ingredients, families, or subfamilies.





