commit wip on schema

This commit is contained in:
Joaquin Ossa 2025-02-23 15:39:07 +01:00
parent 76a247a55f
commit 56619982d2
2 changed files with 192 additions and 14 deletions

View file

@ -78,10 +78,10 @@ select
is_submission_complete,
current_agent_name,
document_version,
created_at_date,
created_date_date,
updated_at_date,
updated_date_date,
created_at_utc,
created_date_utc,
updated_at_utc,
updated_date_utc,
-- Resolution Details
lt.first_comment_at_utc,

View file

@ -12,14 +12,14 @@ models:
- name: id_incident
data_type: text
description: "Unique identifier for the incident."
tests:
data_tests:
- not_null
- unique
- name: id_user
data_type: text
description: "Id of the user who created the incident."
tests:
data_tests:
- not_null
- name: id_verification
@ -29,7 +29,7 @@ models:
- name: current_status_name
data_type: text
description: "Current status of the incident."
tests:
data_tests:
- not_null
- name: is_submission_complete
@ -45,19 +45,49 @@ models:
description: |
"Reported document source, such as ResCentre, API, or manual form."
- name: created_at_date
data_type: timestamp without time zone
- name: created_at_utc
data_type: timestamp
description: "Timestamp when the incident was created."
tests:
data_tests:
- not_null
- name: updated_at_date
data_type: timestamp without time zone
- name: created_date_utc
data_type: date
description: "Date when the incident was created."
data_tests:
- not_null
- name: updated_at_utc
data_type: timestamp
description: "Timestamp when the incident was last updated."
- name: updated_date_utc
data_type: date
description: "Date when the incident was last updated."
- name: first_comment_at_utc
data_type: timestamp
description: "Timestamp of the first comment on the incident."
- name: last_comment_at_utc
data_type: timestamp
description: "Timestamp of the last comment on the incident."
- name: comment_count
data_type: bigint
description: "Number of comments on the incident."
- name: first_status_at_utc
data_type: timestamp
description: "Timestamp of the first status change on the incident."
- name: last_status_at_utc
data_type: timestamp
description: "Timestamp of the last status change on the incident."
- name: resolution_time_in_hours
data_type: numeric
description: "Time taken to resolve the incident, in hours."
description: "Time taken to resolve the incident, in hours, if completed."
- name: number_damaged_items
data_type: bigint
@ -67,16 +97,28 @@ models:
data_type: numeric
description: |
"Original value of the damaged items in the transaction currency."
data_tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
strictly: false
- name: asked_repair_amount_in_txn_currency
data_type: numeric
description: |
"Amount requested by the host for repair in the transaction currency."
data_tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
strictly: false
- name: accepted_amount_in_txn_currency
data_type: numeric
description: |
"Final accepted settlement amount in the transaction currency."
data_tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
strictly: false
- name: protection_name
data_type: text
@ -96,6 +138,50 @@ models:
data_type: text
description: "Guest verification status for this booking."
- name: lower_protection_limit_usd
data_type: text
description: "Lower protection limit in USD."
- name: upper_protection_limit_usd
data_type: text
description: "Upper protection limit in USD."
- name: calculated_payout_amount_in_txn_currency
data_type: text
description: "Calculated payout amount in local currency."
data_tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
strictly: false
- name: calculated_payout_currency
data_type: text
description: "Currency of the calculated payout amount."
data_tests:
- not_null
- name: calculated_payout_amount_in_usd
data_type: text
description: "Calculated payout amount in USD."
data_tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
strictly: false
- name: calculated_guest_charge_amount_in_txn_currency
data_type: text
description: "Calculated guest charge amount in local currency."
data_tests:
- dbt_expectations.expect_column_values_to_be_between:
min_value: 0
strictly: false
- name: calculated_guest_charge_currency
data_type: text
description: "Currency of the calculated guest charge amount."
data_tests:
- not_null
- name: id_user_host
data_type: text
description: |
@ -108,9 +194,101 @@ models:
field: id_user
where: "document_version <> 'OldClaimToIncidentModel'"
- name: claims_count
data_type: bigint
description: "Number of claims made by the host."
- name: host_account_name
data_type: text
description: "Name of the host account."
- name: host_email
data_type: text
description: "Email of the host."
- name: host_last_name
data_type: text
description: "Last name of the host."
- name: host_first_name
data_type: text
description: "First name of the host."
- 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: 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'"
- name: guest_email
data_type: text
description: "Email of the guest."
- name: guest_last_name
data_type: text
description: "Last name of the guest."
- name: guest_first_name
data_type: text
description: "First name of the guest."
- 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: 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: id_accommodation
data_type: text
@ -119,7 +297,7 @@ models:
- name: id_booking
data_type: text
description: "Superhog unique booking ID."
tests:
data_tests:
- not_null
- name: booking_status