commit wip
This commit is contained in:
parent
05adc07674
commit
9704426dd6
2 changed files with 25 additions and 7 deletions
|
|
@ -4,8 +4,11 @@ models:
|
||||||
- name: stg_resolutions__incidents
|
- name: stg_resolutions__incidents
|
||||||
description: |
|
description: |
|
||||||
"Contains all incidents stored by the resolutions team in Cosmos DB.
|
"Contains all incidents stored by the resolutions team in Cosmos DB.
|
||||||
This includes data about the incident, the user claiming the incident, the booking,
|
This includes data about the incident, the user claiming the incident, the booking,
|
||||||
the accommodation, the host and the guest."
|
the accommodation, the host and the guest.
|
||||||
|
Some records (document_version <> 'OldClaimToIncidentModel') are older versions
|
||||||
|
of the incident model and don't have the same data structure as the current one.
|
||||||
|
Many of them don't have the same necessary fields as the current model."
|
||||||
columns:
|
columns:
|
||||||
- name: id_incident
|
- name: id_incident
|
||||||
data_type: text
|
data_type: text
|
||||||
|
|
@ -90,6 +93,9 @@ models:
|
||||||
Can be from SH or can be external from the client."
|
Can be from SH or can be external from the client."
|
||||||
data_tests:
|
data_tests:
|
||||||
- not_null
|
- not_null
|
||||||
|
- relationships:
|
||||||
|
to: ref('stg_core__user')
|
||||||
|
field: id_user
|
||||||
|
|
||||||
- name: host_user_claim_logs
|
- name: host_user_claim_logs
|
||||||
data_type: text
|
data_type: text
|
||||||
|
|
@ -140,6 +146,9 @@ models:
|
||||||
data_tests:
|
data_tests:
|
||||||
- not_null:
|
- not_null:
|
||||||
where: "document_version <> 'OldClaimToIncidentModel'"
|
where: "document_version <> 'OldClaimToIncidentModel'"
|
||||||
|
- relationships:
|
||||||
|
to: ref('stg_core__user')
|
||||||
|
field: id_user
|
||||||
|
|
||||||
- name: guest_email
|
- name: guest_email
|
||||||
data_type: text
|
data_type: text
|
||||||
|
|
@ -224,10 +233,13 @@ models:
|
||||||
damage once identified"
|
damage once identified"
|
||||||
|
|
||||||
- name: id_accommodation
|
- name: id_accommodation
|
||||||
data_type: text
|
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:
|
||||||
|
to: ref('stg_core__accommodation')
|
||||||
|
field: id_accommodation
|
||||||
|
|
||||||
- name: accommodation_url
|
- name: accommodation_url
|
||||||
data_type: text
|
data_type: text
|
||||||
|
|
@ -287,11 +299,14 @@ models:
|
||||||
- not_null
|
- not_null
|
||||||
|
|
||||||
- name: id_booking
|
- name: id_booking
|
||||||
data_type: text
|
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:
|
||||||
|
to: ref('stg_core__booking')
|
||||||
|
field: id_booking
|
||||||
|
|
||||||
- name: booking_status
|
- name: booking_status
|
||||||
data_type: text
|
data_type: text
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ select
|
||||||
->> 'PhoneNumberWithCode' as host_phone_number_with_code,
|
->> 'PhoneNumberWithCode' as host_phone_number_with_code,
|
||||||
|
|
||||||
-- Guest Details
|
-- Guest Details
|
||||||
{{ adapter.quote("documents") }} -> 'Guest' ->> 'Id' as id_user_guest,
|
nullif({{ adapter.quote("documents") }} -> 'Guest' ->> 'Id', '') as id_user_guest,
|
||||||
{{ adapter.quote("documents") }}
|
{{ adapter.quote("documents") }}
|
||||||
-> 'Guest'
|
-> 'Guest'
|
||||||
-> 'ContactDetails'
|
-> 'ContactDetails'
|
||||||
|
|
@ -128,7 +128,8 @@ select
|
||||||
->> 'PreventativeStepsDetails' as guest_preventative_steps_details,
|
->> 'PreventativeStepsDetails' as guest_preventative_steps_details,
|
||||||
|
|
||||||
-- Accommodation Details
|
-- Accommodation Details
|
||||||
{{ adapter.quote("documents") }} -> 'Listing' ->> 'Id' as id_accommodation,
|
(nullif({{ adapter.quote("documents") }} -> 'Listing' ->> 'Id', ''))::numeric
|
||||||
|
as id_accommodation,
|
||||||
{{ adapter.quote("documents") }} -> 'Listing' ->> 'Url' as accommodation_url,
|
{{ adapter.quote("documents") }} -> 'Listing' ->> 'Url' as accommodation_url,
|
||||||
{{ adapter.quote("documents") }} -> 'Listing' ->> 'Name' as accommodation_name,
|
{{ adapter.quote("documents") }} -> 'Listing' ->> 'Name' as accommodation_name,
|
||||||
{{ adapter.quote("documents") }}
|
{{ adapter.quote("documents") }}
|
||||||
|
|
@ -158,7 +159,9 @@ select
|
||||||
as check_out_at_utc,
|
as check_out_at_utc,
|
||||||
({{ adapter.quote("documents") }} -> 'Reservation' ->> 'CheckOut')::date
|
({{ adapter.quote("documents") }} -> 'Reservation' ->> 'CheckOut')::date
|
||||||
as check_out_date_utc,
|
as check_out_date_utc,
|
||||||
{{ adapter.quote("documents") }} -> 'Reservation' ->> 'BookingId' as id_booking,
|
nullif(
|
||||||
|
({{ adapter.quote("documents") }} -> 'Reservation' ->> 'BookingId'), ''
|
||||||
|
)::numeric as id_booking,
|
||||||
{{ adapter.quote("documents") }}
|
{{ adapter.quote("documents") }}
|
||||||
-> 'Reservation'
|
-> 'Reservation'
|
||||||
->> 'BookingStatus' as booking_status,
|
->> 'BookingStatus' as booking_status,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue