Removed bookings_id so we have unique values for id_verification_request, added details as to how we classify the hosts

This commit is contained in:
Joaquin Ossa 2024-07-11 16:19:33 +02:00
parent 5efd91dfbb
commit db04615039
2 changed files with 20 additions and 10 deletions

View file

@ -4,18 +4,19 @@ with
select * from {{ ref("stg_core__verification_request") }} select * from {{ ref("stg_core__verification_request") }}
), ),
booking_source as ( booking_source as (
select select distinct
vr.id_verification_request, vr.id_verification_request,
vr.id_user_guest, vr.id_user_guest,
vr.created_at_utc, vr.created_at_utc,
vr.created_date_utc, vr.created_date_utc,
b.id_booking,
case case
when b.id_integration is not null when b.id_integration is not null
then 'PMS' then 'PMS'
when vr.id_one_step_link is not null when vr.id_one_step_link is not null
then 'OSL' then 'OSL'
else 'API or Manual' else 'API/MANUAL'
-- At this point we can't differentiate between these 2 categories so for
-- now we keep them together
end as source end as source
from stg_core__verification_request vr from stg_core__verification_request vr
left join left join
@ -27,6 +28,5 @@ select
bs.id_user_guest as id_user_guest, bs.id_user_guest as id_user_guest,
bs.created_at_utc as created_at_utc, bs.created_at_utc as created_at_utc,
bs.created_date_utc as created_date_utc, bs.created_date_utc as created_date_utc,
bs.id_booking as id_booking,
bs.source as source bs.source as source
from booking_source bs from booking_source bs

View file

@ -950,6 +950,14 @@ models:
This model contains information on verification requests This model contains information on verification requests
and the category type of host that manages the associated and the category type of host that manages the associated
booking. booking.
For PMS we use the id_integration from stg_core__booking,
if it isn't Null then the host is PMS type.
For OSL we use the id_one_step_link from stg_core__verification_request,
similarly if it isn't Null then the host is OSL type.
Finally if both id_integration and id_one_step_link are Null,
then we classify them as API/MANUAL. (At this point we can't
differentiate between these 2 categories so for now we keep
them together)
columns: columns:
- name: id_verification_request - name: id_verification_request
@ -960,6 +968,7 @@ models:
be associated to more than 1 booking be associated to more than 1 booking
tests: tests:
- not_null - not_null
- unique
- name: id_user_guest - name: id_user_guest
data_type: character varying data_type: character varying
@ -975,15 +984,16 @@ models:
description: description:
Date of creation of the verification request Date of creation of the verification request
- name: id_booking
data_type: bigint
description:
Id value for the booking
- name: source - name: source
data_type: text data_type: text
description: description:
Source type of host of the booking, this could be either; Source type of host of the booking, this could be either;
- PMS - PMS
- OSL - OSL
- API or Manual - API/MANUAL
tests:
- accepted_values:
values:
- 'PMS'
- 'OSL'
- 'API/MANUAL'