_images/tenzo.png

Universal Schema Documentation

Tenzo takes a variety of data sources and then provides a unified schema - this allows you to run prebuilt analytics and reports across wide disparate datasources.

In addition to a set of models (or database tables) covering core concepts found in restaurant and retail - we also have a proprietary summary engine, that will output summarized data to ensure critical bits of data are available quickly.

Today - we cover the following categories of data:

You can see an example of our Sales Summaries

Common

Core Concepts

Throughout we refer to “temporal data” - meaning something that happened at a point in time (i.e. a sale, or a shift), and “categorical data” - meaning something that describes a fixed object (e.g., an employee, or menu item).

There are several common fields that most models have:

  • id - this is a unique ID in Tenzo’s database and is stored as a BigInt

  • local_id - this is the ID of the record in the remote system

  • date_added - this shows the datetime that the record was created

  • last_modified - this shows the datetime that the record was last modified

  • deleted_at - we soft delete data in our database, and this being set indicates that a row has been deleted

Business

class collector.models.Business

This model is not included in a Tenzo shard - but is the representation of a business, or Tenzo customer. Various models may refer to this, for example a collector.models.Location belongs to a Business

Business API Instance

class collector.models.BusinessAPIInstance

This model is not included in a Tenzo shard - but is the representation of an API connection. Many models have an ID that refers to this.

Location

class Location(*args, **kwargs)

This is the core representation of a physical Location within Tenzo

Locations that come from other datasources (e.g., a point of sale, or a labour management system) will have a foreign key to this object to unify locations that come from different systems

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • name (varchar(200)) – Name

  • address_1 (varchar(128)) – Address 1

  • address_2 (varchar(128)) – Address 2

  • city (varchar(64)) – City

  • state_county (varchar(64)) – State / county

  • zip_postal_code (varchar(8)) – Zip/post code

  • country (varchar(2)) – Country

  • council_id (integer to Council) – Deprecated

  • latitude (numeric(9, 6)) – Latitude

  • longitude (numeric(9, 6)) – Longitude

  • use_events_countries (varchar(200)) – Deprecated

  • calendar_id (integer to BusinessCalendar) – A link to a calendar of events associated with this Location (used in forecasting)

  • open_days (varchar(14)) – Comma-separated list: 0 is Monday; defaults to all days

  • open_times (jsonb) – Deprecated

  • recommended_labour_settings (jsonb) – A JSON field for labour planning: Defines min (minimum employees at any time while the store is open, int), open (number of employees required to open the store, int), close (number of employees required to close the store, int), per_unit_sales (the number of employees required for each £ or $ of sales in an hour, float), hours_to_open (the number of hours needed to open the store, float), hours_to_close (the number of hours needed to close the store, float), addition_threshold (the sales required to trigger a fixed minimum, float), addition_employees (the number of employees to add if the threshold is met, int), sales_labour_offset (eg. -1 to staff labour 1 hour before the expected sales occur, int).

  • phone (varchar(50)) – Phone

  • date_added (timestamp with time zone) – Date added

  • business_id (integer to Business) – Business

  • proxy_location_id (bigint to Location) – Used to indicate a similar location for forecasting when there is no data

  • area_id (bigint to Area) – Area

  • change_point (date) – Deprecated

  • pytz_timezone (varchar(300)) – A timezone represented as string - matching the python library pytz

  • is_enabled (boolean) – Determines whether the location is active and should be seen in Tenzo

  • staff_only (boolean) – Only Tenzo staff will see this location within Tenzo

  • data_stream_is_live (boolean) – Indicates whether we expect this location to have live sales (for quality checking)

  • day_part (jsonb) – Deprecated: Day parts are set at the business level

  • categories (jsonb) – Deprecated

  • day_cutoff (time) – Deprecated: end of day cutoff is defined at the business level

  • extra (jsonb) – An optional field to store location specific attributes

  • last_modified (timestamp with time zone) – Last modified

  • events (ManyToManyField) – Events that are directly assigned to this Location (used in forecasting)

  • event_calendars (ManyToManyField) – Event calendars

save(*args, **kwargs)

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

API Location

This is a model that provides a generic way to connect between a location in an API, and a collector.models.Location in Tenzo. This is just a more generic representation of something like a sales.models.POSLocation and will be used for future integrations.

class APILocation(id, deleted_at, business_api_instance, app_location, local_id, name, date_added, last_modified, to_delete)
Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • business_api_instance_id (bigint to BusinessAPIInstance) – Business api instance

  • app_location_id (bigint to Location) – App location

  • local_id (varchar(300)) – Local id

  • name (varchar(300)) – Name

  • date_added (timestamp with time zone) – Date added

  • last_modified (timestamp with time zone) – Last modified

  • to_delete (boolean) – Whilst cleaning up related models, we use this to mark objects as ‘to delete’, before soft deleting using deleted_at once it is safe to do so.

Sales

Note

All sales tables are prefixed with “sales_”

_images/sales.png

Categorical

POSLocation

class POSLocation(*args, **kwargs)

This is the representation of a Location coming from a point of sale

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • business_api_instance_id (bigint to BusinessAPIInstance) – This indicates the business and API this location belongs to

  • app_location_id (bigint to Location) – This unifies this location with a core physical location in Tenzo

  • local_id (varchar(300)) – Local id

  • address (varchar(300)) – Address

  • name (varchar(300)) – Name

  • phone (varchar(10)) – Phone

  • website (varchar(300)) – Website

  • pytz_timezone (varchar(300)) – A timezone represented as string - matching the python library pytz

  • date_added (timestamp with time zone) – Date added

  • last_modified (timestamp with time zone) – Last modified

  • to_delete (boolean) – Whilst cleaning up related models, we use this to mark objects as ‘to delete’, before soft deleting using deleted_at once it is safe to do so.

POSMenuCategory

class POSMenuCategory(*args, **kwargs)

A POSMenuCategory is a way of organizing POSMenuItems within Tenzo

A Category can have a parent, and this hierarchy can potentially be infinite. However, within the core Tenzo app - we only make 2-3 levels of this hierarchy visible

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • poslocation_id (bigint to POSLocation) – The location this POSMenuCategory belongs to

  • local_id (varchar(200)) – Local id

  • name (varchar(300)) – Name

  • parent_category_id (bigint to POSMenuCategory) – Parent category

  • date_added (timestamp with time zone) – Date added

  • last_modified (timestamp with time zone) – Last modified

POSMenuItem

class POSMenuItem(*args, **kwargs)

This represents an item on a menu e.g., Chicken Burger, Coke, or a TV

A POSMenuItem typically belongs to a category for reporting purposes.

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • poslocation_id (bigint to POSLocation) – The location this menu item belongs to

  • category_id (bigint to POSMenuCategory) – Category

  • local_id (varchar(200)) – Local id

  • name (varchar(300)) – Name

  • is_visible (boolean) – Indicates whether this item is visible on the menu

  • extra (jsonb) – An optional field to store integration specific attributes e.g., price

  • price (numeric(20, 6)) – The amount reported by the POS from their menu end point (normally before tax)

  • pos_code (varchar(300)) – Pos code

  • size (varchar(300)) – Size

  • date_added (timestamp with time zone) – Date added

  • last_modified (timestamp with time zone) – Last modified

POSOrderType

class POSOrderType(*args, **kwargs)

The representation of an Order Type for a transaction e.g., Eat-in vs. Delivery vs. Drive-through etc.

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • poslocation_id (bigint to POSLocation) – The location this Order Type belongs to

  • local_id (varchar(200)) – Local id

  • name (varchar(300)) – Name

  • date_added (timestamp with time zone) – Date added

  • last_modified (timestamp with time zone) – Last modified

POSRevenueCenter

class POSRevenueCenter(*args, **kwargs)

A Revenue Center is typically a sub-section of a Location. For example, a Location might have both a bar and a dining area.

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • poslocation_id (bigint to POSLocation) – The location this Revenue Center belongs to

  • local_id (varchar(200)) – Local id

  • name (varchar(300)) – Name

  • date_added (timestamp with time zone) – Date added

  • last_modified (timestamp with time zone) – Last modified

POSEmployee

class POSEmployee(*args, **kwargs)

This represents an employee within a restaurant or retail location

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • poslocation_id (bigint to POSLocation) – The location this Employee belongs to

  • local_id (varchar(200)) – Local id

  • check_name (varchar(300)) – Check name

  • first_name (varchar(300)) – First name

  • last_name (varchar(300)) – Last name

  • login (varchar(300)) – Login

  • date_added (timestamp with time zone) – Date added

  • last_modified (timestamp with time zone) – Last modified

POSCustomer

class POSCustomer(*args, **kwargs)

This represents the end customer (where available) coming from a point of sale. i.e., the person buying the item. Typically this detail may come from a connected loyalty platform.

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • business_api_instance_id (bigint to BusinessAPIInstance) – Business api instance

  • poslocation_id (bigint to POSLocation) – The location this customer belongs to

  • local_id (varchar(200)) – Local id

  • address (varchar(300)) – Address

  • name (varchar(300)) – Name

  • phone (varchar(25)) – Phone

  • email (varchar(200)) – Email

  • signup_date (timestamp with time zone) – Signup date

  • active (boolean) – Whether or not this customer has an active account

  • date_added (timestamp with time zone) – Date added

  • last_modified (timestamp with time zone) – Last modified

POSTable

class POSTable(*args, **kwargs)

This represents a physical Table within a restaurant

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • poslocation_id (bigint to POSLocation) – The location this Table belongs to

  • local_id (varchar(200)) – Local id

  • name (varchar(300)) – Name

  • seats (integer) – The number of seats the table has around it

  • date_added (timestamp with time zone) – Date added

  • last_modified (timestamp with time zone) – Last modified

POSTenderType

class POSTenderType(*args, **kwargs)

The representation of a “method of payment” e.g., Cash vs. Credit Card etc.

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • poslocation_id (bigint to POSLocation) – The location this Tender Type belongs to

  • local_id (varchar(200)) – Local id

  • name (varchar(300)) – Name

  • date_added (timestamp with time zone) – Date added

  • is_cash (boolean) – Is cash

  • last_modified (timestamp with time zone) – Last modified

POSAccount

class POSAccount(*args, **kwargs)

This is a grouping of POSTickets i.e. potentially for one customer, or spanning multiple days

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • poslocation_id (bigint to POSLocation) – The location this account belongs to

  • local_id (varchar(200)) – Local id

  • opened_at (timestamp with time zone) – When the account was opened

  • closed_at (timestamp with time zone) – When the account was closed

  • date_added (timestamp with time zone) – Date added

  • last_modified (timestamp with time zone) – Last modified

Temporal

POSTicket

class POSTicket(*args, **kwargs)

This is the core representation of a sales transaction within Tenzo.

A POSTicket is made up of POSTicketItems, POSTicketDiscounts, and POSTicketAdjustments (typically service charge)

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • poslocation_id (bigint to POSLocation) – The location this transaction happened in

  • local_id (varchar(200)) – Local id

  • name (varchar(2500)) – Name

  • order_type_id (bigint to POSOrderType) – Order type

  • date_of_business (date) – The business day the transaction happened on. This could be different to calendar day, for instance transactions at 1am may be applied to the previous day

  • opened_at (timestamp with time zone) – When the transaction was opened

  • closed_at (timestamp with time zone) – When the transaction was closed

  • printed_at (timestamp with time zone) – When the transaction receipt was printed

  • delivered_at (timestamp with time zone) – If available and applicable, when the transaction was delivered to the customer

  • ready_at (timestamp with time zone) – If available and applicable, when the transaction was ready to go to the customer i.e. normally when it was ‘bumped’ from a KDS

  • gross_revenue_with_tax (numeric(20, 6)) – Deprecated and value not reliable; used to indicate the value before discounts

  • gross_revenue_no_tax (numeric(20, 6)) – Deprecated and value not reliable; used to indicate the value before discounts

  • paid_with_tax (numeric(20, 6)) – The amount paid for this transaction - includes tax, service charge, all items and is AFTER discounts

  • paid_no_tax (numeric(20, 6)) – The amount paid for this transaction, excluding tax, but including service charge, all items and is AFTER discounts

  • promos_with_tax_shield (numeric(20, 6)) – The value of all promos on the transaction including the impact of the tax shield

  • promos_no_tax_shield (numeric(20, 6)) – The value of all promos on the transaction without the impact of the tax shield

  • comps_with_tax_shield (numeric(20, 6)) – The value of all comps (typically staff meals) on the transaction including the impact of the tax shield

  • comps_no_tax_shield (numeric(20, 6)) – The value of all comps (typically staff meals) on the transaction without the impact of the tax shield

  • adjust_with_tax_shield (numeric(20, 6)) – The value of all adjustments including tax

  • adjust_no_tax_shield (numeric(20, 6)) – The value of all adjustments excluding tax

  • tips (numeric(20, 6)) – The value of tips on the transaction - can also be found on the POSPayment

  • revenue_center_id (bigint to POSRevenueCenter) – Revenue center

  • table_id (bigint to POSTable) – Table

  • employee_id (bigint to POSEmployee) – Employee

  • customer_id (bigint to POSCustomer) – Customer

  • account_id (bigint to POSAccount) – Account

  • open (boolean) – Whether the transaction is still open or not

  • guest_count (integer) – The number of guests or covers on a transaction (if avaialable in POS)

  • ticket_number (varchar(300)) – Normally a number that represents a transation that may be communicated to a guest e.g, ‘Ticket 12’

  • was_abandoned (boolean) – indicates whether a transaction was VOIDED or CANCELLED

  • extra (jsonb) – An additional JSON field to store any integration specific information

  • date_added (timestamp with time zone) – Date added

  • last_modified (timestamp with time zone) – Last modified

POSTicketItem

class POSTicketItem(*args, **kwargs)

Represents an individual item on a ticket e.g., Chicken Burger or a Coke

Ticket Items include the value of sub-resources - POSTicketItemDiscount, POSTicketItemModifier

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • posticket_id (bigint to POSTicket) – The ticket the item belongs to

  • local_id (varchar(400)) – Local id

  • comment (varchar(300)) – Deprecated

  • name (varchar(4800)) – Deprecated

  • unit_paid_no_tax (numeric(20, 6)) – The amount paid for ONE of the item without tax. This includes modifiers and is AFTER discounts.

  • unit_paid_with_tax (numeric(20, 6)) – The amount paid for ONE of the item with tax. This includes modifiers and is AFTER discounts.

  • unit_gross_no_tax (numeric(20, 6)) – Deprecated and set inconsistently; aimed to be the amount paid before discounts

  • unit_gross_with_tax (numeric(20, 6)) – Deprecated and set inconsistently; aimed to be the amount paid before discounts

  • quantity (numeric(20, 6)) – The number of the item sold

  • menuitem_id (bigint to POSMenuItem) – Menuitem

  • employee_id (bigint to POSEmployee) – Employee

  • created_at (timestamp with time zone) – When the item was added to the ticket

  • was_abandoned (boolean) – Indicates whether a transaction was VOIDED or CANCELLED

  • is_liability (boolean) – Indicates whether an item was a liability

  • order_type_id (bigint to POSOrderType) – An optional order type for a specific item; in most situations in Tenzo this detail comes from the order type on the POSTicket

  • revenue_center_id (bigint to POSRevenueCenter) – An optional revenue center for a specific item; in most situations in Tenzo this detail comes from the order type on the POSTicket

  • extra (jsonb) – An additional JSON field to store any integration specific information

  • date_added (timestamp with time zone) – Date added

  • last_modified (timestamp with time zone) – Last modified

POSTicketItemDiscount

class POSTicketItemDiscount(*args, **kwargs)

Represents a discount applied to a POSTicketItem

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • posticketitem_id (bigint to POSTicketItem) – A link to the item the discount applies to

  • posdiscount_id (bigint to POSDiscount) – The type or name of this discount

  • type (varchar(30)) – This should be either ‘comp’ or ‘promo’ to indicate the type of the discount. Comps are typically free or staff meals.

  • local_id (varchar(400)) – Local id

  • comment (varchar(300)) – Deprecated

  • name (varchar(300)) – Deprecated

  • unit_value_with_tax_shield (numeric(20, 6)) – The value of the discount including the impact of tax. A POSITIVE amount indicates a REDUCTION in the amount the end customer would pay.

  • unit_value_no_tax_shield (numeric(20, 6)) – The value of the discount excluding the impact of tax. A POSITIVE amount indicates a REDUCTION in the amount the end customer would pay.

  • quantity (integer) – The number of times this discount is applied to the item

  • date_added (timestamp with time zone) – Date added

  • last_modified (timestamp with time zone) – Last modified

POSTicketItemModifier

class POSTicketItemModifier(*args, **kwargs)

Represents a modifier on a ticket item. e.g., this might be something like “Extra Egg” or “Spicy”. Modifiers may or may not have a value

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • posticketitem_id (bigint to POSTicketItem) – The item that this modifier applies to

  • menuitem_id (bigint to POSMenuItem) – A modifier may optionally have a menu item. This can be used to categorize modifiers

  • local_id (varchar(400)) – Local id

  • comment (varchar(300)) – Deprecated

  • name (varchar(300)) – Deprecated; use menuitem instead to store this detail

  • price_per_unit_with_tax (numeric(20, 6)) – The value of ONE modifier with tax

  • price_per_unit_no_tax (numeric(20, 6)) – The value of ONE modifier with tax

  • quantity (integer) – The number of times this modifier is applied to the item

  • created_at (timestamp with time zone) – The time when the modifier was added to the transaction

  • date_added (timestamp with time zone) – Date added

  • last_modified (timestamp with time zone) – Last modified

