Merged PR 3461: Creates models for listing metrics
# Description Adds listing metrics model. It's a bit similar as the Deal metrics, but here we can aggregate by deal :) I'm aware that int_kpis__metric_daily_listings takes quite a bit (3 min). To be optimised later on. # 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: #23567
This commit is contained in:
parent
dada9c289a
commit
335ba9a29b
5 changed files with 484 additions and 1 deletions
|
|
@ -5544,3 +5544,240 @@ models:
|
|||
data_type: bigint
|
||||
description: |
|
||||
Count of deals booked within the past 12 months for a given date, dimension and value.
|
||||
|
||||
- name: int_kpis__metric_daily_listings
|
||||
description: |
|
||||
This model computes the Daily Listing metrics at the deepest granularity.
|
||||
|
||||
Listing metrics at daily level already contain the time dimension
|
||||
aggregates needed, thus we won't have mtd or monthly equivalent models,
|
||||
but rather just select from this daily model the needed days to recover
|
||||
the necessary information.
|
||||
|
||||
The unique key corresponds to the deepest granularity of the model,
|
||||
in this case:
|
||||
- date,
|
||||
- id_deal
|
||||
|
||||
tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- date
|
||||
- id_deal
|
||||
|
||||
columns:
|
||||
- name: date
|
||||
data_type: date
|
||||
description: Date containing the Listing metrics.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: id_deal
|
||||
data_type: string
|
||||
description: Unique identifier of an account.
|
||||
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.
|
||||
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 Listing level.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: new_listings
|
||||
data_type: bigint
|
||||
description: |
|
||||
Count of new listings in a given date and per specified dimension.
|
||||
|
||||
- name: never_booked_listings
|
||||
data_type: bigint
|
||||
description: |
|
||||
Count of never booked listings in a given date and per specified dimension.
|
||||
|
||||
- name: first_time_booked_listings
|
||||
data_type: bigint
|
||||
description: |
|
||||
Count of first-time booked listings in a given date and per specified dimension.
|
||||
|
||||
- name: active_listings
|
||||
data_type: bigint
|
||||
description: |
|
||||
Count of active listings in a given date and per specified dimension.
|
||||
|
||||
- name: inactive_listings
|
||||
data_type: bigint
|
||||
description: |
|
||||
Count of inactive listings in a given date and per specified dimension.
|
||||
|
||||
- name: churning_listings
|
||||
data_type: bigint
|
||||
description: |
|
||||
Count of churning listings in a given date and per specified dimension.
|
||||
|
||||
- name: reactivated_listings
|
||||
data_type: bigint
|
||||
description: |
|
||||
Count of reactivated listings in a given date and per specified dimension.
|
||||
|
||||
- name: listings_booked_in_month
|
||||
data_type: bigint
|
||||
description: |
|
||||
Count of listings booked within the month in a given date and per specified dimension.
|
||||
|
||||
- name: listings_booked_in_6_months
|
||||
data_type: bigint
|
||||
description: |
|
||||
Count of listings booked within the past 6 months in a given date and per specified dimension.
|
||||
|
||||
- name: listings_booked_in_12_months
|
||||
data_type: bigint
|
||||
description: |
|
||||
Count of listings booked within the past 12 months in a given date and per specified dimension.
|
||||
|
||||
- name: int_kpis__agg_daily_listings
|
||||
description: |
|
||||
This model computes the dimension aggregation for
|
||||
Daily Listing metrics.
|
||||
|
||||
The primary key of this model is date, dimension
|
||||
and dimension_value.
|
||||
|
||||
Listing metrics at daily level already contain the time dimension
|
||||
aggregates needed, thus we won't have mtd or monthly equivalent models,
|
||||
but rather just select from this daily model the needed days to recover
|
||||
the necessary information.
|
||||
|
||||
tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- date
|
||||
- dimension
|
||||
- dimension_value
|
||||
|
||||
columns:
|
||||
- name: date
|
||||
data_type: date
|
||||
description: Date containing the Listing metrics.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: dimension
|
||||
data_type: string
|
||||
description: The dimension or granularity of the metrics.
|
||||
tests:
|
||||
- assert_dimension_completeness:
|
||||
metric_column_names:
|
||||
- new_listings
|
||||
- never_booked_listings
|
||||
- first_time_booked_listings
|
||||
- active_listings
|
||||
- churning_listings
|
||||
- inactive_listings
|
||||
- reactivated_listings
|
||||
- listings_booked_in_month
|
||||
- listings_booked_in_6_months
|
||||
- listings_booked_in_12_months
|
||||
|
||||
- accepted_values:
|
||||
values:
|
||||
- global
|
||||
- by_number_of_listings
|
||||
- by_billing_country
|
||||
- by_deal
|
||||
|
||||
- name: dimension_value
|
||||
data_type: string
|
||||
description: The value or segment available for the selected dimension.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: is_end_of_month
|
||||
data_type: boolean
|
||||
description: True if it's end of month, false otherwise.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: is_current_month
|
||||
data_type: boolean
|
||||
description: |
|
||||
True if the date is within the current month, false otherwise.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: is_month_to_date
|
||||
data_type: boolean
|
||||
description: |
|
||||
True if the date is within the scope of month-to-date, false otherwise.
|
||||
The scope of month-to-date takes into account both 1) a date being in
|
||||
the current month or 2) a date corresponding to the same month of the
|
||||
previous year, which day number cannot be higher than yesterday's day
|
||||
number.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: new_listings
|
||||
data_type: bigint
|
||||
description: |
|
||||
Count of new listings for a given date, dimension and value.
|
||||
|
||||
- name: never_booked_listings
|
||||
data_type: bigint
|
||||
description: |
|
||||
Count of never booked listings for a given date, dimension and value.
|
||||
|
||||
- name: first_time_booked_listings
|
||||
data_type: bigint
|
||||
description: |
|
||||
Count of first-time booked listings for a given date, dimension and value.
|
||||
|
||||
- name: active_listings
|
||||
data_type: bigint
|
||||
description: |
|
||||
Count of active listings for a given date, dimension and value.
|
||||
|
||||
- name: inactive_listings
|
||||
data_type: bigint
|
||||
description: |
|
||||
Count of inactive listings for a given date, dimension and value.
|
||||
|
||||
- name: churning_listings
|
||||
data_type: bigint
|
||||
description: |
|
||||
Count of churning listings for a given date, dimension and value.
|
||||
|
||||
- name: reactivated_listings
|
||||
data_type: bigint
|
||||
description: |
|
||||
Count of reactivated listings for a given date, dimension and value.
|
||||
|
||||
- name: listings_booked_in_month
|
||||
data_type: bigint
|
||||
description: |
|
||||
Count of listings booked within the month for a given date, dimension and value.
|
||||
|
||||
- name: listings_booked_in_6_months
|
||||
data_type: bigint
|
||||
description: |
|
||||
Count of listings booked within the past 6 months for a given date, dimension and value.
|
||||
|
||||
- name: listings_booked_in_12_months
|
||||
data_type: bigint
|
||||
description: |
|
||||
Count of listings booked within the past 12 months for a given date, dimension and value.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue