Skip to content

Add region dimension to Orders model for geographic revenue analysis - #128

Open
lightdash[bot] wants to merge 1 commit into
mainfrom
lightdash-ai-writeback/9d576bd7-3dbf-42d0-8048-71a6ec894767
Open

lightdash[bot] wants to merge 1 commit into
mainfrom
lightdash-ai-writeback/9d576bd7-3dbf-42d0-8048-71a6ec894767

Conversation

@lightdash

@lightdash lightdash Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a region additional dimension to dbt_orders derived from the existing shipping_country column via a CASE expression in the semantic layer YAML
  • Maps countries to EMEA, APAC, Americas, or Other using standard geographic groupings
  • Adds ai_hint to both region and shipping_country to route agents: Region for broad groupings (EMEA/APAC/Americas), Shipping Country for country-level analysis
  • No changes to dbt model SQL or any other fields

Review finding addressed

The Orders explore could not answer "revenue by region" because it exposed shipping_country but no region dimension. This change adds the missing semantic-layer grouping without touching model logic.

Test plan

  • Verify region dimension appears in the Orders explore in Lightdash
  • Confirm "Revenue by Region" chart groups correctly into EMEA / APAC / Americas / Other
  • Confirm shipping_country still works for country-level breakdowns
  • Check that the ai_hint text routes AI queries to the right dimension

🤖 Generated with Claude Code

## Summary

- Adds a `region` additional dimension to `dbt_orders` derived from the existing `shipping_country` column via a CASE expression in the semantic layer YAML
- Maps countries to EMEA, APAC, Americas, or Other using standard geographic groupings
- Adds `ai_hint` to both `region` and `shipping_country` to route agents: Region for broad groupings (EMEA/APAC/Americas), Shipping Country for country-level analysis
- No changes to dbt model SQL or any other fields

## Review finding addressed

The Orders explore could not answer "revenue by region" because it exposed `shipping_country` but no region dimension. This change adds the missing semantic-layer grouping without touching model logic.

## Test plan

- [ ] Verify `region` dimension appears in the Orders explore in Lightdash
- [ ] Confirm "Revenue by Region" chart groups correctly into EMEA / APAC / Americas / Other
- [ ] Confirm `shipping_country` still works for country-level breakdowns
- [ ] Check that the `ai_hint` text routes AI queries to the right dimension

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: lightdash[bot] <183517231+lightdash[bot]@users.noreply.github.com>
Co-authored-by: Rohan Bedi <rohan@lightdash.com>
@github-actions

Copy link
Copy Markdown

Lightdash Validation Results

Validating default project 8a223608-a1e4-426e-adcd-0598ea72b9f8

/opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/google/api_core/_python_version_support.py:254: FutureWarning: You are using a Python version (3.10.20) which Google will stop supporting in new releases of google.api_core once it reaches its end of life (2026-10-04). Please upgrade to the latest Python version, or at least Python 3.11, to continue receiving updates for google.api_core past that date.
  warnings.warn(message, FutureWarning)
/opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/google/api_core/_python_version_support.py:254: FutureWarning: You are using a Python version (3.10.20) which Google will stop supporting in new releases of google.cloud.dataproc_v1 once it reaches its end of life (2026-10-04). Please upgrade to the latest Python version, or at least Python 3.11, to continue receiving updates for google.cloud.dataproc_v1 past that date.
  warnings.warn(message, FutureWarning)

- SUCCESS> dbt_users 
- SUCCESS> dbt_support_requests 
- SUCCESS> dbt_baskets 
- SUCCESS> dbt_orders 
- SUCCESS> dbt_orders_no_preagg 

Compiled 5 explores, SUCCESS=5 ERRORS=0
-   Waiting for validation to finish
✔   Validation finished without errors in 18s (5 chart configuration warnings hidden, use --show-chart-configuration-warnings to show)
Done 🕶

This validation check is informational and does not block merging.

@github-actions

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants