Commit update

This commit is contained in:
Joaquin Ossa 2025-02-24 14:53:24 +01:00
parent 7f8e7489e4
commit 68bddf2b7d
2 changed files with 36 additions and 65 deletions

View file

@ -31,11 +31,7 @@ with
from jsonb_array_elements(status_history_logs::jsonb) status_step
order by (status_step ->> 'CreatedDate')::timestamp desc
limit 1
) as last_status_at_utc,
(
select count(*)
from jsonb_array_elements(host_user_claim_logs::jsonb) comment
) as claims_count
) as last_status_at_utc
from stg_resolutions__incidents
),
damage_reported_items as (
@ -72,7 +68,6 @@ with
select
-- Basic Incident Details
i.id_incident,
i.id_user,
i.id_verification,
i.current_status_name,
i.is_submission_complete,
@ -119,7 +114,6 @@ select
-- Host Details
i.id_user_host,
lt.claims_count,
i.host_account_name,
-- Host Contact Details
@ -148,7 +142,7 @@ select
i.has_host_taken_preventative_steps,
i.guest_contribution_amount_in_txn_currency,
i.guest_contribution_currency,
i.guest_contacted_about_damage,
i.is_guest_contacted_about_damage,
-- Accommodation Details
i.id_accommodation,
@ -161,8 +155,7 @@ select
i.check_out_date_utc,
i.id_booking,
i.booking_status,
i.id_reservation,
i.booking_protection
i.id_reservation
from stg_resolutions__incidents i
left join logs_timeline lt on i.id_incident = lt.id_incident

View file

@ -14,13 +14,7 @@ models:
description: "Unique identifier for the incident."
data_tests:
- not_null
# - unique
- name: id_user
data_type: text
description: "Id of the user who created the incident."
data_tests:
- not_null
- unique
- name: id_verification
data_type: text
@ -90,11 +84,11 @@ models:
- name: resolution_time_in_hours
data_type: numeric
description: "Time taken to resolve the incident, in hours, if completed."
# data_tests:
# - dbt_expectations.expect_column_values_to_be_between:
# min_value: 0
# strictly: true
# where: "document_version <> 'OldClaimToIncidentModel'"
data_tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
strictly: true
where: "document_version <> 'OldClaimToIncidentModel'"
- name: number_damaged_items
data_type: bigint
@ -127,20 +121,12 @@ models:
min_value: 0
strictly: false
- name: protection_name
data_type: text
description: "Name of the protection plan covering the booking."
- name: was_overriden
data_type: boolean
description: |
"Flag to indicate if the proposed settlement value from the
calculator was overridden."
- name: waiver_or_deposit_name
data_type: text
description: "Waiver or deposit type associated with the booking."
- name: guest_verification_status
data_type: text
description: "Guest verification status for this booking."
@ -204,16 +190,12 @@ models:
description: |
"Unique Id that identifies the host. Can be from SH or can
be external from the client."
# data_tests:
# - not_null
# - relationships:
# to: ref('stg_core__user')
# field: id_user
# where: "document_version <> 'OldClaimToIncidentModel'"
- name: claims_count
data_type: bigint
description: "Number of claims made by the host."
data_tests:
- not_null
- relationships:
to: ref('stg_core__user')
field: id_user
where: "document_version <> 'OldClaimToIncidentModel'"
- name: host_account_name
data_type: text
@ -242,13 +224,13 @@ models:
- name: id_user_guest
data_type: text
description: "Superhog code that uniquely identifies a single guest."
# data_tests:
# - not_null:
# where: "document_version <> 'OldClaimToIncidentModel'"
# - relationships:
# to: ref('stg_core__user')
# field: id_user
# where: "document_version <> 'OldClaimToIncidentModel'"
data_tests:
- not_null:
where: "document_version <> 'OldClaimToIncidentModel'"
- relationships:
to: ref('stg_core__user')
field: id_user
where: "document_version <> 'OldClaimToIncidentModel'"
- name: guest_email
data_type: text
@ -318,19 +300,19 @@ models:
- not_null:
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
description: "If the host has contacted the guest about the damage caused"
- name: id_accommodation
data_type: numeric
description: "Superhog code that uniquely identifies a single accommodation."
# data_tests:
# - not_null
# - relationships:
# to: ref('stg_core__accommodation')
# field: id_accommodation
# where: "document_version <> 'OldClaimToIncidentModel'"
data_tests:
- not_null
- relationships:
to: ref('stg_core__accommodation')
field: id_accommodation
where: "document_version <> 'OldClaimToIncidentModel'"
- name: accommodation_name
data_type: text
@ -363,13 +345,13 @@ models:
- name: id_booking
data_type: numeric
description: "Superhog unique booking ID"
# data_tests:
# - not_null:
# where: "document_version <> 'OldClaimToIncidentModel'"
# - relationships:
# to: ref('stg_core__booking')
# field: id_booking
# where: "document_version <> 'OldClaimToIncidentModel'"
data_tests:
- not_null:
where: "document_version <> 'OldClaimToIncidentModel'"
- relationships:
to: ref('stg_core__booking')
field: id_booking
where: "document_version <> 'OldClaimToIncidentModel'"
- name: booking_status
data_type: text
@ -378,7 +360,3 @@ models:
- name: id_reservation
data_type: text
description: "External unique ID for the reservation."
- name: booking_protection
data_type: text
description: "Details on the booking protection applied."