Commit update
This commit is contained in:
parent
7f8e7489e4
commit
68bddf2b7d
2 changed files with 36 additions and 65 deletions
|
|
@ -31,11 +31,7 @@ with
|
||||||
from jsonb_array_elements(status_history_logs::jsonb) status_step
|
from jsonb_array_elements(status_history_logs::jsonb) status_step
|
||||||
order by (status_step ->> 'CreatedDate')::timestamp desc
|
order by (status_step ->> 'CreatedDate')::timestamp desc
|
||||||
limit 1
|
limit 1
|
||||||
) as last_status_at_utc,
|
) as last_status_at_utc
|
||||||
(
|
|
||||||
select count(*)
|
|
||||||
from jsonb_array_elements(host_user_claim_logs::jsonb) comment
|
|
||||||
) as claims_count
|
|
||||||
from stg_resolutions__incidents
|
from stg_resolutions__incidents
|
||||||
),
|
),
|
||||||
damage_reported_items as (
|
damage_reported_items as (
|
||||||
|
|
@ -72,7 +68,6 @@ with
|
||||||
select
|
select
|
||||||
-- Basic Incident Details
|
-- Basic Incident Details
|
||||||
i.id_incident,
|
i.id_incident,
|
||||||
i.id_user,
|
|
||||||
i.id_verification,
|
i.id_verification,
|
||||||
i.current_status_name,
|
i.current_status_name,
|
||||||
i.is_submission_complete,
|
i.is_submission_complete,
|
||||||
|
|
@ -119,7 +114,6 @@ select
|
||||||
|
|
||||||
-- Host Details
|
-- Host Details
|
||||||
i.id_user_host,
|
i.id_user_host,
|
||||||
lt.claims_count,
|
|
||||||
i.host_account_name,
|
i.host_account_name,
|
||||||
|
|
||||||
-- Host Contact Details
|
-- Host Contact Details
|
||||||
|
|
@ -148,7 +142,7 @@ select
|
||||||
i.has_host_taken_preventative_steps,
|
i.has_host_taken_preventative_steps,
|
||||||
i.guest_contribution_amount_in_txn_currency,
|
i.guest_contribution_amount_in_txn_currency,
|
||||||
i.guest_contribution_currency,
|
i.guest_contribution_currency,
|
||||||
i.guest_contacted_about_damage,
|
i.is_guest_contacted_about_damage,
|
||||||
|
|
||||||
-- Accommodation Details
|
-- Accommodation Details
|
||||||
i.id_accommodation,
|
i.id_accommodation,
|
||||||
|
|
@ -161,8 +155,7 @@ select
|
||||||
i.check_out_date_utc,
|
i.check_out_date_utc,
|
||||||
i.id_booking,
|
i.id_booking,
|
||||||
i.booking_status,
|
i.booking_status,
|
||||||
i.id_reservation,
|
i.id_reservation
|
||||||
i.booking_protection
|
|
||||||
|
|
||||||
from stg_resolutions__incidents i
|
from stg_resolutions__incidents i
|
||||||
left join logs_timeline lt on i.id_incident = lt.id_incident
|
left join logs_timeline lt on i.id_incident = lt.id_incident
|
||||||
|
|
|
||||||
|
|
@ -14,13 +14,7 @@ models:
|
||||||
description: "Unique identifier for the incident."
|
description: "Unique identifier for the incident."
|
||||||
data_tests:
|
data_tests:
|
||||||
- not_null
|
- not_null
|
||||||
# - unique
|
- unique
|
||||||
|
|
||||||
- name: id_user
|
|
||||||
data_type: text
|
|
||||||
description: "Id of the user who created the incident."
|
|
||||||
data_tests:
|
|
||||||
- not_null
|
|
||||||
|
|
||||||
- name: id_verification
|
- name: id_verification
|
||||||
data_type: text
|
data_type: text
|
||||||
|
|
@ -90,11 +84,11 @@ models:
|
||||||
- name: resolution_time_in_hours
|
- name: resolution_time_in_hours
|
||||||
data_type: numeric
|
data_type: numeric
|
||||||
description: "Time taken to resolve the incident, in hours, if completed."
|
description: "Time taken to resolve the incident, in hours, if completed."
|
||||||
# data_tests:
|
data_tests:
|
||||||
# - dbt_expectations.expect_column_values_to_be_between:
|
- dbt_expectations.expect_column_values_to_be_between:
|
||||||
# min_value: 0
|
min_value: 0
|
||||||
# strictly: true
|
strictly: true
|
||||||
# where: "document_version <> 'OldClaimToIncidentModel'"
|
where: "document_version <> 'OldClaimToIncidentModel'"
|
||||||
|
|
||||||
- name: number_damaged_items
|
- name: number_damaged_items
|
||||||
data_type: bigint
|
data_type: bigint
|
||||||
|
|
@ -127,20 +121,12 @@ models:
|
||||||
min_value: 0
|
min_value: 0
|
||||||
strictly: false
|
strictly: false
|
||||||
|
|
||||||
- name: protection_name
|
|
||||||
data_type: text
|
|
||||||
description: "Name of the protection plan covering the booking."
|
|
||||||
|
|
||||||
- name: was_overriden
|
- name: was_overriden
|
||||||
data_type: boolean
|
data_type: boolean
|
||||||
description: |
|
description: |
|
||||||
"Flag to indicate if the proposed settlement value from the
|
"Flag to indicate if the proposed settlement value from the
|
||||||
calculator was overridden."
|
calculator was overridden."
|
||||||
|
|
||||||
- name: waiver_or_deposit_name
|
|
||||||
data_type: text
|
|
||||||
description: "Waiver or deposit type associated with the booking."
|
|
||||||
|
|
||||||
- name: guest_verification_status
|
- name: guest_verification_status
|
||||||
data_type: text
|
data_type: text
|
||||||
description: "Guest verification status for this booking."
|
description: "Guest verification status for this booking."
|
||||||
|
|
@ -204,16 +190,12 @@ models:
|
||||||
description: |
|
description: |
|
||||||
"Unique Id that identifies the host. Can be from SH or can
|
"Unique Id that identifies the host. Can be from SH or can
|
||||||
be external from the client."
|
be external from the client."
|
||||||
# data_tests:
|
data_tests:
|
||||||
# - not_null
|
- not_null
|
||||||
# - relationships:
|
- relationships:
|
||||||
# to: ref('stg_core__user')
|
to: ref('stg_core__user')
|
||||||
# field: id_user
|
field: id_user
|
||||||
# where: "document_version <> 'OldClaimToIncidentModel'"
|
where: "document_version <> 'OldClaimToIncidentModel'"
|
||||||
|
|
||||||
- name: claims_count
|
|
||||||
data_type: bigint
|
|
||||||
description: "Number of claims made by the host."
|
|
||||||
|
|
||||||
- name: host_account_name
|
- name: host_account_name
|
||||||
data_type: text
|
data_type: text
|
||||||
|
|
@ -242,13 +224,13 @@ models:
|
||||||
- name: id_user_guest
|
- name: id_user_guest
|
||||||
data_type: text
|
data_type: text
|
||||||
description: "Superhog code that uniquely identifies a single guest."
|
description: "Superhog code that uniquely identifies a single guest."
|
||||||
# data_tests:
|
data_tests:
|
||||||
# - not_null:
|
- not_null:
|
||||||
# where: "document_version <> 'OldClaimToIncidentModel'"
|
where: "document_version <> 'OldClaimToIncidentModel'"
|
||||||
# - relationships:
|
- relationships:
|
||||||
# to: ref('stg_core__user')
|
to: ref('stg_core__user')
|
||||||
# field: id_user
|
field: id_user
|
||||||
# where: "document_version <> 'OldClaimToIncidentModel'"
|
where: "document_version <> 'OldClaimToIncidentModel'"
|
||||||
|
|
||||||
- name: guest_email
|
- name: guest_email
|
||||||
data_type: text
|
data_type: text
|
||||||
|
|
@ -318,19 +300,19 @@ models:
|
||||||
- not_null:
|
- not_null:
|
||||||
where: "guest_contribution_amount_in_txn_currency > 0 and document_version <> 'OldClaimToIncidentModel'"
|
where: "guest_contribution_amount_in_txn_currency > 0 and document_version <> 'OldClaimToIncidentModel'"
|
||||||
|
|
||||||
- name: guest_contacted_about_damage
|
- name: is_guest_contacted_about_damage
|
||||||
data_type: boolean
|
data_type: boolean
|
||||||
description: "If the host has contacted the guest about the damage caused"
|
description: "If the host has contacted the guest about the damage caused"
|
||||||
|
|
||||||
- name: id_accommodation
|
- name: id_accommodation
|
||||||
data_type: numeric
|
data_type: numeric
|
||||||
description: "Superhog code that uniquely identifies a single accommodation."
|
description: "Superhog code that uniquely identifies a single accommodation."
|
||||||
# data_tests:
|
data_tests:
|
||||||
# - not_null
|
- not_null
|
||||||
# - relationships:
|
- relationships:
|
||||||
# to: ref('stg_core__accommodation')
|
to: ref('stg_core__accommodation')
|
||||||
# field: id_accommodation
|
field: id_accommodation
|
||||||
# where: "document_version <> 'OldClaimToIncidentModel'"
|
where: "document_version <> 'OldClaimToIncidentModel'"
|
||||||
|
|
||||||
- name: accommodation_name
|
- name: accommodation_name
|
||||||
data_type: text
|
data_type: text
|
||||||
|
|
@ -363,13 +345,13 @@ models:
|
||||||
- name: id_booking
|
- name: id_booking
|
||||||
data_type: numeric
|
data_type: numeric
|
||||||
description: "Superhog unique booking ID"
|
description: "Superhog unique booking ID"
|
||||||
# data_tests:
|
data_tests:
|
||||||
# - not_null:
|
- not_null:
|
||||||
# where: "document_version <> 'OldClaimToIncidentModel'"
|
where: "document_version <> 'OldClaimToIncidentModel'"
|
||||||
# - relationships:
|
- relationships:
|
||||||
# to: ref('stg_core__booking')
|
to: ref('stg_core__booking')
|
||||||
# field: id_booking
|
field: id_booking
|
||||||
# where: "document_version <> 'OldClaimToIncidentModel'"
|
where: "document_version <> 'OldClaimToIncidentModel'"
|
||||||
|
|
||||||
- name: booking_status
|
- name: booking_status
|
||||||
data_type: text
|
data_type: text
|
||||||
|
|
@ -378,7 +360,3 @@ models:
|
||||||
- name: id_reservation
|
- name: id_reservation
|
||||||
data_type: text
|
data_type: text
|
||||||
description: "External unique ID for the reservation."
|
description: "External unique ID for the reservation."
|
||||||
|
|
||||||
- name: booking_protection
|
|
||||||
data_type: text
|
|
||||||
description: "Details on the booking protection applied."
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue