Commit graph

997 commits

Author SHA1 Message Date
Joaquin
b9fe9a0552 stay confident inclusion 2025-07-02 14:37:44 +02:00
Oriol Roqué Paniagua
8bc525e4c2 Merged PR 5589: Limits data test coverage on resolutions data
# Description

This relates to the data alerts on resolutions models.

We have one incident status that refers to the record having missing information. The record that is currently triggering this alerts is indeed tagged as such.

The idea is to:
* Create a new boolean that flags if the incident has missing information. This is propagated stg to reporting.
* Apply a where clause to any existing data alert that might be susceptible to fail due to not having enough quality, in staging and reporting.
* Remove over coverage in intermediate since it's already happening in reporting. However we keep a few not-null tests and the PK on critical information (i.e., id_booking).

# 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.
- [NA] I have checked for DRY opportunities with other models and docs.
- [NA] 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: #31668
2025-07-01 09:44:54 +00:00
Oriol Roqué Paniagua
412e242f42 Merged PR 5586: Fix duplications on 1st of Month for Billable Items Growth Score
# Description

This relates to today's data alerts on Growth Score models.

Error has been found in `int_billable_items_growth_score_by_deal`. This only happens on the 1st of the month.

On the 1st day of the month we will have:
* The actual monthly data from KPIs in the previous month.

But also:
* Projected KPIs will still display data for the previous month, in this case though, projected = actuals.

There's a union all that combines actual monthly KPI data for history purposes and the projected data which fails in this case.

Fix is to remove the data from Projected KPIs if the current date of execution (1st of July) equals the first day of the month when computing `end_date` + 1 day. End date being at this moment 30th of June, + 1 day = 1st of July, extracting the first day of the month then 1st July.

# 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.
- [NA] I have checked for DRY opportunities with other models and docs.
- [NA] 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: #31665
2025-07-01 08:38:21 +00:00
Joaquin
9630001f01 new a/b test model in reporting and updated exposure 2025-07-01 09:59:36 +02:00
Joaquin Ossa
5005b72323 Merged PR 5506: Removed not_null tests
# Description

Removed not_null tests for not mandatory fields, guest, host and listing data.
Manual forms are being excluded from the models because of the unreliability of the data

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

Removed not_null tests

Related work items: #31122
2025-06-19 10:12:16 +00:00
Joaquin
76f243a486 Removed not_null tests 2025-06-19 11:58:37 +02:00
Joaquin
147197c92d Modified test 2025-06-19 11:35:52 +02:00
Joaquin
ecf38144cb fixed schema 2025-06-19 09:09:56 +02:00
Joaquin
986c9f85a8 exclude deals without lifecycle 2025-06-19 09:04:48 +02:00
Oriol Roqué Paniagua
a8927b7a44 Merged PR 5463: New Dash user categorisation + revamp model
# Description

Fixes:
* There was a data quality issue in which active listings with bundles were showing more listings than the total active listings. This has been fixed, plus a bunch of tests have been added to make sure this does not happen again.
* There's a field that reaches the 63 character limit. I modified "paid" per "upgraded" which reduces this to intermediate model; however in reporting I need to keep as is to avoid breaking PBI. I did change the name of the field in the schema so tests/docs work well and explicitly mention this in the doc. This will need adaptation but can be done in the future.
* There was tons of dead code tagged as to be deleted that was not deleted, not sure why or when. Anyway this is dropped now. It's not used in PBI except for the fact that columns are dropped in the data model, so we might have a bit of down time to just remove these.
* Few fields were not displayed correctly in dbt docs.

What's new:
* New user categorisation as an alert-based system. This can be enhanced in the future but so far it covers hell of a lot of cases. This also includes data quality alerts (deal not in HS, or account defaults to MVP launch).
* MVP Launch date moved to project yaml since it's a very standard date.

# 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: #30407
2025-06-13 14:05:30 +00:00
Pablo Martin
efe3f50a37 relax test that didn't make sense, revert wrong solution to issue from this morning 2025-06-12 17:56:24 +02:00
Joaquin
ae373a4fc9 silly me 2025-06-12 12:07:16 +02:00
Pablo Martin
20477dcc2c Merged PR 5447: Fix GJ Payments consistency with VRs
# Description

We're getting Data Alerts triggered for Guest Journey payments with no id for the guest. This is because we have payments in the DWH for which we still don't have the related Verification Request in the DWH as well.

This PR changes a `LEFT JOIN` with the verification request table into an `INNER JOIN`, effectively making it impossible for a payment to not have user data if the VR is not there.

