Merged PR 5365: New version of CIH users through activity

# Description

This PR adds a new version to `int_core__check_in_cover_users`. The new version respectes the public interface of V1, but changes the strategy to determine which users get included in the list. Instead of relying on their account configuration (v1), v2 simply looks at whether they had any VR created offering CIH in the past 30 days.

This approach changes the semantic of the model, but we deem the new one reasonable.

The motivation behind this change is to ensure this models (1) keeps working after the activation of the Guest Products FF and (2) stays simple. Trying to follow a strategy where we look at both old and new configs was deemed very complex and didn't add much value.

# 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: #30165
This commit is contained in:
Pablo Martin 2025-06-04 08:55:55 +00:00
commit 8b8b8441d3
2 changed files with 53 additions and 0 deletions

View file

@ -0,0 +1,35 @@
with
-- We could probably use int_core__user_host instead, but we need to add a
-- few fields to that model first if we want to do so.
stg_core__user as (select * from {{ ref("stg_core__user") }}),
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 '180 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

View file

@ -827,12 +827,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 are offering 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