Commit graph

1392 commits

Author SHA1 Message Date
Oriol Roqué Paniagua
ae9bb524b7 Merged PR 5214: Integrates Guest Product new flow Payments
# Description

Integrates Guest Product Payments coming from the new flow of Guest Products.

This also removes few fields that will not be used or that do not make sense for GP specifically.

# 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: #30110
2025-05-15 07:00:11 +00:00
Oriol Roqué Paniagua
d5dd6df1c1 Merged PR 5201: Eliminates Verification Payments v2 + updates exposures
# Description

Eliminates Verification Payments v2 + updates exposures

# Checklist

- [X] Project compiles

Related work items: #30024
2025-05-13 14:48:34 +00:00
Oriol Roqué Paniagua
4cac5aefa5 Merged PR 5191: Guest Journey Payments to reporting
# Description

Guest Journey Payments to reporting. This aims to substitute core__verification_payments_v2, which is in use in the report of Guest Payments within Business Overview.

In order to avoid re-doing PBI work, I already set  id_guest_product_payment as text for future usage. Similarly, superhog fees are called truvi fees.

# 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: #30024
2025-05-13 07:40:53 +00:00
Oriol Roqué Paniagua
3badc02c9f Merged PR 5187: Switch models that use int_core__verification_payments
# Description

Switches all models that still use int_core__verification_payments, except for the equivalent in reporting that needs a parallel GJ Payments to do a proper refactor.

# 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: #30024
2025-05-12 15:58:53 +00:00
Oriol Roqué Paniagua
c6b61856f0 Merged PR 5183: Switch dependencies on verification payments for KPIs models
# Description

Switches the 3 KPIs models that used int_core__verification_payments_v2 to now use int_core__guest_journey_payments.

Audit successful.

# 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: #30024
2025-05-12 10:56:02 +00:00
Oriol Roqué Paniagua
b1faa83156 Merged PR 5182: First version of Guest Journey Payments
# Description

Creates a first version of Guest Journey Payments. This model intends to replace int_core__verification_payments, and equivalent audit succeeds.

Additional changes:
* Removed decimal conversion in source models. In the GJ Payment model I avoid doing any currency conversion (thus one less join); however we need to have all decimals to exactly replicate the same computation. Peanuts, but still.
* Tagged as deprecated: int_core__verification_payments
* Added additional fields for reference in terms of IDs and specifically a handy is_status_paid for future joins.
* Added more robust test coverage and enhanced descriptions of fields.

# 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: #30024
2025-05-12 09:25:54 +00:00
Oriol Roqué Paniagua
77c3a02466 Merged PR 5173: First version of Verification Product Payments
# Description

New model for Verification Product Payments (Waiver, Deposit, Fee + not assigned set as Unknown).
This includes:
* Similar upper case and coalesce for payment status and verification product name
* Rename of paway_minimum_commission_local_curr as it was not clear (this needs to be handled separately)
* Waiver payaway stuff
* No tax handling

Audit passed with following considerations:

