Commit graph

1137 commits

Author SHA1 Message Date
Joaquin Ossa
30e77c4877 Merged PR 4431: Silly fix
# Description

Fixed my silly mistake because of a copy/paste

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

Silly fix

Related work items: #27178
2025-02-18 11:29:00 +00:00
Joaquin Ossa
275177d674 Silly fix 2025-02-18 12:25:02 +01:00
Joaquin Ossa
1597126927 fixed calculations to gbp 2025-02-18 10:58:32 +01:00
Joaquin Ossa
6dda0cdcc2 Adding fees in gbp 2025-02-18 10:52:38 +01:00
Oriol Roqué Paniagua
9540f18562 Merged PR 4425: Reworks Billable Bookings metrics
# Description

Changes:
* On Est. Billable Bookings, keeps previous logic for Old Dash while assuming the first billable service for New Dash
* Adds a Billable Check Out Bookings in Check Out bookings, as defined in the requirements.

# 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: #27619
2025-02-17 15:59:21 +00:00
Oriol Roqué Paniagua
a3793121af Merged PR 4423: Logic for Billable Bookings in New Dash Bookings
# Description

Changes:
* Tags services to be billed (invoiced to host) in the staging models of product_service and protection_plan
* Propagates into booking_service_detail master table. This also computes billable dates.
* Propagates into booking_summary master table. This has the final determination of a booking being billable or not, and when the first and last billing should occur.

# 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: #27619
2025-02-17 15:01:44 +00:00
Oriol Roqué Paniagua
399feba9af Merged PR 4418: New metric - Live Deals
# Description

Adds new metric - live deals

# 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: #27712
2025-02-17 07:48:11 +00:00
Oriol Roqué Paniagua
4fc0ea71c6 Merged PR 4413: Fixes on Business Scope
# Description

Changes:
* Fixes listings by properly considering the equal or higher sign. I'm very dumb
* Fixes exclusion of new dash billable bookings by properly applying in both monthly and mtd. I'm very dumb x2

# 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: #27356
2025-02-14 16:17:41 +00:00
Oriol Roqué Paniagua
be0b8c41b6 Merged PR 4411: Propagates New Dash/Old Dash/APIs split in KPIs as per Business Scope
# Description

Changes:
* Adapt business_kpis_configuration to include By Business Scope as production dimension.
* Sets in int_mtd_metrics_vs_previous_year the selection of business scope dimension for all KPIs models. This does not affect cross kpis models (churn/mrr). I might need to check later how to adapt Churn to include this dimension, but it's not considered as for this PR. Lastly, Billable Bookings excludes New Dash.
* Adapts condition in int_mtd_metrics_vs_previous_year so MTD values would appear independently of these appearing in the previous year. This is, the model was considering that to show current month MTD values, the dimension needed to exist the year prior. This does not happen with New Dash and I assume we never noticed because in any case, most of our dimensions have quite a long history.
* Adapts int_kpis__agg_dates_main_kpis to include the business scope dimension. By the way it's actually handled, it kind of assumes that a Deal can only be in New or Old Dash (this is correct), but while on New Dash, this deal won't have data for Old Dash (this might not be 100% correct). In any case, the global figure should be ok, and only on the deal + business scope dimensionality this could cause some potential problems. However, this is not being reported anyway at the moment.
* Adapts int_kpis__agg_dates_main_kpis to have a proper variable value for the dimensions, and this is further included in business_kpis_configuration as any other model.

Small changes:
* Adapts Churn metrics to read from dimension_deals rather than core__deals. This should be more accurate anyway.

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

Propagates New Dash/Old Dash/APIs split in KPIs as per Business Scope

Related work items: #27356
2025-02-14 14:12:39 +00:00
Joaquin Ossa
7f9ff85b44 Merged PR 4403: Fixed variable call and naming
# Description

Fixed variable call and naming 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.
- [ ] 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 variable call and naming

Related work items: #25934
2025-02-14 13:25:29 +00:00
Oriol Roqué Paniagua
a690ca6eac Merged PR 4400: Adds Billable Bookings split per scope
# Description

Changes:
* Adds Business Scope split on Billable Bookings + propagates towards Agg/Metric Monthly/MTD models

This is a temporary modification until the ticket on Billable Bookings for New Dash is handled.

# 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: #27356
2025-02-14 12:29:18 +00:00
Joaquin Ossa
aadd0c244b Fixed variable call and naming 2025-02-14 12:19:15 +01:00
Joaquin Ossa
4b94d5f70b Merged PR 3896: S&P invoice model
# Description

New Invoice model for S&P
Quite a dense model, it needs to consider some different situations for the different Protection types, verification status and if the user has the `is_protected` flag active for it's bookings.
I leave the documentation for support to better clarify all the possible scenarios and a screenshot of how it is currently looking the model's result.
There are a couple of rename changes on other models, nothing big.
If there are any inquiries let me know.
https://www.notion.so/knowyourguest-superhog/Invoice-Screen-Protect-1610446ff9c980f88de6d6293b4fab03?pvs=4

