Merged PR 3766: First version of ab_test_tracking_guest_journey
# Description A very simple, clean table to get the records needed for A/B test tracking on GJ side. The table already removes weird cases that are somehow usual within A/B test configurations, to ensure that the monitoring is as clean (and less biased) as possible. # Checklist - [X] The edited models and dependants run properly with production data. - [X] The edited models are sufficiently documented. - [X] The edited models contain PK tests, and I've ran and passed them. - [X] I have checked for DRY opportunities with other models and docs. - [X] I've picked the right materialization for the affected models. # Other - [ ] Check if a full-refresh is required after this PR is merged. Related work items: #25145
This commit is contained in:
parent
896526fe15
commit
37c508fa69
2 changed files with 108 additions and 0 deletions
|
|
@ -0,0 +1,46 @@
|
|||
{{
|
||||
config(
|
||||
materialized="table", unique_key=["id_verification_request", "ab_test_name"]
|
||||
)
|
||||
}}
|
||||
with
|
||||
stg_core__verification_request_feature_flag as (
|
||||
select * from {{ ref("stg_core__verification_request_feature_flag") }}
|
||||
),
|
||||
clean_ab_test_data as (
|
||||
select
|
||||
id_verification_request,
|
||||
feature_flag_name as ab_test_name,
|
||||
feature_flag_variation as variation,
|
||||
min(created_at_utc) as first_appearance_at_utc,
|
||||
max(created_at_utc) as last_appearance_at_utc
|
||||
from stg_core__verification_request_feature_flag
|
||||
where
|
||||
feature_flag_variation is not null
|
||||
and feature_flag_variation <> ''
|
||||
and is_feature_flag_enabled = true
|
||||
group by 1, 2, 3
|
||||
),
|
||||
variations_per_request_and_test as (
|
||||
select
|
||||
id_verification_request,
|
||||
ab_test_name,
|
||||
count(distinct variation) as number_of_different_variations
|
||||
from clean_ab_test_data
|
||||
group by 1, 2
|
||||
)
|
||||
select
|
||||
c.id_verification_request,
|
||||
c.ab_test_name,
|
||||
c.variation,
|
||||
c.first_appearance_at_utc,
|
||||
c.last_appearance_at_utc
|
||||
from clean_ab_test_data c
|
||||
inner join
|
||||
variations_per_request_and_test v
|
||||
on c.id_verification_request = v.id_verification_request
|
||||
and c.ab_test_name = v.ab_test_name
|
||||
-- The following is to ensure that if for whatever reason a given verification request
|
||||
-- has more than one variation in the same A/B test, this data is removed from the
|
||||
-- A/B test tracking
|
||||
where v.number_of_different_variations = 1
|
||||
|
|
@ -4271,3 +4271,65 @@ models:
|
|||
Date of when this Protection Plan Billing Item record was last updated.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: int_core__ab_test_tracking_guest_journey
|
||||
description: |
|
||||
Provides the A/B test tracking of a given Verification Request, aka Guest Journey.
|
||||
For those Guest Journeys that are subject to A/B testing through Feature Flagging,
|
||||
this table will provide the id of the verification request, the A/B test name in
|
||||
which is in and the variation, as well as additional metadata.
|
||||
|
||||
This table already contains cleaning of multi-variant guest journeys and disablement
|
||||
of the feature flag (A/B test) itself, so should be quite ready to use.
|
||||
|
||||
tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- id_verification_request
|
||||
- ab_test_name
|
||||
|
||||
columns:
|
||||
- name: id_verification_request
|
||||
data_type: integer
|
||||
description: |
|
||||
Identifier of the Verification Request. Acts as foreign key to the Verification Request table.
|
||||
It can be duplicated across different Feature Flags - meaning the same verification request
|
||||
can be part of none, one, or several A/B tests.
|
||||
In this table, a Verification Request or Guest Journey can only appear once per A/B test.
|
||||
Cannot be null.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: ab_test_name
|
||||
data_type: string
|
||||
description: |
|
||||
Name of the Guest Journey A/B test. It corresponds to the Feature Flag Name in the
|
||||
backend. Cannot be null.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: variation
|
||||
data_type: string
|
||||
description: |
|
||||
Identifier of the variation a given Verification Request is in, within a
|
||||
given Guest Journey A/B test. Cannot be null.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: first_appearance_at_utc
|
||||
data_type: timestamp
|
||||
description: |
|
||||
Timestamp of the first Verification Request Feature Flag record created
|
||||
with the same verification request and A/B test name. Mostly for information
|
||||
purposes. Cannot be null.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: last_appearance_at_utc
|
||||
data_type: timestamp
|
||||
description: |
|
||||
Timestamp of the last Verification Request Feature Flag record created
|
||||
with the same verification request and A/B test name. Mostly for information
|
||||
purposes. Cannot be null.
|
||||
tests:
|
||||
- not_null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue