> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sourcemedium.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Schema standards

> How SourceMedium names tables and columns, so you can guess a field name before you look it up.

Every table and column in `sm_transformed_v2` follows the same naming formulas. Once you know the pattern, most names are predictable.

## Building blocks

* `entity`: the thing a table or column is about, such as an order, customer, or product.
* `metric`: a quantity, such as revenue, cost, or a count.
* `dimension`: a descriptive attribute used for grouping or filtering, such as a date, country, or product type.
* `modifier`: extra context that narrows a metric or dimension, such as `new_customer` or `primary`.
* `prefix` and `suffix`: short markers at the start or end of a name that flag the kind of data, such as `is_` or `_at`.

## Table names

The prefix tells you the table's shape. [How SourceMedium models your data](/docs/data-transformations/philosophy#table-shapes) explains each shape and when to use it.

| Prefix | Formula                      | Examples                                                  |
| ------ | ---------------------------- | --------------------------------------------------------- |
| `fct_` | `fct_{entity}_{verb}`        | `fct_orders_placed`, `fct_refunds_processed`              |
| `dim_` | `dim_{entity}`               | `dim_customers`, `dim_product_variants`                   |
| `obt_` | `obt_{entity}`               | `obt_orders`, `obt_order_lines`                           |
| `rpt_` | `rpt_{report}_{granularity}` | `rpt_executive_summary_daily`, `rpt_ad_performance_daily` |

## Metric columns

Formula: `{modifier}_{entity}_{metric}`. The entity and the metric always sit next to each other. Any modifier comes first.

* `order_gross_revenue`: `order` is the entity, `gross_revenue` is the metric.
* `order_net_revenue_before_refunds`: `order` is the entity, `net_revenue_before_refunds` is the metric.
* `new_customer_order_net_revenue`: `new_customer` modifies `order_net_revenue`.
* `repeat_customer_order_count`: `repeat_customer` modifies `order_count`.

## Numerical columns

Some numeric columns do not spell out how they are aggregated, because the metric name is already standard.

* `order_total_revenue`: total revenue for the order.
* `subscriber_lifetime_revenue`: revenue from a subscriber over their lifetime.
* `order_discounts`, `order_refunds`, `message_unique_clicks`, `message_unique_opens`, `message_unique_receives`, `list_unsubscribes`.

## Dimension columns

Formula: `{modifier}_{entity}_{dimension}`. As with metrics, the entity and dimension stay together and any modifier comes first.

* `order_index`: `order` is the entity, `index` is the dimension.
* `product_variant_title`: `product_variant` is the entity, `title` is the dimension.
* `primary_order_payment_gateway`: `primary` modifies `order_payment_gateway`.
* `latest_order_refund_date`: `latest` modifies `order_refund_date`.

## Boolean columns

Formula: `is_{entity}_{dimension}`. Read the name as a yes or no question.

* `is_price_tax_inclusive`: does the price include tax?
* `is_product_gift_card`: is the product a gift card?
* `is_order_sm_valid`: should the order count in reporting? See [Valid orders](/docs/help-center/core-concepts/data-definitions/is-order-sm-valid).

## Time columns

Formula: `{entity}_{dimension}_{suffix}`. The suffix tells you the type and timezone.

* `_at`: a timestamp in UTC. Example: `order_processed_at`.
* `_local_datetime`: the same moment as a datetime in your reporting timezone. Example: `order_processed_at_local_datetime`.
* `_datetime`: a datetime kept as the source reported it, without timezone conversion. Example: `event_datetime`.

Use the `_local_datetime` column for day-level reporting, so days line up with your dashboards.

## SourceMedium columns

The `sm_` prefix marks a column SourceMedium derived, rather than copied from a platform.

* `sm_utm_source_medium`: the last-click source and medium chosen from every attribution signal on the order. See [Attribution source hierarchy](/docs/data-transformations/attribution-source-hierarchy).
* `sm_channel` and `sm_sub_channel`: the order's sales channel. See [Sales channel](/docs/data-transformations/order-segmentation/sales-channel).
* `sm_order_type`: subscription or one-time. See [Order type](/docs/data-transformations/order-segmentation/order-type).
* `sm_order_key`, `sm_customer_key`, `sm_order_line_key`: stable join keys that work across source systems.
