data-dwh-dbt-project/models/intermediate/core
Oriol Roqué Paniagua 4cfc0dcd45 Merged PR 2642: Booking Charge Events to have a similar logic as invoicing
# Description

Based on the Notion page [here](https://www.notion.so/knowyourguest-superhog/Data-quality-assessment-Billable-Bookings-97008b7f1cbb4beb98295a22528acd03), this PR mainly adds:

- Charge at verification depends on when the Guest joined or the VR was updated (depending on if the verification request associated exists does not exists or it does, respectively)
- Add the logic to retrieve the last plan that is available at the beginning of each month.
- Additional where conditions, relatively documented, to imitate was is available in the invoicing process. This includes removal of duplicated bookings, guest verification and guest user existing.

Additional changes:
- Remove select star :)
- Added dbt tests that didn't exist before
- Add informative fields on 1) how many price plans were active in a given month, even though we just keep the last one and 2) cases in which bookings are created after the booking is supposed to be charged.

Data quality:´
- I have mixed feelings. This does not correspond 100% to the volumes provided by the exporter, though are quite close. For April, May and June 2024, this logic has more than 95% of accuracy. Still, the fact of using the guest joined, and especially the updated date, I feel like this will make past data "disappear" if the guest has another journey. I don't know for sure since we do not store incremental updates of user information.
I'd propose to move forward to have an estimated metric available anyway - with this or a similar logic, even the previous one based on the used link at but fixing the cases in which there's no VR associated.
Let's discuss 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.
- [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: #18111
2024-09-03 13:15:40 +00:00
..
int_core__accommodation.sql Merged PR 2125: Fixing accommodation host 2024-06-26 14:47:15 +00:00
int_core__accommodation_to_product_bundle.sql Merged PR 2652: Adds accommodation to product bundle in intermediate 2024-08-27 14:05:24 +00:00
int_core__address_validations.sql Removed coalesce so it includes NULL for failed validations 2024-08-20 09:49:34 +02:00
int_core__booking_charge_events.sql Merged PR 2642: Booking Charge Events to have a similar logic as invoicing 2024-09-03 13:15:40 +00:00
int_core__booking_to_product_bundle.sql Merged PR 2650: Added int_core__booking_to_product_bundle in intermediate 2024-08-27 12:51:55 +00:00
int_core__bookings.sql 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
int_core__check_in_cover_listings.sql fixed testing for core__check_in_cover_listings 2024-08-28 10:47:31 +02:00
int_core__check_in_cover_prices.sql propagating renames 2024-05-08 12:03:44 +02:00
int_core__check_in_cover_users.sql Merged PR 2201: Fixing errors raised by texts 2024-07-05 15:12:04 +00:00
int_core__country.sql Merged PR 2077: Adding Country to intermediate 2024-06-19 15:34:15 +00:00
int_core__deal_id_master_list.sql docs and moving stuff 2024-04-08 09:44:32 +02:00
int_core__duplicate_bookings.sql 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
int_core__guest_satisfaction_responses.sql Removed database sources on select 2024-07-12 13:11:56 +02:00
int_core__host_booking_fees.sql Deleted an extra line 2024-08-01 16:18:25 +02:00
int_core__invoicing_price_plans_per_month.sql Merged PR 2642: Booking Charge Events to have a similar logic as invoicing 2024-09-03 13:15:40 +00:00
int_core__monthly_accommodation_history_by_deal.sql Merged PR 2172: Adding accommodation metrics by deal id 2024-07-02 09:32:52 +00:00
int_core__monthly_booking_history_by_deal.sql Merged PR 2301: KPIs Billable Bookings 1st version 2024-07-15 10:59:37 +00:00
int_core__monthly_guest_journey_history_by_deal.sql Merged PR 2257: Expose guest revenue and guest journey payment metrics 2024-07-10 14:17:05 +00:00
int_core__monthly_guest_payments_history_by_deal.sql Merged PR 2433: Remove Deposit payments from Guest Payments metric 2024-07-29 15:15:09 +00:00
int_core__mtd_accommodation_lifecycle.sql Merged PR 2125: Fixing accommodation host 2024-06-26 14:47:15 +00:00
int_core__mtd_accommodation_metrics.sql Merged PR 2575: Accommodation metrics per customer segmentation 2024-08-19 09:03:42 +00:00
int_core__mtd_accommodation_segmentation.sql Merged PR 2615: Beautification of KPIs dimensions 2024-08-21 14:42:05 +00:00
int_core__mtd_booking_metrics.sql Merged PR 2522: Don't Repeat Yourself for KPIs - Applied to Bookings 2024-08-08 13:19:57 +00:00
int_core__mtd_deal_lifecycle.sql Merged PR 2107: Adds host lifecycle metrics into biz kpis 2024-06-25 12:20:59 +00:00
int_core__mtd_deal_metrics.sql Merged PR 2534: Deal metrics per customer segmentation 2024-08-09 10:03:35 +00:00
int_core__mtd_guest_journey_metrics.sql Merged PR 2533: Guest Journey metrics per customer segmentation 2024-08-09 08:41:14 +00:00
int_core__mtd_guest_payments_metrics.sql Merged PR 2583: Invoicing metrics per customer segmentation 2024-08-20 12:05:53 +00:00
int_core__new_dash_user_overview.sql Merged PR 2662: New Dash MVP - with. fix on production issue 2024-08-28 10:09:08 +00:00
int_core__price_plans.sql docs and moving stuff 2024-04-08 09:44:32 +02:00
int_core__unified_user.sql Merged PR 2676: Propagates Billing Country information 2024-08-29 08:25:05 +00:00
int_core__unique_accommodation_to_user.sql Merged PR 2125: Fixing accommodation host 2024-06-26 14:47:15 +00:00
int_core__user_host.sql Merged PR 2676: Propagates Billing Country information 2024-08-29 08:25:05 +00:00
int_core__user_migration.sql Merged PR 2636: First version of User Product Bundle 2024-08-26 09:18:56 +00:00
int_core__user_product_bundle.sql Merged PR 2636: First version of User Product Bundle 2024-08-26 09:18:56 +00:00
int_core__user_role.sql Merged PR 2516: Create host_user and user_role in intermediate 2024-08-07 14:28:34 +00:00
int_core__verification_payments.sql Merged PR 2687: Materialize int_core__verification_payments as a table 2024-08-29 14:25:18 +00:00
int_core__verification_request_booking_source.sql Removed guests_id and modified query structure 2024-07-11 16:49:24 +02:00
int_core__verification_request_completed_date.sql Merged PR 2028: guest journey estimated completed date 2024-06-13 13:30:22 +00:00
int_core__verification_request_completeness.sql Merged PR 2020: Verification request completeness for intermediate steps + schema documentation 2024-06-13 08:14:11 +00:00
int_core__verification_requests.sql Added the new field to int_core__bookings and to int_core__verification_requests 2024-07-11 17:16:51 +02:00
int_core__vr_check_in_cover.sql Changed names for easier understanding 2024-08-20 12:56:52 +02:00
schema.yaml Merged PR 2642: Booking Charge Events to have a similar logic as invoicing 2024-09-03 13:15:40 +00:00