data-dwh-dbt-project/models/intermediate/screen_and_protect/schema.yml

550 lines
17 KiB
YAML
Raw Normal View History

2024-12-04 11:15:21 +01:00
version: 2
models:
- name: int_screen_and_protect__verification_requests
description: |
Records of verification requests from the Screen and Protect API. The
table tracks verification requests, their outcomes, and related metadata
about guests, listings, and partners.
2025-01-13 16:00:35 +01:00
data_tests:
2024-12-17 19:09:54 +01:00
- at_least_one_null:
columns:
2024-12-23 16:20:12 +01:00
- monthly_volume_discount_percentage
- monthly_general_discount_percentage
2024-12-04 11:15:21 +01:00
columns:
- name: id_verification
data_type: text
description: Unique identifier for the verification request.
2025-01-13 16:00:35 +01:00
data_tests:
2024-12-04 11:15:21 +01:00
- unique
- not_null
- name: id_booking
data_type: text
description: Unique identifier for the booking associated with the verification.
2025-01-13 16:00:35 +01:00
data_tests:
2024-12-04 11:15:21 +01:00
- not_null
- name: id_user_partner
data_type: text
description: Identifier for the partner user initiating the verification.
2025-01-13 16:00:35 +01:00
data_tests:
2024-12-04 11:15:21 +01:00
- not_null
- name: id_accommodation
data_type: text
description: Identifier for the accommodation related to the booking.
2024-12-20 14:03:58 +01:00
- name: id_currency
data_type: bigint
description: "Id of the currency, works as a foreign key to the
currency table"
2025-01-13 16:00:35 +01:00
data_tests:
2024-12-20 14:03:58 +01:00
- not_null
- relationships:
to: ref('stg_core__currency')
field: id_currency
2024-12-11 16:35:40 +01:00
- name: is_protected
2024-12-11 15:42:35 +01:00
data_type: boolean
description: |
Indicates if the booking is protected or not.
2025-01-13 16:00:35 +01:00
data_tests:
2024-12-11 15:42:35 +01:00
- not_null
2024-12-04 14:36:49 +01:00
- name: protection_type
data_type: text
description: Specific protection type for the request.
2025-01-13 16:00:35 +01:00
data_tests:
2024-12-04 14:36:49 +01:00
- not_null
- accepted_values:
values:
- "SCREEN & PROTECT"
- "BASIC PROTECTION"
- "STANDALONE PROTECTION"
- "DAMAGE WAIVER"
- "PET PROTECTION"
2024-12-20 14:03:58 +01:00
- name: protection_starting_amount_in_local_currency
2024-12-04 16:33:50 +01:00
data_type: numeric
description: Field used for protection type "STANDALONE PROTECTION" to
indicate the starting level of protection.
2024-12-19 17:18:27 +01:00
In local currency.
2025-01-13 16:00:35 +01:00
data_tests:
2024-12-04 16:33:50 +01:00
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
max_value: 100000
strictly: true
2024-12-19 17:18:27 +01:00
- name: protection_basic_amount_in_local_currency
2024-12-04 11:15:21 +01:00
data_type: numeric
2024-12-04 16:33:50 +01:00
description: Field used for protection type "SCREEN & PROTECT",
"BASIC PROTECTION" or "DAMAGE WAIVER" to show the basic amount of protection.
2024-12-19 17:18:27 +01:00
In local currency.
2025-01-13 16:00:35 +01:00
data_tests:
2024-12-04 11:15:21 +01:00
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
2024-12-04 16:33:50 +01:00
max_value: 100000
2024-12-04 11:15:21 +01:00
strictly: true
2024-12-19 17:18:27 +01:00
- name: protection_extended_amount_in_local_currency
2024-12-04 11:15:21 +01:00
data_type: numeric
2024-12-04 16:33:50 +01:00
description: Field used for protection type "SCREEN & PROTECT",
or "STANDALONE PROTECTION" to show the basic amount of protection.
2024-12-19 17:18:27 +01:00
In local currency.
2025-01-13 16:00:35 +01:00
data_tests:
2024-12-04 16:33:50 +01:00
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
max_value: 50000000
strictly: true
2024-12-04 11:15:21 +01:00
- name: pet_protection
data_type: boolean
description: Indicates if pet protection was included.
- name: verification_status
data_type: text
description: Outcome of the verification process.
2025-01-13 16:00:35 +01:00
data_tests:
2024-12-04 11:15:21 +01:00
- not_null
- accepted_values:
values:
- "APPROVED"
- "FLAGGED"
- "REJECTED"
2024-12-23 15:25:38 +01:00
- name: price_increase_percentage
2024-12-17 19:09:54 +01:00
data_type: numeric
description: The percentage or value of the price increase
applied to the user's account.
2025-01-13 16:00:35 +01:00
data_tests:
2024-12-17 19:09:54 +01:00
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
strictly: true
- name: price_increase_start_date_utc
data_type: date
description: The date when the price increase becomes effective.
This is the first day of the month.
2025-01-13 16:00:35 +01:00
data_tests:
2024-12-17 19:09:54 +01:00
- is_first_day_of_month
2024-12-23 15:25:38 +01:00
- name: monthly_volume_discount_percentage
2024-12-17 19:09:54 +01:00
data_type: numeric
description: The discount percentage or value offered based on the
volume of bookings achieved within a month.
No user can have more than one discount per month.
2025-01-13 16:00:35 +01:00
data_tests:
2024-12-17 19:09:54 +01:00
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
max_value: 100
2024-12-17 19:09:54 +01:00
strictly: true
2024-12-23 15:25:38 +01:00
- name: threshold_approved_or_flagged_booking_volume
2024-12-17 19:09:54 +01:00
data_type: numeric
description: The minimum number of bookings required to qualify for
the monthly volume discount.
2025-01-13 16:00:35 +01:00
data_tests:
2024-12-17 19:09:54 +01:00
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
strictly: true
- name: monthly_volume_discount_start_date_utc
data_type: date
description: The date when the monthly volume discount period begins.
This is the first day of the month.
2025-01-13 16:00:35 +01:00
data_tests:
2024-12-17 19:09:54 +01:00
- is_first_day_of_month
- name: monthly_volume_discount_end_date_utc
data_type: date
description: The date when the monthly volume discount period ends.
This is the last day of the month.
2025-01-13 16:00:35 +01:00
data_tests:
2024-12-17 19:09:54 +01:00
- is_last_day_of_month
2024-12-23 15:25:38 +01:00
- name: monthly_general_discount_percentage
2024-12-17 19:09:54 +01:00
data_type: numeric
description: The general discount percentage or value applied to all
bookings within the applicable period.
No user can have more than one discount per month.
2025-01-13 16:00:35 +01:00
data_tests:
2024-12-17 19:09:54 +01:00
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
max_value: 100
2024-12-17 19:09:54 +01:00
strictly: true
- name: monthly_general_discount_start_date_utc
data_type: date
description: The date when the general discount period begins.
This is the first day of the month.
2025-01-13 16:00:35 +01:00
data_tests:
2024-12-17 19:09:54 +01:00
- is_first_day_of_month
- name: monthly_general_discount_end_date_utc
data_type: date
description: The date when the general discount period ends.
This is the last day of the month.
2025-01-13 16:00:35 +01:00
data_tests:
2024-12-17 19:09:54 +01:00
- is_last_day_of_month
2024-12-04 11:15:21 +01:00
- name: verification_status_reason
data_type: text
description: Reason for the verification status.
- name: email_flag
data_type: text
description: Indicates issues with the email address, if any.
- name: phone_flag
data_type: text
description: Indicates issues with the phone number, if any.
- name: watch_list
data_type: text
description: Indicates if the guest was flagged on a watchlist.
2025-01-13 16:00:35 +01:00
data_tests:
2024-12-04 11:15:21 +01:00
- accepted_values:
values:
- "MATCH"
- "NO MATCH"
- name: channel
data_type: text
description: Booking channel or source.
- name: checkin_date_utc
data_type: date
2024-12-23 16:20:12 +01:00
description: "Check-in date for the booking."
tests:
- not_null
2024-12-04 11:15:21 +01:00
- name: checkout_date_utc
data_type: date
2024-12-23 16:20:12 +01:00
description: "Check-out date for the booking."
tests:
- not_null
2024-12-04 11:15:21 +01:00
- name: number_of_nights
data_type: integer
2024-12-23 16:20:12 +01:00
description: Number of nights for the reservation.
tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 1
2024-12-04 11:15:21 +01:00
- name: is_cancelled
data_type: boolean
description: Indicates if the booking was canceled.
2025-01-13 16:00:35 +01:00
data_tests:
2024-12-04 11:15:21 +01:00
- not_null
- name: cancelled_at_utc
data_type: timestamp without time zone
description: Timestamp when the booking was canceled.
2025-01-13 16:00:35 +01:00
data_tests:
2024-12-04 11:15:21 +01:00
- not_null:
where: is_cancelled = true
- name: user_email
data_type: text
description: Email address of the user associated with the booking.
- name: guest_email
data_type: text
description: Email address of the guest.
- name: guest_last_name
data_type: text
description: Last name of the guest.
- name: guest_first_name
data_type: text
description: First name of the guest.
- name: guest_telephone
data_type: text
description: Telephone number of the guest.
- name: company_name
data_type: text
description: Name of the company associated with the booking.
- name: property_manager_name
data_type: text
description: Name of the property manager.
- name: property_manager_email
data_type: text
description: Email address of the property manager.
- name: listing_name
data_type: text
description: Name of the listing.
- name: listing_address
data_type: text
description: Address of the listing.
- name: listing_town
data_type: text
description: Town where the listing is located.
- name: listing_country
data_type: text
description: Country code where the listing is located.
- name: listing_postcode
data_type: text
description: Postcode of the listing.
- name: pets_allowed
data_type: boolean
description: Indicates if pets are allowed at the listing.
- name: status_updated_at_utc
data_type: timestamp without time zone
description: Timestamp of the last status update for the verification.
2025-01-13 16:00:35 +01:00
data_tests:
2024-12-04 11:15:21 +01:00
- not_null
- name: status_updated_date_utc
data_type: date
description: Date of the last status update for the verification.
2025-01-13 16:00:35 +01:00
data_tests:
2024-12-04 11:15:21 +01:00
- not_null
- name: updated_at_utc
data_type: timestamp without time zone
description: Timestamp of the last update to the record.
2025-01-13 16:00:35 +01:00
data_tests:
2024-12-04 11:15:21 +01:00
- not_null
- name: updated_date_utc
data_type: date
description: Date of the last update to the record.
2025-01-13 16:00:35 +01:00
data_tests:
2024-12-04 11:15:21 +01:00
- not_null
2024-12-17 19:09:54 +01:00
- name: creation_at_utc
2024-12-04 11:15:21 +01:00
data_type: timestamp without time zone
2024-12-04 16:33:50 +01:00
description: |
2024-12-17 19:09:54 +01:00
Timestamp of when the reservation was created.
2025-01-13 16:00:35 +01:00
data_tests:
2024-12-04 16:33:50 +01:00
- not_null
2024-12-17 19:09:54 +01:00
- name: creation_date_utc
2024-12-04 16:33:50 +01:00
data_type: date
description: |
2024-12-17 19:09:54 +01:00
Date of when the reservation was created.
2025-01-13 16:00:35 +01:00
data_tests:
2024-12-04 11:15:21 +01:00
- not_null
2024-12-17 19:09:54 +01:00
- name: cosmos_created_date_utc
2024-12-04 11:15:21 +01:00
data_type: date
2024-12-04 16:33:50 +01:00
description: |
2024-12-17 19:09:54 +01:00
Date of when the verification request was created in Cosmos DB.
2025-01-13 16:00:35 +01:00
data_tests:
2024-12-04 11:15:21 +01:00
- not_null
2024-12-23 16:20:12 +01:00
2024-12-30 12:11:45 +01:00
- name: int_screen_and_protect__verification_fees
2024-12-23 16:20:12 +01:00
description: |
2024-12-30 12:11:45 +01:00
This table contains all records for verification requests
from the Screen and Protect API and their fees.
It tracks financial details such as booking fees, discounts and
some booking-related metadata.
Documentation:
https://www.notion.so/knowyourguest-superhog/Invoice-Screen-Protect-1610446ff9c980f88de6d6293b4fab03?pvs=4
2024-12-23 16:20:12 +01:00
columns:
- name: id_verification
data_type: text
description: "Unique identifier for the verification request."
tests:
- not_null
- unique
- name: id_booking
data_type: text
description: "Unique identifier for the booking associated with the verification."
tests:
- not_null
- name: id_user_partner
data_type: text
description: "Identifier for the partner user initiating the verification."
tests:
- not_null
- name: id_accommodation
data_type: text
description: "Identifier for the accommodation related to the booking."
- name: is_protected
data_type: boolean
description: "Indicates if the booking is protected or not."
- name: protection_type
data_type: text
description: "Specific protection type for the request."
tests:
- not_null
- accepted_values:
values:
- "SCREEN & PROTECT"
- "BASIC PROTECTION"
- "STANDALONE PROTECTION"
- "DAMAGE WAIVER"
- "PET PROTECTION"
- name: protection_starting_amount_in_local_currency
data_type: numeric
description: Field used for protection type "STANDALONE PROTECTION" to
indicate the starting level of protection.
In local currency.
tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
max_value: 100000
strictly: true
- name: protection_basic_amount_in_local_currency
data_type: numeric
description: Field used for protection type "SCREEN & PROTECT",
"BASIC PROTECTION" or "DAMAGE WAIVER" to show the basic amount of protection.
In local currency.
tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
max_value: 100000
strictly: true
- name: protection_extended_amount_in_local_currency
data_type: numeric
description: Field used for protection type "SCREEN & PROTECT",
or "STANDALONE PROTECTION" to show the basic amount of protection.
In local currency.
tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
max_value: 50000000
strictly: true
- name: pet_protection
data_type: boolean
description: Indicates if pet protection was included.
- name: verification_status
data_type: text
description: Outcome of the verification process.
tests:
- not_null
- accepted_values:
values:
- "APPROVED"
- "FLAGGED"
- "REJECTED"
- name: id_currency
data_type: bigint
description: "Id of the currency, works as a foreign key to the
currency table"
tests:
- not_null
- relationships:
to: ref('stg_core__currency')
field: id_currency
- name: checkin_date_utc
data_type: date
description: "Check-in date for the booking."
tests:
- not_null
- name: checkout_date_utc
data_type: date
description: "Check-out date for the booking."
tests:
- not_null
- name: number_of_nights
data_type: integer
description: Number of nights for the reservation.
tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 1
- name: is_cancelled
data_type: boolean
description: "Indicates if the booking was canceled."
- name: cancelled_at_utc
data_type: timestamp without time zone
description: "Timestamp when the booking was canceled."
- name: cancelled_date_utc
data_type: date
description: "Date when the booking was canceled."
- name: total_fee_in_local_currency
data_type: numeric
description: "Total fee in local currency, inclusive of all charges."
tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
max_value: 10000000
strictly: true
2024-12-30 12:11:45 +01:00
- not_null
2024-12-23 16:20:12 +01:00
- name: discount_percentage
data_type: numeric
description: "Percentage of discount applied to the booking."
tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
max_value: 99
strictly: false
2024-12-30 12:11:45 +01:00
- not_null
2024-12-23 16:20:12 +01:00
- name: discount_amount_in_local_currency
data_type: numeric
description: "Amount of discount in local currency applied to the booking."
tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
max_value: 10000000
strictly: false
2024-12-30 12:11:45 +01:00
- not_null
2024-12-23 16:20:12 +01:00
2024-12-30 12:11:45 +01:00
- name: total_fee_after_discount_in_local_currency
2024-12-23 16:20:12 +01:00
data_type: numeric
description: "Total fee in local currency after applying the discount."
tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
max_value: 10000000
strictly: true
2024-12-30 12:11:45 +01:00
- not_null
2024-12-23 16:20:12 +01:00
- name: invoice_date_utc
data_type: date
description: "Date to consider for the invoice."
tests:
- not_null
- name: creation_at_utc
data_type: timestamp without time zone
description: "Timestamp of when the reservation was created."
tests:
- not_null
- name: creation_date_utc
data_type: date
description: "Date of when the reservation was created."
tests:
- not_null
- name: cosmos_created_date_utc
data_type: date
description: "Date of when the verification request was created in Cosmos DB."
tests:
- not_null