---
title: Provider type reference data
summary: Retrieves a single provider type code or the full provider type reference-data catalog; both paths are structurally read-only, rejecting any create, insert, update, or delete SQL access.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-07-30
library: SAIF.Business.View.Provider
reference_type: package
operation_id: OP-VP-07
trigger: Caller reads clsProviderLocation.ProviderType, or calls clsProviderType.GetProviderType(dpi, code) / clsProviderTypeCollection.GetProviderTypeCollection(dpi) directly
---

# Provider type reference data

Provider type reference data reads `PROVIDER_TYPE_CODE`, either a single code record or the full ordered catalog. Both criteria classes explicitly throw on every SQL accessor except `RetrieveSQL` ([BR-001](../business-rules.md#br-001-provider-type-read-only-criteria)), making this operation a read-only reference-data lookup rather than a maintainable business object, despite inheriting the standard `clsBusinessBase`/`IBusinessCriteria` pattern used by mutable entities elsewhere in this library.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-VP-07 |
| **Trigger** | `clsProviderType.GetProviderType(inDataportal, inCode)` — invoked directly or via `clsProviderLocation.ProviderType`; `clsProviderTypeCollection.GetProviderTypeCollection(inDataportal)` |
| **Inputs** | Provider type code (String, 5 characters); or none, for the full collection |
| **Outputs** | A populated `clsProviderType` (claim-profile, diagnosis-required, mandatory-MCO, medical-audit, self-registration, and service-provider-restricted flags, plus DCBS type code and description); or a full `clsProviderTypeCollection` ordered by description |
| **Primary components** | `clsProviderType.GetProviderType`, `clsProviderType.Criteria`, `clsProviderTypeCollection.GetProviderTypeCollection`, `clsProviderTypeCollection.Criteria` |
| **Entry point** | `Business\SAIF.Business.View.Provider\clsProviderType.vb` |

## Steps

1. **Request a single type by code.** `GetProviderType` builds a criteria carrying the code and retrieves through the standard data-portal path.
2. **Bind the code parameter.** `BeforeRetrieve` binds `:Code` (max length 5) and executes the retrieve SQL against `PROVIDER_TYPE_CODE` ([SQL-019](../sql/SQL-019-saif-business-view-provider.md), [PROVIDER_TYPE_CODE](../database-tables.md#provider_type_code)) ([BR-001](../business-rules.md#br-001-provider-type-read-only-criteria)).
3. **Read the single row.** `AfterRetrieve` reads at most one row, fills all flag and descriptive fields plus update info, and marks the object old only when a row was found.
4. **Request the full catalog.** `GetProviderTypeCollection` builds a criteria with no filter parameter.
5. **Execute the unfiltered, ordered query.** The collection criteria's `RetrieveSQL` selects every `PROVIDER_TYPE_CODE` row with no `WHERE` clause, ordered by `CODE_DESCR` ([SQL-020](../sql/SQL-020-saif-business-view-provider.md), [PROVIDER_TYPE_CODE](../database-tables.md#provider_type_code)) ([BR-001](../business-rules.md#br-001-provider-type-read-only-criteria)).
6. **Populate the collection.** `AfterRetrieve` iterates the result set, constructs a `clsProviderType` per row, calls `Load`, and adds each to the collection.
7. **Reject any attempted mutation.** Both criteria classes' `CreateSQL`, `DeleteSQL`, `InsertSQL`, and `UpdateSQL` properties throw `ApplicationException(clsConstants.Messages.InvalidSQLProperty)` unconditionally when read, so any code path that tries to save a `clsProviderType` or `clsProviderTypeCollection` fails immediately at the criteria level before any database call is attempted ([BR-001](../business-rules.md#br-001-provider-type-read-only-criteria)).

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start([Provider type requested]) --> Which{Single or collection?}
	Which -->|Single, by code| Single[Bind Code parameter]
	Which -->|Full collection| Coll[No filter parameter]
	Single --> Exec1[Execute retrieve query]
	Exec1 --> Row{Row found?}
	Row -->|Yes| Fill1[Fill type; MarkOld]
	Row -->|No| Empty1([Object left in default state])
	Coll --> Exec2[Execute unfiltered ordered query]
	Exec2 --> Loop[For each row: create clsProviderType,<br>Load, add to collection]
	Loop --> Done([Populated collection returned])
	Fill1 --> Save{Save attempted?}
	Done --> Save
	Save -->|Yes| Throw([ApplicationException thrown<br>before any database call])
```

## Failure and edge-case behavior

- A single-code lookup that matches no row leaves the object in its default (empty) state with no exception raised — only an attempted save throws, not a missed retrieve.
- A save attempt on either the single object or the collection throws immediately from the criteria property getter, before any SQL is built or executed, so the failure is deterministic and occurs entirely in-process ([BR-001](../business-rules.md#br-001-provider-type-read-only-criteria)).
- The full-collection query has no filter and no pagination, so the entire `PROVIDER_TYPE_CODE` table is returned on every call; this is acceptable for small, largely static reference-data tables but would not scale to a large code table.*

## 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.View.Provider\clsProviderType.vb`
- `Business\SAIF.Business.View.Provider\clsProviderTypeCollection.vb`
