Commit graph

885 commits

Author SHA1 Message Date
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
Pablo Martin
3646a0ca09 tiny comment change in project readme 2024-10-02 15:28:29 +02:00
Joaquin Ossa
28b658a4fe fixed naming 2024-10-02 15:27:47 +02:00
Joaquin Ossa
0a880a138b created macro and fixed naming 2024-10-02 14:50:34 +02:00
Pablo Martin
bcd4ceec86 remove old docker compose 2024-10-02 14:49:47 +02:00
Pablo Martin
a2eaf21ecf more instructions 2024-10-02 14:49:29 +02:00
Oriol Roqué Paniagua
f2e21496fe Merged PR 3006: Integrating to staging Product Service related tables
# Description
This PR integrates into staging the following Core tables, regarding New Pricing:
- ProductService
- ProductServiceToPrice
- AppliedProductService (IT HAS BEEN REMOVED)

Models are also documented in staging. Tables contain data already but not necessarily records for New Dash, since still we have not had any paid service applied into a booking / V2 has not been launched yet.

New Dash modelisation for V2 will follow once these tables exist in staging, in order to be able to report 1) revenue and 2) services selected.

# 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. **N/A, few records so not a big deal. Might need to change in the future.**

# Other

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

Related work items: #20809
2024-10-02 09:13:10 +00:00
Pablo Martín
7d9d9faf71 Merged PR 3024: Activate country test for taxes
# Description

Activates a commented out test for verification payments v2. The test was deactivated because of some master data issues in the backend, but they were fixed after  #22148.

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

Related work items: #20043
2024-10-02 09:09:18 +00:00
Joaquin Ossa
008f0f9987 Merged PR 3025: more features into reporting
# Description

Included more information in the reporting model to add more details in the report

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

more features into reporting
2024-10-02 09:03:42 +00:00
Joaquin Ossa
aab6155b67 more features into reporting 2024-10-02 10:57:30 +02:00