finished schema
This commit is contained in:
parent
8b7dfa0839
commit
63a2eff6e2
2 changed files with 93 additions and 90 deletions
|
|
@ -72,16 +72,16 @@ with
|
||||||
select
|
select
|
||||||
-- Basic Incident Details
|
-- Basic Incident Details
|
||||||
i.id_incident,
|
i.id_incident,
|
||||||
id_user,
|
i.id_user,
|
||||||
id_verification,
|
i.id_verification,
|
||||||
current_status_name,
|
i.current_status_name,
|
||||||
is_submission_complete,
|
i.is_submission_complete,
|
||||||
current_agent_name,
|
i.current_agent_name,
|
||||||
document_version,
|
i.document_version,
|
||||||
created_at_utc,
|
i.created_at_utc,
|
||||||
created_date_utc,
|
i.created_date_utc,
|
||||||
updated_at_utc,
|
i.updated_at_utc,
|
||||||
updated_date_utc,
|
i.updated_date_utc,
|
||||||
|
|
||||||
-- Resolution Details
|
-- Resolution Details
|
||||||
lt.first_comment_at_utc,
|
lt.first_comment_at_utc,
|
||||||
|
|
@ -90,7 +90,7 @@ select
|
||||||
lt.first_status_at_utc,
|
lt.first_status_at_utc,
|
||||||
lt.last_status_at_utc,
|
lt.last_status_at_utc,
|
||||||
case
|
case
|
||||||
when is_submission_complete
|
when i.is_submission_complete
|
||||||
then
|
then
|
||||||
(
|
(
|
||||||
extract(epoch from (lt.last_status_at_utc - lt.first_status_at_utc))
|
extract(epoch from (lt.last_status_at_utc - lt.first_status_at_utc))
|
||||||
|
|
@ -104,65 +104,65 @@ select
|
||||||
dr.accepted_amount_in_txn_currency,
|
dr.accepted_amount_in_txn_currency,
|
||||||
|
|
||||||
-- Resolutions calculator
|
-- Resolutions calculator
|
||||||
protection_name,
|
i.protection_name,
|
||||||
was_overriden,
|
i.was_overriden,
|
||||||
waiver_or_deposit_name,
|
i.waiver_or_deposit_name,
|
||||||
guest_verification_status,
|
i.guest_verification_status,
|
||||||
lower_protection_limit_usd,
|
i.lower_protection_limit_usd,
|
||||||
upper_protection_limit_usd,
|
i.upper_protection_limit_usd,
|
||||||
calculated_payout_amount_in_txn_currency,
|
i.calculated_payout_amount_in_txn_currency,
|
||||||
calculated_payout_currency,
|
i.calculated_payout_currency,
|
||||||
calculated_payout_amount_in_usd,
|
i.calculated_payout_amount_in_usd,
|
||||||
calculated_guest_charge_amount_in_txn_currency,
|
i.calculated_guest_charge_amount_in_txn_currency,
|
||||||
calculated_guest_charge_currency,
|
i.calculated_guest_charge_currency,
|
||||||
calculated_guest_charge_amount_in_usd
|
i.calculated_guest_charge_amount_in_usd,
|
||||||
|
|
||||||
-- Host Details
|
-- Host Details
|
||||||
id_user_host,
|
i.id_user_host,
|
||||||
lt.claims_count,
|
lt.claims_count,
|
||||||
host_account_name,
|
i.host_account_name,
|
||||||
|
|
||||||
-- Host Contact Details
|
-- Host Contact Details
|
||||||
host_email,
|
i.host_email,
|
||||||
host_last_name,
|
i.host_last_name,
|
||||||
host_first_name,
|
i.host_first_name,
|
||||||
host_phone_code,
|
i.host_phone_code,
|
||||||
host_phone_number,
|
i.host_phone_number,
|
||||||
|
|
||||||
-- Guest Details
|
-- Guest Details
|
||||||
id_user_guest,
|
i.id_user_guest,
|
||||||
guest_email,
|
i.guest_email,
|
||||||
guest_last_name,
|
i.guest_last_name,
|
||||||
guest_first_name,
|
i.guest_first_name,
|
||||||
guest_phone_code,
|
i.guest_phone_code,
|
||||||
guest_phone_number,
|
i.guest_phone_number,
|
||||||
|
|
||||||
-- Guest Deposit Details
|
-- Guest Deposit Details
|
||||||
is_guest_deposit_retained,
|
i.is_guest_deposit_retained,
|
||||||
is_guest_deposit_collected,
|
i.is_guest_deposit_collected,
|
||||||
deposit_retained_amount_in_txn_currency,
|
i.deposit_retained_amount_in_txn_currency,
|
||||||
deposit_retained_currency,
|
i.deposit_retained_currency,
|
||||||
|
|
||||||
-- Guest Involvements
|
-- Guest Involvements
|
||||||
has_guest_contributed_to_cost,
|
i.has_guest_contributed_to_cost,
|
||||||
has_host_taken_preventative_steps,
|
i.has_host_taken_preventative_steps,
|
||||||
guest_contribution_amount_in_txn_currency,
|
i.guest_contribution_amount_in_txn_currency,
|
||||||
guest_contribution_currency,
|
i.guest_contribution_currency,
|
||||||
guest_contacted_about_damage,
|
i.guest_contacted_about_damage,
|
||||||
|
|
||||||
-- Accommodation Details
|
-- Accommodation Details
|
||||||
id_accommodation,
|
i.id_accommodation,
|
||||||
accommodation_name,
|
i.accommodation_name,
|
||||||
|
|
||||||
-- Booking Details
|
-- Booking Details
|
||||||
check_in_at_utc,
|
i.check_in_at_utc,
|
||||||
check_in_date_utc,
|
i.check_in_date_utc,
|
||||||
check_out_at_utc,
|
i.check_out_at_utc,
|
||||||
check_out_date_utc,
|
i.check_out_date_utc,
|
||||||
id_booking,
|
i.id_booking,
|
||||||
booking_status,
|
i.booking_status,
|
||||||
id_reservation,
|
i.id_reservation,
|
||||||
booking_protection
|
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,7 +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
|
- name: id_user
|
||||||
data_type: text
|
data_type: text
|
||||||
|
|
@ -49,13 +49,15 @@ models:
|
||||||
data_type: timestamp
|
data_type: timestamp
|
||||||
description: "Timestamp when the incident was created."
|
description: "Timestamp when the incident was created."
|
||||||
data_tests:
|
data_tests:
|
||||||
- not_null
|
- not_null:
|
||||||
|
where: "document_version <> 'OldClaimToIncidentModel'"
|
||||||
|
|
||||||
- name: created_date_utc
|
- name: created_date_utc
|
||||||
data_type: date
|
data_type: date
|
||||||
description: "Date when the incident was created."
|
description: "Date when the incident was created."
|
||||||
data_tests:
|
data_tests:
|
||||||
- not_null
|
- not_null:
|
||||||
|
where: "document_version <> 'OldClaimToIncidentModel'"
|
||||||
|
|
||||||
- name: updated_at_utc
|
- name: updated_at_utc
|
||||||
data_type: timestamp
|
data_type: timestamp
|
||||||
|
|
@ -88,11 +90,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
|
||||||
|
|
@ -194,19 +196,20 @@ models:
|
||||||
data_type: text
|
data_type: text
|
||||||
description: "Currency of the calculated guest charge amount."
|
description: "Currency of the calculated guest charge amount."
|
||||||
data_tests:
|
data_tests:
|
||||||
- not_null
|
- not_null:
|
||||||
|
where: "calculated_guest_charge_amount_in_txn_currency > 0"
|
||||||
|
|
||||||
- name: id_user_host
|
- name: id_user_host
|
||||||
data_type: text
|
data_type: text
|
||||||
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
|
- name: claims_count
|
||||||
data_type: bigint
|
data_type: bigint
|
||||||
|
|
@ -239,13 +242,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
|
||||||
|
|
@ -322,12 +325,12 @@ models:
|
||||||
- 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
|
||||||
|
|
@ -336,13 +339,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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue