Version:

Var Groups (Features)

Use var_groups to define features for your Profiles entities.

var_groups define and organize features for entities and cohorts, and they consist of input_vars and entity_vars.

You can var_groups in the profiles.yaml file:

var_groups:
    name: var_groups_name
    entity_key: entity_name
    vars:
        - input_var:
          <input-var-config>
        - entity_var:
          <entity-var-config>
KeyDescription
nameName of the var_groups.
entity_keyentity for the defined vars.
varsDefinition of input and entity vars.
input_varInput variable configuration.
entity_varEntity variable configuration.

Example

var_groups:
    name: user_var_group
    entity_key: user
    vars:
        - input_var:
          name: page_count
          select: count(distinct url)
          from: inputs/rsPages
          window:
            partition_by:
              - profile_id
              - date
          description: Add column to rsPages SQL model to get a page count per date
        - entity_var:
          name: web_dates_visited_365_days
          select: array_agg(distinct object_construct('date', date, 'page_count',{{pages_orderby_table.page_count}}))
          from: inputs/rsPages
          description: rolling 365 days array of json objects with the UTC timestamps the user visited the website along with the number of pages visited per date stamp
        - entity_var:
          name: first_order_date
          select: min(order_date)
          from: inputs/orders
          description: First order date
        - entity_var:
          name: last_order_date
          select: max(order_date)
          from: inputs/orders
          is_feature: false
        - entity_var:
          name: days_since_la`st_order
          select: "date_diff(CURRENT_DATE(), date({{user.last_order_date}}), day)"
          description: Days since user last completed an order

Questions? Contact us by email or on Slack