hec.rating.rating_specification
Base exception for all rating exceptions
Holds the following information about ratings and rating sets;
- rating idendifier, comprised of
- location identifier
- template identifier
- independent parameters
- dependent parameter
- template version
- specification version
- source agency
- lookup methods for multiple effective dates in rating sets
- method for value times within the range of effective dates
- method for value times before the earliest effective date
- method for value times after the latest effective date
- rounding specifications
- one for each independent parameter
- one for the dependent parameter
- whether the specification is active (should be used)
- whether the ratings with this specification should be automatically updated from the source agency
- whether automatically updated ratings should be set to active
- whether automatically updated ratings should have any rating extension migrated to the new rating
- a description of the rating specification
Initializer for RatingSpecification objects
Arguments:
- name (str): The rating specification identifier
- location (Optional[Location], must be passed by name): A Location object for the specification. Defaults to None. If specified, the location name must match the location portion of the rating specification identifier
- template (Optional[RatingTemplate], must be passed by name): A RatingTemplate object for the specification. Defaults to None. If specified, the rating template identifier must match the template portion of the rating specification identifier.
- office (Optional[str], must be passed by name): The office for the rating specification. Defaults to None. If specified, overrides any office in the
locationandtemplateparameters. - agency (Optional[str], must be passed by name): The agency that generates the ratings for this specification. Defaults to None.
- lookup (Optional[list[str]], must be passed by value): Methods for time-based lookups using effective dates in rating sets with this specification.
Defaults to None. If specified, must be an array of three strings, in the following order
- method for value times within the range of effective dates
- method for value times before the earliest effective date
- method for value times after the latest effective date
If not specified, lookup methods of ['LINEAR', 'NEXT', 'PREVIOUS'] will be used.
- rounding (Optional[list[str]], must be passed by name): Rounding specifications. Defaults to None. If specified:
- must be the length of the number of independent parameters plus 1
- all but the last item are applied to the independent parameters in position order
- the last item is applied to the dependent parameter
- each item must be a valid rounding specification
If not specified, the rounding specification of 4444444449 is used for all parameters
- active (Optional[bool], must be passed by name): Whether ratings and rating sets using this specification are active (should be used). Defaults to True.
- auto_update (Optional[bool], must be passed by name): Whether ratings and rating sets using this specification are active (should be used). Defaults to False.
- auto_activate (Optional[bool], must be passed by name): Whether automatically updated ratings should be set to active. Defaults to False.
- auto_update_migration (Optional[bool], must be passed by name): Whether automatically updated ratings should have any rating extension migrated to the new rating. Defaults to False.
- description (Optional[str], must be passed by name): A description for the rating specification. Defaults to None.
Raises:
- ValueError: if the
nameparameter is not a properly-formed rating specification identifier - TypeError: if one of the named parameters has an unexpected type
- RatingSpecificationException: if one of the named parameters is inconsistent with the rating specification identifier
Whether ratings using this specification are active (should be used)
Operations:
Read/Write
The agency responsible for generating ratings using this specification
Operations:
Read/Write
Whether the ratings with this specification should be automatically updated from the source agency
Operations:
Read/Write
Whether automatically updated ratings should be set to active
Operations:
Read/Write
Whether automatically updated ratings should have any rating extension migrated to the new rating
Operations:
Read/Write
Generates a RatingSpecification object from an XML string representation
Arguments:
- xml (str): The XML string representation
Raises:
- RatingSpecificationException: if there is an error in the XML string
Returns:
RatingSpecification: The generated RatingSpecification object
Returns a formatted xml representation of the rating specification.
For unformatted xml use etree.tostring(<specification_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