New dash service usage model
This commit is contained in:
parent
1a7579c8a8
commit
78e005e8fa
3 changed files with 92 additions and 4 deletions
|
|
@ -2,6 +2,9 @@ with
|
||||||
int_core__user_product_bundle_contains_services as (
|
int_core__user_product_bundle_contains_services as (
|
||||||
select * from {{ ref("int_core__user_product_bundle_contains_services") }}
|
select * from {{ ref("int_core__user_product_bundle_contains_services") }}
|
||||||
),
|
),
|
||||||
|
int_core__user_product_bundle as (
|
||||||
|
select * from {{ ref("int_core__user_product_bundle") }}
|
||||||
|
),
|
||||||
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__accommodation_to_product_bundle as (
|
int_core__accommodation_to_product_bundle as (
|
||||||
select * from {{ ref("int_core__accommodation_to_product_bundle") }}
|
select * from {{ ref("int_core__accommodation_to_product_bundle") }}
|
||||||
|
|
@ -11,10 +14,22 @@ with
|
||||||
select * from {{ ref("int_core__booking_to_product_bundle") }}
|
select * from {{ ref("int_core__booking_to_product_bundle") }}
|
||||||
),
|
),
|
||||||
int_core__bookings as (select * from {{ ref("int_core__bookings") }}),
|
int_core__bookings as (select * from {{ ref("int_core__bookings") }}),
|
||||||
|
bundle_services as (
|
||||||
|
select id_user_product_bundle, id_user_host, product_service_name
|
||||||
|
from int_core__user_product_bundle_contains_services
|
||||||
|
union all
|
||||||
|
select
|
||||||
|
id_user_product_bundle,
|
||||||
|
id_user_host,
|
||||||
|
coalesce(
|
||||||
|
replace(protection_display_name, ' ', ''), 'BASICSCREENING'
|
||||||
|
) as product_service_name
|
||||||
|
from int_core__user_product_bundle
|
||||||
|
),
|
||||||
users as (
|
users as (
|
||||||
select distinct
|
select distinct
|
||||||
(bs.product_service_name), count(distinct bs.id_user_host) as number_users
|
(bs.product_service_name), count(distinct bs.id_user_host) as number_users
|
||||||
from int_core__user_product_bundle_contains_services bs
|
from bundle_services bs
|
||||||
inner join
|
inner join
|
||||||
int_core__user_host uh
|
int_core__user_host uh
|
||||||
on bs.id_user_host = uh.id_user_host
|
on bs.id_user_host = uh.id_user_host
|
||||||
|
|
@ -33,7 +48,7 @@ with
|
||||||
when a.is_active is false then apb.id_accommodation else null
|
when a.is_active is false then apb.id_accommodation else null
|
||||||
end
|
end
|
||||||
) as number_inactive_accommodations
|
) as number_inactive_accommodations
|
||||||
from int_core__user_product_bundle_contains_services bs
|
from bundle_services bs
|
||||||
left join
|
left join
|
||||||
int_core__accommodation_to_product_bundle apb
|
int_core__accommodation_to_product_bundle apb
|
||||||
on apb.id_user_product_bundle = bs.id_user_product_bundle
|
on apb.id_user_product_bundle = bs.id_user_product_bundle
|
||||||
|
|
@ -68,7 +83,7 @@ with
|
||||||
else null
|
else null
|
||||||
end
|
end
|
||||||
) as number_flagged_bookings
|
) as number_flagged_bookings
|
||||||
from int_core__user_product_bundle_contains_services bs
|
from bundle_services bs
|
||||||
left join
|
left join
|
||||||
int_core__booking_to_product_bundle bpb
|
int_core__booking_to_product_bundle bpb
|
||||||
on bpb.id_user_product_bundle = bs.id_user_product_bundle
|
on bpb.id_user_product_bundle = bs.id_user_product_bundle
|
||||||
|
|
|
||||||
|
|
@ -5165,3 +5165,76 @@ models:
|
||||||
- name: chose_checkin_cover
|
- name: chose_checkin_cover
|
||||||
data_type: boolean
|
data_type: boolean
|
||||||
description: "Boolean value indicating if the guest chose CheckIn Cover."
|
description: "Boolean value indicating if the guest chose CheckIn Cover."
|
||||||
|
|
||||||
|
- name: int_core__new_dash_services_usage
|
||||||
|
description: "This model contains the usage of the services in New Dash.
|
||||||
|
This usage is displayed by different levels, such as the number of users,
|
||||||
|
accommodations and bookings."
|
||||||
|
|
||||||
|
columns:
|
||||||
|
- name: product_service_name
|
||||||
|
data_type: text
|
||||||
|
description: "The name of the product service."
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
- accepted_values:
|
||||||
|
values:
|
||||||
|
- "BASICSCREENING"
|
||||||
|
- "SCREENINGPLUS"
|
||||||
|
- "IDVERIFICATION"
|
||||||
|
- "SEXOFFENDERSCHECK"
|
||||||
|
- "BASICDAMAGEDEPOSIT"
|
||||||
|
- "BASICWAIVER"
|
||||||
|
- "WAIVERPLUS"
|
||||||
|
- "WAIVERPRO"
|
||||||
|
- "BASICPROTECTION"
|
||||||
|
- "PROTECTIONPLUS"
|
||||||
|
- "PROTECTIONPRO"
|
||||||
|
|
||||||
|
- name: number_users
|
||||||
|
data_type: bigint
|
||||||
|
description:
|
||||||
|
"Number of user accounts that have a bundle that considers this service.
|
||||||
|
The fact that a user has a bundle with the service included does not mean
|
||||||
|
that the service is active or used. Each user can associate any of their
|
||||||
|
bundles with any of their accommodations."
|
||||||
|
|
||||||
|
- name: number_accommodations
|
||||||
|
data_type: bigint
|
||||||
|
description:
|
||||||
|
"Number of accommodations or listings that have a bundle that considers
|
||||||
|
this service."
|
||||||
|
|
||||||
|
- name: number_active_accommodations
|
||||||
|
data_type: bigint
|
||||||
|
description:
|
||||||
|
"Number of accommodations or listings that have a bundle that considers
|
||||||
|
this service and are active."
|
||||||
|
|
||||||
|
- name: number_inactive_accommodations
|
||||||
|
data_type: bigint
|
||||||
|
description:
|
||||||
|
"Number of accommodations or listings that have a bundle that considers
|
||||||
|
this service and are inactive."
|
||||||
|
|
||||||
|
- name: number_bookings
|
||||||
|
data_type: bigint
|
||||||
|
description: "Number of bookings that have a bundle that considers this service."
|
||||||
|
|
||||||
|
- name: number_approved_bookings
|
||||||
|
data_type: bigint
|
||||||
|
description:
|
||||||
|
"Number of bookings that have a bundle that considers this service and
|
||||||
|
are approved."
|
||||||
|
|
||||||
|
- name: number_cancelled_bookings
|
||||||
|
data_type: bigint
|
||||||
|
description:
|
||||||
|
"Number of bookings that have a bundle that considers this service and
|
||||||
|
are cancelled."
|
||||||
|
|
||||||
|
- name: number_flagged_bookings
|
||||||
|
data_type: bigint
|
||||||
|
description:
|
||||||
|
"Number of bookings that have a bundle that considers this service and
|
||||||
|
are flagged."
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
with
|
id_with
|
||||||
raw_user_product_bundle as (
|
raw_user_product_bundle as (
|
||||||
select * from {{ source("core", "UserProductBundle") }}
|
select * from {{ source("core", "UserProductBundle") }}
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue