Merged PR 5058: Propagate API deals to growth score

# Description

I opted to name the combination of (Platform) Billable Bookings and (API) Billable Verifications as Billable Items. This is to ensure consistent naming.

Changes:
* Renamed `int_kpis_projected__agg_daily_billable_bookings` to `int_kpis_projected__agg_daily_billable_items`. This now has a new CTE named combination_of_billable_items that combines both API and Platform billable items. Renamed any "bookings" field to "items".
* Renamed `int_kpis_projected__agg_monthly_billable_bookings` to `int_kpis_projected__agg_monthly_billable_items`. Renamed any "bookings" field to "items".
* Renamed `int_billable_bookings_growth_score_by_deal` to `int_billable_items_growth_score_by_deal`. This now has a new CTE named `aggregated_monthly_billable_items` that combines the historical information both API and Platform on billable items. Renamed any "bookings" field to "items".
* Changes Schema accordingly. Small note here that the assert dimension completeness stops working since there's dimensions specific to API or Platform, thus I removed it.

# 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: #29374
This commit is contained in:
Oriol Roqué Paniagua 2025-04-25 07:27:22 +00:00
parent 8901cc85ec
commit 0ffcfca6a8
6 changed files with 288 additions and 258 deletions

View file

@ -3225,18 +3225,18 @@ models:
When precision and recall are far apart, the F2 score will be closer to the
lower of the two.
- name: int_billable_bookings_growth_score_by_deal
- name: int_billable_items_growth_score_by_deal
description: |
This model computes the growth score of the billable bookings for each deal.
This model computes the growth score of the billable items for each deal.
The growth score is computed as the average between:
- The billable bookings of a given month vs. the average of the previous
- The billable items of a given month vs. the average of the previous
3 months.
- The share a deal has in terms of billable bookings of a given month
- The share a deal has in terms of billable items of a given month
if compared to the rest of the deals vs. the average of the previous 3
months.
The growth score is capped between -1 and 1.
It is important to note that if we check the current month, the count of
billable bookings and the corresponding share will be based on the projection,
billable items and the corresponding share will be based on the projection,
rather than the actual figure. In this case, the MAE and MAPE of the projected
value are indicated in the model.
While the growth score is computed at a monthly basis, the value will update
@ -3274,12 +3274,12 @@ models:
data_tests:
- not_null
- name: current_month_billable_bookings
- name: current_month_billable_items
data_type: integer
description: |
Monthly billable bookings. If the month is in progress
Monthly billable items. If the month is in progress
then this value corresponds to the projected figure.
This is indicated by "are_billable_bookings_projected"
This is indicated by "are_billable_items_projected"
flag.
data_tests:
- not_null
@ -3287,10 +3287,10 @@ models:
min_value: 0
strictly: false
- name: prior_3_months_avg_monthly_billable_bookings
- name: prior_3_months_avg_monthly_billable_items
data_type: integer
description: |
Average of the billable bookings for the previous 3 months.
Average of the billable items for the previous 3 months.
If the selected range is from 1st April 2025 to 30th April 2025,
then this average will be based between 1st January 2025 to
31st March 2025.
@ -3299,12 +3299,12 @@ models:
min_value: 0
strictly: false
- name: current_month_share_billable_bookings
- name: current_month_share_billable_items
data_type: decimal
description: |
Share of the billable bookings for a given deal in the current month.
Share of the billable items for a given deal in the current month.
If the month is in progress then this value corresponds to the
projected figure. This is indicated by "are_billable_bookings_projected"
projected figure. This is indicated by "are_billable_items_projected"
flag.
data_tests:
- not_null
@ -3312,10 +3312,10 @@ models:
min_value: 0
strictly: false
- name: prior_3_months_avg_monthly_share_billable_bookings
- name: prior_3_months_avg_monthly_share_billable_items
data_type: decimal
description: |
Average of the share of the billable bookings for a given deal in the
Average of the share of the billable items for a given deal in the
previous 3 months. If the selected range is from 1st April 2025 to
30th April 2025, then this average will be based between 1st January
2025 to 31st March 2025.
@ -3324,21 +3324,21 @@ models:
min_value: 0
strictly: false
- name: growth_vs_prior_3_avg_billable_bookings
- name: growth_vs_prior_3_avg_billable_items
data_type: decimal
description: |
Growth score of the billable bookings based purely on the relative
difference between the current month billable bookings vs. the
Growth score of the billable items based purely on the relative
difference between the current month billable items vs. the
prior 3 months average.
This is a subcomputation of the growth score, for information
purposes.
It can be null.
- name: growth_vs_prior_3_avg_share_billable_bookings
- name: growth_vs_prior_3_avg_share_billable_items
data_type: decimal
description: |
Growth score of the billable bookings based purely on the relative
difference between the current month share billable bookings vs. the
Growth score of the billable items based purely on the relative
difference between the current month share billable items vs. the
prior 3 months average.
This is a subcomputation of the growth score, for information
purposes.
@ -3347,10 +3347,10 @@ models:
- name: growth_score
data_type: decimal
description: |
Growth score of the billable bookings, based on the average between:
- The billable bookings of a given month vs. the average of the previous
Growth score of the billable items, based on the average between:
- The billable items of a given month vs. the average of the previous
3 months.
- The share a deal has in terms of billable bookings of a given month
- The share a deal has in terms of billable items of a given month
if compared to the rest of the deals vs. the average of the previous 3
months.
The growth score is capped between -1 and 1.
@ -3365,7 +3365,7 @@ models:
- name: projection_mean_absolute_error
data_type: decimal
description: |
Mean absolute error of the projection of the billable bookings.
Mean absolute error of the projection of the billable items.
It is null if the month is not in progress or value is projected
but there's no prior data to compare the projection against.
data_tests:
@ -3376,7 +3376,7 @@ models:
- name: projection_mean_absolute_percentage_error
data_type: decimal
description: |
Mean absolute percentage error of the projection of the billable bookings.
Mean absolute percentage error of the projection of the billable items.
It is null if the month is not in progress or value is projected
but there's no prior data to compare the projection against.
data_tests:
@ -3384,12 +3384,12 @@ models:
min_value: 0
strictly: false
- name: are_billable_bookings_projected
- name: are_billable_items_projected
data_type: boolean
description: |
Flag indicating if the billable bookings are projected or not.
Flag indicating if the billable items are projected or not.
If the month is in progress then this value corresponds to the
projected figure. This is indicated by "are_billable_bookings_projected"
projected figure. This is indicated by "are_billable_items_projected"
flag.
data_tests:
- not_null