diff --git a/models/intermediate/resolutions/int_resolutions__incidents.sql b/models/intermediate/resolutions/int_resolutions__incidents.sql new file mode 100644 index 0000000..60d23fe --- /dev/null +++ b/models/intermediate/resolutions/int_resolutions__incidents.sql @@ -0,0 +1,86 @@ +with stg_resolutions__incidents as (select * from {{ ref("stg_resolutions__incidents") }}) + +select + -- Basic Incident Details + id_incident, + id_user, + id_verification, + current_status_name, + is_submission_complete, + current_agent_name, + read_only_for_customers, + status_history_logs, + document_version, + task_execution_logs, + created_at_date, + created_date_date, + updated_at_date, + updated_date_date, + + -- Host Details + id_user_host, + host_user_claim_logs, + host_account_name, + + -- Host Contact Details + host_email, + host_last_name, + host_first_name, + host_phone_code, + host_phone_number, + host_phone_number_with_code, + + -- Guest Details + id_user_guest, + guest_email, + guest_last_name, + guest_first_name, + guest_phone_code, + guest_phone_number, + guest_phone_number_with_code, + + -- Guest Deposit Details + is_guest_deposit_retained, + is_guest_deposit_collected, + deposit_retained_amount_in_txn_currency, + deposit_retained_currency, + + -- Guest Involvements + has_guest_contributed_to_cost, + has_host_taken_preventative_steps, + guest_contribution_amount_in_txn_currency, + guest_contribution_currency, + guest_contacted_about_damage, + guest_contacted_evidence_files, + guest_preventative_steps_details, + + -- Accommodation Details + id_accommodation, + accommodation_url, + accommodation_name, + are_pets_allowed, + + -- Booking Details + check_in_at_utc, + check_in_date_utc, + check_out_at_utc, + check_out_date_utc, + id_booking, + + booking_status, + id_reservation, + booking_details, + number_of_guests, + booking_services, + booking_protection, + booking_platform_used, + booking_platform_reference, + + -- Damage Report + before_damage_evidence, + original_invoice_evidence, + damage_incident_details, + has_confirmed_loss, + damage_report_items, + +from raw_incident diff --git a/models/intermediate/resolutions/schema.yml b/models/intermediate/resolutions/schema.yml new file mode 100644 index 0000000..e896661 --- /dev/null +++ b/models/intermediate/resolutions/schema.yml @@ -0,0 +1,363 @@ +version: 2 + +models: + - name: int_resolutions__incidents + description: | + "Contains all incidents stored by the resolutions team in Cosmos DB. + This includes data about the incident, the user claiming the incident, the booking, + the accommodation, the host and the guest." + columns: + - name: id_incident + data_type: text + description: "Unique identifier for the incident." + data_tests: + - unique + - not_null + + - name: id_user + data_type: text + description: "Id of the user who created the incident." + data_tests: + - not_null + + - name: id_verification + data_type: text + description: "Superhog unique validation ID, coming from other APIs." + + - name: current_status_name + data_type: text + description: "current status of the incident." + data_tests: + - not_null + + - name: is_submission_complete + data_type: boolean + description: "Flag to indicate if the submission is complete." + data_tests: + - not_null + + - name: current_agent_name + data_type: text + description: "Name of the agent who is currently handling the incident." + + - name: read_only_for_customers + data_type: boolean + description: "Flag to indicate if the incident is read only for customers." + + - name: status_history_logs + data_type: text + description: "Log of the status history." + + - name: document_version + data_type: text + description: "Reported document resCentre, Api, manual form" + + - name: task_execution_logs + data_type: text + description: "" + + - name: created_at_date + data_type: timestamp without time zone + description: "Timestamp when the incident was created." + data_tests: + - not_null + + - name: created_date_date + data_type: date + description: "Date when the incident was created." + data_tests: + - not_null + + - name: updated_at_date + data_type: timestamp without time zone + description: "Timestamp when the incident was last updated." + data_tests: + - not_null + + - name: updated_date_date + data_type: date + description: "Date when the incident was last updated." + data_tests: + - not_null + + - name: id_user_host + data_type: text + description: "Unique Id that identifies the host. + Can be from SH or can be external from the client." + data_tests: + - not_null + + - name: host_user_claim_logs + data_type: text + description: "" + + - name: host_account_name + data_type: text + description: "Name of the host account." + data_tests: + - not_null + + - name: host_email + data_type: text + description: "Email of the host." + data_tests: + - not_null + + - name: host_last_name + data_type: text + description: "Last name of the host." + data_tests: + - not_null + + - name: host_first_name + data_type: text + description: "First name of the host." + data_tests: + - not_null + + - name: host_phone_code + data_type: text + description: "Phone code of the host." + + - name: host_phone_number + data_type: text + description: "Phone number of the host." + + - name: host_phone_number_with_code + data_type: text + description: "Phone number of the host with the code." + + - name: id_user_guest + data_type: text + description: "Superhog code that uniquely identifies a single guest." + data_tests: + - not_null + + - name: guest_email + data_type: text + description: "Email of the guest." + data_tests: + - not_null + + - name: guest_last_name + data_type: text + description: "Last name of the guest." + data_tests: + - not_null + + - name: guest_first_name + data_type: text + description: "First name of the guest." + data_tests: + - not_null + + - name: guest_phone_code + data_type: text + description: "Phone code of the guest." + + - name: guest_phone_number + data_type: text + description: "Phone number of the guest." + + - name: guest_phone_number_with_code + data_type: text + description: "Phone number of the guest with the code." + + - name: is_guest_deposit_retained + data_type: boolean + description: "In case a deposit has been collected from the guest, + whether it has been retained or not." + + - name: is_guest_deposit_collected + data_type: boolean + description: "If the host has collected a deposit from the guest." + + - name: deposit_retained_amount_in_txn_currency + data_type: text + description: "Amount of the deposit retained in local currency." + + - name: deposit_retained_currency + data_type: text + description: "Currency of the deposit retained." + + - name: has_guest_contributed_to_cost + data_type: boolean + description: "If the guest has agreed to contribute to the cost when + talking to the host" + + - name: has_host_taken_preventative_steps + data_type: boolean + description: "If the host has taken any action to prevent the damage + or further damage once identified" + + - name: guest_contribution_amount_in_txn_currency + data_type: text + description: "Amount of the guest contribution, in case they did, + in local currency." + + - name: guest_contribution_currency + data_type: text + description: "Currency of the guest contribution." + + - name: guest_contacted_about_damage + data_type: boolean + description: "If the host has contacted the guest about the damage caused" + + - name: guest_contacted_evidence_files + data_type: text + description: "" + + - name: guest_preventative_steps_details + data_type: text + description: "Description of any action to prevent the damage or further + damage once identified" + + - name: id_accommodation + data_type: text + description: "Superhog code that uniquely identifies a single accommodation." + data_tests: + - not_null + + - name: accommodation_url + data_type: text + description: "Accommodation URL from any distribution channel, + preferable direct website." + + - name: accommodation_name + data_type: text + description: "Accommodation name." + + - name: accommodation_address + data_type: text + description: "Address of the accommodation." + + - name: are_pets_allowed + data_type: boolean + description: "Flag to indicate if pets are allowed in the accommodation." + + - name: comment_logs + data_type: text + description: "" + + - name: has_underlying_insurance + data_type: boolean + description: "If the property has underlying insurance" + + - name: insurance_claim_submitted + data_type: boolean + description: "If an insurance claim has been submitted to an insurance company" + + - name: insurance_evidence_files + data_type: text + description: "" + + - name: check_in_at_utc + data_type: timestamp without time zone + description: "Timestamp of the check-in date in UTC of the booking." + data_tests: + - not_null + + - name: check_in_date_utc + data_type: date + description: "Date of the check-in date in UTC of the booking." + data_tests: + - not_null + + - name: check_out_at_utc + data_type: timestamp without time zone + description: "Timestamp of the check-out date in UTC of the booking." + data_tests: + - not_null + + - name: check_out_date_utc + data_type: date + description: "Date of the check-out date in UTC of the booking." + data_tests: + - not_null + + - name: id_booking + data_type: text + description: "Superhog unique booking ID" + data_tests: + - not_null + + - name: booking_status + data_type: text + description: "Status of the booking." + + - name: id_reservation + data_type: text + description: "External unique ID" + + - name: booking_details + data_type: text + description: "" + + - name: number_of_guests + data_type: text + description: "Number of guests in the booking." + + - name: booking_services + data_type: text + description: "List of services included in the booking." + + - name: booking_protection + data_type: text + description: "" + + - name: booking_platform_used + data_type: text + description: "The booking platform used" + + - name: booking_platform_reference + data_type: text + description: "" + + - name: agent_history + data_type: text + description: "" + + - name: before_damage_evidence + data_type: text + description: "" + + - name: original_invoice_evidence + data_type: text + description: "" + + - name: damage_incident_details + data_type: text + description: "Description of what happened in general terms" + + - name: has_confirmed_loss + data_type: boolean + description: "Confirmation that the information they have provided in + the report is true to the best of their knowledge." + + - name: damage_report_items + data_type: text + description: "List of items that were damaged." + + - name: third_party_claim_submitted + data_type: boolean + description: "If the host is seeking compensation from another platform" + + - name: third_party_claim_from + data_type: text + description: "For example, Aircover from Airbnb." + + - name: third_party_claim_amount_in_txn_currency + data_type: text + description: "Claim amount in local currency if the host is seeking + compensation from another platform." + + - name: third_party_claim_currency + data_type: text + description: "Currency of the claim amount if the host is seeking + compensation from another platform." + + - name: cosmos_db_timestamp_utc + data_type: timestamp + description: Internal Cosmos DB timestamp of the last record update. + data_tests: + - not_null