From 20a89586795ad96f25d745fcf05fd2ae9e1ff109 Mon Sep 17 00:00:00 2001 From: Joaquin Date: Tue, 25 Mar 2025 17:11:02 +0100 Subject: [PATCH] Commit wip --- .../int_core__new_dash_services_offered.sql | 235 ------------------ models/intermediate/core/schema.yml | 114 --------- ...daily_new_dash_deals_offered_services.sql} | 0 models/intermediate/kpis/schema.yml | 8 +- .../core/core__new_dash_services_offered.sql | 42 ---- models/reporting/core/schema.yml | 111 --------- 6 files changed, 3 insertions(+), 507 deletions(-) delete mode 100644 models/intermediate/core/int_core__new_dash_services_offered.sql rename models/intermediate/kpis/{int_kpis__metric_daily_new_dash_users_offered_services.sql => int_kpis__metric_daily_new_dash_deals_offered_services.sql} (100%) delete mode 100644 models/reporting/core/core__new_dash_services_offered.sql diff --git a/models/intermediate/core/int_core__new_dash_services_offered.sql b/models/intermediate/core/int_core__new_dash_services_offered.sql deleted file mode 100644 index 3fb8f25..0000000 --- a/models/intermediate/core/int_core__new_dash_services_offered.sql +++ /dev/null @@ -1,235 +0,0 @@ -{% set protected_service_status = "'PROTECTED'" %} -{% set rejected_service_status = "'REJECTED'" %} -{% set no_checks_service_status = "'NOCHECKS'" %} -{% set no_flags_service_status = "'NOFLAGS'" %} -{% set paid_service_status = "'PAID'" %} -{% set pending_service_status = "'PENDING'" %} -{% set unknown_service_status = "'-'" %} -{% set partially_protected_service_status = "'PARTIALLY PROTECTED'" %} -{% set not_protected_service_status = "'NOT PROTECTED'" %} -{% set not_paid_service_status = "'NOT PAID'" %} -{% set confirmed_service_status = "'CONFIRMED'" %} -{% set for_review_service_status = "'FORREVIEW'" %} -{% set flagged_service_status = "'FLAGGED'" %} - -with - int_core__user_product_bundle_contains_services as ( - select * from {{ ref("int_core__user_product_bundle_contains_services") }} - ), - int_core__user_product_bundle as ( - select * from {{ ref("int_core__user_product_bundle") }} - ), - int_core__user_host as (select * from {{ ref("int_core__user_host") }}), - int_core__accommodation_to_product_bundle as ( - select * from {{ ref("int_core__accommodation_to_product_bundle") }} - ), - int_core__accommodation as (select * from {{ ref("int_core__accommodation") }}), - int_core__booking_to_product_bundle as ( - select * from {{ ref("int_core__booking_to_product_bundle") }} - ), - int_core__booking_service_detail as ( - select * from {{ ref("int_core__booking_service_detail") }} - ), - int_core__booking_summary as (select * from {{ ref("int_core__booking_summary") }}), - bundle_services as ( - select - bs.id_user_product_bundle, - bs.id_user_host, - bs.product_service_display_name as service_display_name - from int_core__user_product_bundle_contains_services bs - inner join - int_core__user_host uh - on bs.id_user_host = uh.id_user_host - and uh.is_user_in_new_dash = true - and uh.is_missing_id_deal = false - and uh.is_test_account = false - -- Union of all product services with all protection plan services. - -- This is because there are basically two types of services: product services - -- and protection plan services and they are stored in different tables. - union all - select - pb.id_user_product_bundle, - pb.id_user_host, - coalesce( - pb.protection_display_name, {{ var("default_service") }} - ) as service_display_name - from int_core__user_product_bundle pb - inner join - int_core__user_host uh - on pb.id_user_host = uh.id_user_host - and uh.is_user_in_new_dash = true - and uh.is_missing_id_deal = false - and uh.is_test_account = false - ), - users as ( - select - bs.service_display_name, - count(distinct bs.id_user_host) as number_users, - -- Count only users that have at least one active accommodation. - -- with this service. - count( - distinct case - when apb.id_accommodation is not null and a.is_active - then bs.id_user_host - else null - end - ) as number_users_with_service_applied_in_accommodation - from bundle_services bs - left join - int_core__accommodation_to_product_bundle apb - on bs.id_user_product_bundle = apb.id_user_product_bundle - and bs.id_user_host = apb.id_user_host - left join int_core__accommodation a on apb.id_accommodation = a.id_accommodation - group by 1 - ), - accommodations as ( - select - bs.service_display_name, - count(distinct apb.id_accommodation) as number_accommodations, - count( - distinct case when a.is_active then apb.id_accommodation else null end - ) as number_active_accommodations, - count( - distinct case - when a.is_active is false then apb.id_accommodation else null - end - ) as number_inactive_accommodations - from bundle_services bs - left join - int_core__accommodation_to_product_bundle apb - on apb.id_user_product_bundle = bs.id_user_product_bundle - and now() between apb.original_starts_at_utc and coalesce( - apb.original_ends_at_utc, {{ var("end_of_time") }} - ) - left join int_core__accommodation a on apb.id_accommodation = a.id_accommodation - group by 1 - ), - bookings as ( - select - sd.service_name as service_display_name, - count(distinct sd.id_booking) as number_bookings, - count( - distinct case - when upper(sd.service_status) = {{ protected_service_status }} - then sd.id_booking - else null - end - ) as number_bookings_with_service_status_protected, - count( - distinct case - when upper(sd.service_status) = {{ rejected_service_status }} - then sd.id_booking - else null - end - ) as number_bookings_with_service_status_rejected, - count( - distinct case - when upper(sd.service_status) = {{ no_checks_service_status }} - then sd.id_booking - else null - end - ) as number_bookings_with_service_status_no_checks, - count( - distinct case - when upper(sd.service_status) = {{ no_flags_service_status }} - then sd.id_booking - else null - end - ) as number_bookings_with_service_status_no_flags, - count( - distinct case - when upper(sd.service_status) = {{ paid_service_status }} - then sd.id_booking - else null - end - ) as number_bookings_with_service_status_paid, - count( - distinct case - when upper(sd.service_status) = {{ pending_service_status }} - then sd.id_booking - else null - end - ) as number_bookings_with_service_status_pending, - count( - distinct case - when upper(sd.service_status) = {{ unknown_service_status }} - then sd.id_booking - else null - end - ) as number_bookings_with_service_status_unknown, - count( - distinct case - when - upper(sd.service_status) - = {{ partially_protected_service_status }} - then sd.id_booking - else null - end - ) as number_bookings_with_service_status_partially_protected, - count( - distinct case - when upper(sd.service_status) = {{ not_protected_service_status }} - then sd.id_booking - else null - end - ) as number_bookings_with_service_status_not_protected, - count( - distinct case - when upper(sd.service_status) = {{ not_paid_service_status }} - then sd.id_booking - else null - end - ) as number_bookings_with_service_status_not_paid, - count( - distinct case - when upper(sd.service_status) = {{ confirmed_service_status }} - then sd.id_booking - else null - end - ) as number_bookings_with_service_status_confirmed, - count( - distinct case - when upper(sd.service_status) = {{ for_review_service_status }} - then sd.id_booking - else null - end - ) as number_bookings_with_service_status_for_review, - count( - distinct case - when upper(sd.service_status) = {{ flagged_service_status }} - then sd.id_booking - else null - end - ) as number_bookings_with_service_status_flagged - from int_core__booking_service_detail sd - left join int_core__booking_summary bs on sd.id_booking = bs.id_booking - where bs.is_user_in_new_dash = true and bs.is_missing_id_deal = false - group by 1 - ) -select - coalesce(u.service_display_name, b.service_display_name) as service_display_name, - u.number_users, - u.number_users_with_service_applied_in_accommodation, - u.number_users - - u.number_users_with_service_applied_in_accommodation - as number_users_without_service_applied_in_accommodation, - a.number_accommodations, - a.number_active_accommodations, - a.number_inactive_accommodations, - b.number_bookings, - b.number_bookings_with_service_status_protected, - b.number_bookings_with_service_status_rejected, - b.number_bookings_with_service_status_no_checks, - b.number_bookings_with_service_status_no_flags, - b.number_bookings_with_service_status_paid, - b.number_bookings_with_service_status_pending, - b.number_bookings_with_service_status_unknown, - b.number_bookings_with_service_status_partially_protected, - b.number_bookings_with_service_status_not_protected, - b.number_bookings_with_service_status_not_paid, - b.number_bookings_with_service_status_confirmed, - b.number_bookings_with_service_status_for_review, - b.number_bookings_with_service_status_flagged -from users u -left join accommodations a on u.service_display_name = a.service_display_name -full outer join bookings b on u.service_display_name = b.service_display_name diff --git a/models/intermediate/core/schema.yml b/models/intermediate/core/schema.yml index e652653..3d115d2 100644 --- a/models/intermediate/core/schema.yml +++ b/models/intermediate/core/schema.yml @@ -5342,120 +5342,6 @@ models: data_type: boolean description: "Boolean value indicating if the guest chose CheckIn Cover." - - name: int_core__new_dash_services_offered - description: "This model contains the the services offered in New Dash. - These offers are displayed by different measures, such as the number of users, - accommodations and bookings." - meta: - deprecated: true - deprecation_date: "2025-06-30" - - columns: - - name: service_display_name - data_type: text - description: "The name of the New Dash service." - data_tests: - - not_null - - - name: number_users - data_type: bigint - description: - "Number of user accounts that have a bundle that considers this service. - The fact that a user has a bundle with the service included does not mean - that the service is active or used. Each user can associate any of their - bundles with any of their accommodations." - - - name: number_users_with_service_applied_in_accommodation - data_type: bigint - description: - "Number of user accounts that have a bundle that considers this service - and that bundle is active in at least one active accommodation. - In other words there is at least one active accommodation that offers - this service for this number of users." - - - name: number_users_without_service_applied_in_accommodation - data_type: bigint - description: - "Number of user accounts that have a bundle that considers this service - but none of those bundle with the service is active in any active - accommodation. - It is basically the difference between number_users and - number_users_with_service_applied_in_accommodation." - - - name: number_accommodations - data_type: bigint - description: - "Number of accommodations or listings that have a bundle that considers - this service." - - - name: number_active_accommodations - data_type: bigint - description: - "Number of accommodations or listings that have a bundle that considers - this service and are active." - - - name: number_inactive_accommodations - data_type: bigint - description: - "Number of accommodations or listings that have a bundle that considers - this service and are inactive." - - - name: number_bookings - data_type: bigint - description: "Number of bookings that have a bundle that considers this service." - - - name: number_bookings_with_service_status_protected - data_type: bigint - description: "Number of bookings with status PROTECTED for this service." - - - name: number_bookings_with_service_status_rejected - data_type: bigint - description: "Number of bookings with status REJECTED for this service." - - - name: number_bookings_with_service_status_no_checks - data_type: bigint - description: "Number of bookings with status NO CHECKS for this service." - - - name: number_bookings_with_service_status_no_flags - data_type: bigint - description: "Number of bookings with status NO FLAGS for this service." - - - name: number_bookings_with_service_status_paid - data_type: bigint - description: "Number of bookings with status PAID for this service." - - - name: number_bookings_with_service_status_pending - data_type: bigint - description: "Number of bookings with status PENDING for this service." - - - name: number_bookings_with_service_status_unknown - data_type: bigint - description: "Number of bookings with unknown status for this service." - - - name: number_bookings_with_service_status_partially_protected - data_type: bigint - description: "Number of bookings with status PARTIALLY PROTECTED for this service." - - - name: number_bookings_with_service_status_not_protected - data_type: bigint - description: "Number of bookings with status NOT PROTECTED for this service." - - - name: number_bookings_with_service_status_not_paid - data_type: bigint - description: "Number of bookings with status NOT PAID for this service." - - - name: number_bookings_with_service_status_confirmed - data_type: bigint - description: "Number of bookings with status CONFIRMED for this service." - - - name: number_bookings_with_service_status_for_review - data_type: bigint - description: "Number of bookings with status FOR REVIEW for this service." - - - name: number_bookings_with_service_status_flagged - data_type: bigint - description: "Number of bookings with status FLAGGED for this service." - - name: int_core__payments description: | A table holding payment details for guest journeys, including amounts in both diff --git a/models/intermediate/kpis/int_kpis__metric_daily_new_dash_users_offered_services.sql b/models/intermediate/kpis/int_kpis__metric_daily_new_dash_deals_offered_services.sql similarity index 100% rename from models/intermediate/kpis/int_kpis__metric_daily_new_dash_users_offered_services.sql rename to models/intermediate/kpis/int_kpis__metric_daily_new_dash_deals_offered_services.sql diff --git a/models/intermediate/kpis/schema.yml b/models/intermediate/kpis/schema.yml index 9db64f3..0cd1468 100644 --- a/models/intermediate/kpis/schema.yml +++ b/models/intermediate/kpis/schema.yml @@ -7384,14 +7384,14 @@ models: and per specified dimension. This metric is not additive, and its value can vary depending on the time period considered. - - name: int_kpis__metric_daily_new_dash_users_offered_services + - name: int_kpis__metric_daily_new_dash_deals_offered_services description: | - This model computes the Daily Offered Services by Users at the deepest granularity. + This model computes the Daily Offered Services by Deals at the deepest granularity. It only retrieves services that come from users that are in New Dash, as well as it only considers services created after the user has moved to New Dash. The unique key corresponds to the deepest granularity of the model, in this case: - - date, + - date, - id_deal, - id_user_product_bundle, - service_name, @@ -7445,8 +7445,6 @@ models: - "PROTECTION" - "DEPOSIT_MANAGEMENT" - "GUEST_AGREEMENT" - - "UNKNOWN" - - "UNSET" - name: is_upgraded_service data_type: string diff --git a/models/reporting/core/core__new_dash_services_offered.sql b/models/reporting/core/core__new_dash_services_offered.sql deleted file mode 100644 index 07ccfbf..0000000 --- a/models/reporting/core/core__new_dash_services_offered.sql +++ /dev/null @@ -1,42 +0,0 @@ -with - int_core__new_dash_services_offered as ( - select * from {{ ref("int_core__new_dash_services_offered") }} - ) -select - service_display_name as service_display_name, - number_users as number_users, - number_users_with_service_applied_in_accommodation - as number_users_with_service_applied_in_accommodation, - number_users_without_service_applied_in_accommodation - as number_users_without_service_applied_in_accommodation, - number_accommodations as number_accommodations, - number_active_accommodations as number_active_accommodations, - number_inactive_accommodations as number_inactive_accommodations, - number_bookings as number_bookings, - number_bookings_with_service_status_protected - as number_bookings_with_service_status_protected, - number_bookings_with_service_status_rejected - as number_bookings_with_service_status_rejected, - number_bookings_with_service_status_no_checks - as number_bookings_with_service_status_no_checks, - number_bookings_with_service_status_no_flags - as number_bookings_with_service_status_no_flags, - number_bookings_with_service_status_paid - as number_bookings_with_service_status_paid, - number_bookings_with_service_status_pending - as number_bookings_with_service_status_pending, - number_bookings_with_service_status_unknown - as number_bookings_with_service_status_unknown, - number_bookings_with_service_status_partially_protected - as number_bookings_with_service_status_partially_protected, - number_bookings_with_service_status_not_protected - as number_bookings_with_service_status_not_protected, - number_bookings_with_service_status_not_paid - as number_bookings_with_service_status_not_paid, - number_bookings_with_service_status_confirmed - as number_bookings_with_service_status_confirmed, - number_bookings_with_service_status_for_review - as number_bookings_with_service_status_for_review, - number_bookings_with_service_status_flagged - as number_bookings_with_service_status_flagged -from int_core__new_dash_services_offered diff --git a/models/reporting/core/schema.yml b/models/reporting/core/schema.yml index 5936c75..8cda71c 100644 --- a/models/reporting/core/schema.yml +++ b/models/reporting/core/schema.yml @@ -1568,117 +1568,6 @@ models: data_type: boolean description: "Boolean value indicating if the guest chose CheckIn Cover." - - name: core__new_dash_services_offered - description: "This model contains the the services offered in New Dash. - These offers are displayed by different measures, such as the number of users, - accommodations and bookings." - - columns: - - name: service_display_name - data_type: text - description: "The name of the New Dash service." - data_tests: - - not_null - - - name: number_users - data_type: bigint - description: - "Number of user accounts that have a bundle that considers this service. - The fact that a user has a bundle with the service included does not mean - that the service is active or used. Each user can associate any of their - bundles with any of their accommodations." - - - name: number_users_with_service_applied_in_accommodation - data_type: bigint - description: - "Number of user accounts that have a bundle that considers this service - and that bundle is active in at least one active accommodation. - In other words there is at least one active accommodation that offers - this service for this number of users." - - - name: number_users_without_service_applied_in_accommodation - data_type: bigint - description: - "Number of user accounts that have a bundle that considers this service - but none of those bundle with the service is active in any active - accommodation. - It is basically the difference between number_users and - number_users_with_service_applied_in_accommodation." - - - name: number_accommodations - data_type: bigint - description: - "Number of accommodations or listings that have a bundle that considers - this service." - - - name: number_active_accommodations - data_type: bigint - description: - "Number of accommodations or listings that have a bundle that considers - this service and are active." - - - name: number_inactive_accommodations - data_type: bigint - description: - "Number of accommodations or listings that have a bundle that considers - this service and are inactive." - - - name: number_bookings - data_type: bigint - description: "Number of bookings that have a bundle that considers this service." - - - name: number_bookings_with_service_status_protected - data_type: bigint - description: "Number of bookings with status PROTECTED for this service." - - - name: number_bookings_with_service_status_rejected - data_type: bigint - description: "Number of bookings with status REJECTED for this service." - - - name: number_bookings_with_service_status_no_checks - data_type: bigint - description: "Number of bookings with status NO CHECKS for this service." - - - name: number_bookings_with_service_status_no_flags - data_type: bigint - description: "Number of bookings with status NO FLAGS for this service." - - - name: number_bookings_with_service_status_paid - data_type: bigint - description: "Number of bookings with status PAID for this service." - - - name: number_bookings_with_service_status_pending - data_type: bigint - description: "Number of bookings with status PENDING for this service." - - - name: number_bookings_with_service_status_unknown - data_type: bigint - description: "Number of bookings with unknown status for this service." - - - name: number_bookings_with_service_status_partially_protected - data_type: bigint - description: "Number of bookings with status PARTIALLY PROTECTED for this service." - - - name: number_bookings_with_service_status_not_protected - data_type: bigint - description: "Number of bookings with status NOT PROTECTED for this service." - - - name: number_bookings_with_service_status_not_paid - data_type: bigint - description: "Number of bookings with status NOT PAID for this service." - - - name: number_bookings_with_service_status_confirmed - data_type: bigint - description: "Number of bookings with status CONFIRMED for this service." - - - name: number_bookings_with_service_status_for_review - data_type: bigint - description: "Number of bookings with status FOR REVIEW for this service." - - - name: number_bookings_with_service_status_flagged - data_type: bigint - description: "Number of bookings with status FLAGGED for this service." - - name: core__payments description: | A table holding payment details for guest journeys, including amounts in both