diff --git a/models/reporting/kpis/kpis__product_guest_daily_metrics.sql b/models/reporting/kpis/kpis__product_guest_daily_metrics.sql new file mode 100644 index 0000000..3b35402 --- /dev/null +++ b/models/reporting/kpis/kpis__product_guest_daily_metrics.sql @@ -0,0 +1,36 @@ +with + int_kpis__product_guest_daily_metrics as ( + select * from {{ ref("int_kpis__product_guest_daily_metrics") }} + ) + +select + date_day as date_day, + py_date_day as py_date_day, + has_payment as has_payment, + has_id_check as has_id_check, + created_guest_journeys_not_cancelled as created_guest_journeys_not_cancelled, + started_guest_journeys_not_cancelled as started_guest_journeys_not_cancelled, + completed_guest_journeys_not_cancelled as completed_guest_journeys_not_cancelled, + created_guest_journeys as created_guest_journeys, + started_guest_journeys as started_guest_journeys, + completed_guest_journeys as completed_guest_journeys, + total_csat_score_count as total_csat_score_count, + average_csat_score as average_csat_score, + deposit_fees_in_gbp as deposit_fees_in_gbp, + waiver_payments_in_gbp as waiver_payments_in_gbp, + checkin_cover_fees_in_gbp as checkin_cover_fees_in_gbp, + total_guest_payments_in_gbp as total_guest_payments_in_gbp, + py_created_guest_journeys_not_cancelled as py_created_guest_journeys_not_cancelled, + py_started_guest_journeys_not_cancelled as py_started_guest_journeys_not_cancelled, + py_completed_guest_journeys_not_cancelled + as py_completed_guest_journeys_not_cancelled, + py_created_guest_journeys as py_created_guest_journeys, + py_started_guest_journeys as py_started_guest_journeys, + py_completed_guest_journeys as py_completed_guest_journeys, + py_total_csat_score_count as py_total_csat_score_count, + py_average_csat_score as py_average_csat_score, + py_deposit_fees_in_gbp as py_deposit_fees_in_gbp, + py_waiver_payments_in_gbp as py_waiver_payments_in_gbp, + py_checkin_cover_fees_in_gbp as py_checkin_cover_fees_in_gbp, + py_total_guest_payments_in_gbp as py_total_guest_payments_in_gbp +from int_kpis__product_guest_daily_metrics b diff --git a/models/reporting/kpis/schema.yml b/models/reporting/kpis/schema.yml new file mode 100644 index 0000000..2669a8f --- /dev/null +++ b/models/reporting/kpis/schema.yml @@ -0,0 +1,199 @@ +version: 2 + +models: + - name: kpis__product_guest_daily_metrics + description: | + This model computes the Daily Guest Metrics at the deepest granularity. + Here all metrics are attributed to the Check-in Date of the associated + booking, except for payments which are attributed to payment date. + + The unique key corresponds to the deepest granularity of the model, + in this case: + - date_day, + - py_date_day, + - id_deal, + - has_id_check. + + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - date_day + - py_date_day + - has_payment + - has_id_check + columns: + - name: date_day + data_type: date + description: "Date of when Guest Journeys have been completed." + tests: + - not_null + + - name: py_date_day + data_type: date + description: | + Date on the previous year of when Guest Journeys have been completed. + Note that this date can be NULL for leap days (29th February) + + - name: has_payment + data_type: string + description: Has there been any guest payments on the guest journey. + tests: + - not_null + - accepted_values: + values: + - W/O Payment + - With Payment + + - name: has_id_check + data_type: string + description: Does the verification in the guest journey + includes Government Id Check for the bookings. + tests: + - not_null + - accepted_values: + values: + - W/O Id Check + - With Id Check + + - name: created_guest_journeys_not_cancelled + data_type: bigint + description: | + Count of daily guest journeys created, excluding cancelled bookings, + in a given date and per specified dimension. + + - name: started_guest_journeys_not_cancelled + data_type: bigint + description: | + Count of daily guest journeys started, excluding cancelled bookings, + in a given date and per specified dimension. + + - name: completed_guest_journeys_not_cancelled + data_type: bigint + description: | + Count of daily guest journeys completed, excluding cancelled bookings, + in a given date and per specified dimension. + + - name: created_guest_journeys + data_type: bigint + description: | + Count of daily guest journeys created in a given date and + per specified dimension. + + - name: started_guest_journeys + data_type: bigint + description: | + Count of daily guest journeys started in a given date and + per specified dimension. + + - name: completed_guest_journeys + data_type: bigint + description: | + Count of daily guest journeys completed in a given date and + per specified dimension. + + - name: count_csat_score + data_type: bigint + description: | + Count of daily guest journeys with CSAT (customer satisfaction score) + in a given date and per specified dimension. + + - name: average_csat_score + data_type: bigint + description: | + Average daily CSAT score in a given date and per specified dimension. + + - name: deposit_fees_in_gbp + data_type: decimal + description: | + Sum of deposit fees paid by guests, without taxes, in GBP + in a given date and per specified dimension. + + - name: waiver_payments_in_gbp + data_type: decimal + description: | + Sum of waiver payments paid by guests, without taxes, in GBP + in a given date and per specified dimension. + + - name: checkin_cover_fees_in_gbp + data_type: decimal + description: | + Sum of checkin cover fees paid by guests, without taxes, in GBP + in a given date and per specified dimension. + + - name: total_guest_payments_in_gbp + data_type: decimal + description: | + Sum of total payments paid by guests, without taxes, in GBP + in a given date and per specified dimension. + + - name: py_created_guest_journeys_not_cancelled + data_type: bigint + description: | + Count of daily guest journeys created (excluding canceled bookings) + on the same date in the previous year, segmented by the specified dimension. + + - name: py_started_guest_journeys_not_cancelled + data_type: bigint + description: | + Count of daily guest journeys started (excluding canceled bookings) + on the same date in the previous year, segmented by the specified dimension. + + - name: py_completed_guest_journeys_not_cancelled + data_type: bigint + description: | + Count of daily guest journeys completed (excluding canceled bookings) + on the same date in the previous year, segmented by the specified dimension. + + - name: py_created_guest_journeys + data_type: bigint + description: | + Count of daily guest journeys created on the same date in the previous year, + segmented by the specified dimension. + + - name: py_started_guest_journeys + data_type: bigint + description: | + Count of daily guest journeys started on the same date in the previous year, + segmented by the specified dimension. + + - name: py_completed_guest_journeys + data_type: bigint + description: | + Count of daily guest journeys completed on the same date in the previous year, + segmented by the specified dimension. + + - name: py_count_csat_score + data_type: bigint + description: | + Count of daily guest journeys with CSAT (customer satisfaction score) + on the same date in the previous year, segmented by the specified dimension. + + - name: py_average_csat_score + data_type: bigint + description: | + Average daily CSAT score on the same date in the previous year, + segmented by the specified dimension. + + - name: py_deposit_fees_in_gbp + data_type: decimal + description: | + Sum of deposit fees paid by guests, excluding taxes, in GBP + on the same date in the previous year, segmented by the specified dimension. + + - name: py_waiver_payments_in_gbp + data_type: decimal + description: | + Sum of waiver payments paid by guests, excluding taxes, in GBP + on the same date in the previous year, segmented by the specified dimension. + + - name: py_checkin_cover_fees_in_gbp + data_type: decimal + description: | + Sum of check-in cover fees paid by guests, excluding taxes, in GBP + on the same date in the previous year, segmented by the specified dimension. + + - name: py_total_guest_payments_in_gbp + data_type: decimal + description: | + Sum of total payments paid by guests, excluding taxes, in GBP + on the same date in the previous year, segmented by the specified dimension.