hec.rating.rating_template

class RatingTemplateException(hec.shared.RatingException):

Exception for rating templates

DEFAULT_IN_RANGE_METHOD = <LookupMethod.LINEAR: (3, 'Linear interpolation or extrapolation of independent and dependent values')>
DEFAULT_OUT_RANGE_LOW_METHOD = <LookupMethod.NEXT: (8, 'Return the value that is higher in position')>
DEFAULT_OUT_RANGE_HIGH_METHOD = <LookupMethod.PREVIOUS: (7, 'Return the value that is lower in position')>
class RatingTemplate:

Holds independent and dependent parameter names, independent parameter lookup methods, and version string for all associated ratings.

Ratings are associated by using a rating identifier that includes the template identifier.

RatingTemplate(name: str, **kwargs: Any)

Initializes the RatingTemplate object

Arguments:
  • name (str): The rating template identifier
  • lookup_methods (Optional[ tuple[LookupMethod, LookupMethod, LookupMethod] ]): _description_. Defaults to None.
Raises:
  • ValueError: _description_
def copy(self) -> RatingTemplate:

Returns a copy of the rating template

Returns:

RatingTemplate: The copy

dep_param: str

The depdendent parameter

Operations:

Read/Write

description: Optional[str]

The rating template description

Operations:

Read/Write

@staticmethod
def from_xml(xml: str) -> RatingTemplate:

Generates a RatingTemplate object from an XML string representation

Arguments:
  • xml (str): The XML string representation
Raises:
  • RatingTemplateException: if there is an error in the XML string
Returns:

RatingTemplate: The generated RatingTemplate object

ind_param_count: int

The number of independent parameters

Operations:

Read-Only

ind_params: list[str]

The indepdendent parameters as a list of strings

Operations:

Read-Only

lookup: list[list[str]]

The rating independent parameter lookup behaviors in in-range, out-range-low, out-range-high order as a list of lists of strings (one list for each independent parameter)

Operations:

Read/Write

name: str

The rating template identifier

Operations:

Read-Only

office: Optional[str]

The rating template office

Operations:

Read/Write

def to_xml(self, indent: str = ' ', prepend: Optional[str] = None) -> str:

Returns a formatted xml representation of the rating template.

For unformatted xml use etree.tostring(<template_obj>.xml_element)

Arguments:
  • indent (str, optional): The string to use for each level of indentation. Defaults to " ".
  • prepend (Optional[str], optional): A string to prepend to each line. Defaults to None.
Returns:

str: The formatted xml

version: str

The rating template version

Operations:

Read/Write

xml_element: lxml.etree._Element

The rating template as an lxml.etree.Element object

Operations:

Read-Only

class RatingTemplate.IndParameter:

Associates lookup methods with an independent parameter for a RatingTemplate object

RatingTemplate.IndParameter( name: str, lookup_methods: Optional[tuple[hec.rating.LookupMethod, hec.rating.LookupMethod, hec.rating.LookupMethod]] = None)

Initializes the IndParameter object

Arguments:
  • name (str): The associated independent parameter name
  • lookup_methods (Optional[ tuple[ LookupMethod, LookupMethod, LookupMethod ] ]): The lookup methods associated with the independent parameter. Defaults to None. If specified, the lookup methods are in the order of in-range, out-of-range-low, out-of-range-high. If not specified, the default methods of [ LINEAR, NEXT, PREVIOUS ] are used.
Raises:
  • ValueError: if the name is not a valid Parameter name
name: str

The independent parameter name

Operations:

Read-Only

in_range_method: str

The in-range lookup behavior for the independent parameter

Operations:

Read-Only

out_range_low_method: str

The out-of-range-low lookup behavior for the independent parameter

Operations:

Read-Only

out_range_high_method: str

The out-of-range-low lookup behavior for the independent parameter

Operations:

Read-Only