From ba29afa3bddb528e250738918c44ee9f7f1d3cef Mon Sep 17 00:00:00 2001 From: Pablo Martin Date: Tue, 8 Oct 2024 14:41:17 +0200 Subject: [PATCH] docs for athena staging --- models/staging/athena/schema.yml | 271 ++++++++++++++++++++++++++++++- 1 file changed, 269 insertions(+), 2 deletions(-) diff --git a/models/staging/athena/schema.yml b/models/staging/athena/schema.yml index 09a4a51..4d7bb9a 100644 --- a/models/staging/athena/schema.yml +++ b/models/staging/athena/schema.yml @@ -1,2 +1,269 @@ -#TODO Update to the fact that this only has athena stuff now -#TODO update tests to check that there's only athena stuff +version: 2 + +models: + - name: stg_athena__verifications + description: | + Records of each transaction that happens in the Athena API. Records are + mutable and can get updated. + + The table originally receives both records from Athena and edeposit APIs, + but we force only keeping Athena (V1) records here. + columns: + - name: id_verification + data_type: character varying + description: "Unique id for the specific transaction." + tests: + - unique + - not_null + + - name: id_booking + data_type: text + description: "" + tests: + - not_null: + where: created_at_utc > '2024-04-01T00:00:00Z' and verification_status != 'InsufficientInformation' + + - name: id_user_partner + data_type: text + description: The unique ID of the partner calling the API. + tests: + - not_null + + - name: id_accommodation + data_type: text + description: An ID for the listing related to the booking. + + - name: version + data_type: text + description: | + Indicates whether the verification is for V1 (Athena) or V2 + (e-deposit). + tests: + - not_null + - accepted_values: + values: + - "V1" + + - name: nightly_fee_local + data_type: numeric + description: | + The fee per night to be charged for this verification, in the currency + of the user. Note that the Athena/e-deposit user also has a configured + nightly fee. It's unclear at this point which one has priority for + billing. + tests: + - dbt_expectations.expect_column_values_to_be_between: + min_value: 0 + max_value: 100 + strictly: true + + - name: verification_status + data_type: text + description: | + This field shows the outcome of the Verification itself. + tests: + - not_null + - accepted_values: + values: + - "Approved" + - "Flagged" + - "Rejected" + - "InsufficientInformation" + + - name: verification_status_reason + data_type: text + description: Not used, ignore. + + - name: email_flag + data_type: text + description: | + Null if the email shows no issues, otherwise it details the problems + attached to the given email. + + - name: phone_flag + data_type: text + description: | + Null if the phone number shows no issues, otherwise it details the + problems attached to the given phone number. + tests: + - accepted_values: + values: + - "Phone number not reachable" + - "Not a real phone number" + - "Phone number is disposable" + + - name: watch_list + data_type: text + description: "" + tests: + - accepted_values: + values: + - "Match" + - "No Match" + + - name: channel + data_type: text + description: "" + + - name: checkin_at_utc + data_type: timestamp without time zone + description: "" + + - name: checkout_at_utc + data_type: timestamp without time zone + description: "" + + - name: is_cancelled + data_type: boolean + description: | + Indicates if the booking has been cancelled or not. At the source, + null and false values have the same meaning, so here we turn nulls + into false to keep thing simple. + tests: + - not_null + - accepted_values: + values: + - true + - false + + - name: cancelled_at_utc + data_type: timestamp without time zone + description: If the booking was cancelled, when did we learn about it. + tests: + - not_null: + where: is_cancelled = true + + - name: user_email + data_type: text + description: | + The email of the Athena/e-deposit partner user. + + - name: guest_email + data_type: text + description: "" + + - name: guest_last_name + data_type: text + description: "" + + - name: guest_first_name + data_type: text + description: "" + + - name: guest_telephone + data_type: text + description: "" + + - name: company_name + data_type: text + description: "" + + - name: property_manager_name + data_type: text + description: "" + + - name: property_manager_email + data_type: text + description: "" + + - name: listing_name + data_type: text + description: "" + + - name: listing_town + data_type: text + description: "" + + - name: listing_address + data_type: text + description: "" + + - name: listing_country + data_type: text + description: "" + + - name: listing_postcode + data_type: text + description: "" + + - name: pets_allowed + data_type: boolean + description: "" + + - name: level_of_protection_amount + data_type: integer + description: Ignore. + + - name: level_of_protection_currency + data_type: text + description: Ignore. + + - name: attachments + data_type: text + description: "" + + - name: status_updated_at_utc + data_type: timestamp without time zone + description: | + Timestamp of the last time the record was modified before screening + happened. Only relevant for V1 records. + tests: + - not_null: + where: version = 'V1' + + - name: status_updated_date_utc + data_type: timestamp without time zone + description: | + Date of the last time the record was modified before screening + happened. Only relevant for V1 records. + tests: + - not_null: + where: version = 'V1' + + - name: updated_at_utc + data_type: timestamp without time zone + description: | + Timestamp of the last edit of the record, as set by the + Athena/e-deposit application. + tests: + - not_null + + - name: updated_date_utc + data_type: timestamp without time zone + description: | + Date of the last edit of the record, as set by the + Athena/e-deposit application. + tests: + - not_null + + - name: athena_creation_at_utc + data_type: timestamp without time zone + description: | + A client-provided timestamp of when the booking was created. It's an + optional field, only relevant for 'V1' records. + + - name: athena_creation_date_utc + data_type: timestamp without time zone + description: | + A client-provided date of when the booking was created. It's an + optional field, only relevant for 'V1' records. + + - name: created_at_utc + data_type: timestamp without time zone + description: | + The internal application timestamp of when this record was created. + tests: + - not_null + + - name: created_date_utc + data_type: timestamp without time zone + description: | + The internal application date of when this record was created. + tests: + - not_null + + - name: cosmos_db_timestamp_utc + data_type: timestamp with time zone + description: The internal Cosmos DB timestamp of the last record update. + tests: + - not_null