data-dwh-dbt-project/models/reporting/xero/schema.yaml

853 lines
26 KiB
YAML
Raw Normal View History

2024-05-15 19:20:59 +02:00
version: 2
models:
- name: xero__invoices
description: |
2024-05-16 15:47:12 +02:00
Invoices that we have raised within our accounting books.
2024-05-15 19:20:59 +02:00
2024-05-16 15:47:12 +02:00
This includes both our invoices towards customers and invoices provided by our suppliers.
You can read more here: https://developer.xero.com/documentation/api/accounting/invoices
2024-05-15 19:20:59 +02:00
columns:
- name: id_invoice
data_type: character varying
description: Xero's unique identifier for the invoice.
- name: id_contact
data_type: text
description: |
The ID of the contact related to this invoice.
The customer if it's an Accounts Receivables one, the supplier if it's an Accounts Payables one.
You can use this to join with the contacts table.
- name: reference
data_type: character varying
description: |
The Superhog-set reference for the invoices. Only relevant for
2024-05-16 15:47:12 +02:00
records of invoice type (ACCREC).
2024-05-15 19:20:59 +02:00
- name: invoice_number
data_type: character varying
description: ""
- name: invoice_issued_date_utc
data_type: timestamp with time zone
description: Date on which the invoice was issued.
- name: invoice_due_date_utc
data_type: timestamp with time zone
description: The date were the invoice should be paid the latest.
- name: was_fully_paid_on_date_utc
data_type: timestamp with time zone
description: |
The date on which the invoice was fully paid. If the invoice is still
not fully paid, it returns null.
- name: invoice_type
data_type: character varying
description: |
This field indicates whether the invoice is from Superhog towards a customer
(value is "ACCREC") or from a supplier towards Superhog (value is "ACCPAY").
- name: invoice_currency_iso_4217
data_type: character varying
description: The ISO 4217 code for the currency which this invoice uses as unit of account.
- name: exchange_rate_to_gbp
data_type: numeric
2024-05-16 15:47:12 +02:00
description: |
2024-05-15 19:20:59 +02:00
The implied exchange rate between the invoice currency and GBP.
2024-05-16 15:47:12 +02:00
2024-05-15 19:20:59 +02:00
This is the XXX to GBP rate. So the number represented in this field is the units of currency GBP
that 1 unit of XXX buys you.
For example, if the invoice is 135 ZAR, and this rate is 0.0167, the invoice value in GBP is 2.25
(135ZAR * 0.0167GBP/ZAR = 2.25GBP).
- name: total_amount_local_curr
data_type: numeric
description: The total amount to be paid, in the currency the invoice is denominated in.
- name: total_amount_in_gbp
data_type: numeric
description: The total amount to be paid, converted to GBP.
- name: total_amount_wo_tax_local_curr
data_type: numeric
description: The total amount to be paid minus taxes, in the currency the invoice is denominated in.
- name: total_amount_wo_tax_in_gbp
data_type: numeric
description: The total amount to be paid minus taxes, converted to GBP.
- name: total_tax_local_curr
data_type: numeric
description: The total tax, in the currency the invoice is denominated in.
- name: total_tax_in_gbp
data_type: numeric
description: The total tax, converted to GBP.
- name: total_due_local_curr
data_type: numeric
description: The total amount outstanding right now, in the currency the invoice is denominated in.
- name: total_due_in_gbp
data_type: numeric
description: The total amount outstanding right now, converted to GBP.
- name: total_paid_local_curr
data_type: numeric
description: The total amount that has already been paid, in the currency the invoice is denominated in.
- name: total_paid_in_gbp
data_type: numeric
description: The total amount that has already been paid, in GBP.
- name: invoice_status
data_type: character varying
description: |
The status of the invoice.
Can be one of: PAID, VOIDED, DRAFT, DELETED, AUTHORISED, SUBMITTED.
You can read more here: https://developer.xero.com/documentation/api/accounting/types#invoices
- name: has_errors
data_type: boolean
description: ""
- name: is_discounted
data_type: boolean
description: ""
- name: date_string
data_type: timestamp with time zone
description: ""
- name: due_date_string
data_type: timestamp with time zone
description: ""
- name: has_been_sent_to_contact
data_type: boolean
description: ""
- name: total_discount
data_type: numeric
description: ""
- name: total_credited_local_curr
data_type: numeric
2024-05-16 15:47:12 +02:00
description:
Total amount credited by related credit notes, over-payments and
2024-05-15 19:20:59 +02:00
pre-payments.
- name: has_attachments
data_type: boolean
description: Flag indicating if the invoice has an attachment.
- name: updated_at_utc
data_type: timestamp with time zone
description: ""
- name: updated_date_utc
data_type: date
description: ""
- name: line_amount_tax_inclusiveness
data_type: character varying
description: |
Indicates whether the amounts included in line items are tax
inclusive (Inclusive), tax exclusive (Exclusive) or simply,
there are no taxes on the invoice (NoTax).
- name: payment_planned_date_utc
data_type: timestamp with time zone
description: ""
- name: payment_expected_date_utc
data_type: timestamp with time zone
description: ""
- name: dwh_extracted_at_utc
data_type: timestamp with time zone
2024-05-16 15:47:12 +02:00
description: ""
- name: xero__invoice_line_items
description: |
Invoice line items. Every record corresponds to a Line Item in Xero.
A Line Item is a combination of a specific service or item being sold,
together with its quantity, price, total amount and taxes.
You can read more here: https://developer.xero.com/documentation/api/accounting/invoices
columns:
- name: id_invoice
data_type: character varying
description: Xero's unique identifier for the invoice.
- name: id_line_item
data_type: text
description: Xero's unique identifier for the line item.
- name: id_item
data_type: text
description: Xero's unique identifier for the item of this line.
- name: item_code
data_type: text
description: A text based code that describes the Item.
- name: quantity
data_type: numeric
description: How much of the item is sold in its invoice.
- name: unit_amount
data_type: numeric
description: The price of each unit of the item.
- name: line_amount_local_curr
data_type: numeric
description: |
The total value to be charged for this line, in local currency.
- name: line_amount_in_gbp
data_type: numeric
description: The total value to be charged for this line, in GBP.
- name: line_amount_wo_taxes_local_curr
data_type: numeric
description: |
The total value to be charged for this line, minus taxes, in local
currency.
In some cases, this will be the same value as the line amount. This
depends on whether there is any tax in the invoice, and whether the
invoice amounts are tax inclusive or tax exclusive. You can find this
out in the details of the invoice this line item belongs to.
- name: line_amount_wo_taxes_in_gbp
data_type: numeric
description: |
The total value to be charged for this line, minus taxes, in GBP.
In some cases, this will be the same value as the line amount. This
depends on whether there is any tax in the invoice, and whether the
invoice amounts are tax inclusive or tax exclusive. You can find this
out in the details of the invoice this line item belongs to.
- name: tax_amount_local_curr
data_type: numeric
description: The total value of taxes for this line, in local currency.
- name: tax_amount_in_gbp
data_type: numeric
description: The total value of taxes for this line, in GBP.
- name: tax_type
data_type: text
description: ""
- name: invoice_currency_iso_4217
data_type: character varying
2024-05-16 16:02:23 +02:00
description: |
2024-05-16 15:47:12 +02:00
The currency in which this line item amounts are defined.
Line items don't really have a currency definition of its own, this
field is populated for your convenience when working with this data.
The invoice currency is defined at the invoice level, and the values
you see in this field should always be the same as the currency of
the invoice this line item belongs to.
- name: line_description
data_type: text
description: A text description of the line item.
2024-05-16 16:02:23 +02:00
- name: xero__contacts
description: |
Xero contacts identify other parties we transact with: customers, suppliers, employees, etc.
The most interesting contacts are our customers.
columns:
- name: id_contact
data_type: character varying
description: Xero's unique identifier for the contact.
- name: account_number
data_type: character varying
description: A Superhog set identifier. For customers, this is Hubspot's Deal Id.
- name: id_deal
data_type: text
2024-05-16 16:22:41 +02:00
description: |
2024-05-16 16:02:23 +02:00
For those account numbers that look like a Deal Id, we extract them
into this field. Other contacs will have a blank.
You can use this to find specific deal ids or even as a proxy bool to
keep or remove deal id customers.
- name: contact_name
data_type: character varying
description: The name for the customer.
- name: is_customer
data_type: boolean
description: Flag that shows if the contact is a Superhog customer.
- name: is_supplier
data_type: boolean
description: Flag that shows if the contact is a Superhog supplier.
- name: tax_number
data_type: character varying
description: Tax number for this contact.
- name: contact_first_name
data_type: character varying
description: ""
- name: contact_last_name
data_type: character varying
description: ""
- name: phones
data_type: jsonb
description: ""
- name: website
data_type: character varying
description: ""
- name: balances
data_type: jsonb
description: ""
- name: discount
data_type: numeric
description: ""
- name: addresses
data_type: jsonb
description: ""
- name: attachments
data_type: jsonb
description: ""
- name: email_addresses
data_type: character varying
description: ""
- name: payment_terms
data_type: jsonb
description: ""
- name: batch_payments
data_type: jsonb
description: ""
- name: branding_theme
data_type: jsonb
description: ""
- name: contact_groups
data_type: jsonb
description: ""
- name: contact_number
data_type: character varying
description: ""
- name: contact_status
data_type: character varying
description: ""
- name: skyper_user_name
data_type: character varying
description: ""
- name: contact_persons
data_type: jsonb
description: ""
- name: has_attachments
data_type: boolean
description: ""
- name: updated_at_utc
data_type: timestamp with time zone
description: ""
- name: updated_date_utc
data_type: date
description: ""
- name: xero_network_key
data_type: character varying
description: ""
- name: default_currency_iso_4217
data_type: character varying
description: |
The default currency used to interact with this contact.
2024-05-16 16:22:41 +02:00
2024-05-16 16:02:23 +02:00
For customers, this is the currency we will usually use to invoice.
- name: validation_errors
data_type: jsonb
description: ""
- name: bank_account_details
data_type: character varying
description: ""
- name: has_validation_errors
data_type: boolean
description: ""
- name: tracking_category_name
data_type: character varying
description: ""
- name: account_payable_tax_type
data_type: character varying
description: ""
- name: tracking_category_option
data_type: character varying
description: ""
- name: sales_default_account_code
data_type: character varying
description: ""
- name: sales_tracking_categories
data_type: jsonb
description: ""
- name: account_receivable_tax_type
data_type: character varying
description: ""
- name: purchases_default_account_code
data_type: character varying
description: ""
- name: purchases_tracking_categories
data_type: jsonb
description: ""
- name: dwh_extracted_at_utc
data_type: timestamp with time zone
description: ""
2024-05-16 16:06:07 +02:00
- name: xero__denom_invoicing_mart
description: |
This is denormalized table built upon contacts, invoice and invoice line
items. It's just built to save you time in joining and for dealing with
certain limitations in PBI.
The level of granularity is at line item. Line items there are joined
with invoices by the id of the invoice present in the line item, and
contacts are joined by the id of the contact present in the invoice.
Be careful when aggregating figures: sums on the invoice line item level
make sense, sums on the invoice level do not.
Data from the original entities is brought as is with no transformation.
Please, when modelling here, try to respect this approach.
columns:
- name: id_line_item
data_type: text
description: "Xero's unique identifier for the line item."
- name: id_item
data_type: text
description: "Xero's unique identifier for the item of this line."
- name: item_code
data_type: text
description: "A text based code that describes the Item."
- name: quantity
data_type: numeric
description: "How much of the item is sold in its invoice."
- name: unit_amount
data_type: numeric
description: "The price of each unit of the item."
- name: line_amount_local_curr
data_type: numeric
2024-05-16 16:22:41 +02:00
description: |
The total value to be charged for this line, in local currency.
2024-05-16 16:06:07 +02:00
- name: line_amount_in_gbp
data_type: numeric
description: "The total value to be charged for this line, in GBP."
- name: line_amount_wo_taxes_local_curr
data_type: numeric
2024-05-16 16:22:41 +02:00
description: |
The total value to be charged for this line, minus taxes, in local
currency.
2024-05-16 16:06:07 +02:00
2024-05-16 16:22:41 +02:00
In some cases, this will be the same value as the line amount. This
depends on whether there is any tax in the invoice, and whether the
invoice amounts are tax inclusive or tax exclusive. You can find this
out in the details of the invoice this line item belongs to.
2024-05-16 16:06:07 +02:00
- name: line_amount_wo_taxes_in_gbp
data_type: numeric
2024-05-16 16:22:41 +02:00
description: |
The total value to be charged for this line, minus taxes, in GBP.
2024-05-16 16:06:07 +02:00
2024-05-16 16:22:41 +02:00
In some cases, this will be the same value as the line amount. This
depends on whether there is any tax in the invoice, and whether the
invoice amounts are tax inclusive or tax exclusive. You can find this
out in the details of the invoice this line item belongs to.
2024-05-16 16:06:07 +02:00
- name: tax_amount_local_curr
data_type: numeric
description: "The total value of taxes for this line, in local currency."
- name: tax_amount_in_gbp
data_type: numeric
description: "The total value of taxes for this line, in GBP."
- name: tax_type
data_type: text
description: ""
- name: line_description
data_type: text
description: "A text description of the line item."
- name: id_invoice
data_type: character varying
description: "Xero's unique identifier for the invoice."
- name: reference
data_type: character varying
2024-05-16 16:22:41 +02:00
description: |
The Superhog-set reference for the invoices. Only relevant for
records of invoice type (ACCREC).
2024-05-16 16:06:07 +02:00
- name: invoice_number
data_type: character varying
description: ""
- name: invoice_issued_date_utc
data_type: timestamp with time zone
description: "Date on which the invoice was issued."
- name: invoice_due_date_utc
data_type: timestamp with time zone
description: "The date were the invoice should be paid the latest."
- name: was_fully_paid_on_date_utc
data_type: timestamp with time zone
2024-05-16 16:22:41 +02:00
description: |
The date on which the invoice was fully paid. If the invoice is still
not fully paid, it returns null.
2024-05-16 16:06:07 +02:00
- name: invoice_type
data_type: character varying
2024-05-16 16:22:41 +02:00
description: |
This field indicates whether the invoice is from Superhog towards a customer
(value is "ACCREC") or from a supplier towards Superhog (value is "ACCPAY").
2024-05-16 16:06:07 +02:00
- name: invoice_currency_iso_4217
data_type: character varying
2024-05-16 16:22:41 +02:00
description: |
The currency in which this line item amounts are defined.
2024-05-16 16:06:07 +02:00
2024-05-16 16:22:41 +02:00
Line items don't really have a currency definition of its own, this
field is populated for your convenience when working with this data.
The invoice currency is defined at the invoice level, and the values
you see in this field should always be the same as the currency of
the invoice this line item belongs to.
2024-05-16 16:06:07 +02:00
- name: exchange_rate_to_gbp
data_type: numeric
2024-05-16 16:22:41 +02:00
description: |
The implied exchange rate between the invoice currency and GBP.
2024-05-16 16:06:07 +02:00
2024-05-16 16:22:41 +02:00
This is the XXX to GBP rate. So the number represented in this field
is the units of currency GBP that 1 unit of XXX buys you.
2024-05-16 16:06:07 +02:00
2024-05-16 16:22:41 +02:00
For example, if the invoice is 135 ZAR, and this rate is 0.0167, the
invoice value in GBP is 2.25 (135ZAR * 0.0167GBP/ZAR = 2.25GBP).
2024-05-16 16:06:07 +02:00
- name: total_amount_local_curr
data_type: numeric
2024-05-16 16:22:41 +02:00
description: |
The total amount to be paid, in the currency the invoice is
denominated in.
2024-05-16 16:06:07 +02:00
- name: total_amount_in_gbp
data_type: numeric
description: "The total amount to be paid, converted to GBP."
- name: total_amount_wo_tax_local_curr
data_type: numeric
2024-05-16 16:22:41 +02:00
description: |
The total amount to be paid minus taxes, in the currency the invoice
is denominated in.
2024-05-16 16:06:07 +02:00
- name: total_amount_wo_tax_in_gbp
data_type: numeric
2024-05-16 16:22:41 +02:00
description: |
The total amount to be paid minus taxes, converted to GBP.
2024-05-16 16:06:07 +02:00
- name: total_tax_local_curr
data_type: numeric
2024-05-16 16:22:41 +02:00
description: |
The total tax, in the currency the invoice is denominated in.
2024-05-16 16:06:07 +02:00
- name: total_tax_in_gbp
data_type: numeric
description: "The total tax, converted to GBP."
- name: total_due_local_curr
data_type: numeric
2024-05-16 16:22:41 +02:00
description: |
The total amount outstanding right now, in the currency the invoice
is denominated in.
2024-05-16 16:06:07 +02:00
- name: total_due_in_gbp
data_type: numeric
2024-05-16 16:22:41 +02:00
description: |
The total amount outstanding right now, converted to GBP.
2024-05-16 16:06:07 +02:00
- name: total_paid_local_curr
data_type: numeric
2024-05-16 16:22:41 +02:00
description: |
The total amount that has already been paid, in the currency the
invoice is denominated in.
2024-05-16 16:06:07 +02:00
- name: total_paid_in_gbp
data_type: numeric
description: "The total amount that has already been paid, in GBP."
- name: invoice_status
data_type: character varying
2024-05-16 16:22:41 +02:00
description: |
The status of the invoice.
2024-05-16 16:06:07 +02:00
2024-05-16 16:22:41 +02:00
Can be one of PAID, VOIDED, DRAFT, DELETED, AUTHORISED, SUBMITTED.
2024-05-16 16:06:07 +02:00
2024-05-16 16:22:41 +02:00
You can read more here https://developer.xero.com/documentation/api/accounting/types#invoices
2024-05-16 16:06:07 +02:00
- name: has_errors
data_type: boolean
description: ""
- name: is_discounted
data_type: boolean
description: ""
- name: date_string
data_type: timestamp with time zone
description: ""
- name: due_date_string
data_type: timestamp with time zone
description: ""
- name: has_been_sent_to_contact
data_type: boolean
description: ""
- name: total_discount
data_type: numeric
description: ""
- name: total_credited_local_curr
data_type: numeric
2024-05-16 16:22:41 +02:00
description: |
Total amount credited by related credit notes,
over-payments and pre-payments.
2024-05-16 16:06:07 +02:00
- name: has_attachments
data_type: boolean
description: ""
- name: line_amount_tax_inclusiveness
data_type: character varying
2024-05-16 16:22:41 +02:00
description: |
Indicates whether the amounts included in line items are tax
inclusive (Inclusive), tax exclusive (Exclusive) or simply,
there are no taxes on the invoice (NoTax).
2024-05-16 16:06:07 +02:00
- name: payment_planned_date_utc
data_type: timestamp with time zone
description: ""
- name: payment_expected_date_utc
data_type: timestamp with time zone
description: ""
- name: id_contact
data_type: character varying
description: "Xero's unique identifier for the contact."
- name: account_number
data_type: character varying
2024-05-16 16:22:41 +02:00
description: |
A Superhog set identifier. For customers, this is Hubspot's Deal Id.
2024-05-16 16:06:07 +02:00
- name: id_deal
data_type: text
2024-05-16 16:22:41 +02:00
description: |
For those account numbers that look like a Deal Id, we extract them
into this field. Other contacs will have a blank.
2024-05-16 16:06:07 +02:00
2024-05-16 16:22:41 +02:00
You can use this to find specific deal ids or even as a proxy bool to
keep or remove deal id customers.
2024-05-16 16:06:07 +02:00
- name: contact_name
data_type: character varying
description: "The name for the customer."
- name: is_customer
data_type: boolean
description: "Flag that shows if the contact is a Superhog customer."
- name: is_supplier
data_type: boolean
description: "Flag that shows if the contact is a Superhog supplier."
- name: tax_number
data_type: character varying
description: "Tax number for this contact."
- name: contact_first_name
data_type: character varying
description: ""
- name: contact_last_name
data_type: character varying
description: ""
- name: phones
data_type: jsonb
description: ""
- name: website
data_type: character varying
description: ""
- name: balances
data_type: jsonb
description: ""
- name: discount
data_type: numeric
description: ""
- name: addresses
data_type: jsonb
description: ""
- name: attachments
data_type: jsonb
description: ""
- name: email_addresses
data_type: character varying
description: ""
- name: payment_terms
data_type: jsonb
description: ""
- name: batch_payments
data_type: jsonb
description: ""
- name: branding_theme
data_type: jsonb
description: ""
- name: contact_groups
data_type: jsonb
description: ""
- name: contact_number
data_type: character varying
description: ""
- name: contact_status
data_type: character varying
description: ""
- name: skyper_user_name
data_type: character varying
description: ""
- name: contact_persons
data_type: jsonb
description: ""
- name: xero_network_key
data_type: character varying
description: ""
- name: default_currency_iso_4217
data_type: character varying
2024-05-16 16:22:41 +02:00
description: |
The default currency used to interact with this contact.
2024-05-16 16:06:07 +02:00
2024-05-16 16:22:41 +02:00
For customers, this is the currency we will usually use to invoice.
2024-05-16 16:06:07 +02:00
- name: validation_errors
data_type: jsonb
description: ""
- name: bank_account_details
data_type: character varying
description: ""
- name: has_validation_errors
data_type: boolean
description: ""
- name: tracking_category_name
data_type: character varying
description: ""
- name: account_payable_tax_type
data_type: character varying
description: ""
- name: tracking_category_option
data_type: character varying
description: ""
- name: sales_default_account_code
data_type: character varying
description: ""
- name: sales_tracking_categories
data_type: jsonb
description: ""
- name: account_receivable_tax_type
data_type: character varying
description: ""
- name: purchases_default_account_code
data_type: character varying
description: ""
- name: purchases_tracking_categories
data_type: jsonb
description: ""