Merged PR 3667: Creates Chargeable metrics for New Dash KPIs

# Description

Creates the models for KPIs for New Dash - Chargeable metrics. In essence, computes 4 metrics:
- Chargeable Services
- Chargeable Amount (in GBP)
- Chargeable Bookings (unique over a time period and dimension, not additive)
- Chargeable Listings (unique over a time period and dimension, not additive)

This is done by creating:
- A Weekly Metric and Monthly Metric model. Here we keep the granularity of id_booking / id_accommodation to be able to compute the uniqueness.
- A Daily, Weekly and Monthly Aggregated models. Same as usual.
- Integrates everything to the existing model for Product New Dash Agg Metrics
- Exposes everything into reporting

NB: I removed on "by_host" in Created Services - I forgot to clear it out.

# 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: #20809
This commit is contained in:
Oriol Roqué Paniagua 2024-11-26 14:19:41 +00:00
parent b7c5a526f7
commit 42d70f72d5
10 changed files with 808 additions and 24 deletions

View file

@ -303,6 +303,7 @@ models:
- "By New Dash Version"
- "By Has Upgraded Service"
- "By Service"
- "By Service Business Type"
- name: dimension_value
data_type: string
@ -312,12 +313,43 @@ models:
- name: created_services
data_type: bigint
description: The daily created services for a given date, dimension and value.
description: |
The created services for a given time granularity, date or dates range,
dimension and value.
- name: booking_with_created_services_count
data_type: bigint
description: |
The daily bookings with created services for a given date, dimension and value.
The bookings with created services for a given time granularity, date or
dates range, dimension and value.
This is an approximation to booking count since different services can
apply to the same booking and these do not need to be created in the same
time period. Therefore, it's not an additive metric.
- name: total_chargeable_services
data_type: integer
description: |
The total chargeable services for a given time granularity, date or
dates range, dimension and value.
- name: total_chargeable_amount_in_gbp
data_type: decimal
description: |
The total daily chargeable amount for a given time granularity, date or
dates range, dimension and value, in GBP.
- name: unique_chargeable_bookings
data_type: integer
description: |
The unique daily chargeable bookings for a given time granularity, date or
dates range, dimension and value.
This metric is not additive, and its value can vary depending on the time
period considered.
- name: unique_chargeable_listings
data_type: integer
description: |
The unique daily chargeable accommodations, or listings, for a given time
granularity, date or dates range, dimension and value.
This metric is not additive, and its value can vary depending on the time
period considered.