diff --git a/models/intermediate/cross/int_api_verifications.sql b/models/intermediate/cross/int_api_verifications.sql new file mode 100644 index 0000000..399762d --- /dev/null +++ b/models/intermediate/cross/int_api_verifications.sql @@ -0,0 +1,90 @@ +with + int_athena__verifications as (select * from {{ ref("int_athena__verifications") }}), + int_edeposit__verifications as ( + select * from {{ ref("int_edeposit__verifications") }} + ) +select + av.id_verification, + av.id_booking, + av.id_user_partner, + av.id_accommodation, + av.version, + av.verification_source, + av.verification_status, + av.nightly_fee_local, + av.number_nights, + av.email_flag, + av.phone_flag, + av.watch_list, + av.channel, + av.checkin_at_utc, + av.checkin_date_utc, + av.checkout_at_utc, + av.checkout_date_utc, + av.is_cancelled, + av.cancelled_at_utc, + av.cancelled_date_utc, + av.user_email, + av.guest_email, + av.guest_last_name, + av.guest_first_name, + av.guest_telephone, + av.company_name, + av.property_manager_name, + av.property_manager_email, + av.listing_name, + av.listing_town, + av.listing_country, + av.listing_postcode, + av.pets_allowed, + av.status_updated_at_utc, + av.status_updated_date_utc, + av.updated_at_utc, + av.athena_creation_at_utc, + av.athena_creation_date_utc, + av.created_at_utc, + av.created_date_utc +from int_athena__verifications av +union all +select + ev.id_verification, + ev.id_booking, + ev.id_user_partner, + ev.id_accommodation, + ev.version, + ev.verification_source, + ev.verification_status, + ev.nightly_fee_local, + ev.number_nights, + ev.email_flag, + ev.phone_flag, + ev.watch_list, + ev.channel, + ev.checkin_at_utc, + ev.checkin_date_utc, + ev.checkout_at_utc, + ev.checkout_date_utc, + ev.is_cancelled, + ev.cancelled_at_utc, + ev.cancelled_date_utc, + ev.user_email, + ev.guest_email, + ev.guest_last_name, + ev.guest_first_name, + ev.guest_telephone, + ev.company_name, + ev.property_manager_name, + ev.property_manager_email, + ev.listing_name, + ev.listing_town, + ev.listing_country, + ev.listing_postcode, + ev.pets_allowed, + ev.status_updated_at_utc, + ev.status_updated_date_utc, + ev.updated_at_utc, + ev.athena_creation_at_utc, + ev.athena_creation_date_utc, + ev.created_at_utc, + ev.created_date_utc +from int_edeposit__verifications ev diff --git a/models/intermediate/cross/schema.yml b/models/intermediate/cross/schema.yml index d277467..854719d 100644 --- a/models/intermediate/cross/schema.yml +++ b/models/intermediate/cross/schema.yml @@ -1181,3 +1181,208 @@ models: - name: listings_booked_in_month_churn_average_contribution data_type: numeric description: Listings Booked in Month churn rate (average approach). + + - name: int_api_verifications + description: + "This table holds records on verifications for Guesty and Edeposit 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. + + Note that id_verifications and booking_id should normally be 1 to 1. + Though there are exception, the API will accept a duplicate booking and the users + will be charged for it. A duplicate would return a unique id_verification." + 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. + note that this could be duplicated and both will be charged, + it's up to the user to no generate duplicate verifications" + + - name: id_user_partner + data_type: text + description: "unique Superhog generated id for partner" + tests: + - not_null + + - 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: nightly_fee_local + data_type: double precision + 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: "screening result for email" + + - name: phone_flag + data_type: text + description: "screening result for phone" + + - name: watch_list + data_type: text + description: "screening result of the guest" + + - name: channel + data_type: text + description: "" + + - name: checkin_at_utc + data_type: timestamp without time zone + description: "Timestamp of checkin for the booking" + + - name: checkin_date_utc + data_type: date + description: "Date of checkin for the booking" + + - name: checkout_at_utc + data_type: timestamp without time zone + description: "Timestamp of checkout for the booking" + + - name: checkout_date_utc + data_type: date + description: "Date 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: cancelled_date_utc + data_type: date + description: "Date of cancellation for 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: status_updated_date_utc + data_type: date + description: "Date of last status update of the verification" + + - name: updated_at_utc + data_type: timestamp without time zone + description: "Timestamp of last updated of the verification" + + - name: updated_date_utc + data_type: date + description: "Date of last update of the verification" + + - name: athena_creation_at_utc + data_type: timestamp without time zone + description: + "Athena timestamp referring to when the booking was created. + It's provided by Guesty, but is not mandatory. + In case of doubt use created_at_utc or created_date_utc fields" + + - name: athena_creation_date_utc + data_type: date + description: "Athena date referring to when the booking was created. + It's provided by Guesty, but is not mandatory. + In case of doubt use created_at_utc or created_date_utc fields" + + - name: created_at_utc + data_type: timestamp without time zone + description: "Timestamp of creation of the verification in the system" + + - name: created_date_utc + data_type: date + description: "Date of creation of the verification in the system"