Tables driving rating cost algorithm definition
The rating engine calculates the rest of the costs with an algorithm driven by tables. The basic approach is to read the set of steps required by state and date from a system table (WC_Rating_Steps.xml). The steps have a strict order.
The user interface needs to know to display certain price subtotals after certain steps. There are a couple of times where you need to get to a certain stage of the calculation across all states and rating periods. For example, getting a subtotal of premiums policy-wide prior to determine the premium discount percentage.
You can think about this like certain
step numbers are synchronization points in a process that is otherwise
a parallel calculation by state and rating period. For each combination
of state and rating period, each calculation pauses at that step number
to perform some calculation across the full policy period. If you are
interested in the details, refer to the WCRatingEngine method called rateJurisdictionCosts.
For worker’s compensation rating steps, PolicyCenter sets up a double loop over state and rating period. It checks whether there are any days to rate within the rating period. This is because PolicyCenter may be rating only a premium report for 1 month, so it can skip any rating period that does not overlap with that 1 month.
The rateJurisdictionCosts
method calls the processWCRatingSteps
method, which sets up the loop across state and jurisdiction. Within
the loop, it calls the processWCRatingStepsByPeriod
method. That method looks up data from the configuration table and then
iterates across each step. It uses a switch
statement that calls code that knows how to handle each type of step.
It defines a number of different types of steps that the engine can use.
Many of the calculations that the worker’s compensation rating algorithm
requires can use a generic handler. For example, calculating a subtotal
or applying a modifier. However, some of the most important calculations
require specific handlers, such as determining the expense constant or
minimum premium.
In workers’ compensation, there are standard subtotals that the rating engine uses in later steps. For example, manual premium, modified premium (after applying the experience modification), and so on. The table defines when to calculate each standard subtotal and then which subtotal to use in subsequent calculations.
The most complex code is what happens at synchronization points, particularly for the premium discount. The basic idea is to determine the total standard premium policy wide. Next, use that number to determine the discount percent based on the rules for each state and (rating period start) date independently.
For a premium report, in which you only rate a portion of the period, the rating engine uses the discount percent previously calculated, for example during submission or renewal. The rating engine does not recalculate the discount percent during the premium report because the calculation only makes sense when rating the entire period.