![image.png](https://guardhog.visualstudio.com/4148d95f-4b6d-4205-bcff-e9c8e0d2ca65/_apis/git/repositories/54ac356f-aad7-46d2-b62c-e8c5b3bb8ebf/pullRequests/3896/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: #25360
2025-02-14 08:18:42 +00:00
Joaquin Ossa
fdd58fd55e Merged PR 4387: Adding booking services status
# Description

Need opinion on this model, it's not so easy so if needed we can have a quick call
- Since the `int_core__booking_service_detail` has some services combined in one I tried to split them to count separately each service per booking and their statuses. There are also some cases where there are services combined but also separate for the same booking, in those cases I only take in count the status of the service with the most recent `service_detail_updated_at_utc `
![image (2).png](https://guardhog.visualstudio.com/4148d95f-4b6d-4205-bcff-e9c8e0d2ca65/_apis/git/repositories/54ac356f-aad7-46d2-b62c-e8c5b3bb8ebf/pullRequests/4387/attachments/image%20%282%29.png)
So here it takes for the `BASIC DAMAGE DEPOSIT` the status Paid which is more recent but for `WAIVER PLUS` the status Not Paid.
- I created a macro to count all the distinct bookings with each `service_status` that also adds the column name. If there are new statuses being used we would have to add them to the macro as well as calling the new columns on the final select. Might not be the most optimal approach WDYT??

**The PR is not ready to be closed**

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

Adding booking services status

Related work items: #25934
2025-02-14 08:16:59 +00:00
Joaquin Ossa
ca9188b1ab Addressed comments 2025-02-14 08:35:51 +01:00
Oriol Roqué Paniagua
d8a0bb07d3 Merged PR 4395: Propagates business scope into Deal/Listing metrics
# Description

Changes:
* Propagates business scope, based on deal, for Deal and Listing metrics. This already handles the daily metric and the daily aggregation.
* Modifies lifecycle_daily_deal to depend on dimension_deals and compute API segmentation.
* Creates new metric: Live Deals, that includes New, Active and Reactivated. This will be needed for YTD/MTD 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: #27356
2025-02-13 16:34:14 +00:00
Joaquin Ossa
a00a4b4e4b Updated model 2025-02-13 17:13:05 +01:00
Joaquin Ossa
67bf836621 commit wip 2025-02-13 15:31:22 +01:00
Joaquin Ossa
c01d09d9f6 Addressed comments 2025-02-13 15:31:22 +01:00
Joaquin Ossa
60ebb13f1d Completed schema 2025-02-13 15:31:22 +01:00
Joaquin Ossa
9a4c7a312d Invoice model completed 2025-02-13 15:31:22 +01:00
Joaquin Ossa
1fff7b91a2 commit wip 2025-02-13 15:29:19 +01:00
Joaquin Ossa
68c21458c2 fixed call 2025-02-13 14:53:44 +01:00
Joaquin Ossa
03bbf54e14 Changed to service_detail_updated_at_utc 2025-02-13 14:52:38 +01:00
Joaquin Ossa
43742355f0 Adding booking services status 2025-02-13 14:45:26 +01:00
Oriol Roqué Paniagua
5382a9b32b Merged PR 4374: Ensures KYG lite users are excluded from New and Old Dash
# Description

Changes:
* **Main change:** exclusion of KYG lite users of the segmentation of Business Scope. These are "freemium" users, kind of demo users, that shouldn't have any real impact in terms of revenue. These are in New Dash, but do not have a deal. The problem is that we don't want to consider them as New Dash, but the current condition was making them appear as Old Dash. This PR fixes this by handling the logic for backend related models. Note that Xero remains unaffected - this is based on Deal, and these users do not have Deal.
* Small data quality fix I noticed while debugging KYG lite cases. It's better to use the "is upgraded service" from the staging original tables rather than the one with the prices. If a user does not have a currency (which can be the case for KYG lite users), then the coalesce would tag any service as not upgraded, which is not true.

# 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: #27356
2025-02-13 09:38:43 +00:00
Joaquin Ossa
db86f75f75 Merged PR 4373: Fixed model error
# Description

Fixed model error

# 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 model error
2025-02-12 15:46:55 +00:00
Joaquin Ossa
b4d19ddbb5 Merged PR 4371: fixed exposures
# Description

Fixed model name

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

fixed exposures
2025-02-12 14:49:46 +00:00
Joaquin Ossa
b8c953c7eb Merged PR 4370: new active_users data
# Description

Added active and inactive users:
- Active_users: those that are actually using the services in any accommodation of their bundles
- Inactive_users: basically the difference between users with the service and active_users

# Checklist

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

# Other

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

new active_users data

Related work items: #25934
2025-02-12 14:35:56 +00:00
Joaquin Ossa
c7a8420de3 fixed schema 2025-02-12 15:35:03 +01:00
Joaquin Ossa
375c8679cd changed naming 2025-02-12 15:16:41 +01:00
Joaquin Ossa
9e744f41b0 Format schema 2025-02-12 15:03:17 +01:00
Joaquin Ossa
9af7b27e04 new active_users data 2025-02-12 15:00:31 +01:00
Joaquin Ossa
06736de6a6 Updated exposures 2025-02-12 12:50:54 +01:00
Joaquin Ossa
0aca860f29 Merged PR 4360: Added all booking states
# Description

Included all booking states in the model.
At first I thought I would only show the most relevant but better to show all of them so the total adds up

# 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: #25934
2025-02-12 08:26:25 +00:00
Joaquin Ossa
aa840aedd0 fixed naming 2025-02-12 09:24:53 +01:00
Oriol Roqué Paniagua
edddb0ac37 Merged PR 4357: Propagates in Host Resolutions and Invoiced Revenue the new business scope
# Description

Changes:
* Business scope is now propagated in Host Resolutions and Invoiced Revenue Monthly/MTD Metric and Aggregated models

# 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: #27356
2025-02-12 08:17:44 +00:00
Joaquin Ossa
0866b2bf9d added all booking states 2025-02-12 09:09:16 +01:00
Joaquin Ossa
83e8723d7d commit wip 2025-02-12 09:07:47 +01:00
Oriol Roqué Paniagua
78707ef649 Merged PR 4352: Bulk update dash_source to business_scope
# Description

Changes:
* Switches dash_source to business_scope in all kpis models, schema and macro configuration.

# 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: #27356
2025-02-11 16:19:33 +00:00
Joaquin Ossa
1577db322f ***ing decimals 2025-02-11 17:10:07 +01:00
Oriol Roqué Paniagua
4867e8f6d0 Merged PR 4349: Xero metrics by Business Scope
# Description

Changes:
* Creation of a deal-based model that contains when a "deal has appeared in new dash". This is tricky because a Deal can still have multiple users, thus it needs to be attributed to a date. I've chosen the first user appearance for the rest of the metrics.
* Adaptation of dimension deals in KPIs to include a client type, that indicates if the deal is from APIs or not (Platform, i.e., Dashboard).
* Xero metrics by Business Scope. This is the previous "dash source" that I need to change in the previously worked models. I decided to include APIs in the segmentation since in most cases we distinguish old dash from new dash by just "anything that is not in new dash". This is very wrong for invoicing metrics, in which we have APIs. So this actually properly computes a client segmentation by scope.

Note that I'll need to handle the monthly/mtd metrics/agg for these 2 metric models (Resolutions + Invoiced revenue) separately.

# 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: #27356
2025-02-11 15:13:42 +00:00
Joaquin Ossa
cb907764ac removed currency 2025-02-11 15:05:35 +01:00
Joaquin Ossa
7f98a5865b fixed rate exchange 2025-02-11 15:04:27 +01:00
Joaquin Ossa
b639264710 fix booking_detail model 2025-02-11 12:36:47 +01:00
Joaquin Ossa
c4a6a78bd5 Merged PR 4263: Payments model for legacy report
# Description

Payments model for legacy report
It includes payments with and without taxes for guest payment validations.
It also has the payaway amount depending on whether the host or superhog is taking the risk.

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

In case you want to take a look at how is it looking

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

Payments model for legacy report

Related work items: #27178
2025-02-11 11:14:23 +00:00
Joaquin Ossa
125325fcf2 Updated model 2025-02-11 10:44:19 +01:00
Oriol Roqué Paniagua
dffb1d5a1e Merged PR 4336: MTD and Monthly Verification Requests dependant KPIs for Dash Source
# Description

Changes:
* Adds Dash Source in Monthly and MTD Metric models for Verification Request dependant KPIs
* Propagates to Aggregated Monthly and MTD models for VR dependant KPIs
* Eliminates unused Weekly Guest Payment models.

# 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: #27356
2025-02-11 08:47:48 +00:00
Oriol Roqué Paniagua
b471b64d9c Merged PR 4335: Rework new dash attribution using booking summary
# Description

Changes:
* On Created and Check Out Bookings daily models, the determination of New Dash bookings now uses `int_core__booking_summary`. This does not change the output, but will be more consistent for other KPIs.
* Adds the categorisation of `dash_source` in all daily metric models that depend on Verification Requests (Guest Journeys). This affects GJ Created, GJ Started, GJ Completed, GJ w. Payment and Guest Payments. Note that the next aggregations (monthly, mtd, agg_monthly, agg_mtd) are not created yet. This will be done in a separated PR.

# 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: #27356
2025-02-11 07:12:46 +00:00
Joaquin Ossa
bc17ee7b4b New waiver fees model 2025-02-10 18:42:15 +01:00