```
-- THIS GOES INTO AN AUDIT FILE
{% set old_query %}
  select
    *
  from dwh_hybrid.intermediate.int_core__verification_product_payments
{% endset %}

{% set new_query %}
  select
    id_verification_to_payment,
    id_payment,
    is_refundable,
    created_at_utc,
    updated_at_utc,
    payment_due_at_utc,
    payment_due_date_utc,
    payment_paid_at_utc,
    payment_paid_date_utc,
    payment_reference,
    refund_due_at_utc,
    refund_due_date_utc,
    payment_refunded_at_utc,
    payment_refunded_date_utc,
    refund_payment_reference,
    id_user_host,
    id_guest_user as id_user_guest,
    id_verification,
    id_verification_request,
    coalesce(
        upper(verification_payment_type), 'UNKNOWN'
    ) as verification_product_name,
    currency,
    total_amount_in_txn_currency,
    total_amount_in_gbp,
    is_host_taking_waiver_risk,
    payaway_percentage,
    payaway_minimum_commission_local_curr as payaway_minimum_commission_in_txn_currency,
    amount_due_to_host_in_txn_currency,
    amount_due_to_host_in_gbp,
    superhog_fee_in_txn_currency,
    superhog_fee_in_gbp,
    coalesce(upper(payment_status),'UNKNOWN') as payment_status,
    notes
  from dwh_hybrid.intermediate.int_core__verification_payments_v2
  where (verification_payment_type != 'CheckInCover' or verification_payment_type is null)
{% endset %}

{{
    audit_helper.compare_and_classify_query_results(
        old_query,
        new_query,
        primary_key_columns=["id_verification_to_payment"],
        columns=[
            "id_verification_to_payment",
            "id_payment",
            "is_refundable",
            "created_at_utc",
            "updated_at_utc",
            "payment_due_at_utc",
            "payment_due_date_utc",
            "payment_paid_at_utc",
            "payment_paid_date_utc",
            "payment_reference",
            "refund_due_at_utc",
            "refund_due_date_utc",
            "payment_refunded_at_utc",
            "payment_refunded_date_utc",
            "refund_payment_reference",
            "id_user_host",
            "id_user_guest",
            "id_verification",
            "id_verification_request",
            "verification_product_name",
            "currency",
            "total_amount_in_txn_currency",
            "total_amount_in_gbp",
            "is_host_taking_waiver_risk",
            "payaway_percentage",
            "payaway_minimum_commission_in_txn_currency",
            "amount_due_to_host_in_txn_currency",
            "amount_due_to_host_in_gbp",
            "superhog_fee_in_txn_currency",
        ...
2025-05-09 11:27:00 +00:00
Oriol Roqué Paniagua
ac73138cf1 Merged PR 5171: First version of Guest Product Payments
# Description

First model for Guest Product Payments. It only contains CIH from Verification Payments (so, the "old" CIH).

Some notes:
* It does not handle taxes computation.
* It converts guest product name to upper case, as the guest product tables are in upper case. I also apply it for payment status, as well as an UNKNOWN status for whenever it's null - we'd need to consider this for the rest of the refactor.
* Computation is placed within a CTE. This is intended since at some point this will include also Guest Product Payments that come from Guest Product related tables.
* Enhanced documentation with respect to Verification Payments V2.

Audit performed:

```
-- THIS GOES INTO AN AUDIT FILE
{% set old_query %}
  select
    *
  from dwh_hybrid.intermediate.int_core__guest_product_payments
{% endset %}

{% set new_query %}
  select
    id_verification_to_payment,
    id_payment,
    is_refundable,
    created_at_utc,
    updated_at_utc,
    payment_due_at_utc,
    payment_due_date_utc,
    payment_paid_at_utc,
    payment_paid_date_utc,
    payment_reference,
    refund_due_at_utc,
    refund_due_date_utc,
    payment_refunded_at_utc,
    payment_refunded_date_utc,
    refund_payment_reference,
    id_user_host,
    id_guest_user as id_user_guest,
    id_verification,
    id_verification_request,
    upper(verification_payment_type) as guest_product_name,
    currency,
    total_amount_in_txn_currency,
    total_amount_in_gbp,
    coalesce(upper(payment_status),'UNKNOWN') as payment_status,
    notes
  from dwh_hybrid.intermediate.int_core__verification_payments_v2
  where verification_payment_type = 'CheckInCover'
{% endset %}