POSTicketDiscount

class POSTicketDiscount(*args, **kwargs)

Resource for Discounts that have been applied to the entire Ticket (i.e. NOT a specific item)

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • posticket_id (bigint to POSTicket) – The ticket this discount is on

  • posdiscount_id (bigint to POSDiscount) – Type or name of discount

  • local_id (varchar(200)) – Local id

  • comment (varchar(300)) – Deprecated

  • name (varchar(300)) – Name

  • created_at (timestamp with time zone) – This is the time the discount was added to the ticket

  • unit_value_with_tax_shield (numeric(20, 6)) – The value of the discount including the impact of tax. A POSITIVE amount indicates a REDUCTION in the amount the end customer would pay.

  • unit_value_no_tax_shield (numeric(20, 6)) – The value of the discount excluding the impact of tax. A POSITIVE amount indicates a REDUCTION in the amount the end customer would pay.

  • quantity (integer) – The number of times this discount has been applied

  • employee_id (bigint to POSEmployee) – The employee that added the discount

  • date_added (timestamp with time zone) – Date added

  • last_modified (timestamp with time zone) – Last modified

POSTicketAdjustment

class POSTicketAdjustment(*args, **kwargs)

This handles arbitrary adjustments to the POSTicket: the most common case here is service charge

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • posticket_id (bigint to POSTicket) – The ticket with the adjustment

  • local_id (varchar(200)) – Local id

  • comment (varchar(300)) – Can include additional info on the adjustment e.g., the type of service charge

  • name (varchar(300)) – Name

  • type (integer) – Type 1 = Service Charge

  • employee_id (bigint to POSEmployee) – The employee who added the adjustment

  • created_at (timestamp with time zone) – when the Adjsutment was added to the ticket

  • value_with_tax (numeric(20, 6)) – The amount of the adjustment including tax

  • value_no_tax (numeric(20, 6)) – The amount of the adjustment excluding tax

  • date_added (timestamp with time zone) – Date added

  • last_modified (timestamp with time zone) – Last modified

POSPayment

class POSPayment(*args, **kwargs)

Representation of an actual payment within Tenzo e.g., cash or credit

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • posticket_id (bigint to POSTicket) – The Ticket the payment applies to

  • account_id (bigint to POSAccount) – Optional: the customer account the payment applies to

  • employee_id (bigint to POSEmployee) – The employee who processed the payment

  • local_id (varchar(200)) – Local id

  • comment (varchar(300)) – Deprecated

  • tender_type_id (bigint to POSTenderType) – The type of the payment e.g., cash vs credit

  • paid_with_tax (numeric(20, 6)) – The amount of the payment including tax

  • paid_no_tax (numeric(20, 6)) – The amount of the payment excluding tax (often this cannot be determined, so will be the same as the paid_with_tax)

  • payment_time (timestamp with time zone) – The time the payment was made

  • tip (numeric(20, 6)) – Any tip included with this payment

  • date_added (timestamp with time zone) – Date added

  • last_modified (timestamp with time zone) – Last modified

Sales Summaries

SummarySalesByDay

class SummarySalesByDay(*args, **kwargs)

SummarySalesByDay represents the aggregation of daily sales in a location, grouped by POSLocation and date_of_business.

The base Sales models are used to calculate, aggregating POSTickets, POSTicketItems, and POSTicketItemDiscounts.

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • poslocation_id (bigint to POSLocation) – Poslocation

  • date_of_business (date) – Date of business

  • ticket_count (integer) – Ticket count

  • gross_revenue_with_tax (numeric(20, 6)) – Gross revenue with tax

  • gross_revenue_no_tax (numeric(20, 6)) – Gross revenue no tax

  • paid_with_tax (numeric(20, 6)) – Paid with tax

  • paid_no_tax (numeric(20, 6)) – Paid no tax

  • promos_with_tax_shield (numeric(20, 6)) – Promos with tax shield

  • promos_no_tax_shield (numeric(20, 6)) – Promos no tax shield

  • comps_with_tax_shield (numeric(20, 6)) – Comps with tax shield

  • comps_no_tax_shield (numeric(20, 6)) – Comps no tax shield

  • adjust_with_tax_shield (numeric(20, 6)) – Adjust with tax shield

  • adjust_no_tax_shield (numeric(20, 6)) – Adjust no tax shield

  • tips (numeric(20, 6)) – Tips

  • guest_ticket_count (integer) – Guest ticket count

  • guest_gross_revenue_with_tax (numeric(20, 6)) – Guest gross revenue with tax

  • guest_gross_revenue_no_tax (numeric(20, 6)) – Guest gross revenue no tax

  • guest_paid_with_tax (numeric(20, 6)) – Guest paid with tax

  • guest_paid_no_tax (numeric(20, 6)) – Guest paid no tax

  • guest_promos_with_tax_shield (numeric(20, 6)) – Guest promos with tax shield

  • guest_promos_no_tax_shield (numeric(20, 6)) – Guest promos no tax shield

  • guest_comps_with_tax_shield (numeric(20, 6)) – Guest comps with tax shield

  • guest_comps_no_tax_shield (numeric(20, 6)) – Guest comps no tax shield

  • guest_adjust_with_tax_shield (numeric(20, 6)) – Guest adjust with tax shield

  • guest_adjust_no_tax_shield (numeric(20, 6)) – Guest adjust no tax shield

  • guest_tips (numeric(20, 6)) – Guest tips

  • guest_count (integer) – Guest count

  • void_ticket_count (integer) – Void ticket count

  • void_gross_revenue_with_tax (numeric(20, 6)) – Void gross revenue with tax

  • void_gross_revenue_no_tax (numeric(20, 6)) – Void gross revenue no tax

  • void_paid_with_tax (numeric(20, 6)) – Void paid with tax

  • void_paid_no_tax (numeric(20, 6)) – Void paid no tax

  • void_promos_with_tax_shield (numeric(20, 6)) – Void promos with tax shield

  • void_promos_no_tax_shield (numeric(20, 6)) – Void promos no tax shield

  • void_comps_with_tax_shield (numeric(20, 6)) – Void comps with tax shield

  • void_comps_no_tax_shield (numeric(20, 6)) – Void comps no tax shield

  • void_adjust_with_tax_shield (numeric(20, 6)) – Void adjust with tax shield

  • void_adjust_no_tax_shield (numeric(20, 6)) – Void adjust no tax shield

  • void_tips (numeric(20, 6)) – Void tips

  • void_guest_count (integer) – Void guest count

  • last_modified (timestamp with time zone) – Last modified

  • time_to_serve (numeric(20, 6)) – Time to serve

  • guest_time_to_serve (numeric(20, 6)) – Guest time to serve

  • void_time_to_serve (numeric(20, 6)) – Void time to serve

SummarySalesByOrderType

class SummarySalesByOrderType(*args, **kwargs)

SummarySalesByOrderType represents the aggregation of daily sales by order type in a location, grouped by POSLocation, date_of_business, and POSOrderType.

