Commit graph

955 commits

Author SHA1 Message Date
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
Joaquin Ossa
bf01360fba Merged PR 3020: new features dates
# Description

Added 2 new columns with a concatenation of month number and full name o short name

# 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.
- [ ] 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 features dates
2024-10-02 08:18:52 +00:00
Joaquin Ossa
c5cc2e2167 new features dates 2024-10-02 10:11:48 +02:00
Joaquin Ossa
e001691ed4 Merged PR 3019: fixed cancellation fee charge
# Description

Fixed cancellation fee charge that was being applied to every verification when the threshold was passed, now it will be applied only to those that are actually cancelled

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

fixed cancellation fee charge
2024-10-02 07:56:42 +00:00
Pablo Martín
d4d15dbed4 Merged PR 3015: Add Kosovo to VAT rates
# Description

This PR adds Kosovo to our guest vat rates seed data. It's an exceptional record because it doesn't comply with the ISO 3166 that the model is supposed to follow. But we need to do it because Kosovo is a recognized country in the Superhog backend.

Nila from finance confirmed that the VAT rate should be 0.

# 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: #22148
2024-10-02 07:52:21 +00:00
Joaquin Ossa
f37d419a1a fixed cancellation fee charge 2024-10-02 09:30:33 +02:00
Pablo Martin
dcbfcec627 add note in docs. 2024-10-01 15:52:30 +02:00
Pablo Martin
6f63aae1a1 add kosovo 2024-10-01 15:49:25 +02:00
Pablo Martin
3a4314397a fix bug in refresh 2024-10-01 15:41:32 +02:00
Pablo Martin
8f46b474fd fix bug in second procedure 2024-10-01 10:38:08 +02:00
Pablo Martin
e6bd5dfc22 change file name 2024-10-01 10:12:40 +02:00
Pablo Martin
3a649db5f2 remove old docs from readme 2024-10-01 10:09:30 +02:00
Pablo Martin
f955dc4f4c stuff 2024-10-01 10:09:30 +02:00
Pablo Martin
0e39d0a687 Move compose to dedicated folder 2024-10-01 10:09:30 +02:00
Joaquin Ossa
ae865b8848 Merged PR 2994: Staging Hubspot deals
# Description

Creation on stg_hubspot__deals 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.
2024-09-27 15:30:53 +00:00
Joaquin Ossa
ee6b613887 Stg Hubspot form_submissions 2024-09-27 17:30:25 +02:00
Pablo Martín
cb9c96930b Merged PR 2996: Activate one test, prepare the other
# Description

There were two tests for `int_core__verification_payments` awaiting activation because the source master data had issues that needed to be fixed.

This PR activates the test for `is_missing_user_country` because the dash team has already fixed the problematic country data.

The other test remains turned off because we still have a master data issue (missing VAT rate for Kosovo), but I've already added a missing where condition, and a reference to the ticket where we are tracking the master data issue.

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

activate one test, prepare another but keep it commented

Related work items: #20043
2024-09-27 14:44:31 +00:00
Pablo Martin
a08941c5dc comment vacuum analyze to run weekend test 2024-09-27 16:29:29 +02:00
Pablo Martin
4ff1375160 tiny commit ever just for foramatting 2024-09-27 16:28:00 +02:00
Pablo Martin
6124c19f98 activate one test, prepare another but keep it commented 2024-09-27 16:11:34 +02:00
Joaquin Ossa
306035d46d Hubspot deals 2024-09-27 12:24:27 +02:00
Joaquin Ossa
20425495f9 staging Hubspot contacts 2024-09-27 10:44:48 +02:00
Joaquin Ossa
c6e14adad5 Merged PR 2988: Added new role
# Description

Added new role to int_core__user_role

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

Added new role
2024-09-27 08:01:41 +00:00
Joaquin Ossa
37d9f5250a Added new role 2024-09-27 09:55:37 +02:00
Pablo Martín
a280f79d18 Merged PR 2971: Fix no tax bug
# Description

Fixes a bug introduced by PR: https://guardhog.visualstudio.com/Data/_git/data-pbi-reports/pullrequest/2962

The previous PR made non-waiver services become tax free if the host had an active payaway setting at the payment timestamp, which makes no sense because payaway only relates to waiver and not to other services.

# 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: #20043
2024-09-25 14:24:35 +00:00
Pablo Martin
0cd8f71889 remove variable that doesn't make sense anymore 2024-09-25 16:12:55 +02:00
Pablo Martin
bea2e0d926 fix broken case logic 2024-09-25 16:12:36 +02:00
Oriol Roqué Paniagua
070d067709 Merged PR 2918: Integrates screening API verifications into DWH staging
# Description

This PR integrates screening API verifications into staging.

There's 2 commits:
* The earliest one, it just copy-pastes the strategy followed by edeposit and adapts it to fit screening API case, which is simpler. Note here that the schema entries contain a low number of tests. This is because we only have 7 records in production - and these seem fake anyway :) - so it's complex to extrapolate. Those I could extrapolate (NoFlags/Flagged) I'm taking from the data transformation within the PBI report.
* The last commit, it's just a DRY. It handles the deduplication logic for cosmos db in a macro, and I applied it on both the screening API and the edeposit verifications. Works well from my POV.

Since you guys are far more knowledgeable on APIs scope, I'll let you take a close look in case I missed something.

# Checklist

- [X] The edited models and dependants run properly with production data.
- [ ] The edited models are sufficiently documented. **I guess it can be improved, waiting for your comments here**
- [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. **Used default coming from stg_edeposit__verifications**

# Other

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

Related work items: #20127
2024-09-25 10:52:50 +00:00
Pablo Martín
260b46171c Merged PR 2888: No taxes for host takes risk waivers
# Description

This PR modifies the V2 of `int_core__verification_payments` to make sure that taxes are not computed for waivers where the host takes the risk (in line with our guest taxes guidelines: https://www.notion.so/knowyourguest-superhog/Guest-Services-Taxes-How-to-calculate-a5ab4c049d61427fafab669dbbffb3a2?pvs=4#323e230365ed496cad6a65b5659895ea).

The PR changes the intermediate column `is_service_subject_to_vat`, making it `false` in the cases where there was no active payaway plan during the month where the payment was generated. This cascades in the main body of the model, because if `is_service_subject_to_vat` is `false`, then the tax amounts get turned into zero.

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

add logic

Related work items: #20043
2024-09-25 10:34:46 +00:00
Pablo Martin
73753092fa yolo activate vacuum analyze 2024-09-20 18:11:59 +02:00
Joaquin Ossa
e401efdd5d Merged PR 2933: Financial rate metrics
# Description

Changed the financial rate metrics to have `number_fomat = "converted_metric_currency_gbp"`

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

Financial rate metrics

Related work items: #21564
2024-09-20 14:29:30 +00:00