Merged PR 5242: Adds new model in intermediate for new dash deal onboarding

# Description

Adds new model in intermediate for new dash deal onboarding.
Adds additional fields in new dash tables for services completion at program level.

# 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.
- [ ] I have checked for DRY opportunities with other models and docs.
- [ ] 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: #30249
This commit is contained in:
Oriol Roqué Paniagua 2025-05-16 17:09:30 +00:00
parent 43a20a3c22
commit 5455bd2c01
6 changed files with 606 additions and 3 deletions

View file

@ -30,6 +30,10 @@ select
else greatest(date(atpb.ends_at_utc), upb.effective_end_date_utc)
end as effective_end_date_utc,
atpb.has_no_end_date,
upb.product_bundle_services,
upb.is_custom_bundle,
upb.has_upgraded_services,
upb.has_billable_services,
atpb.created_at_utc,
atpb.created_date_utc,
atpb.updated_at_utc,

View file

@ -4,8 +4,27 @@ with
select * from {{ ref("stg_core__user_product_bundle") }}
),
stg_core__protection_plan as (select * from {{ ref("stg_core__protection_plan") }}),
int_core__user_host as (select * from {{ ref("int_core__user_host") }})
int_core__user_host as (select * from {{ ref("int_core__user_host") }}),
int_core__user_product_bundle_contains_services as (
select * from {{ ref("int_core__user_product_bundle_contains_services") }}
),
product_bundle_services_agg as (
select
id_user_product_bundle,
case
when sum(cast(not is_default_service as integer)) > 0
then true
else false
end as has_upgraded_services,
case
when sum(cast(is_billable_service as integer)) > 0 then true else false
end as has_billable_services,
string_agg(
distinct service_name, '|' order by service_name asc
) as product_bundle_services
from int_core__user_product_bundle_contains_services
group by 1
)
select
upb.id_user_product_bundle,
upb.id_user as id_user_host,
@ -17,6 +36,7 @@ select
pp.protection_display_name,
upb.display_on_front_end,
upb.chosen_product_services,
pbsa.product_bundle_services,
upb.starts_at_utc as original_starts_at_utc,
upb.ends_at_utc as original_ends_at_utc,
/*
@ -39,6 +59,11 @@ select
upb.created_date_utc,
upb.updated_at_utc,
upb.updated_date_utc,
case
when upb.id_product_bundle is null then true else false
end as is_custom_bundle,
pbsa.has_upgraded_services,
pbsa.has_billable_services,
upb.dwh_extracted_at
from stg_core__user_product_bundle upb
/*
@ -55,3 +80,6 @@ inner join
and uh.is_missing_id_deal = false
and uh.is_test_account = false
left join stg_core__protection_plan pp on upb.id_protection_plan = pp.id_protection_plan
left join
product_bundle_services_agg pbsa
on upb.id_user_product_bundle = pbsa.id_user_product_bundle

View file

@ -27,6 +27,7 @@ select
pb.product_bundle_name,
ps.service_business_type,
ps.is_default_service,
ps.is_billable_service,
ps.product_service_display_name as service_name
from stg_core__user_product_bundle pb
inner join int_core__user_host uh on pb.id_user = uh.id_user_host
@ -44,6 +45,7 @@ select
pb.product_bundle_name,
'PROTECTION' as service_business_type,
pp.is_default_service,
pp.is_billable_service,
pp.protection_display_name as service_name
from stg_core__user_product_bundle pb
inner join int_core__user_host uh on pb.id_user = uh.id_user_host

View file

@ -1927,6 +1927,11 @@ models:
a chosen_product_services = 257 means it has the services 1 + 256, which are the
Basic Screening and the Waiver Pro.
- name: product_bundle_services
data_type: string
description: |
List of services that are included in this bundle, separated by "|", ordered alphabetically.
- name: original_starts_at_utc
data_type: timestamp
description: |
@ -1987,6 +1992,23 @@ models:
description: |
Date of when this User has Product Bundle was last updated in the Backend.
- name: is_custom_bundle
data_type: boolean
description: |
True if the bundle or program is custom, false if it's a default one.
- name: has_billable_services
data_type: boolean
description: |
True if the bundle or program contains at least one billable service, false
otherwise.
- name: has_upgraded_services
data_type: boolean
description: |
True if the bundle or program contains at least one service different than
the default one, false otherwise.
- name: dwh_extracted_at
data_type: timestamp
description: |
@ -2141,7 +2163,7 @@ models:
data_tests:
- not_null
- name: product_bundle_name
- name: user_product_bundle_name
data_type: string
description: |
The name of the Product Bundle.
@ -2208,6 +2230,29 @@ models:
description: |
Date of when this Accommodation to Product Bundle record was last updated in the Backend.
- name: product_bundle_services
data_type: string
description: |
List of services that are included in the bundle applied to the listing,
separated by "|", ordered alphabetically.
- name: is_custom_bundle
data_type: boolean
description: |
True if the bundle or program applied to the listing is custom, false if it's a default one.
- name: has_billable_services
data_type: boolean
description: |
True if the bundle or program applied to the listing contains at least one billable service,
false otherwise.
- name: has_upgraded_services
data_type: boolean
description: |
True if the bundle or program applied to the listing contains at least one service different
than the default one, false otherwise.
- name: dwh_extracted_at
data_type: timestamp with timezone
description: |
@ -2842,6 +2887,12 @@ models:
data_tests:
- not_null
- name: is_billable_service
data_type: boolean
description: |
Flag that determines if the service is billable to the
host (True) or not (False).
- name: int_core__product_service_to_price
description: |
This model provides the information related to the prices of the different