The base Sales models are used to calculate, aggregating POSTickets, POSTicketItems, and POSTicketItemDiscounts.

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • poslocation_id (bigint to POSLocation) – Poslocation

  • date_of_business (date) – Date of business

  • ticket_count (integer) – Ticket count

  • gross_revenue_with_tax (numeric(20, 6)) – Gross revenue with tax

  • gross_revenue_no_tax (numeric(20, 6)) – Gross revenue no tax

  • paid_with_tax (numeric(20, 6)) – Paid with tax

  • paid_no_tax (numeric(20, 6)) – Paid no tax

  • promos_with_tax_shield (numeric(20, 6)) – Promos with tax shield

  • promos_no_tax_shield (numeric(20, 6)) – Promos no tax shield

  • comps_with_tax_shield (numeric(20, 6)) – Comps with tax shield

  • comps_no_tax_shield (numeric(20, 6)) – Comps no tax shield

  • adjust_with_tax_shield (numeric(20, 6)) – Adjust with tax shield

  • adjust_no_tax_shield (numeric(20, 6)) – Adjust no tax shield

  • tips (numeric(20, 6)) – Tips

  • guest_ticket_count (integer) – Guest ticket count

  • guest_gross_revenue_with_tax (numeric(20, 6)) – Guest gross revenue with tax

  • guest_gross_revenue_no_tax (numeric(20, 6)) – Guest gross revenue no tax

  • guest_paid_with_tax (numeric(20, 6)) – Guest paid with tax

  • guest_paid_no_tax (numeric(20, 6)) – Guest paid no tax

  • guest_promos_with_tax_shield (numeric(20, 6)) – Guest promos with tax shield

  • guest_promos_no_tax_shield (numeric(20, 6)) – Guest promos no tax shield

  • guest_comps_with_tax_shield (numeric(20, 6)) – Guest comps with tax shield

  • guest_comps_no_tax_shield (numeric(20, 6)) – Guest comps no tax shield

  • guest_adjust_with_tax_shield (numeric(20, 6)) – Guest adjust with tax shield

  • guest_adjust_no_tax_shield (numeric(20, 6)) – Guest adjust no tax shield

  • guest_tips (numeric(20, 6)) – Guest tips

  • guest_count (integer) – Guest count

  • void_ticket_count (integer) – Void ticket count

  • void_gross_revenue_with_tax (numeric(20, 6)) – Void gross revenue with tax

  • void_gross_revenue_no_tax (numeric(20, 6)) – Void gross revenue no tax

  • void_paid_with_tax (numeric(20, 6)) – Void paid with tax

  • void_paid_no_tax (numeric(20, 6)) – Void paid no tax

  • void_promos_with_tax_shield (numeric(20, 6)) – Void promos with tax shield

  • void_promos_no_tax_shield (numeric(20, 6)) – Void promos no tax shield

  • void_comps_with_tax_shield (numeric(20, 6)) – Void comps with tax shield

  • void_comps_no_tax_shield (numeric(20, 6)) – Void comps no tax shield

  • void_adjust_with_tax_shield (numeric(20, 6)) – Void adjust with tax shield

  • void_adjust_no_tax_shield (numeric(20, 6)) – Void adjust no tax shield

  • void_tips (numeric(20, 6)) – Void tips

  • void_guest_count (integer) – Void guest count

  • last_modified (timestamp with time zone) – Last modified

  • time_to_serve (numeric(20, 6)) – Time to serve

  • guest_time_to_serve (numeric(20, 6)) – Guest time to serve

  • void_time_to_serve (numeric(20, 6)) – Void time to serve

  • order_type_id (bigint to POSOrderType) – Order type

SummarySalesByRevenueCenter

class SummarySalesByRevenueCenter(*args, **kwargs)

SummarySalesByRevenueCenter represents the aggregation of daily sales by revenue center in a location, grouped by POSLocation, date_of_business, and POSRevenueCenter.

The base Sales models are used to calculate, aggregating POSTickets, POSTicketItems, and POSTicketItemDiscounts.

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • poslocation_id (bigint to POSLocation) – Poslocation

  • date_of_business (date) – Date of business

  • ticket_count (integer) – Ticket count

  • gross_revenue_with_tax (numeric(20, 6)) – Gross revenue with tax

  • gross_revenue_no_tax (numeric(20, 6)) – Gross revenue no tax

  • paid_with_tax (numeric(20, 6)) – Paid with tax

  • paid_no_tax (numeric(20, 6)) – Paid no tax

  • promos_with_tax_shield (numeric(20, 6)) – Promos with tax shield

  • promos_no_tax_shield (numeric(20, 6)) – Promos no tax shield

  • comps_with_tax_shield (numeric(20, 6)) – Comps with tax shield

  • comps_no_tax_shield (numeric(20, 6)) – Comps no tax shield

  • adjust_with_tax_shield (numeric(20, 6)) – Adjust with tax shield

  • adjust_no_tax_shield (numeric(20, 6)) – Adjust no tax shield

  • tips (numeric(20, 6)) – Tips

  • guest_ticket_count (integer) – Guest ticket count

  • guest_gross_revenue_with_tax (numeric(20, 6)) – Guest gross revenue with tax

  • guest_gross_revenue_no_tax (numeric(20, 6)) – Guest gross revenue no tax

  • guest_paid_with_tax (numeric(20, 6)) – Guest paid with tax

  • guest_paid_no_tax (numeric(20, 6)) – Guest paid no tax

  • guest_promos_with_tax_shield (numeric(20, 6)) – Guest promos with tax shield

  • guest_promos_no_tax_shield (numeric(20, 6)) – Guest promos no tax shield

  • guest_comps_with_tax_shield (numeric(20, 6)) – Guest comps with tax shield

  • guest_comps_no_tax_shield (numeric(20, 6)) – Guest comps no tax shield

  • guest_adjust_with_tax_shield (numeric(20, 6)) – Guest adjust with tax shield

  • guest_adjust_no_tax_shield (numeric(20, 6)) – Guest adjust no tax shield

  • guest_tips (numeric(20, 6)) – Guest tips

  • guest_count (integer) – Guest count

  • void_ticket_count (integer) – Void ticket count

  • void_gross_revenue_with_tax (numeric(20, 6)) – Void gross revenue with tax

  • void_gross_revenue_no_tax (numeric(20, 6)) – Void gross revenue no tax

  • void_paid_with_tax (numeric(20, 6)) – Void paid with tax

  • void_paid_no_tax (numeric(20, 6)) – Void paid no tax

  • void_promos_with_tax_shield (numeric(20, 6)) – Void promos with tax shield

  • void_promos_no_tax_shield (numeric(20, 6)) – Void promos no tax shield

  • void_comps_with_tax_shield (numeric(20, 6)) – Void comps with tax shield

  • void_comps_no_tax_shield (numeric(20, 6)) – Void comps no tax shield

  • void_adjust_with_tax_shield (numeric(20, 6)) – Void adjust with tax shield

  • void_adjust_no_tax_shield (numeric(20, 6)) – Void adjust no tax shield

  • void_tips (numeric(20, 6)) – Void tips

  • void_guest_count (integer) – Void guest count

  • last_modified (timestamp with time zone) – Last modified

  • time_to_serve (numeric(20, 6)) – Time to serve

  • guest_time_to_serve (numeric(20, 6)) – Guest time to serve

  • void_time_to_serve (numeric(20, 6)) – Void time to serve

  • revenue_center_id (bigint to POSRevenueCenter) – Revenue center

SummarySalesByProductItem

class SummarySalesByProductItem(*args, **kwargs)

SummarySalesByProductItem represents the aggregation of daily sales by product item (menu item) in a location, grouped by POSLocation, date_of_business, and POSMenuItem.

The base Sales models are used to calculate, aggregating POSTickets, POSTicketItems, and POSTicketItemDiscounts.

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • poslocation_id (bigint to POSLocation) – Poslocation

  • date_of_business (date) – Date of business

  • menuitem_id (bigint to POSMenuItem) – Menuitem

  • type (integer) – Type

  • ticket_count (integer) – Total number of tickets (on this dob-loc. Includes tickets without TicketItems)

  • quantity_count (numeric(20, 6)) – Sum of the quantity field on POSTicketItem for this MenuItem

  • total_paid_no_tax (numeric(20, 6)) – Total paid no tax

  • total_paid_with_tax (numeric(20, 6)) – Total paid with tax

  • promos_no_tax_shield (numeric(20, 6)) – Promos no tax shield

  • promos_with_tax_shield (numeric(20, 6)) – Promos with tax shield

  • comps_no_tax_shield (numeric(20, 6)) – Comps no tax shield

  • comps_with_tax_shield (numeric(20, 6)) – Comps with tax shield

  • adjust_no_tax_shield (numeric(20, 6)) – Adjust no tax shield

  • adjust_with_tax_shield (numeric(20, 6)) – Adjust with tax shield

  • last_modified (timestamp with time zone) – Last modified

  • total_gross_no_tax (numeric(20, 6)) – deprecated

  • total_gross_with_tax (numeric(20, 6)) – deprecated

SummarySalesByTimeOfDay

class SummarySalesByTimeOfDay(*args, **kwargs)

SummarySalesByTimeOfDay represents the aggregation of sales by fifteen minute periods in a day for a location. For a particular date_of_business and POSLocation, Time of Day summaries would be represented by 96 fifteen minute periods, starting with 00:00 - 00:14, then 00:15-00:29 and so on.

