diff --git a/apps.md b/apps.md index 3565222..500f232 100644 --- a/apps.md +++ b/apps.md @@ -71,9 +71,3 @@ gcloud config set project {my_project_id} --installation name="Hacker News" description="Posts from news.ycombinator.com" --> - - \ No newline at end of file diff --git a/bigquery/README.md b/bigquery/README.md index 8748480..1ffa7a7 100644 --- a/bigquery/README.md +++ b/bigquery/README.md @@ -12,10 +12,6 @@ gcloud config set project {my_project_id} --installation This set of models points at a publicly available FAA flights dataset including information on flights, airports, air crafts and aircraft models from 2000 to 2005. A wide variety of patterns and features are used in this model and any of our examples in documentation are based on this dataset, so it's a great place to start as you get to know Malloy. -## [Iowa Liquor](iowa) - -Liquor sales in Iowa are state-controlled, with all liquor wholesale run by the state. All purchases and sales of liquor that stores make are a matter of public record. A walk through of exploring and modeling this dataset can be found [here](https://malloydata.github.io/documentation/examples/iowa/iowa.html); this makes a great introduction to Malloy. - ## [E-commerce](ecommerce) This model points to a dataset for a fictitious e-commerce business. It has a clean and typical schema for a transactional dataset. It also includes an example of an interesting brand affinity analysis (people who buy x also buy y). An example of how to use dataset can be found [here](https://malloydata.github.io/documentation/examples/ecommerce.html). diff --git a/bigquery/iowa/README.malloynb b/bigquery/iowa/README.malloynb deleted file mode 100644 index 6b29703..0000000 --- a/bigquery/iowa/README.malloynb +++ /dev/null @@ -1,44 +0,0 @@ ->>>markdown -# Iowa State Store Liquor Purchases - -In Iowa, all liquor stores are own by the state. The store's purchases are a matter of public record. - -See the [Malloy source code](https://github.com/malloydata/malloy-samples/tree/main/bigquery/iowa) for this data set. - -## Overview - -The query below will give you a feel for the market as a whole. Notice that some of the top seller are a huge part of the market. For example Tito's vodka is 3.5% of all liquor sales in Iowa. ->>>malloy -import 'iowa.malloy' ->>>malloy -# dashboard -run: iowa -> { - nest: by_class - nest: by_vendor - nest: by_month - nest: top_sellers_by_revenue + {limit: 10} - nest: most_expensive_products + {limit: 10} - nest: top_10_counties is { - group_by: county - aggregate: total_sale_dollars - limit: 10 - } -} ->>>markdown -## Lookup Dashboards -Examine the market for a particular class of alcohol: ->>>malloy -// Try this with 'TEQUILAS', 'WHISKIES', 'RUM', 'GINS' - -# dashboard -run: iowa -> vendor_dashboard + { - where: category_class ~ 'VODKAS' -} ->>>markdown -## Vendor Dashboards -Examine the sales of a particular vendor. ->>>malloy -# dashboard -run: iowa -> vendor_dashboard + { - where: vendor_name ~ 'JIM BEAM%' -} \ No newline at end of file diff --git a/bigquery/iowa/iowa.malloy b/bigquery/iowa/iowa.malloy deleted file mode 100644 index db1ae4f..0000000 --- a/bigquery/iowa/iowa.malloy +++ /dev/null @@ -1,151 +0,0 @@ -source: iowa is bigquery.table('malloy-data.iowa_liquor_sales.sales_deduped') extend { - - rename: _vendor_name is vendor_name - // dimensions - dimension: - gross_margin is 100 * (state_bottle_retail - state_bottle_cost) / nullif(state_bottle_retail, 0) - price_per_100ml is state_bottle_retail / nullif(bottle_volume_ml, 0) * 100 - - category_class is category_name ? - pick 'WHISKIES' when ~ r'(WHISK|SCOTCH|BOURBON|RYE)' - pick 'VODKAS' when ~ r'VODKA' - pick 'RUMS' when ~ r'RUM' - pick 'TEQUILAS' when ~ r'TEQUILA' - pick 'LIQUEURS' when ~ r'(LIQUE|AMARETTO|TRIPLE SEC)' - pick 'BRANDIES' when ~ r'BRAND(I|Y)' - pick 'GINS' when ~ r'GIN' - pick 'SCHNAPPS' when ~ r'SCHNAP' - else 'OTHER' - - bottle_size is bottle_volume_ml ? - pick 'jumbo (over 1000ml)' when > 1001 - pick 'liter-ish' when >= 750 - else 'small or mini (under 750ml)' - - vendor_name is upper(_vendor_name) - // measures - measure: - # currency - total_sale_dollars is sale_dollars.sum() - item_count is count(item_number) - total_bottles is bottles_sold.sum() - line_item_count is count() - avg_price_per_100ml is price_per_100ml.avg() - percent_of_sales is total_sale_dollars / all(total_sale_dollars) * 100 - - // queries - # line_chart - view: by_month is { - order_by: 1 - group_by: purchase_month is `date`.week - aggregate: total_sale_dollars - } - - view: top_sellers_by_revenue is { - top: 5 - group_by: - vendor_name - item_description - aggregate: - total_sale_dollars - total_bottles - avg_price_per_100ml - percent_of_sales - } - - view: most_expensive_products is { - top: 10 - order_by: avg_price_per_100ml desc - group_by: - vendor_name - item_description - aggregate: - total_sale_dollars - total_bottles - avg_price_per_100ml - } - - # bar_chart - view: by_vendor is { - top: 10 - group_by: vendor_name - aggregate: - total_sale_dollars - total_bottles - } - - # bar_chart - view: by_class is { - top: 10 - group_by: category_class - aggregate: - total_sale_dollars - item_count - } - - # bar_chart - view: by_category is { - top: 10 - group_by: category_name - aggregate: - total_sale_dollars - item_count - } - - # bar_chart - view: by_sku is { - group_by: item_description - aggregate: total_sale_dollars - limit: 5 - } - - # dashboard - view: vendor_dashboard is { - aggregate: vendor_count is count(vendor_number) - aggregate: - total_sale_dollars - total_bottles - nest: - by_month - by_class - by_vendor - top_sellers_by_revenue - most_expensive_products - by_vendor_dashboard is { - top: 10 - group_by: vendor_name - aggregate: total_sale_dollars - nest: - by_month, - top_sellers_by_revenue, - most_expensive_products - } - } -} - -query: vodka_dashboard is iowa->vendor_dashboard + { - where: category_class ~ 'VODKAS' -} - -query: tequila_dashboard is iowa->vendor_dashboard + { - where: category_class ~ 'TEQUILAS' -} - -query: luxco_dashboard is iowa->vendor_dashboard + { - where: vendor_name ~ 'LUXCO%' -} - -query: jim_beam_dashboard is iowa->vendor_dashboard + { - where: vendor_name ~ 'JIM BEAM%' -} - -# dashboard -run: iowa -> { - nest: by_class - nest: by_vendor - nest: by_month - nest: by_county is { - group_by: county - aggregate: total_sale_dollars - } -} \ No newline at end of file diff --git a/composer.json b/composer.json index a590421..45aee78 100644 --- a/composer.json +++ b/composer.json @@ -36,10 +36,6 @@ "id": "bigquery_hackernews", "path": "./bigquery/hackernews/" }, - { - "id": "bigquery_iowa", - "path": "./bigquery/iowa/" - }, { "id": "bigquery_the_met", "path": "./bigquery/the_met/"