Commit graph

387 commits

Author SHA1 Message Date
Joaquin Ossa
87eac12281 fixed bookings test to include null for verification_request_booking_source 2024-08-27 15:45:22 +02:00
Oriol Roqué Paniagua
b927635cf1 Merged PR 2650: Added int_core__booking_to_product_bundle in intermediate
# Description

Creates a new view with the bookings that come from New Dash, linked to the Product Bundles. Extensive documentation added, please check it out and if something is not clear I'll modify 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.
- [ ] I've picked the right materialization for the affected models. To be discussed. There's not huge data still so view looks ok to me. I guess, maybe, in the future, we will have a flag or similar in int_core__bookings to detect if a bookings comes from New Dash/New Pricing or not, but it's still early to decide. In any case this model is needed for immediate New Dash MVP reporting so I propose to keep it like this as a view and afterwards we can decide if it makes more sense to materialise it differently.

# Other

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

Related work items: #19570
2024-08-27 12:51:55 +00:00
Oriol Roqué Paniagua
c613d2859f Merged PR 2648: Fixes int_dates_by_deal tests
# Description

Fixes int_dates_by_deal tests

# 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: #20318, #20319
2024-08-27 09:34:07 +00:00
Oriol Roqué Paniagua
cb3d1e628b Merged PR 2647: Adding accommodation_to_product_bundle to stg
# Description

Adds accommodation to product bundle table from sync_core to staging. Note that this table still has no data because so far no listing has an associated product bundle.

Small change: removed in schema pending confirmation comments from Lou now that we've got an answer confirming it.

# Checklist

- [ ] The edited models and dependants run properly with production data: **N/A - there's no data :(**
- [X] The edited models are sufficiently documented.
- [ ] The edited models contain PK tests, and I've ran and passed them. **N/A - there's no data :(**
- [X] I have checked for DRY opportunities with other models and docs.
- [ ] I've picked the right materialization for the affected models. **N/A - there's no data :(**

# Other

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

Related work items: #19570
2024-08-27 08:57:23 +00:00
Oriol Roqué Paniagua
3d9c7cf571 Merged PR 2636: First version of User Product Bundle
# Description

Working version of User Product Bundle in intermediate. I tried to be quite explicit in the documentation of the model and the choices made (both in the code itself and in the schema). There's some opinionated choices so feel free to challenge them.

There's a small change on the user_migration model, in which I didn't properly set a field into a date.

Note that there's some schema comments pending from Lou's validation. Up to you if we prefer to wait until resolved or we move forward - to me, it's not blocking.

# 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: #19570
2024-08-26 09:18:56 +00:00
Oriol Roqué Paniagua
c8f4d2be70 Merged PR 2629: Integrates logic to detect New Dashboard users within DWH
# Description

First step towards reporting New Dash is to be able within DWH to know which hosts have been migrated.
In order to do so, and anticipating that there's going to be new phases in the future, I've created a `int_core__user_migration` model that reads from a configuration macro `get_new_dash_migration_phases_config` that will allow semi-automatic user retrieval in the future. This avoids nasty hardcoding within the model itself.
The information of whether a user is migrated, in which phase and when the phase was deployed is available at user level in the `int_core__user_host` table.

# 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. **-> I selected a view for this model since I don't believe we should materialse this data other than the user host table**

# Other

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

Related work items: #19570
2024-08-22 12:10:25 +00:00
Oriol Roqué Paniagua
85131985d8 Merged PR 2615: Beautification of KPIs dimensions
# Description

Changes:

* Separate 1) the internal naming of dimensions available within DWH vs. 2) the display of the dimensions in the reporting. Mainly it changes the "by_number_of_listings" to display "By # of Listings Booked in 12 Months". I edited the production macro since to me it's linked to when things are available for display.
* Add preceding zeros on the segmentation so it's ordered correctly. Before, the segment 21-60 was displayed before the 6-20.
* Also added some capital letters to the schema config of the reporting model :)

I attach a screenshot of how it looks in PBI in my local development branch to exemplify why this is "Beautification". Be aware that merging this also puts in production the dimensions.

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

# 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: #19325
2024-08-21 14:42:05 +00:00
Oriol Roqué Paniagua
83d913f9fc Merged PR 2607: Propagates and exposes multiple dimension handling for KPIs
# Description

This PR ensures the propagation of the dimensions for KPIs across the key aggregating and exposing models. Additionally, provides these 2 new fields in reporting while **not affecting the current data display**, thus it's safe to work in the PBI report without needing to work in 2 PRs in parallel.

**Changes:**

**1 - Intermediate, `int_mtd_vs_previous_year_metrics`:**

* Removes the temporary filter on `where dimension in ({{ production_dimensions }})`. This will be applied directly to reporting later. This ensures that the new dimension on customer segmentation is fully available only within intermediate.
* Adds `dimension` and `dimension_value` granularity. This includes: 1) adding these fields, 2) joining by these fields with all the source CTEs containing the source models with metrics - which in turn needs the change of the dates model - and 3) joining by these fields in the self-join to compute the incremental vs. previous year.
* Changes on the schema file

**2 - Intermediate, `int_mtd_aggregated_metrics`:**

* Adds `dimension` and `dimension_value` granularity. This includes only adding these fields.
* Changes on the schema file

**3 - Reporting, `mtd_aggregated_metrics`:**

* Adds the filter removed on `int_mtd_vs_previous_year_metrics`. This ensures that only the Global dimension is available for the reporting, thus **no changes from user POV**.
* Adds `dimension` and `dimension_value` granularity. This includes only adding these fields
* Changes on the schema file

# 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: #19325
2024-08-20 15:42:27 +00:00
Joaquin Ossa
db9f9a6c25 Merged PR 2599: Added address_validation to int_core__vr_check_in_cover
# Description

Added address_validation to int_core__vr_check_in_cover for check in hero report in PBI

# 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: #17069
2024-08-20 12:06:51 +00:00
Oriol Roqué Paniagua
80abac494a Merged PR 2583: Invoicing metrics per customer segmentation
# Description

Silly change:

* Modifies `int_core__mtd_guest_payments_metrics` to apply the proper key on date, dimension and dimension_value.
* -> *The weird thing is that the previous dbt test I run worked well. Is it possible that the configuration in the schema file prevails on top of the model configuration? I thought it was the other way around...*

Main changes:

* Modifies `int_xero__mtd_invoicing_metrics` to include the customer segmentation based on listings.
* `schema.yaml` is also affected including new fields and tests
* Added the macro to retrieve the production dimension in `int_core__mtd_vs_previous_year_metrics` to avoid propagating this upwards and messing up with the data display.

Overall, follows a similar strategy as we did for Booking, Guest Journey, Deal, Accommodation and Guest Payments metrics. For reference, [here's the previous PR on Guest Payments](https://guardhog.visualstudio.com/Data/_git/data-dwh-dbt-project/pullrequest/2580).

This is the last PR on the source models for KPIs. Will follow: propagation + exposure

# Checklist

- [X] The edited models and dependants run properly with production data.
* **Important note**: this segmentation provides null values for all API-related KPIs. Makes sense, since the 4 deal id we have for APIs do NOT have, or have had, a listing linked to them. I'd say it's not a blocker.
- [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: #19325
2024-08-20 12:05:53 +00:00
Oriol Roqué Paniagua
68f490f9fa Merged PR 2593: Modifying int_core__user_host to take into account KYG users
# Description

Adds the possibility of considering as Hosts those users that come from Know Your Guest (KYG), after the discussion with Ben R yesterday. This uses the Claim table, specifically on any Kyg claim type:
- KygRegistrationSignUpType
- KygRegistrationIntegrationTypeName
- KygMvp

From what I see compiling the new vs. the previous version of this model and running into production to have up-to-date data, this increases the number of hosts in 8, from 2.608 to 2.616 so it's not a massive change in volumes.

I also modified the schema for this model to reflect the new logic.

# 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: #19513
2024-08-20 11:27:43 +00:00
Joaquin Ossa
45f7f640ba Changed names for easier understanding 2024-08-20 12:56:52 +02:00
Joaquin Ossa
c9fb99743a Merge remote-tracking branch 'origin/models/17069_addressvalidation_to_reporting' into models/17069_addressvalidation_to_reporting 2024-08-20 12:32:58 +02:00
Joaquin Ossa
8171fda345 Merged PR 2578: Created address_validations in intermediate
# Description

Created address_validations in intermediate for check in hero

# 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: #17069
2024-08-20 09:46:27 +00:00
Joaquin Ossa
1c60099b0b Removed coalesce so it includes NULL for failed validations 2024-08-20 10:02:04 +02:00
Joaquin Ossa
798fc7b937 Removed coalesce so it includes NULL for failed validations 2024-08-20 09:49:34 +02:00
Joaquin Ossa
ff962608ad Added Address_validation to int_core__vr_check_in_cover 2024-08-20 09:27:49 +02:00
Oriol Roqué Paniagua
e1d04c2e4e Merged PR 2580: Guest Payments metrics per customer segmentation
# Description

Modifies `int_core__mtd_guest_payments_metrics` to include the customer segmentation based on listings. `schema.yaml` is also affected including new fields, tests and apply the proper naming (from guest revenue to guest payments). I also modified a silly naming that was referring to deals to refer to listings/accommodations, my bad.
Added the macro to retrieve the production dimension in `int_core__mtd_vs_previous_year_metrics` to avoid propagating this upwards and messing up with the data display.

Overall, follows a similar strategy as we did for Booking, Guest Journey, Deal and Accommodation metrics. For reference, [here's the previous PR on Accommodations](https://guardhog.visualstudio.com/Data/_git/data-dwh-dbt-project/pullrequest/2575?_a=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.
- [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: #19325
2024-08-19 11:45:42 +00:00
Oriol Roqué Paniagua
997cb85c6c Merged PR 2577: Adding get_kpi_dimensions_for_production
# Description

Takes into account @<Pablo Martín> 's feedback from the previous PR, slightly modified. This PR separates 1) the dimensions while developing vs. 2) the dimensions once these are available for production. This are within the same file of macro configuration for KPIs, namely `business_kpis_configuration`.

End-goal, all CTEs in `int_mtd_vs_previous_year_metrics` will read from this new macro `get_kpi_dimensions_for_production`, so eventually we won't need any hardcode once we want to add new dimensions. In the meantime, I'll be adding this new line for each PR (still 2 missing :D)

# Checklist

- [X] The edited models and dependants run properly with production data.
- [X] The edited models are sufficiently documented.
- [ ] 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.
- [ ] 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: #19325
2024-08-19 09:57:28 +00:00
Joaquin Ossa
e8b76e130e Created address_validations in intermediate 2024-08-19 11:43:54 +02:00
Oriol Roqué Paniagua
89dd8845cc Merged PR 2575: Accommodation metrics per customer segmentation
# Description

Modifies `int_core__mtd_accommodation_metrics` to include the customer segmentation based on listings. `schema.yaml` is also affected including new fields and tests. Hardcoded `int_core__mtd_vs_previous_year_metrics` to avoid propagating this upwards and messing up with the data display.

Overall, follows a similar strategy as we did for Booking, Guest Journey and Deal metrics. For reference, here's [the previous PR on Deal](https://guardhog.visualstudio.com/Data/_git/data-dwh-dbt-project/pullrequest/2534). I noticed that I mixed the schema tests of Deals and Accommodations, this PR should fix both.

# 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: #19325
2024-08-19 09:03:42 +00:00
Joaquin Ossa
52f42b9e9b Revert "Created address_validation in staging"
This reverts commit 4a6fdd5ac7.
2024-08-16 12:57:54 +02:00
Joaquin Ossa
4a6fdd5ac7 Created address_validation in staging 2024-08-16 12:51:13 +02:00
Oriol Roqué Paniagua
d323460d1a Merged PR 2534: Deal metrics per customer segmentation
# Description

Modifies `int_core__mtd_deal_metrics` to include the customer segmentation based on listings. `schema.yaml` is also affected including new fields and tests. Hardcoded `int_core__mtd_vs_previous_year_metrics` to avoid propagating this upwards and messing up with the data display.

Overall, follows a similar strategy as we did for Booking and Guest Journey metrics. For reference, [here's the previous PR on GJ](https://guardhog.visualstudio.com/Data/_git/data-dwh-dbt-project/pullrequest/2533).

# 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: #19325
2024-08-09 10:03:35 +00:00
Oriol Roqué Paniagua
6a660aeac8 Merged PR 2533: Guest Journey metrics per customer segmentation
# Description

Modifies `int_core__mtd_guest_journey_metrics` to include the customer segmentation based on listings. `schema.yaml` is also affected including new fields and tests. Hardcoded `int_core__mtd_vs_previous_year_metrics` to avoid propagating this upwards and messing up with the data display.

Overall, follows a similar strategy as we did for Booking metrics.

# 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: #19325
2024-08-09 08:41:14 +00:00
Joaquin Ossa
87bee4a95a Fixed models for mtd_aggregated_metrics 2024-08-08 17:06:11 +02:00
Oriol Roqué Paniagua
6caac0bb02 Merged PR 2527: Revert 'Added relative_increment_with_sign_format'
# Description

_Describe your motivation and changes here._

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

# Description

Added relative_increment_with_sign_format for special formatting in PBI

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

Added relative_increment_with_sign_format

Reverts !2524

Related work items: #19559
2024-08-08 13:27:33 +00:00
Oriol Roqué Paniagua
b61fe3f70d Merged PR 2522: Don't Repeat Yourself for KPIs - Applied to Bookings
# Description

What's new:
- Creation of `get_kpi_dimensions`: new macro to have a single point of source of configuration for dimensions for the KPIs. It's a way to enforce global variables on-demand. I kind of like this approach and we could do it for Xero models as well :)
- Modification of `int_core__mtd_booking_metrics` and `int_dates_mtd_by_dimension`: removal of duplicated code within the dimension context. Uses Jinja code and applies different configurations depending on the dimension chosen. Still, different metrics are placed in different CTEs. I believe it might be possible to also configure metrics BUT at the cost of over-complexifying the macro logic, so I wouldn't go for it at this stage.

# 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: #19325
2024-08-08 13:19:57 +00:00
Joaquin Ossa
8ac1eb4717 Added relative_increment_with_sign_format 2024-08-08 14:48:12 +02:00
Oriol Roqué Paniagua
afc20f0e20 Merged PR 2519: mtd bookings with 2 dimensions
# Description
This is a first idea of how I'd like to add dimensionality in the KPIs for the mtd models. For the moment, I keep deal_id apart, so I just touch the "mtd" models, that so far only contained "global" metrics.

In this case I include the listing segmentation (0, 1-5, 6-20, etc) in the bookings. To do this, I created 2 new fields: dimension and dimension_values.
I also created a "master" table with `date` - `dimension` - `dimension_value` called `int_dates_mtd_by_dimension`

Important notes:
- I force a hardcode in `int_mtd_vs_previous_year_metrics`. This is to not break production.
- You will notice how repetitive the code is starting to look. My intention with this PR is that we are happy with this approach on the naming, the strategy for joins, etc. If that's ok, next step is going to be doing macros on top. Think of the state of `int_core__mtd_booking_metrics` as the "compiled version" of the macro that should come afterwards.

# 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.
- [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: #19325
2024-08-08 09:11:01 +00:00
Oriol Roqué Paniagua
7177b41e19 Merged PR 2516: Create host_user and user_role in intermediate
# Description

Adds 2 new tables:
- `int_core__user_role`: contains the relationship of a given user has a role.
- `int_core__user_host`: based on the previous table, it selects the users and main information from those users that are considered as hosts according to the role they have.

Note: I needed to change the test in stg. A user, generally, can have no role, one role, or multiple roles. Thus we cannot propagate this information in the unified_user model.

# 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: #19513
2024-08-07 14:28:34 +00:00
Oriol Roqué Paniagua
94bdc53adf Merged PR 2498: Materialise int_dates_mtd and int_dates_by_deal as table to improve performance
# Description

Materialise int_dates_mtd and int_dates_by_deal as tables. This should improve the run speed as seen in local by quite a bit, and hopefully provide a better starting point for adding new dimensionality on business kpis.

I also documented these 2 models, that were missing :)

# 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: #19514
2024-08-06 15:03:32 +00:00
Joaquin Ossa
b1bdbc0f39 Merged PR 2459: duplicated_bookings modification
# Description

I modified the model of duplicated_bookings, I saw it had some errors and data that was not being used

# 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: #18875
2024-08-05 09:44:11 +00:00
Joaquin Ossa
a82ab121f1 Deleted an extra line 2024-08-01 16:18:25 +02:00
Joaquin Ossa
02ddac3167 Added a coalesce for the booking_fee_in_gbp calculation for old cases where there is no preferred currency for the user_guest 2024-08-01 16:15:48 +02:00
Joaquin Ossa
25e657014a Modified filter and table used 2024-08-01 14:32:45 +02:00
Joaquin Ossa
0281e6e72e Included the exchange rate to GBP in the model 2024-08-01 12:58:36 +02:00
Joaquin Ossa
646ff7276a Added function to get false instead of null in is_duplicate_booking 2024-07-31 16:38:33 +02:00
Joaquin Ossa
78ffefb145 Thanks Uri for the catch, then when id_user_guest is NULL it won't be considered a duplicate. 2024-07-31 16:23:27 +02:00
Joaquin Ossa
6cb06b73cd Modified how stg_core__booking was being called and some typo errors 2024-07-31 15:32:54 +02:00
Joaquin Ossa
00e7554300 Creation of host_booking_fees 2024-07-31 15:16:15 +02:00
Joaquin Ossa
c4fc81d934 Included tests 2024-07-31 12:48:57 +02:00
Joaquin Ossa
9996368e22 I modified the model of duplicated_bookings, I saw it had some errors and data that was not being used 2024-07-31 12:44:54 +02:00
Oriol Roqué Paniagua
65ebd8c2d2 Merged PR 2441: KPIs - Customer Segmentation based on listings
This PR creates a new model int_core__mtd_accommodation_segmentation that provides the customer segments based on listing activity:
- 0
- 1-5
- 6-20
- 21-60
- 61+

For end of April 2024, the volume distribution on number of deals and total listings booked is:
![image.png](https://guardhog.visualstudio.com/4148d95f-4b6d-4205-bcff-e9c8e0d2ca65/_apis/git/repositories/54ac356f-aad7-46d2-b62c-e8c5b3bb8ebf/pullRequests/2441/attachments/image.png)
For information, I estimate that around 3% of listings with bookings are missed, according to the data displayed in the KPIs for 30th April 2024. This is because we enforce deal-based categorisation (same happens with the deal view, anyway)

Related work items: #19325
2024-07-30 13:21:08 +00:00
Oriol Roqué Paniagua
b79df1b42e Merged PR 2433: Remove Deposit payments from Guest Payments metric
After discussion with Pablo on the fact that Deposits are only with status "Paid" for a given time before they get Cancelled or Refunded, we just believe it's best to remove the Deposits amount from the Guest Payments metric. In any case, this does not represent a Revenue source... This was discovered while doing the data quality assessment for revenue figures ([here](https://www.notion.so/knowyourguest-superhog/Data-quality-assessment-DWH-vs-Finance-revenue-figures-6e3d6b75cdd4463687de899da8aab6fb))

Before, `total_guest_payments_in_gbp` was a standalone metric that computed any payment by the guest with status paid. We were computing revenue based on the `total_guest_income_in_gbp`, which mainly was the sum of waiver payments, deposit fees (not deposit itself!) and check in hero fees.

Mainly what I did is:
- remove the existing `total_guest_payments_in_gbp` in the source models (int_core__xxx_guest_payments_xxx)
- rename the already existing `total_guest_income_in_gbp` to `total_guest_payments_in_gbp`

Related work items: #18787, #18914
2024-07-29 15:15:09 +00:00
Oriol Roqué Paniagua
756d1c54d5 Merged PR 2429: Business KPIs - Revenue details
Exposes the following metrics:
1. Invoiced Booking Fees
1. Invoiced Listing Fees
1. Invoiced Verification Fees
1. Invoiced Guesty Fees
1. Invoiced E-Deposit Fees
1. Deposit Fees
1. Waiver Amount Paid by Guests
1. Waiver Amount Paid back to Hosts
1. Check-In Hero Amount Paid by Guests

This PR is only for Global metrics, the one by deal id will follow separately.
Keep in mind that merging this PR will make the data appear in the report.

Related work items: #18914
2024-07-29 13:16:19 +00:00
Oriol Roqué Paniagua
7e9b3733c8 Merged PR 2425: Fix model documentation names
Fix model documentation names after last PR, it triggered some warnings since the name was not correct. My bad :)

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

Related work items: #18914
2024-07-29 09:38:44 +00:00
Oriol Roqué Paniagua
1b1b97380a Merged PR 2422: Ensure that guest payments models follow nomenclature
Small refactor to follow up on last week's PR. We removed from the Guest Revenue models the host-takes-waiver aspect, thus these models are now only depending from Core. We just need to migrate it from cross to core.

One small detail as well, since we do not take into account at these models level the host-takes-waiver, technically, I would not call these models revenue but rather Guest Payments. This is why I also took the opportunity to apply this name.

Changes:
- `int_monthly_guest_revenue_by_deal` is now `int_core__monthly_guest_payments_history_by_deal`, and the location has changed from `intermediate.cross` to `intermediate.core`
- `int_mtd_guest_revenue_metrics` is now `int_core__mtd_guest_payments_metrics`, and the location has changed from `intermediate.cross` to `intermediate.core`
- Schema changes, moving these 2 models' documentation with the new naming from Cross to Core
- Provide continuity in following dependants: `int_mtd_vs_previous_year_metrics` and `int_monthly_aggregated_metrics_history_by_deal` now read from the 2 new models respectively. Additionally, the model alias has changed from `guest_revenue` to `guest_payments` to keep consistency.

This PR does not expose new metrics, but should keep the existing ones unaffected.

Related work items: #18914
2024-07-29 09:10:58 +00:00
Oriol Roqué Paniagua
04eb09c318 Merged PR 2413: Adding submetrics of guest revenue by deal
Adding submetrics of guest revenue by deal:

- deposit_fees_in_gbp
- checkin_cover_fees_in_gbp
- waiver_payments_in_gbp

all of this adds up to

- total_guest_income_in_gbp

and the total_guest_revenue_in_gbp is now computed by subtracting waivers paid to hosts, coming from the invoiced model. This also affects the total revenue computation and the weighted metrics.

This PR it's completely equivalent to the [Adding submetrics of guest revenue](https://guardhog.visualstudio.com/Data/_git/data-dwh-dbt-project/pullrequest/2381?path=/models/intermediate/cross/int_mtd_guest_revenue_metrics.sql&_a=files), that was already merged for the global view. The only difference is that this one is for the deal-based part. It does not expose the metrics to the report.

A follow-up PR is expected to apply the correct naming conventions for guest revenue models.

I recommend checking the first commit, the one that applies the changes, and should be easily understandable with the link to the previous PR. There's a couple of additional commits that only affect formatting.

Related work items: #18787, #18914
2024-07-26 10:42:48 +00:00
Joaquin Ossa
e2fb73d558 Added count distinct 2024-07-24 17:31:25 +02:00