The base Sales models are used to calculate, aggregating POSTickets, POSTicketItems, and POSTicketItemDiscounts.

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • poslocation_id (bigint to POSLocation) – Poslocation

  • date_of_business (date) – Date of business

  • ticket_count (integer) – Ticket count

  • gross_revenue_with_tax (numeric(20, 6)) – Gross revenue with tax

  • gross_revenue_no_tax (numeric(20, 6)) – Gross revenue no tax

  • paid_with_tax (numeric(20, 6)) – Paid with tax

  • paid_no_tax (numeric(20, 6)) – Paid no tax

  • promos_with_tax_shield (numeric(20, 6)) – Promos with tax shield

  • promos_no_tax_shield (numeric(20, 6)) – Promos no tax shield

  • comps_with_tax_shield (numeric(20, 6)) – Comps with tax shield

  • comps_no_tax_shield (numeric(20, 6)) – Comps no tax shield

  • adjust_with_tax_shield (numeric(20, 6)) – Adjust with tax shield

  • adjust_no_tax_shield (numeric(20, 6)) – Adjust no tax shield

  • tips (numeric(20, 6)) – Tips

  • guest_ticket_count (integer) – Guest ticket count

  • guest_gross_revenue_with_tax (numeric(20, 6)) – Guest gross revenue with tax

  • guest_gross_revenue_no_tax (numeric(20, 6)) – Guest gross revenue no tax

  • guest_paid_with_tax (numeric(20, 6)) – Guest paid with tax

  • guest_paid_no_tax (numeric(20, 6)) – Guest paid no tax

  • guest_promos_with_tax_shield (numeric(20, 6)) – Guest promos with tax shield

  • guest_promos_no_tax_shield (numeric(20, 6)) – Guest promos no tax shield

  • guest_comps_with_tax_shield (numeric(20, 6)) – Guest comps with tax shield

  • guest_comps_no_tax_shield (numeric(20, 6)) – Guest comps no tax shield

  • guest_adjust_with_tax_shield (numeric(20, 6)) – Guest adjust with tax shield

  • guest_adjust_no_tax_shield (numeric(20, 6)) – Guest adjust no tax shield

  • guest_tips (numeric(20, 6)) – Guest tips

  • guest_count (integer) – Guest count

  • void_ticket_count (integer) – Void ticket count

  • void_gross_revenue_with_tax (numeric(20, 6)) – Void gross revenue with tax

  • void_gross_revenue_no_tax (numeric(20, 6)) – Void gross revenue no tax

  • void_paid_with_tax (numeric(20, 6)) – Void paid with tax

  • void_paid_no_tax (numeric(20, 6)) – Void paid no tax

  • void_promos_with_tax_shield (numeric(20, 6)) – Void promos with tax shield

  • void_promos_no_tax_shield (numeric(20, 6)) – Void promos no tax shield

  • void_comps_with_tax_shield (numeric(20, 6)) – Void comps with tax shield

  • void_comps_no_tax_shield (numeric(20, 6)) – Void comps no tax shield

  • void_adjust_with_tax_shield (numeric(20, 6)) – Void adjust with tax shield

  • void_adjust_no_tax_shield (numeric(20, 6)) – Void adjust no tax shield

  • void_tips (numeric(20, 6)) – Void tips

  • void_guest_count (integer) – Void guest count

  • last_modified (timestamp with time zone) – Last modified

  • time_to_serve (numeric(20, 6)) – Time to serve

  • guest_time_to_serve (numeric(20, 6)) – Guest time to serve

  • void_time_to_serve (numeric(20, 6)) – Void time to serve

  • fifteen_minute_period (integer) – Fifteen minute period of the day, with 0 representing 00:00 to 00:14, and 1 representing 00:15 to 00:29

  • open_tickets (integer) – Open tickets

SummarySalesByTimeOfDayByProductItem

class SummarySalesByTimeOfDayByProductItem(*args, **kwargs)

SummarySalesByTimeOfDayByProductItem represents the aggregation of sales by product item (menu item) and fifteen minute period in a day for a location. For a particular date_of_business, POSMenuItem and POSLocation, Time of Day summaries would be represented by 96 fifteen minute periods, starting with 00:00 - 00:14, then 00:15-00:29 and so on.

The base Sales models are used to calculate, aggregating POSTickets, POSTicketItems, and POSTicketItemDiscounts.

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • poslocation_id (bigint to POSLocation) – Poslocation

  • date_of_business (date) – Date of business

  • menuitem_id (bigint to POSMenuItem) – Menuitem

  • type (integer) – Type

  • ticket_count (integer) – Total number of tickets (on this dob-loc. Includes tickets without TicketItems)

  • quantity_count (numeric(20, 6)) – Sum of the quantity field on POSTicketItem for this MenuItem

  • total_paid_no_tax (numeric(20, 6)) – Total paid no tax

  • total_paid_with_tax (numeric(20, 6)) – Total paid with tax

  • promos_no_tax_shield (numeric(20, 6)) – Promos no tax shield

  • promos_with_tax_shield (numeric(20, 6)) – Promos with tax shield

  • comps_no_tax_shield (numeric(20, 6)) – Comps no tax shield

  • comps_with_tax_shield (numeric(20, 6)) – Comps with tax shield

  • adjust_no_tax_shield (numeric(20, 6)) – Adjust no tax shield

  • adjust_with_tax_shield (numeric(20, 6)) – Adjust with tax shield

  • last_modified (timestamp with time zone) – Last modified

  • total_gross_no_tax (numeric(20, 6)) – deprecated

  • total_gross_with_tax (numeric(20, 6)) – deprecated

  • fifteen_minute_period (integer) – Fifteen minute period

Labor

Note

All labor tables are prefixed with “labor_”

_images/labor.png

Categorical

RotaLocation

class RotaLocation(*args, **kwargs)

The representation of a Location coming from a labor / staff scheduler

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • business_api_instance_id (bigint to BusinessAPIInstance) – Business api instance

  • app_location_id (bigint to Location) – Unifies this Rota Location with a core physical location in Tenzo

  • local_id (varchar(200)) – Local id

  • name (varchar(200)) – Name

  • last_modified (timestamp with time zone) – Last modified

  • date_added (timestamp with time zone) – Date added

  • to_delete (boolean) – To delete

RotaHousePart

class RotaHousePart(*args, **kwargs)

RotaHousePart is a way of organizing RotaEmployees within Tenzo.

The default hierarchy is RotaLocation > RotaHousePart > RotaRole > RotaEmployee, but this can be modified depending on the integration.

Usually, a RotaHousePart can be considered as a grouping of RotaRoles

Some common examples are: Front of House, Back of House

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • business_api_instance_id (bigint to BusinessAPIInstance) – Business api instance

  • local_id (varchar(200)) – Local id

  • name (varchar(200)) – Name of the house part

  • last_modified (timestamp with time zone) – Last modified

  • date_added (timestamp with time zone) – Date added

RotaRole

class RotaRole(*args, **kwargs)

RotaRole is a way of organizing RotaEmployees within Tenzo.

The default hierarchy is RotaLocation > RotaHousePart > RotaRole > RotaEmployee, but this can be modified depending on the integration.

Some common examples are: Waiter, Chef, Manager

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • business_api_instance_id (bigint to BusinessAPIInstance) – Business api instance

  • local_id (varchar(200)) – Local id

  • name (varchar(200)) – Name of the Role

  • last_modified (timestamp with time zone) – Last modified

  • date_added (timestamp with time zone) – Date added

RotaEmployee

class RotaEmployee(*args, **kwargs)

RotaEmployee represents an employee, coming from a labor / staff scheduler

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • business_api_instance_id (bigint to BusinessAPIInstance) – Business api instance

  • local_id (varchar(200)) – Local id

  • rotalocation_id (bigint to RotaLocation) – Rotalocation

  • rotarole_id (bigint to RotaRole) – Rotarole

  • pay_rate_type (integer) – Relates to pay_rate, and is the default pay rate type for the employee (can be overriden on the shift). This can be either 0: Hourly or 1: Salaried.

  • pay_rate (numeric(20, 2)) – The default rate of pay for the employee (can be overriden on the shift). If pay_rate_type is hourly, then pay_rate is the hourly rate. If pay_rate_type is Salaried, then pay_rate is the annual rate.

  • full_name (varchar(200)) – Usually a combination of first_name and last_name, however in some cases full_name can be an abbreviation or nickname

  • first_name (varchar(200)) – First name

  • last_name (varchar(200)) – Last name

  • hire_date (date) – Hire date

  • termination_date (date) – Termination date

  • extra (jsonb) – Extra

  • last_modified (timestamp with time zone) – Last modified

  • date_added (timestamp with time zone) – Date added

Temporal

RotaShift

class RotaShift(*args, **kwargs)

RotaShift is the core representation of a shift within Tenzo.

Each shift is tied to a RotaEmployee and RotaLocation, and optionally a RotaRole and RotaHousePart. Shifts can be worked or unworked (paid or unpaid absences), and can be for hourly or salaried staff.

