---
title: Provider queries
summary: Query provider identity, relationship, address, location, and MCO-window data used across bill and claim workflows.
status: draft
owner: SAIF.Core documentation team
last_reviewed: 2026-09-24
library: SAIF.Data
reference_type: package
operation_id: OP-SD-21
trigger: Provider lookup or update requests.
---

# Provider queries

Query provider identity, relationship, address, location, and MCO-window data used across bill and claim workflows.

| Field | Value |
| --- | --- |
| **Operation ID** | OP-SD-21 |
| **Trigger** | Provider lookup or update requests. |
| **Inputs** | Provider id, bill id, MCO id |
| **Outputs** | Provider data, updated audit stamp, bool |
| **Primary components** | `ProviderQueryProvider` |
| **Entry point** | `Data/SAIF.Data/Queries/Providers/ProviderQueryProvider.cs` |

## Steps

1. Apply identity codes NPI/ONPI, relationship type WRK, and address types PAY/PHY/COR ([SD-BR-080](../business-rules.md#sd-br-080-provider-identity-relationship-and-address-code-sets), [SQL-200](../sql/SQL-200-provider-query-provider-get-provider-address-last-update-date.md), [SQL-201](../sql/SQL-201-provider-query-provider-get-all-active-provider-addresses-for-update-date.md), [SQL-202](../sql/SQL-202-provider-query-provider-get-provider.md), [SQL-203](../sql/SQL-203-provider-query-provider-get-provider-by-tax-id.md), [SQL-204](../sql/SQL-204-provider-query-provider-get-provider-by-tax-id.md), [SQL-205](../sql/SQL-205-provider-query-provider-get-location.md)). Data: `PROVIDER_IDENTITY`, `PROVIDER_RELATIONSHIP`, `PROVIDER_ADDRESS`.
2. The last-update user constant is "CMN0140" ([SD-BR-081](../business-rules.md#sd-br-081-provider-updates-stamped-with-a-fixed-audit-user)).
3. `GetBillProviderLocationIds` excludes bills with status "DIS" ([SD-BR-082](../business-rules.md#sd-br-082-dismissed-bills-excluded-from-provider-location-ids)).
4. `IsProviderInMco` checks the MCO provider date window ([SD-BR-083](../business-rules.md#sd-br-083-provider-in-mco-only-within-date-window)). Data: `MCO_PROVIDER`.
5. `GetActiveWorkingRelationshipsForProvider` ignores its `providerLocationId` parameter, a probable defect*.

## Process flow

The following diagram visualizes this operation's control flow.

```mermaid
flowchart TD
	Start([Provider lookup or update requests.]) --> S1["`ProviderQueryProvider`"]
	S1 --> S2{"Rules satisfied?"}
	S2 -->|Yes| EndOk([Result returned])
	S2 -->|No| EndErr([Exception / empty result])
```

## Failure and edge-case behavior
- Bill status "DIS": excluded from `GetBillProviderLocationIds` results.

## Related documentation
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [SQL catalog](../sql/index.md)
- [Database tables](../database-tables.md)


## Sources
- `Data/SAIF.Data/Queries/Providers/ProviderQueryProvider.cs`
- `Data/SAIF.Data/Queries/Providers/ProviderQueryProvider.cs:35`
- `Data/SAIF.Data/Queries/Providers/ProviderQueryProvider.cs:41`
- `Data/SAIF.Data/Queries/Providers/ProviderQueryProvider.cs:50`