{{
    audit_helper.compare_and_classify_query_results(
        old_query,
        new_query,
        primary_key_columns=["id_verification_to_payment"],
        columns=[
            "id_verification_to_payment",
            "id_payment",
            "is_refundable",
            "created_at_utc",
            "updated_at_utc",
            "payment_due_at_utc",
            "payment_due_date_utc",
            "payment_paid_at_utc",
            "payment_paid_date_utc",
            "payment_reference",
            "refund_due_at_utc",
            "refund_due_date_utc",
            "payment_refunded_at_utc",
            "payment_refunded_date_utc",
            "refund_payment_reference",
            "id_user_host",
            "id_user_guest",
            "id_verification",
            "id_verification_request",
            "guest_product_name",
            "currency",
            "total_amount_in_txn_currency",
            "total_amount_in_gbp",
            "payment_status",
            "notes",
        ],
        sample_limit=10000000,
    )
}}
```

# 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 ...
2025-05-09 10:13:58 +00:00
Oriol Roqué Paniagua
a3038089e8 Merged PR 5162: Fixes month shift on revenue share and rank
# Description

Fixes the Account Growth issue on the rank/share on revenue metrics.

Issue was that the share needs to be shifted one month for account computation; meaning that the impact score of April relies on the share from March (as there's no April revenue data).

The shift also affected the rank as it's based on the share.

Solution is:
* Re-bring actual revenue share and attribute it to the correct month
* Apply a coalesce giving priority to the revenue share/rank from the correct month. If no data is available (ongoing month), show share/rank of previous month. This is intended to help quantify account importance in the ongoing month - as it's actually the case in the report

Tested locally + run in prod to check the report performance. Small note, this makes revenue share not adding up anymore to 100% as accounts that go live in the same month are excluded. This is exactly the same as for Billable Items.

# 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: #30013
2025-05-08 06:15:44 +00:00
Joaquin Ossa
fb3a8c7bfa Merged PR 5131: Remove old models
# Description

Remove old models:
- `monthly_aggregated_metrics_history_by_deal`
- `int_monthly_aggregated_metrics_history_by_deal`

# Checklist

- [ ] The edited models and dependants run properly with production data.
- [ ] The edited models are sufficiently documented.
- [ ] 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.

Remove old models

Related work items: #29672
2025-05-05 14:00:21 +00:00
Joaquin
a265b01672 Remove old models 2025-05-05 14:47:22 +02:00
Oriol Roqué Paniagua
09e599308c Merged PR 5129: Update exposures/deprecation dates on AM reporting
# Description

Updates deprecation dates to 23rd May.
Updates exposure with new Account Growth report

# Checklist

- [X] Project compiles

Related work items: #29374
2025-05-05 07:09:41 +00:00
Joaquin
8235bb5228 Restored schema 2025-04-30 16:54:06 +02:00
Joaquin
8372f4680f restored files 2025-04-30 16:51:25 +02:00
Joaquin
ce63d90a3f Updated exposure 2025-04-30 16:23:03 +02:00
Oriol Roqué Paniagua
b2e3355612 Merged PR 5085: Propagates the new account growth model to reporting
# Description

Propagates the new account growth model to reporting.

Rounds and a couple of additional fields are handled here for PBI purposes.

# 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
2025-04-29 12:46:50 +00:00
Joaquin
16bf7f1d6c Host Resolution model for report 2025-04-29 11:43:38 +02:00
Oriol Roqué Paniagua
ca5be5c3cf Merged PR 5069: Account revenue impact from growth in a monthly basis
# Description

Creates an intermediate model to compute the impact in revenue (total or rrpr) due to the growth.
This model also categorises the impact, and provides additional attributes for reporting purposes.

This model aims to substitute, in time, the current existing version of `int_monthly_growth_score_by_deal`.

# 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
2025-04-28 09:36:25 +00:00
Joaquin
afb9e7ae01 Commit wip 2025-04-28 09:20:59 +02:00
Joaquin Ossa
b230bf8f47 Merged PR 5015: Xero Resolutions
# Description

New model for Resolutions payments

# 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: #29373
2025-04-25 14:32:49 +00:00
Oriol Roqué Paniagua
f999210f86 Merged PR 5061: Removes exposures of monthly_aggregated_metrics_history_by_deal in Main KPIs
# Description

Removes exposures of monthly_aggregated_metrics_history_by_deal in Main KPIs

Project compiles.

# Checklist

N/A

Related work items: #29204
2025-04-25 14:27:21 +00:00
Joaquin
5256c4ba02 Updated host resolutions model 2025-04-25 15:13:07 +02:00
Joaquin
06031a2e79 Addressed comments 2025-04-25 14:21:47 +02:00
Joaquin
a405affdb4 changed name 2025-04-25 14:21:47 +02:00
Joaquin
623d30bf80 New xero model for resolutions payments 2025-04-25 14:21:47 +02:00
Joaquin
ab6ea150a8 Excluded host resolutions payments 2025-04-25 12:15:17 +02:00
Joaquin
423457126f refactor xero__net_fees_by_deal 2025-04-25 11:55:14 +02:00
Oriol Roqué Paniagua
0ffcfca6a8 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
2025-04-25 07:27:22 +00:00
Oriol Roqué Paniagua
9be6ec1dae Merged PR 5055: KPIs models for API Billable Verifications
# Description

Changes:
* 4 new models in the scope of KPIs for Billable Verifications from APIs. I believe it's more correct to say these are Billable Verifications than Billable Bookings since there's some cases in which a Booking can be duplicated and it's billed multiple times. These include:
* A daily metric model - extremely simple. You will notice there's no Billing Country not Listing Segmentation. This is because for ALL API cases this is UNSET, thus, I just remove it.
* An equivalent monthly metric model.
* Two aggregated models per dimension, dimension value: on a daily and a monthly basis.

Important change: the macro that handles the aggregations sets by default Billing Country and Listing Segmentation. I modified a bit the flow so the only required dimension is Global, and these are skipped for APIs models.

This is needed for the changes intended on the Growth score. In there, I'll combine both Platform Billable Bookings with API Billable Verifications.

Notice there's no MTD models. These could be added for sure; but since I'm not creating any metric in Main KPIs or similar, I opted to skip it for now. It can be done 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.
- [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
2025-04-24 15:01:04 +00:00
Oriol Roqué Paniagua
653666abad Merged PR 5044: Switch Projected Created Bookings to Billable Bookings
# Description

Switches Created Bookings to Billable Bookings in the scope of Projected Bookings. I opted for hard switching (thus removing Projected Created Bookings) altogether to avoid having unused models in production.

This aims to set the ground to include, in the future, APIs Billable Bookings.

Impact in KPIs:
* `int_kpis__agg_daily_created_bookings` now is `int_kpis__agg_daily_billable_bookings`. Aside from the name change, it's reduced to 4 metrics to just one. Schema changes also apply.

Impact in Projected KPIs:
* `int_kpis_projected__agg_daily_created_bookings` now is `int_kpis_projected__agg_daily_billable_bookings`. Fields are also renamed accordingly.
* `int_kpis_projected__agg_monthly_created_bookings` now is `int_kpis_projected__agg_monthly_billable_bookings`. Fields are also renamed accordingly.
* Schema file is also updated accordingly.

Impact on new model for Growth Score:
* `int_created_bookings_growth_score_by_deal` now is `int_billable_bookings_growth_score_by_deal`. Fields are also renamed accordingly.
* Schema is also updated accordingly.

Note that since the end model `int_billable_bookings_growth_score_by_deal` is not used at the moment in reporting, there's no user-facing impact. Also, the rest of modified models are not used for other purposes.

# 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
2025-04-24 12:42:21 +00:00
Oriol Roqué Paniagua
ca2311d935 Merged PR 5047: First API unified version of Verifications
# Description

Creates a first unified version of API verifications. This is a very simple model as it aims to capture the minimal essence of Verifications in a unified view. Any very-in-depth-API-specific detail is not available here.

Additionally, I propagated the Check-in date in the Athena model.

This is needed for API Bookings KPIs future models.

# 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. **Currently as a view, despite it's 70k records. If this grows we could consider other materialisations**

# Other

- [ ] Check if a full-refresh is required after this PR is merged.

Related work items: #29374
2025-04-24 12:21:50 +00:00
Oriol Roqué Paniagua
54e20e00d5 Merged PR 5049: Set option with basic waiver as deposit management
# Description

Removes UNKNOWN in Service Business Type linked to 'BASIC DAMAGE DEPOSIT OR BASIC WAIVER'.

# 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.

Set option with basic waiver as deposit management

Related work items: #29649
2025-04-24 12:20:50 +00:00
Oriol Roqué Paniagua
a944a873d7 Merged PR 5014: New Created Bookings Growth Score
# Description

After checking the current growth score model... I think I will decommission it for something simpler.

This PR introduces a new growth score purely based on Created Bookings, thus it won't work for API deals. For API deals I will do a similar Total Revenue comparison separately.

This uses the projected bookings at the end of the month, thus this is updated in a daily basis and it's timely.

# 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
2025-04-24 07:10:39 +00:00
Oriol Roqué Paniagua
45514dcd6a Merged PR 5012: Small refactor on Growth Score
# Description

Small refactor on Growth Score model. It just handles the dimension deals attributes at the end instead of having these in each CTE.

I also forced a partition ordered by deal AFTER the current ordering. This is a side effect because SQL randomly choses a value if the value being used to order was exactly the same (ex: revenue = 0). This was causing issues when auditing the refactor.

# 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: #29374
2025-04-17 10:01:15 +00:00
Oriol Roqué Paniagua
6e354e7df1 Merged PR 5010: Adds missing payout amount computation for full consistency
# Description

Technically, a payout can be submitted while not in a finished incident state. Likely next step from res perspective is just to close the ticket.

This PR just adds two new fields for completion and consistency, and fixes the completion test so it makes sense.

# 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.
2025-04-17 08:15:37 +00:00
Joaquin Ossa
84eda4554f Merged PR 5005: New API invoices
# Description

Added new invoices metrics for CIH and S&P API for KPI and Accounting models

# 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.

New API invoices

Related work items: #29276
2025-04-16 15:24:25 +00:00
Oriol Roqué Paniagua
cae6d791b5 Merged PR 5007: Deprecation of monthly_aggregated_metrics_history_by_deal models
# Description

Deprecation of monthly_aggregated_metrics_history_by_deal models

dbt Compiles

Related work items: #29204
2025-04-16 15:19:09 +00:00
Joaquin
e8cab61787 Addressed comments 2025-04-16 16:18:14 +02:00
Joaquin
2c7e396c2c New API invoices 2025-04-16 14:27:23 +02:00
Oriol Roqué Paniagua
4922fce426 Merged PR 5001: Payouts amounts attributed to Bookings
# Description

Adds monetary value in terms of payouts for further understanding of the potential impact on improving the flagging.

# 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: #29284
2025-04-16 06:48:39 +00:00
uri
e981cc1739 Fix schema 2025-04-15 13:37:57 +02:00
Oriol Roqué Paniagua
a2cad661dd Merged PR 4996: First tracking of flagging performance
# Description

Creates 2 new models in the scope of flagging: how good are we at identifying "at risk" bookings vs. 1) the number of claims generated and 2) the number of submitted payouts?
This only applies for Protected Bookings in New Dash that have been completed (14 days after the check-out) with potential resolutions appearing in Resolutions Center.

The first table `int_flagging_booking_categorisation` contains all the heavy logic to categorise the bookings.

The second view `int_flagging_performance_analysis` computes standard binary classification scores, for the 2 possible ways of tracking.

Tables are already in prod to help you understand while reviewing. You'll see that the figures are still quite low, specially due to small amount of claims/submitted payouts. This makes the true positives being just... 1.

There's heavy test and documentation coverage to ensure there's no mistakes on the computation.

# 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. **Materialising as table the first model despite being just 1 record since otherwise tests takes ages**

# Other

- [ ] Check if a full-refresh is required after this PR is merged.

Related work items: #29284
2025-04-15 10:14:02 +00:00
Oriol Roqué Paniagua
587661f818 Merged PR 4977: More robust testing on key metrics
# Description

Adds more robust testing for Total Revenue and Revenue Retained Post-Resolutions in:
* int_mtd_vs_previous_year_metrics
* int_ytd_mtd_main_metrics_overview

# 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.

More robust testing on key metrics

Related work items: #29227
2025-04-10 13:06:04 +00:00
Joaquin Ossa
5267fa9fe6 Merged PR 4966: CIH API fix
# Description

Now that we finally have customers on CIH API
Nathan noticed an error on the report which we hadn't noticed before, the fees were not included in the reporting model and was previously being taken from the monthly model which did have them. So currently the monthly value is being displayed correctly but not the individual fees for each verification.

# 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.

cih api fix

Related work items: #29225
2025-04-10 07:41:16 +00:00
Oriol Roqué Paniagua
fa6114b2af Merged PR 4970: Fix data quality issue on Revenue Retained metrics
# Description

As raised by Kayla, Retained metrics are not computed correctly in AM Account Margin report, see screenshot:

![image.png](https://guardhog.visualstudio.com/4148d95f-4b6d-4205-bcff-e9c8e0d2ca65/_apis/git/repositories/54ac356f-aad7-46d2-b62c-e8c5b3bb8ebf/pullRequests/4970/attachments/image.png)

Issue lies in the fact that Guest Payments contains more dimensions than the rest of the models. This is generating duplicates in the combination_of_sources CTE, but these are effectively hidden because of the sum() applied of the metrics.

In the case of a Deal having in the same day Guest Payments with different dimensions from those selected, AND on the same day having a value on Invoiced Revenue or Host Resolutions, then the Invoiced Revenue or Host Resolutions would be duplicated.

This PR aims to fix this issue, and also adds a few tests on the base model for AM Account Margin to ensure this is kind of error raises an alert.

I'll be debugging other affected models and increase the robustness test-wise; as well as gathering the full impact.

# 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: #29227
2025-04-10 07:23:31 +00:00
Joaquin
f0d5a8da98 cih api fix 2025-04-09 15:30:17 +02:00
Oriol Roqué Paniagua
55f8b47faa Merged PR 4959: Exclude data from model to improve performance
# Description

Small changes to exclude "irrelevant" data. All data is relevant I guess but this is less.
* Exclude churned accounts after 3 months.
* Exclude any data after 24 months.

# 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: #28998
2025-04-09 08:13:44 +00:00
Oriol Roqué Paniagua
7b6fd81bf1 Merged PR 4956: Update exposures to include Account Performance
# Description

Updates exposures to include Account Performance. Project compiles.

# Checklist

N/A

# Other

N/A

Related work items: #28998
2025-04-08 13:55:12 +00:00
Joaquin Ossa
d4713dbdf3 Merged PR 4952: upgraded screening
# Description

Added `has_upgraded_screening_services_business_type`
So in the report we can filter by this because currently all bookings should have `has_screening_services_business_type` with BASIC SCREENING

# 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.

upgraded screening

Related work items: #28640
2025-04-08 10:44:36 +00:00
Joaquin
ce4e81749b upgraded screening 2025-04-08 12:09:08 +02:00