---
title: Adjustment code lookup
summary: Resolves audit adjustment type reference data, either a single code or the full active table, consumed by service adjustment and aggregate audit-description display.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-07-30
library: SAIF.Business.Claim.MedicalBill
reference_type: package
operation_id: OP-MB-05
trigger: clsAdjustmentCode.GetAdjustmentCode(code) for a single code, or clsAdjustmentCodeCollection.GetCodes() for the full reference table
---

# Adjustment code lookup

Adjustment code lookup reads the `CBP_AUDIT_ADJUSTMENT_TYPE` reference table directly (not through a stored procedure). It supports two access patterns: a single-code lookup used whenever a service adjustment needs to resolve its descriptive text, and a full-table lookup used to build reference lists (for example, the aggregate `AuditDescriptions` collections on a bill or bill collection).

| Field | Value |
| --- | --- |
| **Operation ID** | OP-MB-05 |
| **Trigger** | `clsAdjustmentCode.GetAdjustmentCode(dataportal, code)`; `clsAdjustmentCodeCollection.GetCodes(dataportal)` |
| **Inputs** | `code` (single lookup); none beyond the data-portal info (collection lookup) |
| **Outputs** | Populated `clsAdjustmentCode` (single) or `clsAdjustmentCodeCollection` (full reference table) |
| **Primary components** | `clsAdjustmentCode.GetAdjustmentCode`, `clsAdjustmentCode.BeforeRetrieve`, `clsAdjustmentCodeCollection.GetCodes`, `clsAdjustmentCodeCollection.BeforeRetrieve` |
| **Entry point** | `Business\SAIF.Business.Claim.MedicalBill\clsAdjustmentCode.vb`, `Business\SAIF.Business.Claim.MedicalBill\clsAdjustmentCodeCollection.vb` |

## Steps

1. **Single-code lookup.** `clsAdjustmentCode.GetAdjustmentCode(dpi, code)` issues a direct SQL retrieve against `CBP_AUDIT_ADJUSTMENT_TYPE` filtered to the requested code ([SQL-004](../sql/SQL-004.md), [CBP_AUDIT_ADJUSTMENT_TYPE](../database-tables.md#cbp_audit_adjustment_type)) and fills a single `clsAdjustmentCode` from the resulting reader row.
   - Callers most commonly reach this path through `clsServiceAdjustment.AdjustmentCodeObject`, documented as part of [Audit service and adjustment retrieval](audit-service-and-adjustment-retrieval.md).
2. **Full-table lookup.** `clsAdjustmentCodeCollection.GetCodes(dpi)` issues a direct SQL retrieve against the same table without a code filter ([SQL-005](../sql/SQL-005.md), [CBP_AUDIT_ADJUSTMENT_TYPE](../database-tables.md#cbp_audit_adjustment_type)) and loads one `clsAdjustmentCode` per row.
3. **Consumption by aggregate description views.** `clsMedicalBill.AuditDescriptions` and `clsMedicalBillCollection.AuditDescriptions` each build a deduplicated, `Code`-sorted `clsAdjustmentCodeCollection` by calling `AdjustmentCodeObject` (step 1) once per unique adjustment code encountered across a bill's (or collection's) audit services and adjustments — they do not call `GetCodes` (step 2) themselves.

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start([Caller needs adjustment code data]) --> Which{Single code or full table?}
	Which -->|Single code| SingleSql[Retrieve single row by code]
	Which -->|Full table| FullSql[Retrieve all reference rows]
	SingleSql --> SingleObj[Fill single clsAdjustmentCode]
	FullSql --> Collection[Load clsAdjustmentCodeCollection]
	SingleObj --> Done([Returned to caller])
	Collection --> Done
```

## Failure and edge-case behavior

- Both lookups are read-only direct-SQL retrievals; there is no persist/save path on either object.
- A single-code lookup for a code with no matching reference row returns an unfilled `clsAdjustmentCode`, so callers reading `Code`/description properties afterward would see empty values rather than an explicit error.*
- `AuditDescriptions` on the bill and bill-collection objects always uses the per-code lookup path, so it issues one retrieval per unique adjustment code rather than a single bulk retrieval, even though a bulk lookup (`GetCodes`) exists.*

## 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.

## Sources

- `Business\SAIF.Business.Claim.MedicalBill\clsAdjustmentCode.vb`
- `Business\SAIF.Business.Claim.MedicalBill\clsAdjustmentCodeCollection.vb`
