Describing and documenting business logic code for non-technical users #1478
Replies: 2 comments 5 replies
-
In an ideal world, the model and column docs should be written as if you were speaking to a "non-SQL-knowing" business stakeholder. I try to tell my team to write dbt models (with a lot of commentary within the dbt model code) as if you were trying to explain this to someone who's brand new to the Data team. Then write the model and column documentation as if you were speaking to your embedded team stakeholders. I think this really applies to marts models that touch your visualization layer. Another noodle -- I think that we haven't leveraged loom videos for documentation enough. Like model walkthroughs for the analytics engineers or thorough explanations of business concept (re: ARR modeling --> change categories) within dbt Docs (model description and column descriptions) NOTE: |
Beta Was this translation helpful? Give feedback.
-
I think anything is possible here if you're committed to explaining things in enough detail. Here's an example of a model description which explains some logical decisions made in the process (the columns for this model are similarly detailed): models:
- name: agg_daily_subscription_movements
description: |
An aggregation model for understanding subscription movements over time, including breakdowns for subscriptions
that are in a trial vs those that aren't. The model is designed so that all columns (except active subscriptions) can
be summed to give monthly/yearly numbers.
Trials in the subscription model are the first portion of select subscriptions. In this model, that first part of the
subscription is recognized as a separate, `is_in_trial` subscription. If there is a cancellation before the end of the trial,
it appears as an `is_in_trial` cancellation. If the trial converts to a full subscription (ie is not cancelled before the end
of the trial), it shows as both a `is_in_trial` cancellation and a `not is_in_trial` subscription.
Any subscription that is fully refunded is excluded from these counts, as are refunded renewals. Corporate
subscriptions are also excluded.
Active subscriptions can be summed for any single day (ie summing both
values for `is_in_trial`) but summed over multiple days will substantially overreport numbers. Alternate options
are to take the values for the last day of the period, or otherwise a manual rolling sum of net_subscriptions will
yield the same value.
Churn (using [client_name]'s internal formula) can be calculated for any window as
`cancellations / (cancellations + renewals)`. |
Beta Was this translation helpful? Give feedback.
-
Background
I recently saw something that sparked a memory for me: I had remembered when I sent some dbt Docs to a business user who wanted to understand how a certain explore in Looker was modeled out. The key chunk of the business logic for this particular model was in a
case when
statement and this business user (with little technical background) could not understand it, even with column and model descriptions. As data folks, we can often readcase when
statements or other SQL for business logic relatively easily, but how do we make this easier for non-technical stakeholders?The question
How do you write documentation for business logic in dbt models that truly explains what's happening in the key areas of the model in a way that end business users can understand? Another way of stating it: When an end business user is sent some dbt Docs on a model to see how certain business logic is implemented, is there a way to write documentation that supports the best readability to non-technical users?
Where I'm at...
I'd love to learn about the best practices around documenting business logic in dbt models. Do you use dbt Docs description? Do you write in-line comments in SQL? A combination of the two? A separate markdown file that provides in-depth business logic context? Eager to hear it all!
Beta Was this translation helpful? Give feedback.
All reactions