The liquor_data dbt project (with the dbt_utils and codegen packages) transforms the consolidated table through one staging model and twelve core models. The staging view stg_iowa_liquor de-duplicates on invoice and date with a row_number, generates a surrogate sales_id, applies type-safe casts to the numeric fields, supports a 100-row is_test_run guard, and is documented column by column in schema.yml.
Time-series and geographic analytics: monthly sales with month-over-month growth computed with lag() window functions, a four-month rolling-average sales forecast, and monthly cost-versus-retail price trajectories per item. County revenue rankings and per-store revenue aggregated to latitude/longitude with BigQuery geography functions (ST_X/ST_Y) make the results mappable.
Commercial analytics: item-level price elasticity estimated as the change in bottles sold per unit change in average retail price, store segmentation into sales and volume quartiles with ntile(4), bought-together product pairs from an invoice-level self-join (top 20), ranked top stores and categories, most popular bottle sizes, and low-access “liquor deserts” — counties with fewer than five stores. Every model states its business question in a SQL header comment, is materialized as a table, and is built through dbt build.