1. How to use this material
This material accompanies a two-hour online workshop for the Data & Analytics class of the BEES Functional Trainings, a class that brings together data engineers, analysts, data scientists and machine learning engineers. The workshop is the first of four in the track and prepares the ground for the other three, which build features, validate models and analyse experiments on top of the canonical layer designed here.
Sections 2 to 10 contain the pre-work and the concepts of the briefing. Sections 11 to 14 describe the lab, the files and the templates, and are the reference the groups keep open during the session. Sections 15 and 16 close the cycle with the rubric used in the debrief and the post-work that applies the session to the participant's own context.
The lab uses Tradeline, a fictional B2B ordering marketplace that connects manufacturers, distributors and retailers in Brazil, Mexico, Colombia, South Africa and the Dominican Republic. Tradeline does not exist, and every file of the lab was generated by a script for teaching purposes. The case was built to reproduce situations that are common in multi-market products, and it does not describe the systems or the numbers of any company.
Intermediate SQL and a validated access to the lab query environment, in Databricks or an equivalent tool. The data engineering lifecycle is assumed and is not reviewed in the session. If access is not available on the day, the lab can be done in DuckDB on a laptop, as described in Section 13.
2. Pre-work
The pre-work takes about fifteen minutes and is done in the week before the session. Its purpose is to bring to the workshop one concrete case from the participant's own work, which is used in the opening poll and in the debrief.
- Note an example of a metric whose definition changes across teams, customers or markets in your work, and write in one sentence what changes: the event that counts, the clock, the currency or the population.
- Note one friction point in the current orchestration of your pipelines, such as a dependency on another domain that breaks without notice, a backfill that nobody dares to run or a deadline that is often missed.
- Validate your access to the query environment, open a notebook and run a simple query. If access fails, install DuckDB on your laptop as the no-login alternative.
- Read Sections 3 and 5 of this material.
The examples should not contain confidential names or numbers. A description of the kind of difference is enough for the discussion.
3. Comparable telemetry in a configurable product
A global B2B product grows by accommodating differences between customers and markets. Each market has its own currency, its own time zone, its own regulation and, frequently, its own history of instrumentation, because the events of the checkout flow were defined by the team that launched the product there. The product team then asks a simple question, such as which market converts more orders or whether a new capability increased the completed orders in every market where it was enabled, and discovers that the answer depends on which table is read.
The difficulty has a structural cause. Comparing markets requires that the same quantity is measured in the same way, while the operation of each market requires that local differences are respected. A regulation that only allows an order to be delivered with a fiscal document, for example, is a real constraint of one market, and the local team has good reasons to track it. When the comparison is made by forcing every market into one definition and discarding the local rule, the local team loses information it needs. When each market keeps its own definition, the global comparison is meaningless.
The workshop treats this tension as a design problem with a known structure. The comparable part is expressed as a canonical metric with a declared grain, calculated once in the gold layer. The local part is preserved as documented attributes and extensions of a data contract. The calculation is placed in the orchestration graph at a single point, with an owner, so that no other domain recalculates it with a different logic. Each of these three elements is discussed in the following sections.
The guiding question of the session states the same problem from the standpoint of the data platform: how to build a data, transformation and orchestration foundation that allows customers, tenants and markets to be compared at high scale, without erasing relevant differences and without creating customer-specific pipelines.
4. Transformation and orchestration at scale
In an ELT architecture the raw data is loaded into the platform first and transformed there, which places the calculation of business metrics in the transformation layer rather than in the source systems. Reis and Housley (2022) describe transformation and orchestration as parts of the same lifecycle that runs from generation to serving. At small scale the question is how to write each transformation. At the scale of hundreds or thousands of DAGs maintained by several domains, the more consequential questions are where each metric is calculated, which tables it depends on, how it is recomputed when data arrives late and who answers when two numbers disagree.
Five properties summarise what a high-scale orchestration needs. A task is idempotent when running it twice for the same partition produces the same result, which in practice means overwriting a partition instead of appending to it; without idempotency, a retry after a failure doubles the orders of a day. Reprocessing and backfill require a declared window for late events and a mechanism that recomputes past partitions without touching the others; without them, an order delivered three days after the end of the month never reaches the month in which it was delivered. Cross-domain dependencies need to be explicit and to come with an agreed freshness, otherwise a finance table may silently read a commerce table whose logic has changed. Delivery deadlines tie the critical path of the graph to the time at which a consumer, such as an executive board, needs the data. Ownership and observability, finally, make it possible to know which team answers for each output and to see its freshness, volume and failure history.
These properties do not depend on the orchestration tool. They are design decisions about the graph, and the lab asks the groups to make them for one metric in a graph of 350 DAGs.
5. The medallion architecture and the gold layer
The medallion architecture organises a lakehouse in three layers of increasing refinement. The bronze layer stores the data as it was received, with the source and the load time, so that any later decision can be traced back and reprocessed. The silver layer applies types, removes duplicates, conforms keys and maps local vocabularies to a common one. The gold layer models the data for consumption, in tables designed around business processes and metrics (Databricks, 2025).
The first decision in the gold layer is the grain, that is, the statement of what one row of a fact table represents. Kimball and Ross (2013) place the declaration of the grain before the choice of dimensions and measures, because the dimensions that can be attached to a row and the measures that can be added across rows depend on it. A table of completed orders whose grain is one row per order supports a count of orders and a sum of amounts by any dimension that is true at the order level. A table that mixes rows per order with rows per event produces double counting as soon as someone sums it.
A second decision concerns the number of places where a metric is calculated. When several domains need the same metric, the gold layer should calculate it once and let every domain read it. Recalculating it in each domain reproduces, inside the platform, the divergence between definitions that the gold layer was supposed to remove, with the aggravating factor that the divergent tables now carry names that suggest they are the same.
6. Conformed dimensions and federated governance
A conformed dimension is a dimension that has the same keys, attributes and meaning in every fact table that uses it (Kimball & Ross, 2013). It is the mechanism that allows a measure from Brazil and a measure from South Africa to be placed side by side. In a multi-market product, the dimensions that need to be conformed are typically the market, the tenant, the retailer with its service model, segment and tier, and the date. The date dimension deserves attention because monthly reports are closed in the local calendar of each market while systems record timestamps in different clocks; the conformed date therefore carries both the UTC timestamp and the local business date.
Data mesh, as described by Dehghani (2022), distributes the ownership of analytical data to the business domains and rests on four principles: domain ownership, data as a product, a self-serve data platform and federated computational governance. The principles do not prevent a centralised gold layer for cross-domain metrics. Federated governance is precisely the mechanism by which the domains agree on global standards, such as the canonical list of lifecycle events, the conformed keys and the lineage requirements, while keeping autonomy over the decisions that affect only their own consumers. The balance proposed in the session is that domains own their silver data products, and that cross-domain metrics live in a gold layer with a single owner.
7. Data contracts and schema evolution
A data contract is an agreement between the producer of a dataset and its consumers about the schema, the meaning, the quality and the rules under which the dataset may change. Jones (2023) presents contracts as a way to move the responsibility for data quality towards the producer and to replace silent upstream changes with negotiated ones.
In a multi-market product the contract has a natural structure in two parts. The common core contains the attributes that every market emits with the same name, type and meaning, such as the event, the order, the timestamp in UTC, the market, the tenant, the amount and the currency. The extensions contain optional attributes of one market, documented with the reason they exist and the decisions that depend on them. A fiscal document identifier required by local regulation is a typical extension: it is irrelevant for the global comparison and indispensable for the local operation.
The evolution rules complete the contract. Adding an optional attribute or a new allowed value that consumers can ignore is a compatible change. Renaming or removing a core attribute, changing its type or changing the meaning of an event on which a metric depends is a breaking change, which requires notice, a new major version and a period in which both versions coexist. The template in Section 14 follows this structure.
8. AI-assisted mapping under human review
Mapping a local schema to a canonical model is repetitive work that coding assistants and the assistants embedded in data platforms do quickly. Given the canonical model, the local header and a sample of rows, an assistant proposes which local event corresponds to which canonical event, writes the transformation and suggests tests of uniqueness, completeness and order of events. The practice is still at an early stage in many data teams, and the session treats it as a practice to try with explicit verification.
The proposal of an assistant is a hypothesis about the data. Three errors are frequent in generated mappings: an event with a plausible name is mapped to the wrong state of the lifecycle, a decimal or separator convention of the source is ignored, and a timestamp without an explicit offset is assumed to be in UTC. All three produce code that runs without error and numbers that look reasonable. The verification that exposes them is a reconciliation of counts and amounts by market and month against an independent source, followed by a written explanation of every difference. Huyen (2025) treats the evaluation of model outputs as a core part of engineering applications with foundation models, and the same reasoning applies here: the mapping is accepted when it has been evaluated, and the person who accepts it records the assumptions and keeps the tests in the pipeline.
Use only the tools approved by BEES and only the synthetic files of the lab. In real work, the sample given to an assistant should not contain personal data or confidential commercial values.
9. Multi-tenant product telemetry
In a configurable product, an event without the context in which it happened cannot be compared with another event. A completed order in a tenant with a premium tier and a new checkout flow enabled is not comparable with a completed order in a tenant without them unless both events say so. Golding (2024) describes tenant context as a cross-cutting concern of multi-tenant SaaS architectures, and the same applies to telemetry: each event needs the attributes that identify the tenant, the market, the service model and tier, the application and configuration versions, the state of the relevant features and, when applicable, the experiment and variant to which the user was exposed.
Exposure logging deserves a specific mention because it is the basis of the experimentation covered in Workshops 3 and 4 of the track. An experiment can only be analysed when the platform records, for each unit, the moment it was exposed to a variant; inferring exposure afterwards from other events introduces bias.
The OpenTelemetry semantic conventions define common names for the attributes of traces, metrics and logs across services (OpenTelemetry, 2024). Agreeing on names before the data exists costs less than mapping them afterwards, which is what the lab asks the groups to do for five markets. Product analytics events, such as those exported by Mixpanel, are joined to the analytical base through a stable key, and personal data is minimised or pseudonymised before reaching the shared layers.
10. Worked example
The facilitator demonstrates the reasoning of the lab on two illustrative markets whose numbers are deliberately small and different from those of the lab. Market A reports 1,000 completed orders in March and Market B reports 800. Read side by side, the numbers suggest that Market A converts 25% more orders. The comparison is false because the two teams count different things.
| Market A | Market B | |
|---|---|---|
| Local event that counts | payment_captured | order_delivered |
| Timestamp used for the month | Server time in UTC | Local time of the market |
| Amount reported | Net of discount | Gross, with the discount in another column |
| Completed orders reported in March | 1,000 | 800 |
| Canonical completed orders in March | 830 | 800 |
The canonical definition chooses one lifecycle state and one time reference for every market: an order is completed when its delivery is confirmed and it has not been cancelled, and it is attributed to the local business date of the delivery. Applied to Market A, the definition removes 170 orders that were paid and later cancelled before delivery. Applied to Market B, it keeps the count and changes the amount, because the canonical amount is net of discount. The local rule of Market A remains available as an attribute, so the local team can still reproduce its own report from the gold layer.
SELECT o.order_id,
o.market,
o.tenant_id,
d.local_business_date AS completed_date,
o.net_amount_local,
o.net_amount_local * fx.usd_per_unit AS net_amount_usd,
o.local_completion_rule -- extension kept for the local report
FROM silver.order_lifecycle o
JOIN silver.dim_date_local d
ON d.market = o.market AND d.utc_ts = o.delivered_at_utc
JOIN silver.fx_daily fx
ON fx.currency = o.currency AND fx.rate_date = d.local_business_date
WHERE o.delivered_at_utc IS NOT NULL
AND o.cancelled_at_utc IS NULL;
The last step places the metric in the orchestration graph. One DAG owns the fact table, and the tables in other domains that recalculated completed orders with their own logic are rewired to read it and then retired. The example ends with the metric connected to a business indicator, revenue per completed order, which is what allows a difference between markets to be read as impact.
11. The Telemetry Harmonization Lab
Tradeline operates in five markets, and each market instruments the checkout and fulfilment flow differently. The event names and the column names change from file to file, each market reports amounts in its own currency, timestamps come in different formats and clocks, some attributes are missing in some markets, and in one market a local regulatory rule changes the moment at which the local team considers an order completed. The local teams report completed orders and GMV for September and October 2026, each with its own definition, and the regional leadership wants to compare the markets.
Groups of five or six participants work for forty minutes in breakout rooms. One participant leads the discussion, another records the deliverable in the template, a third keeps time and a fourth acts as the skeptic, whose role is to challenge every mapping that has not reconciled. Data engineers lead the silver model and the contract, analysts define the canonical metrics, and data scientists and machine learning engineers check whether the model meets the feature needs by market. Data engineers with orchestration experience lead the reorganisation of the DAG graph.
| Step | Task | Time |
|---|---|---|
| 1. Metric and grain | Define the canonical completed order, the time reference that attributes it to a month and the grain of the gold fact table. | 8 min |
| 2. Dimensions and contract | Design the conformed dimensions and draft the data contract with a common core and extensible attributes. | 8 min |
| 3. AI-assisted mapping | Use the Databricks assistant or another tool approved by BEES to map at least three local schemas to the model and to generate the transformations for the gold layer. Validate the mapping by reconciling aggregates with local_reported_kpis.csv and write the cause of each difference. | 12 min |
| 4. Orchestration | In orchestration_graph.csv, find the gold-layer metrics that are calculated twice and propose a reorganisation: where the canonical metric is calculated, which DAGs it depends on, how it is reprocessed and who owns it. | 8 min |
| 5. Business link | State how the canonical metric connects to revenue per completed order, so that the comparison across markets can be read in terms of impact. | 4 min |
The local regulatory difference is preserved as a documented attribute rather than eliminated by standardisation, and the canonical metric has a single point of calculation in the gold layer.
When choosing the three schemas for step 3, include markets with different time formats and different currencies, since those are the differences a generated mapping most often gets wrong. A difference that the group cannot explain in the time available is recorded as open in the reconciliation table.
12. Data dictionary
The files below are described as each local team documents its export. The descriptions state formats and meanings declared by the producers; whether the data matches the declaration is part of what the lab checks.
checkout_events_br.csv · Brazil
| Column | Description |
|---|---|
id_evento | Event identifier |
id_pedido | Order identifier in the Brazilian system |
id_cliente | Local retailer key, mapped to the global key in dim_retailer.csv |
modelo_atendimento | Service model of the retailer |
nome_evento | Lifecycle event in Portuguese, including the issue and cancellation of the fiscal invoice (nfe_emitida, nfe_cancelada) |
data_hora_local | Local date and time, format dd/mm/yyyy HH:MM:SS |
valor_liquido_brl | Order amount net of discount, in BRL, with comma as decimal mark |
chave_nfe | Fiscal invoice key, filled only in the invoice issue event |
The file uses a semicolon as separator.
checkout_events_mx.csv · Mexico
| Column | Description |
|---|---|
event_id, order_id | Event and order identifiers |
retailer_ref | Local retailer key |
tenant_id, service_model | Tenant and service model of the retailer |
event_type | Lifecycle event in English |
event_ts | ISO 8601 timestamp with offset |
amount_mxn, currency | Order amount net of discount, in MXN |
checkout_events_co.csv · Colombia
| Column | Description |
|---|---|
event | Product analytics event name, exported from the analytics tool |
time | Unix time in seconds |
distinct_id | Local retailer key used by the analytics tool |
$insert_id | Identifier of the event in the analytics tool |
properties.order_id | Order identifier |
properties.total, properties.currency | Order amount net of discount, in COP without decimals |
properties.app_version | Version of the application that sent the event |
checkout_events_za.csv · South Africa
| Column | Description |
|---|---|
evt_id, ord_ref | Event and order identifiers |
evt | Lifecycle event in upper case |
occurred_at_utc | Timestamp in UTC, ISO 8601 with Z |
value_zar_cents | Order amount net of discount, in ZAR cents |
tenant, svc_model, customer_code | Tenant, service model and local retailer key |
checkout_events_do.csv · Dominican Republic
| Column | Description |
|---|---|
pedido, cliente | Order identifier and local retailer key, both with leading zeros |
modelo_servicio | Service model of the retailer |
estado, fecha_estado | Status in Spanish and local date and time of the status change, format yyyy-mm-dd HH:MM |
total_bruto_dop, descuento_dop | Gross order amount and discount, in DOP |
Shared files
| File | Columns | Description |
|---|---|---|
dim_retailer.csv | retailer_id, market, market_retailer_key, tenant_id, service_model, segment, tier | Global retailer dimension with the local key used by each market |
fx_rates.csv | rate_date, currency, usd_per_unit, source | Daily reference rate, in US dollars per unit of local currency |
local_reported_kpis.csv | market, month, kpi, value, unit, reported_by, local_definition | Completed orders and GMV reported by each local team for September and October 2026, with the definition each team declares |
orchestration_graph.csv | dag_id, domain, owner_team, layer, output_table, upstream_dags, schedule_utc, avg_runtime_min, failures_last_30d, sla_deadline_utc, notes | 350 DAGs of eight domains; upstream_dags is a list separated by semicolons |
13. Loading the data
Databricks
Upload the CSV files to a Unity Catalog volume, import databricks_starter_bronze.py as a notebook, set the catalog, the schema and the volume path in the widgets and run it. The notebook lands each file as text in a bronze table, with the source file and the load time, renames the column names that are not valid in Delta tables and shows the distinct event names per market. Typing, deduplication and harmonisation are left for the lab, in silver.
No-login alternative with DuckDB
Install DuckDB, unzip the lab files into a folder and run the starter script from that folder. The script creates the same bronze tables in a local database file.
unzip tradeline-telemetry-lab-data.zip
cd tradeline-telemetry-lab
duckdb tradeline.duckdb < starter_duckdb.sql
duckdb tradeline.duckdb # then query bronze.checkout_events_br and the others
Both starters read every column as text on purpose. Choosing the type of each column is a decision of the silver layer, and the Brazilian file shows why: read with default options, its amounts are parsed incorrectly.
14. Templates
The Canonical Metric Spec is the artifact of the session. It records, for one metric, the business question and the indicator it feeds, the definition with the moment of attribution and the monetary basis, the grain, the conformed dimensions, the local extensions that are preserved, the expected quality checks, the single point of calculation with its upstream DAGs, reprocessing rule and deadline, and the reconciliation record with the cause of every difference. The data contract template follows the structure of Section 7, with a common core, extensions per market, semantics, quality checks, evolution rules and service levels.
Canonical Metric Spec
Markdown template with eight sections, to be filled in the collaborative board or in a shared document.
Data contract
YAML template with the core and extension structure used in the lab.
15. Formative rubric
The rubric guides the feedback in the debrief and does not produce a grade.
| Criterion | Proficient | Developing |
|---|---|---|
| Canonical model | Comparable definitions with relevant differences preserved | Standardisation that erases context |
| Contract and orchestration | Contract with evolution rules, and a metric with a single point of calculation and explicit dependencies | Schema without versioning, or metric duplicated across pipelines |
| Use of AI | Mapping validated by reconciliation | Mapping accepted without verification |
A frequent misconception is to create one pipeline per market to absorb each variation of instrumentation. The approach multiplies code, tests and failure points, and it still does not produce a comparable number, because each pipeline encodes its own definition. A canonical layer allows the markets to be compared and keeps the differences that affect decisions as data, in a single pipeline.
16. Post-work
The post-work takes about twenty minutes and transfers the lab to the participant's own context. Choose a real metric whose definition changes across teams, customers or markets, possibly the one noted in the pre-work, and write its Canonical Metric Spec with the definition, grain, required dimensions, local extensions, expected quality, point of calculation in the gold layer, orchestration dependencies and owner. Confidential names and numbers should be left out.
Workshop 2 of the track, on feature engineering and data preprocessing, starts from the canonical layer and the conformed dimensions of this session to discuss missing values and outliers across markets, normalisation, leakage, distribution shift and feature engineering with generative AI.
17. Downloads
All files are synthetic and describe the fictional company Tradeline. The zip contains every file of the table below.
| File | Content |
|---|---|
| tradeline-telemetry-lab-data.zip | All lab files, starters and templates |
| checkout_events_br.csv | Brazil, 15,349 events |
| checkout_events_mx.csv | Mexico, 11,119 events |
| checkout_events_co.csv | Colombia, 9,973 events |
| checkout_events_za.csv | South Africa, 9,521 events |
| checkout_events_do.csv | Dominican Republic, 8,079 status changes |
| dim_retailer.csv | 2,199 retailers |
| fx_rates.csv | Daily rates of five currencies |
| local_reported_kpis.csv | Local reports for September and October 2026 |
| orchestration_graph.csv | 350 DAGs of eight domains |
| databricks_starter_bronze.py | Databricks notebook for bronze ingestion |
| starter_duckdb.sql | DuckDB script for the no-login alternative |
18. References
- Databricks. (2025). What is the medallion lakehouse architecture? Databricks documentation. https://docs.databricks.com/aws/en/lakehouse/medallion
- Dehghani, Z. (2022). Data mesh: Delivering data-driven value at scale. O'Reilly Media.
- Golding, T. (2024). Building multi-tenant SaaS architectures. O'Reilly Media.
- Huyen, C. (2025). AI engineering: Building applications with foundation models. O'Reilly Media.
- Jones, A. (2023). Driving data quality with data contracts. Packt Publishing.
- Kimball, R., & Ross, M. (2013). The data warehouse toolkit: The definitive guide to dimensional modeling (3rd ed.). Wiley.
- OpenTelemetry. (2024). OpenTelemetry semantic conventions. https://opentelemetry.io/docs/specs/semconv/
- Reis, J., & Housley, M. (2022). Fundamentals of data engineering. O'Reilly Media.