Writing your own line-specific rating engine subclass
The AbststractRatingEngine class is the parent class for all built-in line-specific rating engine classes. It serves two purposes.
- Defines a basic structure for rating that works for most lines
- Defines helper functions that could be useful across lines of business
The most important top-level method on AbstractRatingEngine is the rate method. The default rating
plugin calls this method. This method is responsible for rating and then
adjusting the Cost rows
appropriately. Do not modify this method, generally speaking. It converts
cost data objects to cost entity instances, adds them to the policy line,
and removes no-longer-used costs on that policy line.
The rate
method calls out to the rateOnly
method. It rates costs per slice, then merges and prorates, and then
finally rates window mode costs. That algorithm suffices for most lines
of business. However, other lines such as workers’ compensation and
inland marine override the rateOnly
method to work differently in built-in code. You could override rateOnly in a rating engine to
perform your own custom behavior. The rateOnly
method returns the list of CostData
objects, which the rate
method converts to Cost
rows to persist in the database.
For typical rating lines, your actual
formulas and table lookups would happen in the rateSlice and rateWindow methods. The rateSlice method must rate a PolicyLine viewed as a slice on
a specified slice date. The rateWindow
method must rate all the window-mode costs for the PolicyLine. If you write your
own rating engine subclass, writing your actual rating formulas in these
methods are your primary tasks.
For a typical rating integration project,
implementing your actual rating algorithm, typically in rateSlice and rateWindow, is the majority of
your engineering time.
In nearly all cases, it is best to use
AbstractRatingEngine as
the parent class for new rating engines. There is a parent class of AbstractRatingEngine, called AbstractRatingEngineBase. If the
normal paradigm of rating one line of business at a time does not mesh
well with the rating algorithm, the new base class allows this. For example,
to integrate with an external rating engine that rates all lines of the
package in a single call. Refer to AbstractRatingEngineBase
in Studio for details.
