Skip to content

Commit 0e0385f

Browse files
danyelfclaude
andcommitted
Add schema.yml files for intermediate and metrics layers
Define model descriptions and data tests (unique, not_null) for all 25 intermediate models and 15 metrics/reporting models. All 15 tests pass. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8da3994 commit 0e0385f

2 files changed

Lines changed: 149 additions & 0 deletions

File tree

models/intermediate/schema.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
version: 2
2+
3+
models:
4+
- name: int_category_hierarchy
5+
description: Recursive flattening of category parent-child tree
6+
columns:
7+
- name: category_id
8+
tests:
9+
- not_null
10+
11+
- name: int_products_with_categories
12+
description: Products joined to their full category hierarchy
13+
columns:
14+
- name: product_id
15+
tests:
16+
- unique
17+
- not_null
18+
19+
- name: int_product_margins
20+
description: Product-level margin calculations
21+
columns:
22+
- name: product_id
23+
tests:
24+
- unique
25+
- not_null
26+
27+
- name: int_order_items_with_products
28+
description: Order line items enriched with product and category info
29+
columns:
30+
- name: order_item_id
31+
tests:
32+
- unique
33+
- not_null
34+
35+
- name: int_order_items_enriched
36+
description: Order line items with margin data
37+
columns:
38+
- name: order_item_id
39+
tests:
40+
- unique
41+
- not_null
42+
43+
- name: int_order_totals
44+
description: Order-level aggregations from line items
45+
columns:
46+
- name: order_id
47+
tests:
48+
- unique
49+
- not_null
50+
51+
- name: int_order_payments_matched
52+
description: Payment-to-order matching with status flags
53+
54+
- name: int_orders_with_promotions
55+
description: Orders joined to their promotion details
56+
57+
- name: int_order_enriched
58+
description: Fully enriched orders with totals, promotions, and payment status
59+
60+
- name: int_daily_order_summary
61+
description: Incremental daily order aggregation
62+
columns:
63+
- name: order_date
64+
tests:
65+
- unique
66+
- not_null
67+
68+
- name: int_customer_order_history
69+
description: Per-customer order statistics
70+
columns:
71+
- name: customer_id
72+
tests:
73+
- unique
74+
- not_null
75+
76+
- name: int_customer_first_last_orders
77+
description: First and last order dates per customer
78+
79+
- name: int_customer_payment_methods
80+
description: Customer payment method preferences
81+
82+
- name: int_customer_review_activity
83+
description: Customer review statistics
84+
85+
- name: int_customer_segments
86+
description: RFM-based customer segmentation
87+
88+
- name: int_store_employees_active
89+
description: Store-level employee counts by role
90+
91+
- name: int_store_order_assignments
92+
description: Deterministic order-to-store mapping
93+
94+
- name: int_store_revenue
95+
description: Store-level revenue aggregation
96+
97+
- name: int_store_performance
98+
description: Store performance with efficiency metrics
99+
100+
- name: int_supply_order_costs
101+
description: Supply orders with cost calculations
102+
103+
- name: int_inventory_movements
104+
description: Combined supply and sales inventory movements
105+
106+
- name: int_product_stock_levels
107+
description: Incremental product stock level calculation
108+
109+
- name: int_reviews_with_products
110+
description: Reviews enriched with product info
111+
112+
- name: int_product_ratings
113+
description: Product-level rating aggregation
114+
115+
- name: int_promotion_effectiveness
116+
description: Promotion vs non-promotion order comparison

models/metrics/schema.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
version: 2
2+
3+
models:
4+
- name: metric_daily_revenue
5+
description: Daily revenue metrics
6+
- name: metric_daily_orders
7+
description: Daily order count by status
8+
- name: metric_weekly_sales
9+
description: Weekly sales rollup
10+
- name: metric_monthly_sales
11+
description: Monthly sales rollup
12+
- name: metric_customer_acquisition_monthly
13+
description: Monthly new customer counts
14+
- name: metric_customer_retention_monthly
15+
description: Monthly cohort retention rates
16+
- name: metric_product_sales_daily
17+
description: Product-level daily sales
18+
- name: metric_store_daily
19+
description: Store-level daily metrics
20+
- name: metric_promotion_daily
21+
description: Promotion daily effectiveness
22+
- name: metric_inventory_daily
23+
description: Inventory snapshot metrics
24+
- name: rpt_executive_dashboard
25+
description: Executive-level KPI summary
26+
- name: rpt_sales_dashboard
27+
description: Sales-focused dashboard with WoW growth
28+
- name: rpt_customer_dashboard
29+
description: Customer-focused dashboard summary
30+
- name: rpt_product_dashboard
31+
description: Product-focused dashboard summary
32+
- name: rpt_store_dashboard
33+
description: Store-focused dashboard with rankings

0 commit comments

Comments
 (0)