We increase data latency (the payment won't show up until the related VR is in the DWH) but we win consistency (no orphan payments without their full details).

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

change left join to inner join
2025-06-12 08:06:08 +00:00
Joaquin Ossa
5abbff9560 Merged PR 5441: New fields for Invoicing & Crediting
# Description

New fields for Invoicing & Crediting that Finance needs for their usage.
Specifically they need to be able to differentiate the amount due because of invoice and not credit notes to know who to pay resolutions claims or not.
Will also add the amounts in local currency.

# 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 fields for Invoicing & Crediting

Related work items: #30204
2025-06-12 07:23:11 +00:00
Joaquin
6c7e80eb75 Addressed comments 2025-06-12 09:22:22 +02:00
Joaquin
80651ce60e New fields for Invoicing & Crediting 2025-06-11 16:57:10 +02:00
Joaquin
4a4e17f068 Add Flex API into KPI models 2025-06-11 14:44:07 +02:00
Oriol Roqué Paniagua
0021827368 Merged PR 5429: Rework Booking Source in int_core__bookings
# Description

This PR creates a proper Booking Source in `int_core__bookings` table. This mostly refers to ensure that whenever we do data requests tickets on this regards we have a proper logic in place (as last time we had issues because of this). Logic follows Gus recommendation on applying:

```
case
  when upper(coalesce(bsrc.booking_source, 'UNKNOWN')) = 'UNKNOWN'
  then b.raw_booking_source
  else bsrc.booking_source
end
```

where b. is Booking table and bsrc. is Booking Source table.

Things to note:
* A new `stg_core__booking_source` table is created, full-refreshed from the backend (less than 10 records)
* I added a unique test for `stg_core__booking` that was not in there. I don't document the rest of the model though.
* I remove the previous `id_booking_source` as it wasn't used and the logic in place should be far more accurate.
* I do NOT remove the existing `verification_request_booking_source`. I don't remember what's this but I see this is in use specially on Guest Insights (CSAT) and the legacy Truvi reporting (Bookings, PMS, etc.). Not the scope of this ticket to change it.
* I don't do further propagation, but potentially, this could be extended to New Dash Booking Summary as this source is being shown in the dashboard itself.

# 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: #30415
2025-06-10 14:38:35 +00:00
Pablo Martin
47c51dd18d missing filter to avoid new vrs appearing in the old cte 2025-06-10 16:35:16 +02:00
Pablo Martin
61ceda5234 Merge branch 'master' of ssh.dev.azure.com:v3/guardhog/Data/data-dwh-dbt-project 2025-06-10 15:08:24 +02:00
Pablo Martin
70cf3ce312 missing cast to make union work 2025-06-10 15:08:18 +02:00
Joaquin Ossa
8b415fc726 Merged PR 5427: data alert fix
# Description

Change in model `int_core__accommodation_to_product_bundle` to remove effective dates and use original start and end date.
Updated downstream models as well

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

data alert fix

Related work items: #30948
2025-06-10 12:57:05 +00:00
Joaquin
5f2bd33eed addressed comments 2025-06-10 14:45:53 +02:00
Joaquin
c5c25af59b addressed comments 2025-06-10 14:42:59 +02:00
Joaquin
1bd2fd9585 updated comments 2025-06-10 14:22:40 +02:00
Joaquin
a543fa1d83 changed names 2025-06-10 14:20:28 +02:00
Joaquin
e85de15d22 data alert fix 2025-06-10 13:58:50 +02:00
Pablo Martin
c8e4c88074 rename model to make version name explicit 2025-06-10 12:43:49 +02:00
Pablo Martin
1f8debc41b bump version 2025-06-10 12:21:33 +02:00
Pablo Martin
ad518c3083 change if block to avoid whitespace trimming 2025-06-10 11:55:11 +02:00
Oriol Roqué Paniagua
dc0abe6098 Merged PR 5403: Removes test accounts
# Description

This PR directly removes test accounts, and not just flag them, from:
* `int_core__unified_user`, which means is also propagated to `int_core__user_host`.

It does so by creating a new, extremely simple model named: `int_core__user_test_account`

Then, `int_core__user_host` is inner joined with a small explanation comment on:
* `int_core__accommodation`
* `int_core__unique_accommodation_to_user`
* `int_core__bookings`
* `int_core__verification_requests`
* `int_core__payments`

Effectively removing test accounts.

Lastly, any existence and usage of the column `is_test_account` has been removed -> mostly on New Dash-related models.

# Checklist

**As discussed in the daily, I'll be playing around in prod with this PR**

- [ ] 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.

Related work items: #27319
2025-06-06 12:17:49 +00:00
uri
08678427ad Bugfix - Host Resolutions Payments not filtering credit notes relevant status 2025-06-05 13:35:34 +02:00
Oriol Roqué Paniagua
9cbb748b0f Merged PR 5389: Adapt Test Account flag with Claim dedicated source
# Description

Applies the new dedicated source of truth of "is this account fake" based on Claims. This removes the previous logic.

In terms of differences, not much because:
1. New logic applied in the backend is pretty much the same as we had with a few improvements
2. This exclusion is only applied for New Dash. I checked the number of test accounts in New Dash and these are 2, the same ones in the new logic and for the old (currently in production). So no real impact.

Impact will come at the moment to start handling exclusions for KPIs, but this will done later on dedicated PRs to assess impacts properly.

# 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: #27319
2025-06-04 12:58:40 +00:00
Joaquin
5fdb5ffcde id_deal unique test 2025-06-04 12:28:52 +02:00
Pablo Martin
8b8b8441d3 Merged PR 5365: New version of CIH users through activity
# Description

This PR adds a new version to `int_core__check_in_cover_users`. The new version respectes the public interface of V1, but changes the strategy to determine which users get included in the list. Instead of relying on their account configuration (v1), v2 simply looks at whether they had any VR created offering CIH in the past 30 days.

This approach changes the semantic of the model, but we deem the new one reasonable.

The motivation behind this change is to ensure this models (1) keeps working after the activation of the Guest Products FF and (2) stays simple. Trying to follow a strategy where we look at both old and new configs was deemed very complex and didn't add much value.

# 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: #30165
2025-06-04 08:55:55 +00:00
Pablo Martin
a401153472 be more precise 2025-06-04 10:54:27 +02:00
Pablo Martin
0c11cfe739 removed unused upstream models 2025-06-04 10:53:24 +02:00
Pablo Martin
159813544f comment on why user and not host 2025-06-04 10:53:01 +02:00
Pablo Martin
54fca806b9 6 months, not one 2025-06-04 10:48:16 +02:00
Joaquin Ossa
536ab9b2a1 Merged PR 5364: Outstanding Payments
# Description

Adds a field that helps categorize whether we owe money to an account or they owe money to Truvi.
Outstanding Resolutions or Outstanding Invoices

The idea is to include this field as a filter in the Invoicing & Crediting report to help Finance and Resolutions in the payment and approval process.

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

Outstanding Payments

Related work items: #30204
2025-06-03 12:53:59 +00:00
Joaquin
1b362024f1 addressed comments 2025-06-03 14:17:47 +02:00
Joaquin
d50442e887 New model for deals total due amount 2025-06-03 11:53:40 +02:00
Joaquin
2746977671 commit wip 2025-06-03 10:53:22 +02:00
Joaquin
f768be9ea5 commit wip 2025-06-03 09:31:56 +02:00
Oriol Roqué Paniagua
affeac612a Merged PR 5366: Adds Incident data to Booking Summary
# Description

This PR moves the categorisation of Bookings with Incidents from the flagging specific model to Booking Summary, effectively keeping this at Booking ID level.

This also handles the direct dependency with the flagging categorisation model.

I also improved the documentation and test coverage on the Booking Summary as it's becoming more and more central to many areas.

# 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: #30676
2025-06-02 15:56:54 +00:00
Pablo Martin
92b144d78e Merged PR 5357: Adapt vr_check_in_cover model for Guest Products
# Description

This PR prepares the existing `int_core__vr_check_in_cover` model for the activation of the Guest Products feature flag.

It creates a second logic path which identifies VRs that have CIH in them ~~through product bundles~~ through looking at `stg_core__verification_request_to_guest_product `, and unions it with the old stuff.

The new CTE only gets called after the FF gets activated. This is defined in a var that we will need to adjust depending on when do we really activate the FF.

Note that these items are still pending:
- update the var to the right value once Lawrence pulls the trigger.
- clarify what the hell happens with CIH being "pushed" or not to ALL old dash hosts. This PR currently assumes this will NOT happen. If it will happen, we will need to change things.

# 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: #30165
2025-06-02 14:22:58 +00:00
Pablo Martin
1a35839deb new version and docs 2025-06-02 16:02:33 +02:00
Joaquin
cf5eaac593 Removed total 2025-06-02 15:59:34 +02:00
Joaquin
0fdfe651a2 Outstanding Payments 2025-06-02 15:58:01 +02:00
Pablo Martin
c6a06b49e9 mention double logic in docs 2025-05-30 15:50:30 +02:00