---
title: AuditQueryProvider
summary: API reference for AuditQueryProvider.
status: draft
owner: SAIF.Core documentation team
last_reviewed: 2026-09-24
library: SAIF.Data
reference_type: package
---

# AuditQueryProvider

Query provider exposing 9 data-access operation(s) (`GetAdjustmentType`, `GetAudit`, `GetAuditForBill`, `GetNationalDrugCode`, `GetNonDuplicateServiceCount`, `GetOriginalBills` and 3 more) against 8 distinct table(s); see [sql/index.md](../../sql/index.md) for the full ORM operation catalog.

## Purpose
- Provides read/write access to 8 table(s) via NHibernate `IQueryable<T>`/`GetRepository<T>()` calls documented in [sql/index.md](../../sql/index.md).
- Exposes 9 public query/command method(s) consumed by higher application layers; see [database-tables.md](../../database-tables.md) for the underlying schema.

## Context
- Namespace: `SAIF.Data.Queries.Claims`
- Assembly/package: `SAIF.Data`

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| BillId | `long BillId { get; set; }` | Foreign-key identifier referencing the related bill record.* |
| OriginalBillId | `long? OriginalBillId { get; set; }` | Foreign-key identifier referencing the related original bill record.* |
| GetAudit | `CbpAudit GetAudit(long auditId)` | Executes an ORM query ([SQL-013](../../sql/SQL-013-audit-query-provider-get-audit.md)) against [CBP_AUDIT](../../database-tables.md#cbp_audit), [CBP_BILL](../../database-tables.md#cbp_bill). |
| GetAuditForBill | `CbpAudit GetAuditForBill(long billId)` | Executes an ORM query ([SQL-014](../../sql/SQL-014-audit-query-provider-get-audit-for-bill.md)) against [CBP_AUDIT](../../database-tables.md#cbp_audit), [CBP_BILL](../../database-tables.md#cbp_bill). |
| GetNationalDrugCode | `CbpNationalDrug GetNationalDrugCode(string code)` | Executes an ORM query ([SQL-015](../../sql/SQL-015-audit-query-provider-get-national-drug-code.md)) against [CBP_NATIONAL_DRUG](../../database-tables.md#cbp_national_drug). |
| IsNurseReviewRequired | `bool IsNurseReviewRequired(long billId)` | Executes an ORM query ([SQL-016](../../sql/SQL-016-audit-query-provider-is-nurse-review-required.md)) against [CBP_SERVICE_CODE](../../database-tables.md#cbp_service_code). |
| GetNonDuplicateServiceCount | `int GetNonDuplicateServiceCount(long billId)` | Executes an ORM query ([SQL-018](../../sql/SQL-018-audit-query-provider-get-non-duplicate-service-count.md)) against [CBP_AUDITED_SERVICE](../../database-tables.md#cbp_audited_service), [CBP_AUDIT](../../database-tables.md#cbp_audit), [CBP_BILL](../../database-tables.md#cbp_bill), [CBP_ORIGINAL_BILL_CODE](../../database-tables.md#cbp_original_bill_code). |
| GetServices | `IEnumerable<CbpAuditedService> GetServices(long claimId, long billIdToExclude, DateTime fromDate, DateTime thruDate)` | Executes an ORM query ([SQL-019](../../sql/SQL-019-audit-query-provider-get-services.md)) against [CBP_AUDITED_SERVICE](../../database-tables.md#cbp_audited_service), [CBP_AUDIT](../../database-tables.md#cbp_audit), [CBP_BILL](../../database-tables.md#cbp_bill). |
| GetOriginalBills | `IEnumerable<long> GetOriginalBills(long billId)` | Executes an ORM query ([SQL-020](../../sql/SQL-020-audit-query-provider-get-original-bills.md)) against [CBP_AUDITED_SERVICE](../../database-tables.md#cbp_audited_service), [CBP_AUDIT](../../database-tables.md#cbp_audit), [CBP_BILL](../../database-tables.md#cbp_bill). |
| GetPhysicalMedicineCount | `int GetPhysicalMedicineCount(long claimId)` | Executes an ORM query ([SQL-021](../../sql/SQL-021-audit-query-provider-get-physical-medicine-count.md)) against [CBP_AUDITED_SERVICE](../../database-tables.md#cbp_audited_service), [CBP_BILL](../../database-tables.md#cbp_bill). |
| GetAdjustmentType | `CbpAuditAdjustmentType GetAdjustmentType(string code)` | Executes an ORM query ([SQL-023](../../sql/SQL-023-audit-query-provider-get-adjustment-type.md)) against [CBP_AUDIT_ADJUSTMENT_TYPE](../../database-tables.md#cbp_audit_adjustment_type). |
| AuditQueryProvider(IRepositoryFactory factory, IProviderQueryProvider providerQueryProvider, IServiceCodeQueryProvider serviceCodeQueryProvider, IAuditNoteQueryProvider auditNoteQueryProvider, IClaimPaymentQueryProvider claimPaymentQueryProvider) | `AuditQueryProvider(IRepositoryFactory factory, IProviderQueryProvider providerQueryProvider, IServiceCodeQueryProvider serviceCodeQueryProvider, IAuditNoteQueryProvider auditNoteQueryProvider, IClaimPaymentQueryProvider claimPaymentQueryProvider)` | Initializes a new instance, wiring the repository factory used by this provider's query methods.* |

## Behavioral notes
- Query methods build LINQ expressions over `IQueryable<T>` obtained via `Factory.GetRepository<T>()` and execute them against the underlying NHibernate session.*

## Constraints and usage notes
- Instances are constructed with an `IRepositoryFactory` and are expected to be resolved through dependency injection rather than instantiated directly.*

> **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
- `Data/SAIF.Data/Queries/AuditQueryProvider.cs`
