---
title: Loss category and offset maintenance
summary: Creates, retrieves, updates, and deletes US_LOSS_CATEGORY rows and their child US_LOSS_CATEGORY_OFFSET rows, including offset-type code lookup.
status: draft
owner: SAIF
last_reviewed: 2026-07-30
library: SAIF.Business.UnitStat.Claim
reference_type: package
operation_id: OP-USC-04
trigger: Caller invokes clsLossCategory.NewLossCategory / GetLossCategory or clsLossCategoryOffset.NewLossCategoryOffset / GetLossCategoryOffset, then Save() or Delete()
---

# Loss category and offset maintenance

Each loss summary breaks its totals down into categories (`clsLossCategory`, e.g. medical vs. indemnity, or a `SETL` settlement category), and each category can carry one or more offset rows (`clsLossCategoryOffset`) that adjust the category's reported amount — for example, a third-party-prediction (`TPN`) offset used by the settlement floor described in [Loss summary maintenance](loss-summary-maintenance.md). `clsOffsetTypeCode` is a small lookup class used to validate/describe offset type codes such as `TPN`.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-USC-04 |
| **Trigger** | `NewLossCategory` / `GetLossCategory` and `NewLossCategoryOffset` / `GetLossCategoryOffset`, followed by `Save()` or `Delete()`; offset-type lookups via `clsOffsetTypeCode.GetOffsetTypeCode` |
| **Inputs** | `ClaimID`, `LossCategoryCode` (parent key), `OffsetTypeCode` (child key) |
| **Outputs** | Persisted or retrieved `US_LOSS_CATEGORY` and `US_LOSS_CATEGORY_OFFSET` rows |
| **Primary components** | `clsLossCategory`, `clsLossCategoryOffset`, `clsOffsetTypeCode` |
| **Entry point** | `Business\SAIF.Business.UnitStat.Claim\Loss Summary\clsLossCategory.vb`, `Business\SAIF.Business.UnitStat.Claim\Loss Summary\clsLossCategoryOffset.vb` |

## Steps

1. **Create category.** `NewLossCategory` builds a `Criteria` with the parent claim ID and category code; `BeforeInsert` binds these plus standard audit columns and executes ([SQL-004](../sql/sql-004-insert.md), [US_LOSS_CATEGORY](../database-tables.md#us_loss_category)):
   ```sql
   INSERT INTO us_loss_category (claim_id, loss_category_code, ..., update_num, update_date, update_user)
   VALUES (:ClaimID, :LossCategoryCode, ..., :UpdateNum, :UpdateDate, :UpdateUser)
   ```
2. **Retrieve / update / delete category.** Standard CRUD pattern against [US_LOSS_CATEGORY](../database-tables.md#us_loss_category): update executes [SQL-019](../sql/sql-019-update.md), delete executes [SQL-024](../sql/sql-024-delete.md). `AfterRetrieve` also loads the category's child `LossCategoryOffsets` collection.
3. **Create offset.** `NewLossCategoryOffset` builds a `Criteria` with the parent claim ID, category code, and offset type code; `BeforeInsert` executes ([SQL-005](../sql/sql-005-insert.md), [US_LOSS_CATEGORY_OFFSET](../database-tables.md#us_loss_category_offset)):
   ```sql
   INSERT INTO us_loss_category_offset (claim_id, loss_category_code, offset_type_code, offset_amount, ..., update_num, update_date, update_user)
   VALUES (:ClaimID, :LossCategoryCode, :OffsetTypeCode, :OffsetAmount, ..., :UpdateNum, :UpdateDate, :UpdateUser)
   ```
4. **Retrieve / update / delete offset.** Standard CRUD pattern against [US_LOSS_CATEGORY_OFFSET](../database-tables.md#us_loss_category_offset): update executes [SQL-020](../sql/sql-020-update.md), delete executes [SQL-025](../sql/sql-025-delete.md).
5. **Offset-type code lookup.** `clsOffsetTypeCode.GetOffsetTypeCode(dpi, code)` retrieves a single lookup row describing an offset type (such as `TPN`) from the `US_OFFSET_TYPE_CODE` table. This table is not yet cataloged in [Database tables](../database-tables.md), and no numbered SQL statement is indexed for this lookup in the SQL catalog, so it is referenced here by name only, without a link.**
6. **Consumption by loss-summary totals.** The [Loss summary maintenance](loss-summary-maintenance.md) operation reads `LossCategories` and their child `LossCategoryOffsets` to compute derived totals and the settlement/third-party-prediction floor — this operation only owns the persistence of the category/offset rows themselves, not the aggregation logic.

## Process flow

```mermaid
flowchart TD
	Start([Caller requests category or offset operation]) --> Which{Category or offset?}
	Which -->|Category| CatCRUD{Create, retrieve,<br>update, or delete?}
	CatCRUD -->|Create| CatInsert[Insert US_LOSS_CATEGORY row]
	CatCRUD -->|Retrieve| CatRetrieve[Select category, then load child offsets]
	CatCRUD -->|Update| CatUpdate[Update US_LOSS_CATEGORY row]
	CatCRUD -->|Delete| CatDelete[Delete US_LOSS_CATEGORY row]
	Which -->|Offset| OffCRUD{Create, retrieve,<br>update, or delete?}
	OffCRUD -->|Create| OffInsert[Insert US_LOSS_CATEGORY_OFFSET row]
	OffCRUD -->|Retrieve| OffRetrieve[Select offset row]
	OffCRUD -->|Update| OffUpdate[Update US_LOSS_CATEGORY_OFFSET row]
	OffCRUD -->|Delete| OffDelete[Delete US_LOSS_CATEGORY_OFFSET row]
	Which -->|Lookup| Lookup[Retrieve US_OFFSET_TYPE_CODE row by code]
```

## Failure and edge-case behavior
- As with the other CRUD-style objects in this library, a rows-affected value other than `1` on insert, update, or delete adds an error/broken-rule entry rather than throwing an exception.*
- `US_OFFSET_TYPE_CODE` is uncataloged in [Database tables](../database-tables.md) and its retrieval SQL is not indexed in the [SQL catalog](../sql/index.md); this is a documentation gap in the prior catalog pass rather than evidence the lookup is unused — `clsLossSummary`'s floor calculation depends on `OffsetTypeCode` values such as `TPN` being correctly categorized.**
- No property-level `AddBusinessRules()` validation beyond standard framework checks was found on either `clsLossCategory` or `clsLossCategoryOffset` during tracing.*

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [SQL catalog](../sql/index.md)
- [Database tables](../database-tables.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.UnitStat.Claim\Loss Summary\clsLossCategory.vb`
- `Business\SAIF.Business.UnitStat.Claim\Loss Summary\clsLossCategoryOffset.vb`
- `Business\SAIF.Business.UnitStat.Claim\Loss Summary\clsOffsetTypeCode.vb`
