---
title: SAIF.Business.Policy.Rating architecture
summary: Architectural responsibilities, boundaries, and interaction patterns for the rating library.
status: draft
owner: Technical Writer
last_reviewed: 2026-07-31
library: SAIF.Business.Policy.Rating
reference_type: package
---

# SAIF.Business.Policy.Rating architecture

`SAIF.Business.Policy.Rating` turns published Oracle rating data into BOF business objects, factor providers, and shared helper logic. It is consumed by premium-calculation code but does not depend on `SAIF.Business.Policy.Premium` itself.

## Responsibilities
- Manage manual-class, rate-file, factor, discount, and rating-plan reference data.
- Compose base and adjusted rates from provider contracts and effective factor rows.
- Retrieve period-level rating context from WCIS and legacy policy-period sources.

## Component boundaries
- BOF business objects own retrieval, validation, and limited persistence behavior.
- Helper modules (`ClassRateExtensions`, `RateTierFactorExtensions`, `RatingPlanFactorExtensions`, `PrepayFrequencyExtensions`) centralize shared selection and composition logic.
- All data access flows through BOF criteria or direct portal requests; the library does not create ADO.NET connections directly.

## Interaction model
Callers use shared factory methods and criteria-driven retrieval to load manual classes, rate files, factors, discounts, and period context. The resulting objects then feed the extension-module rate engine, which composes a base rate and adjusted rate from the applicable factor set.

## Architecture diagram
The following diagram shows the library's position in the policy stack.

```mermaid
flowchart TD
  Premium[SAIF.Business.Policy.Premium] --> Rating[SAIF.Business.Policy.Rating]
  Rating --> Policy[SAIF.Business.Policy contracts and enums]
  Rating --> Core[SAIF.Framework.Core BOF base types]
  Rating --> Oracle[(Oracle rating tables)]
```

## Sequence diagram
The following diagram shows a representative class-rate lookup and computation flow.

```mermaid
sequenceDiagram
  participant Consumer
  participant Rating as SAIF.Business.Policy.Rating
  participant Portal as IDataPortalInfo
  participant Oracle
  Consumer->>Rating: GetManualClassBase / GetPeriodRatingInfo
  Rating->>Portal: Execute criteria SQL or stored procedure
  Portal->>Oracle: Retrieve filing, class, factor, or period rows
  Oracle-->>Portal: Result set / procedure outputs
  Portal-->>Rating: Hydrated BOF objects
  Consumer->>Rating: BaseRate / AdjustedRate
  Rating-->>Consumer: Computed rate
```

## Design constraints
- All retrieval and persistence flows through BOF `IBusinessCriteria` and portal request patterns.†
- `RateTierFactorExtensions.AppliesTo` can return `Nothing`, so careless callers could dereference a missing factor.**
- `clsManualClassParagraph.CreateSQL` contains the placeholder token `PARAGRAPH_NUM_NEXTVAL` instead of valid Oracle `NEXTVAL` syntax.
- `clsPrepayFrequencyCodeCollection.UpdateSQL` ends at a bare `Where` clause and is not executable as written.

## Related documentation
- [Index](index.md)
- [Overview](overview.md)
- [Dependencies](dependencies.md)
- [Operations and processes](operations-processes.md)
- [Business rules](business-rules.md)
- [Database tables](database-tables.md)
- [SQL catalog](sql/index.md)
- [API reference](api/index.md)

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts. Statements
> marked with ** could not be confirmed; treat as unknown until verified.

## Sources
- `Business\SAIF.Business.Policy.Rating\ClassRateExtensions.vb`
- `Business\SAIF.Business.Policy.Rating\clsManualClassBase.vb`
- `Business\SAIF.Business.Policy.Rating\clsManualClassParagraph.vb`
- `Business\SAIF.Business.Policy.Rating\clsPeriodRatingInfo.vb`
- `Business\SAIF.Business.Policy.Rating\clsPrepayFrequencyCollection.vb`
- `Business\SAIF.Business.Policy.Rating\clsRateFileMaster.vb`