diff --git a/models/intermediate/core/int_edeposit__verifications.sql b/models/intermediate/core/int_edeposit__verifications.sql new file mode 100644 index 0000000..8440f50 --- /dev/null +++ b/models/intermediate/core/int_edeposit__verifications.sql @@ -0,0 +1,47 @@ +with + stg_edeposit__verifications as ( + select * from {{ ref("stg_edeposit__verifications") }} + ) +select + -- note that these ids are not the same as the ones found in Core DWH + -- they are completely unrelated + id as id_verification, + id_booking, + id_user as id_user_host, + id_listing as id_accommodation, + version, -- V1 for Guesty and V2 for E-deposit + case + when version = 'V1' then 'Guesty' when version = 'V2' then 'Edeposit' else null + end as verification_source, + verification_status, + verification_status_reason, + nightly_fee_local, + cast(checkout_at_utc as date) - cast(checkin_at_utc as date) as number_nights, + email_flag, + phone_flag, + watch_list, + channel, + checkin_at_utc, + checkout_at_utc, + is_cancelled, + cancelled_at_utc, + user_email, + guest_email, + guest_last_name, + guest_first_name, + guest_telephone, + company_name, + property_manager_name, + property_manager_email, + listing_name, + listing_town, + listing_country, + listing_postcode, + pets_allowed, + level_of_protection_amount, + level_of_protection_currency, + status_updated_at_utc, + updated_at_utc, + creation_at_utc, + created_at_utc +from stg_edeposit__verifications diff --git a/models/intermediate/core/schema.yaml b/models/intermediate/core/schema.yaml index aabb776..6c7f064 100644 --- a/models/intermediate/core/schema.yaml +++ b/models/intermediate/core/schema.yaml @@ -2767,3 +2767,173 @@ models: data_type: integer description: | Integer-based flag version of total_bookings_with_product_bundle_with_paid_service. + + - name: int_edeposit__verifications + description: + "This table holds records on verifications for e-deposit bookings. + It contains details on validations checked on the guests, guest information + and some booking details like checkin-checkout date or the status of the verification. + The id values found here are completely unrelated to the ones found in Core DWH." + columns: + - name: id_verification + data_type: text + description: "unique Superhog generated id for this verification" + tests: + - unique + - not_null + + - name: id_booking + data_type: text + description: "unique Superhog generated id for a booking" + + - name: id_user_host + data_type: text + description: "unique Superhog generated id for host" + + - name: id_accommodation + data_type: text + description: "unique Superhog generated id for a listing" + + - name: version + data_type: text + description: + "value to identify if it is Guesty (V1) or E-deposit (V2)" + tests: + - accepted_values: + values: + - V1 + - V2 + + - name: verification_source + data_type: text + description: + "source of the verification for the booking" + tests: + - accepted_values: + values: + - Guesty + - Edeposit + + - name: verification_status + data_type: text + description: "status of the verification" + + - name: verification_status_reason + data_type: text + description: "short explanation for status" + + - name: nightly_fee_local + data_type: text + description: "fee charged per night" + + - name: number_nights + data_type: integer + description: "number of nights for the booking" + + - name: email_flag + data_type: text + description: "" + + - name: phone_flag + data_type: text + description: "" + + - name: watch_list + data_type: text + description: "" + + - name: channel + data_type: text + description: "" + + - name: checkin_at_utc + data_type: timestamp without time zone + description: "Timestamp of checkin for the booking" + + - name: checkout_at_utc + data_type: timestamp without time zone + description: "Timestamp of checkout for the booking" + + - name: is_cancelled + data_type: boolean + description: "" + + - name: cancelled_at_utc + data_type: timestamp without time zone + description: "Timestamp of cancellation of the booking" + + - name: user_email + data_type: text + description: "" + + - name: guest_email + data_type: text + description: "" + + - name: guest_last_name + data_type: text + description: "" + + - name: guest_first_name + data_type: text + description: "" + + - name: guest_telephone + data_type: text + description: "" + + - name: company_name + data_type: text + description: "" + + - name: property_manager_name + data_type: text + description: "" + + - name: property_manager_email + data_type: text + description: "" + + - name: listing_name + data_type: text + description: "" + + - name: listing_town + data_type: text + description: "" + + - name: listing_country + data_type: text + description: "" + + - name: listing_postcode + data_type: text + description: "" + + - name: pets_allowed + data_type: boolean + description: "" + + - name: level_of_protection_amount + data_type: integer + description: "" + + - name: level_of_protection_currency + data_type: text + description: "" + + - name: status_updated_at_utc + data_type: timestamp without time zone + description: "Timestamp when status was last updated" + + - name: updated_at_utc + data_type: timestamp without time zone + description: "Timestamp of last updated" + + - name: creation_at_utc + data_type: timestamp without time zone + description: "" + + - name: created_at_utc + data_type: timestamp without time zone + description: ""