diff --git a/examples/README.md b/examples/README.md index 45b23ef..fc76960 100644 --- a/examples/README.md +++ b/examples/README.md @@ -7,6 +7,7 @@ They are public-safe product examples, not proprietary domain packs. Use them to ## Example sets - [Hospitality](hospitality/README.md) +- [Postgres operational dashboard](postgres-operational-dashboard/README.md) - [Energy retail](energy-retail/README.md) - [Ecommerce](ecommerce/README.md) - [SaaS embedded analytics](saas/README.md) diff --git a/examples/hospitality/README.md b/examples/hospitality/README.md index bed7808..55da512 100644 --- a/examples/hospitality/README.md +++ b/examples/hospitality/README.md @@ -33,6 +33,85 @@ Hospitality reporting is most useful when it becomes a business health check, no - combo opportunity table - PMS occupancy and ADR trend +## Calculation patterns + +### Revenue health + +Question: + +```text +Is revenue healthy this week compared with last week? +``` + +Expected calculation: + +```text +current_period_net_sales +previous_period_net_sales +absolute_change = current_period_net_sales - previous_period_net_sales +percentage_change = absolute_change / previous_period_net_sales +``` + +Answer should include the selected business date range, location filter, net/gross basis, and whether refunds and voids are excluded. + +### Product mix and margin + +Question: + +```text +Which categories are driving revenue but hurting margin? +``` + +Expected calculation: + +```text +net_sales by category +cost by category +gross_margin = net_sales - cost +gross_margin_percentage = gross_margin / net_sales +``` + +Dashboard output should be a ranked table with category, sales, margin, margin percentage, and contribution percentage. + +### Wastage risk for ready-made food + +Question: + +```text +Which ready-made items are slow moving and likely to create waste? +``` + +Expected calculation: + +```text +units_produced +units_sold +unsold_units = units_produced - units_sold +sell_through_percentage = units_sold / units_produced +estimated_waste_value = unsold_units * unit_cost +``` + +If production or waste fields are missing, IntraQ should say which fields are required instead of guessing. + +### Basket and combo opportunity + +Question: + +```text +Which products are frequently bought together? +``` + +Expected calculation: + +```text +orders containing product_a and product_b +pair_frequency +pair_revenue +attach_rate = orders_with_pair / orders_with_product_a +``` + +Dashboard output should show product pair, pair frequency, attach rate, pair revenue, and suggested promotion angle. + ## Trust checks - Confirm the date basis: transaction date, business date, stay date, or invoice date. diff --git a/examples/postgres-operational-dashboard/README.md b/examples/postgres-operational-dashboard/README.md new file mode 100644 index 0000000..2f076b8 --- /dev/null +++ b/examples/postgres-operational-dashboard/README.md @@ -0,0 +1,110 @@ +# Postgres operational dashboard example + +This example shows how to position IntraQ for a team with operational data already stored in PostgreSQL. + +The goal is not only to connect Postgres. The goal is to turn SQL-backed tables into trusted AI answers and reusable dashboard components. + +## Example source tables + +```text +orders + id + business_date + location_id + channel + gross_sales + discount_amount + refund_amount + tax_amount + net_sales + cost_amount + +order_items + id + order_id + product_id + quantity + gross_sales + discount_amount + net_sales + cost_amount + +products + id + name + category + sku + +locations + id + name + region +``` + +## Metadata IntraQ needs + +- Date field: `orders.business_date` +- Revenue metric: `sum(orders.net_sales)` +- Gross sales metric: `sum(orders.gross_sales)` +- Discount metric: `sum(orders.discount_amount)` +- Refund metric: `sum(orders.refund_amount)` +- Margin metric: `sum(orders.net_sales - orders.cost_amount)` +- Relationships: + - `orders.id = order_items.order_id` + - `order_items.product_id = products.id` + - `orders.location_id = locations.id` + +## Questions to try + +```text +How is revenue trending by day for this month? +``` + +Expected output: + +- line chart +- grouped by `business_date` +- metric: net sales +- evidence: SQL query and row count + +```text +Which products have high revenue but low margin? +``` + +Expected output: + +- table sorted by net sales descending +- columns: product, category, net sales, cost, gross margin, gross margin percentage +- warning if cost fields are missing + +```text +Which locations are underperforming compared with last week? +``` + +Expected output: + +- table by location +- current period net sales +- previous period net sales +- absolute change +- percentage change +- selected date range and comparison range + +```text +Create a dashboard with revenue trend, revenue by channel, margin by category, and top products. +``` + +Expected output: + +- four dashboard components +- each component has a saved data source/table binding +- each chart remains backed by SQL, not static data + +## Trust checks + +- Always confirm the selected date range. +- Confirm whether revenue uses gross, net, tax-inclusive, or tax-exclusive sales. +- Confirm how discounts, refunds, voids, and cancelled orders are handled. +- Confirm whether results are filtered by location, tenant, company, or all accessible data. +- If a relationship or metric definition is missing, ask for it before generating a final answer. +