A RotaShift stores the number of minutes and the costs for the shift.

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • business_api_instance_id (bigint to BusinessAPIInstance) – Business api instance

  • rotalocation_id (bigint to RotaLocation) – Rotalocation

  • rotaemployee_id (bigint to RotaEmployee) – Rotaemployee

  • rotarole_id (bigint to RotaRole) – Rotarole

  • rotahousepart_id (bigint to RotaHousePart) – Rotahousepart

  • date_of_business (date) – Date the shift will or did take place

  • local_id (varchar(200)) – Local id

  • work_type (integer) – Used to identify absences. Choices are 0: worked, 1: Paid time off, or 2: Unpaid time off

  • pay_rate_type (integer) – Relates to pay_rate, and is the pay rate type for the employee. This can be either 0: Hourly or 1: Salaried.

  • pay_rate (numeric(20, 2)) – Rate of pay for the shift. Hourly rate for hourly shifts, Annual rate for Salaried shifts.

  • base_cost (numeric(20, 2)) – Base Cost of the shift (without any overheads).

  • penalty_cost (numeric(20, 2)) – An overhead. Any penalty costs associated with the shift (usually relating to labor laws).

  • holiday_accrual_cost (numeric(20, 2)) – An overhead. Value of any holiday accrued

  • overtime_cost (numeric(20, 2)) – An overhead. Value of any overtime cost

  • other_overhead_cost (numeric(20, 2)) – An overhead. Value of any ‘other’ overheads, e.g. tax

  • employer_taxes (numeric(20, 2)) – An overhead. Value of any employer taxes

  • pension (numeric(20, 2)) – An overhead. Value of any pension

  • start_time (timestamp with time zone) – Start time of the shift

  • end_time (timestamp with time zone) – End time of the shift

  • num_mins (integer) – Number of minutes in the shift, deducting unpaid break minutes. num_mins = (end_time - start_time) - num_mins_break_unpaid

  • num_mins_break_unpaid (integer) – Minutes of unpaid break in the shift

  • num_mins_break_paid (integer) – Minutes of paid break in the shift

  • num_mins_overtime (integer) – Minutes of overtime in the shift

  • last_modified (timestamp with time zone) – Last modified

  • date_added (timestamp with time zone) – Date added

  • extra (jsonb) – Extra

RotaShiftPlanned

class RotaShiftPlanned(*args, **kwargs)

RotaShiftPlanned represents an upcoming planned shift (though we keep historical records to allow comparison between planned and actual shift costs).

It is almost identical to RotaShift, expect for having an extra field “plan_date”. This keeps a record of the planned shift and how it changes over time, allowing you to see how shift and planning costs change in the lead up to shifts being worked.

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • business_api_instance_id (bigint to BusinessAPIInstance) – Business api instance

  • rotalocation_id (bigint to RotaLocation) – Rotalocation

  • rotaemployee_id (bigint to RotaEmployee) – Rotaemployee

  • rotarole_id (bigint to RotaRole) – Rotarole

  • rotahousepart_id (bigint to RotaHousePart) – Rotahousepart

  • date_of_business (date) – Date the shift will or did take place

  • local_id (varchar(200)) – Local id

  • work_type (integer) – Used to identify absences. Choices are 0: worked, 1: Paid time off, or 2: Unpaid time off

  • pay_rate_type (integer) – Relates to pay_rate, and is the pay rate type for the employee. This can be either 0: Hourly or 1: Salaried.

  • pay_rate (numeric(20, 2)) – Rate of pay for the shift. Hourly rate for hourly shifts, Annual rate for Salaried shifts.

  • base_cost (numeric(20, 2)) – Base Cost of the shift (without any overheads).

  • penalty_cost (numeric(20, 2)) – An overhead. Any penalty costs associated with the shift (usually relating to labor laws).

  • holiday_accrual_cost (numeric(20, 2)) – An overhead. Value of any holiday accrued

  • overtime_cost (numeric(20, 2)) – An overhead. Value of any overtime cost

  • other_overhead_cost (numeric(20, 2)) – An overhead. Value of any ‘other’ overheads, e.g. tax

  • employer_taxes (numeric(20, 2)) – An overhead. Value of any employer taxes

  • pension (numeric(20, 2)) – An overhead. Value of any pension

  • start_time (timestamp with time zone) – Start time of the shift

  • end_time (timestamp with time zone) – End time of the shift

  • num_mins (integer) – Number of minutes in the shift, deducting unpaid break minutes. num_mins = (end_time - start_time) - num_mins_break_unpaid

  • num_mins_break_unpaid (integer) – Minutes of unpaid break in the shift

  • num_mins_break_paid (integer) – Minutes of paid break in the shift

  • num_mins_overtime (integer) – Minutes of overtime in the shift

  • last_modified (timestamp with time zone) – Last modified

  • date_added (timestamp with time zone) – Date added

  • extra (jsonb) – Extra

  • plan_date (date) – An extra dimension for planned shifts. Stores the date when the planned shift was retrieved, so you can see how scheduling costs are altered before the shift happens.

static get_latest_plan_date_shifts(queryset) list

Get the most recent shifts by plan_date grouped by location, role, housepart, employee and date_of_business

Labor Summaries

SummaryLaborByDay

class SummaryLaborByDay(*args, **kwargs)

SummaryLaborByDay represents the aggregation of daily shifts in a location, grouped by RotaLocation and date_of_business.

It is calculated using the base Labor models, aggregating RotaShifts

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • rotalocation_id (bigint to RotaLocation) – Rotalocation

  • date_of_business (date) – Date of business

  • last_modified (timestamp with time zone) – Last modified

  • work_type (integer) – Work type

  • pay_rate_type (integer) – Pay rate type

  • base_cost (numeric(20, 6)) – Base cost

  • penalty_cost (numeric(20, 6)) – Penalty cost

  • holiday_accrual_cost (numeric(20, 6)) – Holiday accrual cost

  • overtime_cost (numeric(20, 6)) – Overtime cost

  • other_overhead_cost (numeric(20, 6)) – Other overhead cost

  • employer_taxes (numeric(20, 6)) – Employer taxes

  • pension (numeric(20, 6)) – Pension

  • num_mins (integer) – Num mins

  • num_mins_break_unpaid (integer) – Num mins break unpaid

  • num_mins_break_paid (integer) – Num mins break paid

  • num_mins_overtime (integer) – Num mins overtime

SummaryLaborByRole

class SummaryLaborByRole(*args, **kwargs)

SummaryLaborByRole represents the aggregation of daily shifts in a location, grouped by RotaRole, RotaLocation, and date_of_business.

It is calculated using the base Labor models, aggregating RotaShifts

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • rotalocation_id (bigint to RotaLocation) – Rotalocation

  • date_of_business (date) – Date of business

  • last_modified (timestamp with time zone) – Last modified

  • work_type (integer) – Work type

  • pay_rate_type (integer) – Pay rate type

  • base_cost (numeric(20, 6)) – Base cost

  • penalty_cost (numeric(20, 6)) – Penalty cost

  • holiday_accrual_cost (numeric(20, 6)) – Holiday accrual cost

  • overtime_cost (numeric(20, 6)) – Overtime cost

  • other_overhead_cost (numeric(20, 6)) – Other overhead cost

  • employer_taxes (numeric(20, 6)) – Employer taxes

  • pension (numeric(20, 6)) – Pension

  • num_mins (integer) – Num mins

  • num_mins_break_unpaid (integer) – Num mins break unpaid

  • num_mins_break_paid (integer) – Num mins break paid

  • num_mins_overtime (integer) – Num mins overtime

  • rotarole_id (bigint to RotaRole) – Rotarole

SummaryLaborByHousePart

class SummaryLaborByHousePart(*args, **kwargs)

SummaryLaborByHousePart represents the aggregation of daily shifts in a location, grouped by RotaHousePart, RotaLocation, and date_of_business.

It is calculated using the base Labor models, aggregating RotaShifts

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • rotalocation_id (bigint to RotaLocation) – Rotalocation

  • date_of_business (date) – Date of business

  • last_modified (timestamp with time zone) – Last modified

  • work_type (integer) – Work type

  • pay_rate_type (integer) – Pay rate type

  • base_cost (numeric(20, 6)) – Base cost

  • penalty_cost (numeric(20, 6)) – Penalty cost

  • holiday_accrual_cost (numeric(20, 6)) – Holiday accrual cost

  • overtime_cost (numeric(20, 6)) – Overtime cost

  • other_overhead_cost (numeric(20, 6)) – Other overhead cost

  • employer_taxes (numeric(20, 6)) – Employer taxes

  • pension (numeric(20, 6)) – Pension

  • num_mins (integer) – Num mins

  • num_mins_break_unpaid (integer) – Num mins break unpaid

  • num_mins_break_paid (integer) – Num mins break paid

  • num_mins_overtime (integer) – Num mins overtime

  • rotahousepart_id (bigint to RotaHousePart) – Rotahousepart

SummaryLaborByTimeOfDay

