Distance From First

Prev Next

Find The: Distance From First Image

distance_from_first

The distance from the location of the current event to the location of the earliest event matching the criteria.

For example:

  • Distance of a shipping address from the user's first order.
  • Distance of a device from account registration, useful in account sharing and restriction use cases.

Image

Configuration

  • Feature Name: The "dictionary" name under which the feature value will be stored and referenced by in rules.
  • Coordinate Attribute: The attribute holding the location. It must have the Coordinate data type; anything else is rejected at build time.
  • In Units: kilometers or miles. Required.
  • For Events:
    • With The Same: Provides a way of filtering past events based on the attribute values. There must be at least one Identifier and only Identifier and Subject attributes can be used.

Optional Configuration

  • Default Value: A value that can be assigned to the feature if the attributes to calculate the features are not present.
  • Scope: Can be used to extend the event search from the local node, to all nodes within the same organization all the way to all across customers (global).
  • For Events:
    • All event types: Default, no filter
    • Same as current: Filter by event_type of event being processed
    • Specific event type: List out the event_type to restrict to, as a list. Example: only consider account_login_success.
  • Condition: A Query-Language filter that can be used to refine Features for specific use cases.
  • Time Window: Can be used to limit the Feature calculation to a specific time period/window. e.g 1 week. Default is all ; no time window
  • Starting: Can be used to remove recent events from Feature calculation. Default is immediately ; no lag.

Use Case 1

Calculate the current distance of the device from account signup, in miles.

Implementing In The Feature Editor

image.png

image.png

image.png

  - name: device_dist_from_register_mi
    default_value: null
    time_window: all
    starting: immediately
    find_the:
      distance_from_first:
        events:
          event_type:
            - account_creation
          include_current_event: false
          with_the_same:
            - identity['ACCOUNT'].customer_token.customer_token
        coordinate: profiling.tcp_connection['WEBRTC'].ipdb.coordinate
        in_units: miles
    with_scope: same_node_instance