Merged PR 2267: Business KPIs refactor - cleaning

This PR cleans the unused models in reporting that keep the "core" wrong convention. Also drops schema documentation for these.
Lastly, exposures have been updated to point towards the new production models.

- This is the last PR for the refactor! ![dbt-dag (2).png](https://guardhog.visualstudio.com/4148d95f-4b6d-4205-bcff-e9c8e0d2ca65/_apis/git/repositories/54ac356f-aad7-46d2-b62c-e8c5b3bb8ebf/pullRequests/2267/attachments/dbt-dag%20%282%29.png)

Refactor documentation: https://www.notion.so/knowyourguest-superhog/Refactoring-Business-KPIs-5deb6aadddb34884ae90339402ac16e3

Related work items: #18202
This commit is contained in:
Oriol Roqué Paniagua 2024-07-11 09:17:44 +00:00
parent b4a7089070
commit 0c1535b150
4 changed files with 2 additions and 211 deletions

View file

@ -567,167 +567,6 @@ models:
data_type: timestamp with time zone
description: ""
- name: core__mtd_aggregated_metrics
description: |
IMPORTANT: This model has moved to the general tab, into the mtd_aggregated_metrics
Deprecated. This model will be burned to the ground.
This model aggregates the historic information of our business by providing
different metrics computed at global level.
It's the main source of information for the Main KPIs reporting, specifically
on the MTD (Month To Date) and the Monthly Overview.
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- date
- metric
columns:
- name: year
data_type: int
description: year number of the given date.
tests:
- not_null
- name: month
data_type: int
description: month number of the given date.
tests:
- not_null
- name: day
data_type: int
description: day monthly number of the given date.
tests:
- not_null
- name: is_end_of_month
data_type: boolean
description: is end of month, 1 for yes, 0 for no.
tests:
- not_null
- name: is_current_month
data_type: boolean
description: |
checks if the date is within the current executed month,
1 for yes, 0 for no.
tests:
- not_null
- name: date
data_type: date
description: |
main date for the computation, that is used for filters.
It comes from int_dates_mtd logic.
tests:
- not_null
- name: previous_year_date
data_type: date
description: |
corresponds to the date of the previous year, with respect to the field date.
It comes from int_dates_mtd logic. It's only displayed for information purposes,
should not be needed for reporting.
- name: metric
data_type: text
description: name of the business metric.
tests:
- not_null
- name: order_by
data_type: integer
description: |
order for displaying purposes. Null values are accepted, but keep
in mind that then there's no default controlled display order.
- name: number_format
data_type: text
description: allows for grouping and formatting for displaying purposes.
tests:
- accepted_values:
values: ['integer', 'percentage']
- name: value
data_type: numeric
description: |
numeric value (integer or decimal) that corresponds to the MTD computation of the metric
at a given date. Note that if the month is not in progress, then this value corresponds
to the monthly figure.
- name: previous_year_value
data_type: numeric
description: |
numeric value (integer or decimal) that corresponds to the MTD computation of the metric
on the previous year at a given date.
- name: relative_increment
data_type: numeric
description: |
numeric value that corresponds to the relative increment between value and previous year value,
following the computation: value / previous_year_value - 1.
- name: core__monthly_aggregated_metrics_history_by_deal
description: |
IMPORTANT: This model has moved to the general tab, into the monthly_aggregated_metrics_history_by_deal
Deprecated. This model will be burned to the ground.
This model aggregates the monthly historic information regarding the different metrics computed
at deal level. The primary sources of data are the `int_core__monthly_XXXXX_history_by_deal`
models which contain the raw metrics data per source.
This table is used to provide "By Deal" metrics in the Business Overview reporting.
Unlike the core__mtd_aggregated_metrics, this model does not abstract each metric, since
no comparison versus last year is performed. In short, it just gathers the information stored
in the abovementioned models.
To keep in mind: aggregating the information of this model will not necessarily result into
the int_core__mtd_aggregated metrics because 1) the mtd version contains more computing dates
than the by deal version, the latest being a subset of the first, and 2) the deal based model
enforces that a booking/guest journey/listing/etc has a host with a deal assigned, which is
not necessarily the case.
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- date
- id_deal
columns:
- name: date
data_type: date
description: The last day of the month or yesterday for historic metrics.
tests:
- not_null
- name: id_deal
data_type: character varying
description: Id of the deal associated to the host.
tests:
- not_null
- name: year
data_type: int
description: year number of the given date.
tests:
- not_null
- name: month
data_type: int
description: month number of the given date.
tests:
- not_null
- name: day
data_type: int
description: day monthly number of the given date.
tests:
- not_null
- name: core__unified_user
description:
This is a table to join data from all users of Superhog (hosts, PMs, guests, etc).