class SummaryLaborByTimeOfDay(*args, **kwargs)

SummaryLaborByTimeOfDay represents the aggregation of shifts in a location, grouped by RotaLocation, a fifteen_minute_period representing time of day, and date_of_business.

It is calculated using the base Labor models, aggregating RotaShifts

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • rotalocation_id (bigint to RotaLocation) – Rotalocation

  • date_of_business (date) – Date of business

  • last_modified (timestamp with time zone) – Last modified

  • work_type (integer) – Work type

  • pay_rate_type (integer) – Pay rate type

  • base_cost (numeric(20, 6)) – Base cost

  • penalty_cost (numeric(20, 6)) – Penalty cost

  • holiday_accrual_cost (numeric(20, 6)) – Holiday accrual cost

  • overtime_cost (numeric(20, 6)) – Overtime cost

  • other_overhead_cost (numeric(20, 6)) – Other overhead cost

  • employer_taxes (numeric(20, 6)) – Employer taxes

  • pension (numeric(20, 6)) – Pension

  • num_mins_break_unpaid (integer) – Num mins break unpaid

  • num_mins_break_paid (integer) – Num mins break paid

  • num_mins_overtime (integer) – Num mins overtime

  • fifteen_minute_period (integer) – An integer representing a fifteen-minute time period of the day, where 0 corresponds to 00:00, and 1 corresponds to 00:15, and so on

  • num_mins (numeric(20, 6)) – Num mins

SummaryLaborPlannedByDay

class SummaryLaborPlannedByDay(*args, **kwargs)

SummaryLaborPlannedByDay represents the aggregation of daily planned shifts in a location, grouped by RotaLocation, and date_of_business.

It is calculated using the base Labor models, aggregating RotaShiftPlanned

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • rotalocation_id (bigint to RotaLocation) – Rotalocation

  • date_of_business (date) – Date of business

  • last_modified (timestamp with time zone) – Last modified

  • work_type (integer) – Work type

  • pay_rate_type (integer) – Pay rate type

  • base_cost (numeric(20, 6)) – Base cost

  • penalty_cost (numeric(20, 6)) – Penalty cost

  • holiday_accrual_cost (numeric(20, 6)) – Holiday accrual cost

  • overtime_cost (numeric(20, 6)) – Overtime cost

  • other_overhead_cost (numeric(20, 6)) – Other overhead cost

  • employer_taxes (numeric(20, 6)) – Employer taxes

  • pension (numeric(20, 6)) – Pension

  • num_mins (integer) – Num mins

  • num_mins_break_unpaid (integer) – Num mins break unpaid

  • num_mins_break_paid (integer) – Num mins break paid

  • num_mins_overtime (integer) – Num mins overtime

SummaryLaborPlannedByRole

class SummaryLaborPlannedByRole(*args, **kwargs)

SummaryLaborPlannedByRole represents the aggregation of daily planned shifts in a location, grouped by RotaRole, RotaLocation, and date_of_business.

It is calculated using the base Labor models, aggregating RotaShiftPlanned

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • rotalocation_id (bigint to RotaLocation) – Rotalocation

  • date_of_business (date) – Date of business

  • last_modified (timestamp with time zone) – Last modified

  • work_type (integer) – Work type

  • pay_rate_type (integer) – Pay rate type

  • base_cost (numeric(20, 6)) – Base cost

  • penalty_cost (numeric(20, 6)) – Penalty cost

  • holiday_accrual_cost (numeric(20, 6)) – Holiday accrual cost

  • overtime_cost (numeric(20, 6)) – Overtime cost

  • other_overhead_cost (numeric(20, 6)) – Other overhead cost

  • employer_taxes (numeric(20, 6)) – Employer taxes

  • pension (numeric(20, 6)) – Pension

  • num_mins (integer) – Num mins

  • num_mins_break_unpaid (integer) – Num mins break unpaid

  • num_mins_break_paid (integer) – Num mins break paid

  • num_mins_overtime (integer) – Num mins overtime

  • rotarole_id (bigint to RotaRole) – Rotarole

SummaryLaborPlannedByHousePart

class SummaryLaborPlannedByHousePart(*args, **kwargs)

SummaryLaborPlannedByHousePart represents the aggregation of daily planned shifts in a location, grouped by RotaHousePart, RotaLocation, and date_of_business.

It is calculated using the base Labor models, aggregating RotaShiftPlanned

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • rotalocation_id (bigint to RotaLocation) – Rotalocation

  • date_of_business (date) – Date of business

  • last_modified (timestamp with time zone) – Last modified

  • work_type (integer) – Work type

  • pay_rate_type (integer) – Pay rate type

  • base_cost (numeric(20, 6)) – Base cost

  • penalty_cost (numeric(20, 6)) – Penalty cost

  • holiday_accrual_cost (numeric(20, 6)) – Holiday accrual cost

  • overtime_cost (numeric(20, 6)) – Overtime cost

  • other_overhead_cost (numeric(20, 6)) – Other overhead cost

  • employer_taxes (numeric(20, 6)) – Employer taxes

  • pension (numeric(20, 6)) – Pension

  • num_mins (integer) – Num mins

  • num_mins_break_unpaid (integer) – Num mins break unpaid

  • num_mins_break_paid (integer) – Num mins break paid

  • num_mins_overtime (integer) – Num mins overtime

  • rotahousepart_id (bigint to RotaHousePart) – Rotahousepart

SummaryLaborPlannedByTimeOfDay

class SummaryLaborPlannedByTimeOfDay(*args, **kwargs)

SummaryLaborPlannedByTimeOfDay represents the aggregation of planned shifts in a location, grouped by RotaLocation, a fifteen_minute_period representing time of day, and date_of_business.

It is calculated using the base Labor models, aggregating RotaShiftPlanned

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • rotalocation_id (bigint to RotaLocation) – Rotalocation

  • date_of_business (date) – Date of business

  • last_modified (timestamp with time zone) – Last modified

  • work_type (integer) – Work type

  • pay_rate_type (integer) – Pay rate type

  • base_cost (numeric(20, 6)) – Base cost

  • penalty_cost (numeric(20, 6)) – Penalty cost

  • holiday_accrual_cost (numeric(20, 6)) – Holiday accrual cost

  • overtime_cost (numeric(20, 6)) – Overtime cost

  • other_overhead_cost (numeric(20, 6)) – Other overhead cost

  • employer_taxes (numeric(20, 6)) – Employer taxes

  • pension (numeric(20, 6)) – Pension

  • num_mins_break_unpaid (integer) – Num mins break unpaid

  • num_mins_break_paid (integer) – Num mins break paid

  • num_mins_overtime (integer) – Num mins overtime

  • fifteen_minute_period (integer) – An integer representing a fifteen-minute time period of the day, where 0 corresponds to 00:00, and 1 corresponds to 00:15, and so on

  • num_mins (numeric(20, 6)) – Num mins

SummaryLaborPlannedByPlanDateByDay

class SummaryLaborPlannedByPlanDateByDay(*args, **kwargs)

SummaryLaborPlannedByPlanDateByDay represents the aggregation of daily planned shifts in a location, grouped by plan_day, RotaLocation, and date_of_business.

It is calculated using the base Labor models, aggregating RotaShiftPlanned.

This allows viewing how planned shifts change over time.

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • rotalocation_id (bigint to RotaLocation) – Rotalocation

  • date_of_business (date) – Date of business

  • last_modified (timestamp with time zone) – Last modified

  • work_type (integer) – Work type

  • pay_rate_type (integer) – Pay rate type

  • base_cost (numeric(20, 6)) – Base cost

  • penalty_cost (numeric(20, 6)) – Penalty cost

  • holiday_accrual_cost (numeric(20, 6)) – Holiday accrual cost

  • overtime_cost (numeric(20, 6)) – Overtime cost

  • other_overhead_cost (numeric(20, 6)) – Other overhead cost

  • employer_taxes (numeric(20, 6)) – Employer taxes

  • pension (numeric(20, 6)) – Pension

  • num_mins (integer) – Num mins

  • num_mins_break_unpaid (integer) – Num mins break unpaid

  • num_mins_break_paid (integer) – Num mins break paid

  • num_mins_overtime (integer) – Num mins overtime

  • plan_date (date) – Plan date

Inventory

Note

All inventory tables are prefixed with “inventory_”

_images/inventory.png

Categorical

INVLocation

class INVLocation(id, deleted_at, business_api_instance, local_id, app_location, name, last_modified, date_added, to_delete)
Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • business_api_instance_id (bigint to BusinessAPIInstance) – Business api instance

  • local_id (varchar(200)) – Local id

  • app_location_id (bigint to Location) – App location

  • name (varchar(200)) – Name

  • last_modified (timestamp with time zone) – Last modified

  • date_added (timestamp with time zone) – Date added

  • to_delete (boolean) – To delete

