|
| 1 | +--- |
| 2 | +description: Canonical data model to use as the basis for all documentation examples |
| 3 | +globs: docs-mintlify/** |
| 4 | +alwaysApply: false |
| 5 | +--- |
| 6 | + |
| 7 | +# Canonical Example Data Model |
| 8 | + |
| 9 | +All documentation examples and recipes must use the [ecommerce demo data model](https://github.com/cubedevinc/ecommerce_demo) as their basis unless the topic genuinely requires a different domain. |
| 10 | + |
| 11 | +## Cubes |
| 12 | + |
| 13 | +### `order_items` (fact, `ECOMMERCE.ORDER_ITEMS`) |
| 14 | +The primary fact table. Use this as the starting point for most examples. |
| 15 | + |
| 16 | +Key fields: |
| 17 | +- `id` — primary key |
| 18 | +- `order_id`, `user_id`, `product_id`, `inventory_item_id` — foreign keys |
| 19 | +- `status` (string) — `complete`, `processing`, `shipped`, `cancelled`, `returned` |
| 20 | +- `sale_price` (number) — revenue per line item; measure `total_sale_price` (sum, currency) |
| 21 | +- `created_at`, `shipped_at`, `delivered_at`, `returned_at` (time) |
| 22 | +- `is_delivered` (boolean) |
| 23 | +- measures: `count`, `order_count` (count_distinct on order_id), `total_sale_price` |
| 24 | + |
| 25 | +### `orders` (`ECOMMERCE.ORDERS`) |
| 26 | +Order-level table. Use when examples are about order status or counts. |
| 27 | + |
| 28 | +Key fields: |
| 29 | +- `order_id` — primary key |
| 30 | +- `user_id`, `status`, `gender`, `num_of_item` |
| 31 | +- `created_at`, `delivered_at`, `shipped_at` (time) |
| 32 | +- measures: `count` |
| 33 | + |
| 34 | +### `products` (`ECOMMERCE.PRODUCTS`) |
| 35 | +Product catalog. Use when examples need brand, category, or product dimensions. |
| 36 | + |
| 37 | +Key fields: |
| 38 | +- `id` — primary key |
| 39 | +- `brand`, `category`, `department`, `name`, `sku` |
| 40 | +- `cost`, `retail_price` (number) |
| 41 | +- measures: `count` |
| 42 | + |
| 43 | +### `users` (`ECOMMERCE.USERS`) |
| 44 | +Customer table. Use when examples need demographic or geographic dimensions. |
| 45 | + |
| 46 | +Key fields: |
| 47 | +- `id` — primary key |
| 48 | +- `first_name`, `last_name`, `full_name`, `email` |
| 49 | +- `age`, `gender` |
| 50 | +- `city`, `state`, `country` |
| 51 | +- `traffic_source` |
| 52 | +- `created_at` (time) |
| 53 | +- measures: `count` |
| 54 | + |
| 55 | +## Common example patterns |
| 56 | + |
| 57 | +**Revenue over time** → `order_items.total_sale_price` + `order_items.created_at` |
| 58 | + |
| 59 | +**Orders by status** → `order_items.count` + `order_items.status` |
| 60 | + |
| 61 | +**Revenue by brand/category** → `order_items.total_sale_price` joined to `products.brand` / `products.category` |
| 62 | + |
| 63 | +**User demographics** → `users.count` + `users.city` / `users.country` / `users.traffic_source` |
| 64 | + |
| 65 | +**Multi-cube join** → `order_items` joins `orders`, `products`, `users` via foreign keys defined in the repo |
| 66 | + |
| 67 | +## Reference |
| 68 | + |
| 69 | +Full model: https://github.com/cubedevinc/ecommerce_demo |
0 commit comments