commit wip
This commit is contained in:
parent
2e984aa61b
commit
d0bc64b868
3 changed files with 223 additions and 0 deletions
|
|
@ -0,0 +1,23 @@
|
||||||
|
{% set dimensions = get_kpi_dimensions_per_model("NEW_DASH_DEALS_OFFERED_SERVICES") %}
|
||||||
|
|
||||||
|
{{ config(materialized="table", unique_key=["date", "dimension", "dimension_value"]) }}
|
||||||
|
|
||||||
|
|
||||||
|
{% for dimension in dimensions %}
|
||||||
|
select
|
||||||
|
-- Unique Key --
|
||||||
|
d.date,
|
||||||
|
{{ dimension.dimension }} as dimension,
|
||||||
|
{{ dimension.dimension_value }} as dimension_value,
|
||||||
|
-- Metrics --
|
||||||
|
count(distinct dos.id_deal) as deal_with_offered_service_count
|
||||||
|
from {{ ref("int_kpis__dimension_dates") }} d
|
||||||
|
inner join
|
||||||
|
{{ ref("int_kpis__metric_daily_new_dash_deals_offered_services") }} as dos
|
||||||
|
on dos.date = d.date
|
||||||
|
where d.is_end_of_week = true
|
||||||
|
group by 1, 2, 3
|
||||||
|
{% if not loop.last %}
|
||||||
|
union all
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
{{
|
||||||
|
config(
|
||||||
|
materialized="view",
|
||||||
|
unique_key=[
|
||||||
|
"end_date",
|
||||||
|
"service_name",
|
||||||
|
"active_accommodations_per_deal_segmentation",
|
||||||
|
"service_business_type",
|
||||||
|
"new_dash_version",
|
||||||
|
"is_upgraded_service",
|
||||||
|
"main_billing_country_iso_3_per_deal",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
|
||||||
|
select
|
||||||
|
-- Unique Key --
|
||||||
|
d.first_day_week as start_date,
|
||||||
|
d.date as end_date,
|
||||||
|
dos.service_name,
|
||||||
|
dos.active_accommodations_per_deal_segmentation,
|
||||||
|
dos.service_business_type,
|
||||||
|
dos.new_dash_version,
|
||||||
|
dos.is_upgraded_service,
|
||||||
|
dos.main_billing_country_iso_3_per_deal,
|
||||||
|
-- Metrics --
|
||||||
|
count(distinct dos.id_deal) as deal_with_offered_service_count
|
||||||
|
from {{ ref("int_kpis__dimension_dates") }} d
|
||||||
|
inner join
|
||||||
|
{{ ref("int_kpis__metric_daily_new_dash_deals_offered_services") }} dos
|
||||||
|
on dos.date = d.date
|
||||||
|
where d.is_end_of_week = true and dos.id_deal is not null
|
||||||
|
group by 1, 2, 3, 4, 5, 6, 7, 8
|
||||||
|
|
@ -7635,6 +7635,173 @@ models:
|
||||||
data_tests:
|
data_tests:
|
||||||
- not_null
|
- not_null
|
||||||
|
|
||||||
|
- name: deal_with_offered_service_count
|
||||||
|
data_type: bigint
|
||||||
|
description: |
|
||||||
|
The daily count of deals with services offered for a given date, dimension and value.
|
||||||
|
|
||||||
|
- name: int_kpis__metric_weekly_new_dash_deals_offered_services
|
||||||
|
description: |
|
||||||
|
This model computes the Number of Deals with Offered Services at the
|
||||||
|
deepest granularity by the end of each week.
|
||||||
|
It only retrieves services that come from users that are in New Dash, as well
|
||||||
|
as it only considers services created after the user has moved to New Dash.
|
||||||
|
Be aware that any dimension that can change over the weekly period,
|
||||||
|
such as daily segmentations, are included in the primary key of the
|
||||||
|
model.
|
||||||
|
|
||||||
|
The unique key corresponds to:
|
||||||
|
- end_date,
|
||||||
|
- service_name,
|
||||||
|
- active_accommodations_per_deal_segmentation,
|
||||||
|
- service_business_type,
|
||||||
|
- new_dash_version,
|
||||||
|
- is_upgraded_service,
|
||||||
|
- main_billing_country_iso_3_per_deal.
|
||||||
|
|
||||||
|
data_tests:
|
||||||
|
- dbt_utils.unique_combination_of_columns:
|
||||||
|
combination_of_columns:
|
||||||
|
- end_date
|
||||||
|
- service_name
|
||||||
|
- active_accommodations_per_deal_segmentation
|
||||||
|
- service_business_type
|
||||||
|
- new_dash_version
|
||||||
|
- is_upgraded_service
|
||||||
|
- main_billing_country_iso_3_per_deal
|
||||||
|
|
||||||
|
columns:
|
||||||
|
- name: start_date
|
||||||
|
data_type: date
|
||||||
|
description: |
|
||||||
|
The start date of the week.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: end_date
|
||||||
|
data_type: date
|
||||||
|
description: |
|
||||||
|
The end date of the week.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: service_name
|
||||||
|
data_type: string
|
||||||
|
description: Name of the created service.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: service_business_type
|
||||||
|
data_type: string
|
||||||
|
description: |
|
||||||
|
Identifies the service type (Screening, Deposit Management,
|
||||||
|
Protection or Guest Agreement) according to New Pricing documentation.
|
||||||
|
Cannot be null.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
- accepted_values:
|
||||||
|
values:
|
||||||
|
- "SCREENING"
|
||||||
|
- "PROTECTION"
|
||||||
|
- "DEPOSIT_MANAGEMENT"
|
||||||
|
- "GUEST_AGREEMENT"
|
||||||
|
|
||||||
|
- name: is_upgraded_service
|
||||||
|
data_type: string
|
||||||
|
description: |
|
||||||
|
Whether the service is an upgraded version of the
|
||||||
|
default. In other words, if it's not Basic Screening.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
- accepted_values:
|
||||||
|
values:
|
||||||
|
- "YES"
|
||||||
|
- "NO"
|
||||||
|
|
||||||
|
- name: new_dash_version
|
||||||
|
data_type: string
|
||||||
|
description: |
|
||||||
|
The version of the New Dash. It corresponds to the
|
||||||
|
release or migration phase from user point of view.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: active_accommodations_per_deal_segmentation
|
||||||
|
data_type: string
|
||||||
|
description: |
|
||||||
|
Segment value based on the number of listings booked in 12 months
|
||||||
|
for a given deal and date.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
- accepted_values:
|
||||||
|
values:
|
||||||
|
- "0"
|
||||||
|
- "01-05"
|
||||||
|
- "06-20"
|
||||||
|
- "21-60"
|
||||||
|
- "61+"
|
||||||
|
- "UNSET"
|
||||||
|
|
||||||
|
- name: main_billing_country_iso_3_per_deal
|
||||||
|
data_type: string
|
||||||
|
description: |
|
||||||
|
Main billing country of the host aggregated at Deal level.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: deal_with_offered_service_count
|
||||||
|
data_type: bigint
|
||||||
|
description: |
|
||||||
|
The count of deals with services offered for a give end of
|
||||||
|
week date, dimension and value.
|
||||||
|
|
||||||
|
- name: int_kpis__agg_weekly_new_dash_deals_offered_services
|
||||||
|
description: |
|
||||||
|
This model computes the dimension aggregation for Number of Deals with
|
||||||
|
Offered Services by the end of each week.
|
||||||
|
It only retrieves services that come from users that are in New Dash, as well
|
||||||
|
as it only considers services created after the user has moved to New Dash.
|
||||||
|
The primary key of this model is date, dimension and dimension_value.
|
||||||
|
|
||||||
|
data_tests:
|
||||||
|
- dbt_utils.unique_combination_of_columns:
|
||||||
|
combination_of_columns:
|
||||||
|
- date
|
||||||
|
- dimension
|
||||||
|
- dimension_value
|
||||||
|
|
||||||
|
columns:
|
||||||
|
- name: date
|
||||||
|
data_type: date
|
||||||
|
description: |
|
||||||
|
The end date of the week.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
|
- name: dimension
|
||||||
|
data_type: string
|
||||||
|
description: The dimension or granularity of the metrics.
|
||||||
|
data_tests:
|
||||||
|
- assert_dimension_completeness:
|
||||||
|
metric_column_names:
|
||||||
|
- deal_with_offered_service_count
|
||||||
|
where: "dimension in ('by_number_of_listings', 'by_billing_country', 'by_new_dash_version')"
|
||||||
|
- accepted_values:
|
||||||
|
values:
|
||||||
|
- global
|
||||||
|
- by_number_of_listings
|
||||||
|
- by_billing_country
|
||||||
|
- by_new_dash_version
|
||||||
|
- by_has_upgraded_service
|
||||||
|
- by_service
|
||||||
|
- by_service_business_type
|
||||||
|
|
||||||
|
- name: dimension_value
|
||||||
|
data_type: string
|
||||||
|
description: The value or segment available for the selected dimension.
|
||||||
|
data_tests:
|
||||||
|
- not_null
|
||||||
|
|
||||||
- name: deal_with_offered_service_count
|
- name: deal_with_offered_service_count
|
||||||
data_type: bigint
|
data_type: bigint
|
||||||
description: |
|
description: |
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue