Retrieve values across property items

Properly configuring the rating for a number of ISO rules requires the following functionality:

  • max_property_item_value
  • sum_property_item_value
  • exists_in_property_group

Examples of coverages requiring this functionality to properly rate:

  • Contractor Tools & Equipment Coverage
  • Money & Securities
  • Interruption of Computer Operations
  • Electronic Data
  • Water Back-up & Sump Overview

max_property_item_value

The max_property_item_value function allows you to retrieve the maximum limit, variable, or premium for a given item name across all properties within a policy or property group.

The max_property_item_value utility receives the following parameters:

  • item_name: Use to get the item’s name.
  • property_group_id: Optional; use to get the maximum value within only a given Property Group id.
  • attribute_name: Use to get the name of an attribute: limit, premium, or <variableName>.

    Note: The attribute_name defaults to premium.

  • filter_by_category: Optional; use to filter a dictionary containing category name and value.

    Example: {“Business Type”: “Contractors”}

max_property_item_value(
    "Money and Securities On-Premises",
    attribute_name="lossCost",
    property_group_id=this.property.property_group_id,
)

Figure 1: A max_property_item_value example.

sum_property_item_value

The sum_property_item_value function allows you to retrieve the sum of an item’s limit, variable, or premium for a given name across all properties within a policy or property group.

The sum_property_item_value utility receives the following parameters:

  • item_name: Use to get the item’s name.
  • property_group_id: Optional; use to get the maximum value within only a given Property Group id.
  • attribute_name: Use to get the name of an attribute: limit, premium, or <variableName>.

    Note: The attribute_name defaults to premium.

  • filter_by_category: Optional; use to filter a dictionary containing category name and value.

    Example: {“Business Type”: “Contractors”}

max(
    [
      sum_property_item_value(
            "Business Personal Property",
            attribute_name="limit",
            property_group_id=property_group.id,
            filter_by_category={"Business Type": "Contractors"},
        )
      for property_group in this.revision.property_groups
  ]
)

Figure 2: A sum_property_item_value example.

exists_in_property_group

The exists_in_property_group function allows you to discover whether or not an item is present within a property group.

The exists_in_property_group utility receives the item_name as a parameter and retrieves either True or False.

d('35') if exists_in_property_group("Business Personal Property") and this.limit == 5000
else
d('42') if this.limit == 5000
else
0

Figure 3: An exists_in_property_group example.