From 1a35839debd2597c4ee66fc370cbcf6b5dc387fc Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Mon, 2 Jun 2025 16:02:33 +0200 Subject: [PATCH] new version and docs --- .../int_core__check_in_cover_users_v2.sql | 39 +++++++++++++++++++ models/intermediate/core/schema.yml | 18 +++++++++ 2 files changed, 57 insertions(+) create mode 100644 models/intermediate/core/int_core__check_in_cover_users_v2.sql diff --git a/models/intermediate/core/int_core__check_in_cover_users_v2.sql b/models/intermediate/core/int_core__check_in_cover_users_v2.sql new file mode 100644 index 0000000..e9cc136 --- /dev/null +++ b/models/intermediate/core/int_core__check_in_cover_users_v2.sql @@ -0,0 +1,39 @@ +with + stg_core__user as (select * from {{ ref("stg_core__user") }}), + stg_core__verification_set as ( + select * from {{ ref("stg_core__verification_set") }} + ), + stg_core__verification_set_to_verification_type as ( + select * from {{ ref("stg_core__verification_set_to_verification_type") }} + ), + int_core__vr_check_in_cover as ( + select * from {{ ref("int_core__vr_check_in_cover") }} + ), + hosts_with_check_in_cover as ( + select distinct vrcih.id_user_host + from int_core__vr_check_in_cover vrcih + where vrcih.created_at_utc >= current_date - interval '30 days' + ), + check_in_cover_added_date_utc as ( + select + vrcih.id_user_host, + min(vrcih.created_at_utc) as check_in_cover_added_date_utc + from int_core__vr_check_in_cover vrcih + group by 1 + ) +select + u.id_user as id_user_host, + u.id_deal, + u.last_name, + u.user_name, + u.first_name, + u.email as host_email, + u.phone_number, + u.joined_at_utc, + u.joined_date_utc, + ad.check_in_cover_added_date_utc, + u.billing_town, + u.company_name +from stg_core__user u +inner join hosts_with_check_in_cover hcih on hcih.id_user_host = u.id_user +left join check_in_cover_added_date_utc ad on ad.id_user_host = u.id_user diff --git a/models/intermediate/core/schema.yml b/models/intermediate/core/schema.yml index 439168e..603f8c0 100644 --- a/models/intermediate/core/schema.yml +++ b/models/intermediate/core/schema.yml @@ -821,12 +821,30 @@ models: description: Timestamp of when the accommodation record was extracted from the backend into the DWH. - name: int_core__check_in_cover_users + latest_version: 1 + description: This model contains information about hosts that offer check in cover. It has basic information on the users like name, phone, email or joined date. This model is restricted to active user so it doesn't include historical data like users that had check-in cover but are currently inactive. + + The new candidate version for this model, v2, changes the strategy to + define which hosts we consider to offer check in cover. v1 used to look at + the verification set configurations and added hosts which had the cover in + it. v2 instead simply assumes that hosts that have had Guest Journeys + which offer the cover in the last 30 natural days are relevant. This is + simpler, but considered good enough. This decision was made as part of the + migration to the Guest Products data model, which would have made sticking + to the old way extremely complex and error prone. + + versions: + - v: 1 + - v: 2 + columns: + - include: all + columns: - name: id_user_host data_type: character varying