Merged PR 3654: New Dash KPIs - Chargeable Services (Revenue)
# Description This PR aims to do 2 things: 1. Create the first metric daily model for New Dash - Chargeable Services * PK at Booking, Date and Service. I added a few more dimensions such as Accommodation and Business Type. The idea is that while Daily Unique Bookings/Accommodations Charged will be close (if not the same) as Charged Services, by having the ID we can compute Monthly/Weekly Unique Bookings/Accommodations Charged in a proper manner. Besides this, we would still compute additive metrics in the future such as the sum of Charged Services and the sum of Service Total Price in GBP. * `IMPORTANT`: as discussed in the daily, I changed New Pricing models containing "Charged" columns to "Chargeable". This affects the new model for New Dash KPIs, but also `int_core__booking_summary` and `int_core__booking_service_detail`. 2. Small fixes on New Dash - Created Services. * Mainly, there were some inconsistencies with what was actually written (and really applied) in the schema entry as for what was the PK of the model vs. what was stated in the model. I just re-ordered the columns and re-specified correctly the PK. # 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:
parent
645958239e
commit
2251a45540
8 changed files with 203 additions and 51 deletions
|
|
@ -3640,10 +3640,10 @@ models:
|
|||
description: |
|
||||
This is an informative field, use at your own risk.
|
||||
Identifies the service unit price converted to GBP. If the date of
|
||||
the charge exists, it will use the latest charge date for the exchange
|
||||
the chargeable exists, it will use the latest chargeable date for the exchange
|
||||
rate computation. If not, it will use the moment this service detail line
|
||||
was created. It can be null. It can vary over time due to the currency rate
|
||||
estimation in the future for charge dates, and can vary also because of
|
||||
estimation in the future for chargeable dates, and can vary also because of
|
||||
changes in the date used.
|
||||
|
||||
- name: service_total_price_in_gbp
|
||||
|
|
@ -3652,24 +3652,24 @@ models:
|
|||
Identifies the current total price of that service in a given
|
||||
booking converted in GBP. Can be null. Can vary over time depending
|
||||
on the service status, payments, etc, as well as it can vary over
|
||||
time until the charge date due to the currency rate estimation in
|
||||
time until the chargeable date due to the currency rate estimation in
|
||||
the future.
|
||||
|
||||
- name: service_first_charge_date_utc
|
||||
- name: service_first_chargeable_date_utc
|
||||
data_type: date
|
||||
description: |
|
||||
Identifies the first date in which the billing item for this service
|
||||
is supposed to be charged. It can be null if no billing item is
|
||||
available. If there's only one billing item, this field will contain
|
||||
the same value as service_last_charge_date_utc.
|
||||
the same value as service_last_chargeable_date_utc.
|
||||
|
||||
- name: service_last_charge_date_utc
|
||||
- name: service_last_chargeable_date_utc
|
||||
data_type: date
|
||||
description: |
|
||||
Identifies the last date in which the billing item for this service
|
||||
is supposed to be charged. It can be null if no billing item is
|
||||
available. If there's only one billing item, this field will contain
|
||||
the same value as service_first_charge_date_utc.
|
||||
the same value as service_first_chargeable_date_utc.
|
||||
|
||||
- name: is_missing_currency_code
|
||||
data_type: boolean
|
||||
|
|
@ -3703,22 +3703,22 @@ models:
|
|||
tests:
|
||||
- not_null
|
||||
|
||||
- name: is_missing_charge_date
|
||||
- name: is_missing_chargeable_date
|
||||
data_type: boolean
|
||||
description: |
|
||||
Flag to identify if the service has no charge date.
|
||||
Flag to identify if the service has no chargeable date.
|
||||
Cannot be null.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
- name: is_service_charged_in_a_single_date
|
||||
- name: is_service_chargeable_in_a_single_date
|
||||
data_type: boolean
|
||||
description: |
|
||||
Flag to identify if the service is charged in a single date.
|
||||
If True, it means that service_first_charge_date_utc contains
|
||||
the same date as service_last_charge_date_utc. If False, these
|
||||
Flag to identify if the service is chargeable in a single date.
|
||||
If True, it means that service_first_chargeable_date_utc contains
|
||||
the same date as service_last_chargeable_date_utc. If False, these
|
||||
fields will contain different dates. It can be null, thus meaning
|
||||
there's no charge date at all.
|
||||
there's no chargeable date at all.
|
||||
|
||||
- name: int_core__booking_summary
|
||||
description: |
|
||||
|
|
@ -3912,22 +3912,22 @@ models:
|
|||
Identifies the current total price of the booking by adding up the
|
||||
prices of each service applied to this booking, converted in GBP.
|
||||
Can be null. Can vary over time depending on the service status,
|
||||
payments, etc, as well as it can vary over time until the charge
|
||||
payments, etc, as well as it can vary over time until the chargeable
|
||||
date due to the currency rate estimation in the future.
|
||||
|
||||
- name: first_service_charge_date_utc
|
||||
- name: service_first_chargeable_date_utc
|
||||
data_type: date
|
||||
description: |
|
||||
Identifies the first moment in time in which the first
|
||||
service applied to this booking is charged.
|
||||
service applied to this booking is supposed to be charged.
|
||||
|
||||
- name: last_service_charge_date_utc
|
||||
- name: service_last_chargeable_date_utc
|
||||
data_type: date
|
||||
description: |
|
||||
Identifies the last moment in time in which the last
|
||||
service applied to this booking is charged.
|
||||
service applied to this booking is supposed to be charged.
|
||||
|
||||
- name: first_service_detail_created_at_utc
|
||||
- name: service_first_created_at_utc
|
||||
data_type: timestamp
|
||||
description: |
|
||||
Timestamp corresponding to the first creation of a Service
|
||||
|
|
@ -3935,7 +3935,7 @@ models:
|
|||
tests:
|
||||
- not_null
|
||||
|
||||
- name: last_service_detail_created_at_utc
|
||||
- name: service_last_created_at_utc
|
||||
data_type: timestamp
|
||||
description: |
|
||||
Timestamp corresponding to the latest creation of a Service
|
||||
|
|
@ -3943,7 +3943,7 @@ models:
|
|||
tests:
|
||||
- not_null
|
||||
|
||||
- name: last_service_detail_updated_at_utc
|
||||
- name: service_last_updated_at_utc
|
||||
data_type: timestamp
|
||||
description: |
|
||||
Timestamp corresponding to the latest update on any Service
|
||||
|
|
@ -3968,17 +3968,18 @@ models:
|
|||
Total number of Services different from Basic Screening
|
||||
applied to this Booking.
|
||||
|
||||
- name: is_booking_charged
|
||||
- name: is_booking_chargeable
|
||||
data_type: boolean
|
||||
description: |
|
||||
Flag to identify it the Booking is charged or not.
|
||||
In essence, it solves the question: are we getting money out
|
||||
of this booking, or not?
|
||||
To be considered as charged, a charge date needs to exist as
|
||||
well as the total price converted to GBP needs to be strictly
|
||||
greater than 0. The fact that a booking is not charged does
|
||||
not necessarily mean that it won't be in the future. It cannot
|
||||
be null.
|
||||
Flag to identify it the Booking is chargeable or not.
|
||||
In essence, it solves the question: are we supposed to get
|
||||
money out of this booking, or not?
|
||||
To be considered as chargeable, a chargeable date needs to exist
|
||||
as well as the total price converted to GBP needs to be strictly
|
||||
greater than 0. The fact that a booking is not chargeable does
|
||||
not necessarily mean that it won't be in the future. Similarly, if
|
||||
the booking is chargeable it does not necessarily mean that is actually
|
||||
charged. It cannot be null.
|
||||
tests:
|
||||
- not_null
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue