Commit graph

894 commits

Author SHA1 Message Date
Pablo Martin
002eadc362 add table alias optional argument to macro 2024-10-14 11:37:37 +02:00
Pablo Martin
c0718daaa9 deal pipeline 2024-10-14 11:10:07 +02:00
Oriol Roqué Paniagua
7f9c038fc0 Merged PR 3120: Creation of growth score by deal model for top losers report (intermediate)
# Description

Creates a model to identify deal growth based on YoY performance of Created Bookings, YoY performance of Listings Booked in Month and one month shifted YoY performance of Revenue.
Also added weighted score to account for revenue size.

# 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. **Probably something can be done here, sorry I've not checked.**
- [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: #22635
2024-10-11 07:20:35 +00:00
Oriol Roqué Paniagua
52f01adc11 Merged PR 3127: (3/3) Revenue renaming - KPIs by deal
# Description

Main changes:
* Guest revenue is now guest payments. PBI uses Guest revenue, so alias is changed at reporting level, while it uses guest_payments_in_gbp field.
* Removal of Waiver Amount Paid back to Host to Guest revenue and Total revenue.

# Checklist

- [X] The edited models and dependants run properly with production data.
- [NA] 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: #22688
2024-10-10 14:01:49 +00:00
Oriol Roqué Paniagua
745f00bad2 Merged PR 3124: 1/3 - Revenue renaming Main KPIs - MTD scope
# Description

Adapts revenue figures in Main KPIs - MTD scope or global view. This includes MTD, Monthly Overview, Global Evolution over Time, Detail by Category. In essence, everything that is not by deal.

The changes are mainly 2:
* Remove the line that deducts the `Waiver Amount Paid Back to Hosts` in all metrics except the `Waiver Net Fees`. This effectively means that the previous `Guest Revenue` = `Guest Payments`, thus I dropped all 3 `Guest Payments` metrics.
* Do a renaming at metric display level, but not in the code. This means that I remove the computation of `guest_revenue_in_gbp` for instance and keep `guest_payments_in_gbp`, and apply the renaming later on, since the modelisation already accounts for defining metric names differently from those of the fields. For the rest of metrics, I revised all metrics name and did changes based on the [whiteboard](https://whiteboard.office.com/me/whiteboards/p/c3BvOmh0dHBzOi8vZ3VhcmRob2ctbXkuc2hhcmVwb2ludC5jb20vcGVyc29uYWwvcGFibG9fbWFydGluX3N1cGVyaG9nX2NvbQ%3d%3d/b!T2D3opQuBECSDnhuFZrUacFu3TxvSvdIsnI4Dxsh2IuaB1AigbciRqkqte61I4wz/01H5SI4J4L7HTPJGUT7JGYKTOSQYYWACXU). I also changed the dedicated data tests in Main KPIs to ensure it's working. I also changed the exclusion logic in reporting based on the name of the metric to not display metrics that depend on the invoicing cycle unless it's 2 months ago or before.

To keep in mind:
* Merging this will automatically display the new figures/naming in production. Might be wise to communicate to stakeholders since some key metrics (namely, Guest Revenue / Total Revenue) will change the meaning.
* We also need to do these changes in the metrics by deal part of the computation. I'd do first the removal of these fields in the PBI report (and take the opportunity to change the Data Catalogue) and then do the PR in DWH to change the logic. Before that though let's check that the names included in this PR are the correct ones :)

# Checklist

- [X] The edited models and dependants run properly with production data.
- [NA] 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: #22688
2024-10-10 13:46:59 +00:00
Pablo Martín
bf3d1344a3 Merged PR 3123: Add new guesty claims seed
# Description

Add a new seed with some data coming from a manual file as part of #22703.

I'm adding it here to make it available for some Python notebook errands. Might be useful in the future as well.

# Checklist

- [X] The edited models and dependants run properly with production data.
- [X] The edited models are sufficiently documented.
- [NA] 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: #22703
2024-10-10 12:35:10 +00:00
Pablo Martin
744f8c6bf6 remove tests 2024-10-10 14:34:15 +02:00
Pablo Martin
8253b370d7 add new seed 2024-10-10 14:31:09 +02:00
Pablo Martín
ee9d563c3e Merged PR 3116: edeposit invoicing - Point exposure to the table that PBI actually uses
# Description

The exposure for this report is wrong. It reads from a differnt model than what it states. This PR points to the actual model.

# Checklist

- [NA] The edited models and dependants run properly with production data.
- [NA] The edited models are sufficiently documented.
- [NA] 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: #22186
2024-10-09 15:57:19 +00:00
Pablo Martin
936b4878cf point exposure to the table that PBI actually uses 2024-10-09 17:54:32 +02:00
Pablo Martin
a1a68d236b removed incorrect uniqueness test 2024-10-09 17:41:43 +02:00
Oriol Roqué Paniagua
a26665512f Merged PR 3100: Fixes exposures. Fixes accepted roles
# Description

PR to fix dbt test on user_role, by just adding the new API role "CancellationApi"

# 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: #22627
2024-10-09 08:21:13 +00:00
uri
7302790d42 Add new API role CancellationApi in user_role accepted values 2024-10-09 10:17:34 +02:00
Pablo Martín
071aa8ddd5 Merged PR 3094: Split e-deposit and Athena
# Description

This PR artificially splits Athena and e-deposit domains into two different lines of folders in staging, intermediate and reporting. I say artificially because the `verifications` data still comes from the same sync table for both lineages.

This is in preparation for the upcoming database migration in which the source databases will be effectively split.

The reporting models in the `reporting/edeposit` folder are still untouched because they have PBI dependencies. Once the PBIs are managed (after this PR), we will make a different PR to clean them up and remove deprecated models and docs here.

# 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: #22186
2024-10-08 15:56:59 +00:00
Pablo Martin
09fe9ded77 signal model deprecation more clearly, unlock a few tests 2024-10-08 17:44:31 +02:00
Pablo Martin
ea4274b37c missing docs 2024-10-08 17:25:16 +02:00
Pablo Martin
2d42d99543 docs for athena int 2024-10-08 14:54:11 +02:00
Pablo Martin
c81f6c955d move docs for int_edeposit__guesty_verifications 2024-10-08 14:45:50 +02:00
Pablo Martin
ba29afa3bd docs for athena staging 2024-10-08 14:41:17 +02:00
Pablo Martin
13819c9f99 update edeposit staging 2024-10-08 14:39:25 +02:00
Pablo Martin
d3de03890c more todos 2024-10-08 14:37:00 +02:00
Pablo Martin
d21d9b6a01 todos 2024-10-08 14:37:00 +02:00
Pablo Martin
3dbeaf0575 reporting model for athena 2024-10-08 14:37:00 +02:00
Pablo Martin
654255321f fix typo in version 2024-10-08 14:37:00 +02:00
Pablo Martin
d16647ac72 push upstream the filter 2024-10-08 14:37:00 +02:00
Pablo Martin
67dcc8b237 split staging layer 2024-10-08 14:37:00 +02:00
Pablo Martin
761cf409c6 push filter down one model 2024-10-08 14:37:00 +02:00
Pablo Martin
30c73b1ab9 duplicate athena verifications 2024-10-08 14:37:00 +02:00
Pablo Martin
67b8e1263d move guesty to athena folder 2024-10-08 14:37:00 +02:00
Oriol Roqué Paniagua
b70f426f8e Merged PR 3089: Remove custom pricing/protection
# Description

This PR aims to remove custom pricing/protection fields for New Pricing.
After discussing with Clay, custom pricing/protected amounts are not allowed in New Pricing. This user-specific changes might be applied in the form of discounts, but these are not defined/implemented yet.

There were some fields created in the New Pricing tables that were considering the custom possibility, and Gus confirm that these will come as Null. So I prefer to delete them now, have clean code, and if in X months dev team wants to remove these, we should be good.

# 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: #20809
2024-10-08 11:48:25 +00:00
Oriol Roqué Paniagua
ea8972a91b Merged PR 3090: Propagates Protection Plan to intermediate, for price and cover
# Description

Propagates Protection Plan to price and cover to intermediate. Ideally I wanted to have a single table that contained prices + covers, but it is not straight forward to assume:
*  if a modification of the amount covered by a protection plan will create a new protection plan id, or not
* if a modification of the price a protection costs will create a new protection plan id, or not
So I keep it split for the time being. Besides, use cases might be different, ex: I want to see all prices of services (product + protection plan, but no need for cover).

# Checklist

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

# Other

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

Related work items: #20809
2024-10-08 11:44:52 +00:00
Oriol Roqué Paniagua
bad27ecbc3 Merged PR 3087: Adding int_core__product_service_to_price
# Description

Adds int_core__product_service_to_price.

This model is the equivalent of staging but just adding currency code, product service name and a few boolean fields to identify if the product service to price is currently active and if it's the default price or not.
Currently it's a view since it has 16 records, likely it can be transformed into a table in the future.

The idea will be to create a similar table for protection_plan.

# 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.
- [NA] I've picked the right materialization for the affected models. -> We will see in the future if needs to be adapted

# Other

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

Related work items: #20809
2024-10-08 11:39:34 +00:00
Oriol Roqué Paniagua
9dc1b4b99f Merged PR 3084: Provide Protection Name in User Product Bundle
# Description

Small PR to provide the Protection Name into User Product Bundle
There's some additional automatic formatting changes

# Checklist

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

# Other

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

Related work items: #20809
2024-10-08 08:48:10 +00:00
uri
911603f2e8 Documenting protection name fields in user_product_bundle 2024-10-07 17:21:52 +02:00
uri
9424a96707 Adding protection names 2024-10-07 17:18:41 +02:00
Pablo Martín
c503d797b6 Merged PR 3075: Remove edeposit email flag test
# Description

Deactivates the accepted values test that we had in the edeposit verifications staging table.

The table is more complex that we initially thought (multiple values can appear comma separated) and we don't really care enough to increase to make it worth it to increase the complexity of the test, so we are removing it.

# Checklist

- [NA] The edited models and dependants run properly with production data.
- [NA] 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.
2024-10-07 12:34:17 +00:00
Pablo Martin
0c3be659b1 remove test 2024-10-07 14:28:05 +02:00
Pablo Martín
167875a8e8 Merged PR 3034: FDW local setup
# Description

This PR changes the documentation on how we set up our local Postgres instance to leverage Foreign Data Wrappers to have a more convenient development workflow in dbt.

@<Joaquin Ossa> and @<Oriol Roqué Paniagua> : for this review, I want to ask you to:
- Take a look at the entire `dev-env/local_dwh.md` file with a critical eye and make suggestions, spot mistakes, look for gaps, etc.
- And also follow and use (so we know the instructions are complete) the section `dev-env/local_dwh.md#Filling `dwh` with copied data`. This bit is new and we haven't discussed, but I hope the instructions are self-descriptive. Please, try to follow them and validate that you can run things as described before approving this PR.
2024-10-04 13:35:02 +00:00
Pablo Martin
8fcf1a2966 atypos 2024-10-04 15:34:47 +02:00
Oriol Roqué Paniagua
f292bc84ba Merged PR 3059: Keep latest booking to product bundle program
# Description

This PR fixes today's issue on dbt test, since we had a duplicated booking in this table.

Technically, according to Daga, a booking can only be overridden with a new program ONLY if the first program was the default BasicScreening, and it's a new bundle containing a Paid Service. Once there's a product bundle applied to a booking that contains a paid service, it cannot be overridden.

Thus in essence, by just keeping the latest update date it will only take into account the potential switch to a paid service, that is what really matters, and cannot change 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.
- [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: #22346
2024-10-04 13:16:08 +00:00
Joaquin Ossa
b8caa18352 Merged PR 3000: Stg Hubspot form_submissions
# Description

Creation on stg_hubspot__form_submissions 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.
- [ ] 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.

Stg Hubspot form_submissions
2024-10-04 09:49:54 +00:00
Joaquin Ossa
9ad768f6bb Merged PR 2990: staging Hubspot contacts
# Description

Creation on stg_hubspot__contacts 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.
- [ ] 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.

staging Hubspot contacts
2024-10-04 09:48:37 +00:00
uri
4de5c08a26 Keep latest booking to product bundle state 2024-10-04 10:32:15 +02:00
Oriol Roqué Paniagua
3480d4d787 Merged PR 3047: Override migration date with join date if join date is after migration date
# Description

Quick fix to make lower_limit_migration_date_utc more robust for new dash reporting purposes. I noticed some cases in which users were actually created after the migration date. In these cases, I just keep joined 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.
- [ ] 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: #22331
2024-10-04 07:16:52 +00:00
Joaquin Ossa
751a95f9ae modified macro 2024-10-04 08:42:28 +02:00
Oriol Roqué Paniagua
28c554de63 Merged PR 3038: Adding Protection tables in the scope of New Pricing/Dashboard
# Description

This PR creates 3 new models in staging:
- `stg_core__protection_plan`: main information of a protection plan. Here I denormalise the info coming from Protection, meaning, Protection is not a standalone model.
- `stg_core__protection_plan_to_price`: How much does a protection service cost? It's very similar to the model product_service_to_price.
- `stg_core__protection_plan_cover`: How much does a protection service protects, i.e., covers? I took the liberty of modifying the original name since it was confusing to me. Let me know if you'd like to modify the name.

# Checklist

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

# Other

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

Related work items: #20809
2024-10-03 11:05:05 +00:00
Oriol Roqué Paniagua
3ba65e8ed5 Merged PR 3041: Adapts outlier detection
# Description

This PR adapts the outlier detection test for KPIs. Specifically:

1) It removes not additive lifecycle metrics, which are:
- Churning Listings/Deals
- Listings/Deals Booked in Month/6 Months/12 Months

this is because the test computes data at daily level by just doing value/number of days. The thing is that for all these metrics, Listing/Deal bookings are computed **uniquely over a month**, i.e., if a listing is booked 100 times in a single month, it will only appear as once. Thus it makes it fail on early days of the month. Similar case for Churn, in this case, at the beginning of the month we have the total maximum number of listing/deals that are expected to churn if nothing happens, and this can decrease a bit over time if these get reactivated.

2) I reduced the variance threshold from 10 to 8, meaning now the alerts will raise more often. This is because we're removing some wrongly assessed metrics from the computation, thus I feel we can leave with better fine-grained detection. It could be even further reduced (8 is still super high tolerance) since today maximum signal-to-noise ratio was less than 4 on checkout bookings, but I'd propose to see how it goes in the following days and then assess if it's necessary to reduce it even further.

# Checklist

- [X] 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.
2024-10-03 10:43:15 +00:00
Joaquin Ossa
e9f16342e7 added tests 2024-10-03 12:19:27 +02:00
Oriol Roqué Paniagua
8e4e967c20 Merged PR 3028: Adding int_core__user_product_bundle_contains_services
# Description

This PR adds a new table named `user_product_bundle_contains_services` in intermediate core.

Mainly, this table serves as a bridge between `user_product_bundle` and `product_services`. A `product_bundle` within `user_product_bundle` can contain 1 or several services, and this was stated in the field `contains_product_services`. The value of this field corresponds to the sum of `product_service_binary_tier` from the services that apply within that bundle. Even though the information is quite concise using this format, it adds extra complexity for analytical purposes, so this new table just duplicates the `user_product_bundle` main attributes as many times as services are contained.

For example:
`id_user_product_bundle` = 383 contains one unique bundle named Basic Program. This bundle has the `chosen_product_services` = 257, which can only be decomposed in power of 2 as of the sum of 256 + 1. This bundle therefore contains 2 services, Basic Screening (`product_service_binary_tier` = 1) and Waiver Pro (`product_service_binary_tier` = 256). Thus, in the new table, we will have 2 records and remove all this logic to something more standard, as seen in this screenshot:

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

# 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. *N/A - there's no PK in this table, but the combination of columns that should be unique is tested*
- [X] I have checked for DRY opportunities with other models and docs.
- [X] I've picked the right materialization for the affected models.

# Other

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

Related work items: #20809
2024-10-02 14:54:03 +00:00
Pablo Martin
34d0e9cffb activate vacuum analyze again 2024-10-02 15:32:22 +02:00