INVItem

class INVItem(*args, **kwargs)

Represents an INVItem (ingredient/item of stock)

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • business_api_instance_id (bigint to BusinessAPIInstance) – Business api instance

  • local_id (varchar(200)) – Local id

  • name (varchar(200)) – Name

  • category_id (bigint to INVCategory) – Category

  • last_modified (timestamp with time zone) – Last modified

  • date_added (timestamp with time zone) – Date added

INVCategory

class INVCategory(id, deleted_at, business_api_instance, local_id, name, parent_category, last_modified, date_added)
Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • business_api_instance_id (bigint to BusinessAPIInstance) – Business api instance

  • local_id (varchar(200)) – Local id

  • name (varchar(200)) – Name

  • parent_category_id (bigint to INVCategory) – Parent category

  • last_modified (timestamp with time zone) – Last modified

  • date_added (timestamp with time zone) – Date added

INVVendor

class INVVendor(id, deleted_at, business_api_instance, local_id, name, last_modified, date_added)
Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • business_api_instance_id (bigint to BusinessAPIInstance) – Business api instance

  • local_id (varchar(200)) – Local id

  • name (varchar(200)) – Name

  • last_modified (timestamp with time zone) – Last modified

  • date_added (timestamp with time zone) – Date added

Temporal

INVPurchase

class INVPurchase(*args, **kwargs)

Represents the purchase of an item

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • business_api_instance_id (bigint to BusinessAPIInstance) – Business api instance

  • local_id (varchar(200)) – Local id

  • invlocation_id (bigint to INVLocation) – Invlocation

  • item_id (bigint to INVItem) – Item

  • date_of_business (date) – Date of business

  • vendor_id (bigint to INVVendor) – Vendor

  • order_date (timestamp with time zone) – Order date

  • delivery_date (timestamp with time zone) – Delivery date

  • quantity (numeric(20, 2)) – Quantity

  • cost_no_tax (numeric(20, 2)) – Cost no tax

  • cost_with_tax (numeric(20, 2)) – Cost with tax

  • base_unit (varchar(100)) – Base unit

  • last_modified (timestamp with time zone) – Last modified

  • date_added (timestamp with time zone) – Date added

  • extra (jsonb) – Extra

INVUsage

class INVUsage(*args, **kwargs)

Represents the usage of an item.

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • business_api_instance_id (bigint to BusinessAPIInstance) – Business api instance

  • local_id (varchar(200)) – Local id

  • invlocation_id (bigint to INVLocation) – Invlocation

  • item_id (bigint to INVItem) – Item

  • date_of_business (date) – Date of business

  • usage_type (integer) – Usage type

  • quantity (numeric(20, 2)) – Quantity

  • cost_no_tax (numeric(20, 2)) – Cost no tax

  • cost_with_tax (numeric(20, 2)) – Cost with tax

  • last_modified (timestamp with time zone) – Last modified

  • date_added (timestamp with time zone) – Date added

  • extra (jsonb) – Extra

INVTransfer

class INVTransfer(*args, **kwargs)

Represents the transfer in (positive) or transfer out (negative) of an item

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • business_api_instance_id (bigint to BusinessAPIInstance) – Business api instance

  • local_id (varchar(200)) – Local id

  • invlocation_id (bigint to INVLocation) – Invlocation

  • item_id (bigint to INVItem) – Item

  • date_of_business (date) – Date of business

  • transferring_location_id (bigint to INVLocation) – Transferring location

  • transfer_type (integer) – Transfer type

  • quantity (numeric(20, 2)) – Quantity

  • cost_no_tax (numeric(20, 2)) – Cost no tax

  • cost_with_tax (numeric(20, 2)) – Cost with tax

  • last_modified (timestamp with time zone) – Last modified

  • date_added (timestamp with time zone) – Date added

  • extra (jsonb) – Extra

Social

Categorical

SocialLocation

class SocialLocation(id, deleted_at, business_api_instance, api, api_credentials, business, location, local_id, identifier, search_query, ignored, version, last_modified, date_added, to_delete)
Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • business_api_instance_id (bigint to BusinessAPIInstance) – Business api instance

  • api_id (integer to API) – Api

  • api_credentials_id (integer to APICredentials) – Api credentials

  • business_id (integer to Business) – Business

  • location_id (bigint to Location) – Location

  • local_id (varchar(300)) – Local id

  • identifier (varchar(300)) – Identifier

  • search_query (varchar(300)) – Search query

  • ignored (boolean) – Ignored

  • version (integer) – Version

  • last_modified (timestamp with time zone) – Last modified

  • date_added (timestamp with time zone) – Date added

  • to_delete (boolean) – To delete

Temporal

SocialReview

class SocialReview(id, deleted_at, sociallocation, instance_type, rating, local_id, source_id, language, author_name, author_url, linker_url, content_type, comment, text, has_replied, ignored, extra, date_added, review_datetime, review_created, last_modified)
Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • sociallocation_id (bigint to SocialLocation) – Sociallocation

  • instance_type (integer) – Instance type

  • rating (numeric(8, 5)) – Rating

  • local_id (varchar(200)) – Local id

  • source_id (varchar(200)) – Source id

  • language (varchar(10)) – Language

  • author_name (varchar(200)) – Author name

  • author_url (varchar(200)) – Author url

  • linker_url (varchar(200)) – Linker url

  • content_type (varchar(200)) – Content type

  • comment (varchar(1000)) – Comment

  • text (text) – Text

  • has_replied (boolean) – Has replied

  • ignored (boolean) – Ignored

  • extra (jsonb) – Extra

  • date_added (timestamp with time zone) – Date added

  • review_datetime (timestamp with time zone) – Review datetime

  • review_created (timestamp with time zone) – Review created

  • last_modified (timestamp with time zone) – Last modified

SocialSubRating

class SocialSubRating(id, deleted_at, local_id, social_review, rating, rating_type, text, extra, date_added, last_modified)
Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • local_id (varchar(200)) – Local id

  • social_review_id (bigint to SocialReview) – Social review

  • rating (numeric(7, 5)) – Rating

  • rating_type (text) – Rating type

  • text (text) – Text

  • extra (jsonb) – Extra

  • date_added (timestamp with time zone) – Date added

  • last_modified (timestamp with time zone) – Last modified

Reservations

Categorical

ResCustomer

class ResCustomer(*args, **kwargs)

This represents the end customer who will be coming into the location

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • business_api_instance_id (bigint to BusinessAPIInstance) – Business api instance

  • local_id (varchar(200)) – Local id

  • name (varchar(300)) – Name

  • date_added (timestamp with time zone) – Date added

  • last_modified (timestamp with time zone) – Last modified

Temporal

Reservation

class Reservation(*args, **kwargs)

This represents an individual reservation at a specific time for a certain number of people

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • apilocation_id (bigint to APILocation) – Apilocation

  • customer_id (bigint to ResCustomer) – Customer

  • revenue_center_id (bigint to ResRevenueCenter) – Revenue center

  • local_id (varchar(300)) – Local id

  • date_of_business (date) – Date of business

  • reservation_datetime (timestamp with time zone) – Reservation datetime

  • reservation_created (timestamp with time zone) – Reservation created

  • reservation_last_updated (timestamp with time zone) – Reservation last updated

  • num_guests (integer) – Num guests

  • status (integer) – Status

  • tags (text) – Can store any additional info about the reservation e.g., special requests etc.

  • extra (jsonb) – Extra

  • date_added (timestamp with time zone) – Date added

  • last_modified (timestamp with time zone) – Last modified

Footfall

Categorical

FootfallSubLocation

class FootfallSubLocation(*args, **kwargs)

This represents a subcomponent of a location e.g, bar, restaurant, terrace

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • apilocation_id (bigint to APILocation) – Apilocation

  • local_id (varchar(200)) – Local id

  • name (varchar(300)) – Name

  • date_added (timestamp with time zone) – Date added

  • last_modified (timestamp with time zone) – Last modified

Temporal

Footfall

class Footfall(*args, **kwargs)

This represents a foot fall event at a point in time, with the number of people present

Parameters:
  • id (bigint) – Id

  • deleted_at (timestamp with time zone) – Deleted at

  • apilocation_id (bigint to APILocation) – Apilocation

  • sublocation_id (bigint to FootfallSubLocation) – Sublocation

  • local_id (varchar(300)) – Local id

  • date_of_business (date) – Date of business

  • footfall_datetime (timestamp with time zone) – Footfall datetime

  • num_present (integer) – Num present

  • extra (jsonb) – Extra

  • date_added (timestamp with time zone) – Date added

  • last_modified (timestamp with time zone) – Last modified