---
title: IndexService
summary: API reference for IndexService.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-24
library: SAIF.Services
reference_type: package
---

# IndexService

Implements `IIndexService` to index an extracted e-billing batch's providers, patients, and bill service locations against internal claim/location data, then transition the batch to the `Indexed` status. It delegates the actual matching logic to the static `ProviderIndexer`, `PatientIndexer`, and `BillIndexer` helpers, persisting each step through its own `IUnitOfWork` transaction and recording indexing errors through `IErrorConditionHandler`.

## Purpose
- Indexes a batch's providers to internal locations (`IndexProviders`).
- Indexes a batch's patients to internal claims (`IndexPatients`).
- Indexes a batch's bill service providers to internal locations (`IndexBills`).
- Runs all three indexing steps for a batch and transitions it to `Indexed` status, returning the aggregated results (`IndexBatch`).

## Context
- Namespace: `SAIF.Services.Claims.EBilling`
- Assembly/package: `SAIF.Services` (packaged inside the `SAIF.SAIFCode.Core` NuGet package)

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| IndexService | `public IndexService(IUnitOfWork uow, IUserProfileService prof, IEbillingQueryProvider qu, IErrorConditionHandler err)` | Wires the unit-of-work, current-user resolver, e-billing query provider, and error-condition handler used to drive indexing. |
| IndexBatch | `public IndexResults IndexBatch(long batchId)` | Runs provider, patient, and bill indexing for the batch in sequence, then transitions the batch to `Indexed`, returning the combined `IndexResults`. |

## Behavioral notes
- Each indexing step (`IndexProviders`, `IndexPatients`, `IndexBills`) and the final status transition run in its own separate `IUnitOfWork.Begin()`/`Commit()` transaction rather than one transaction spanning the whole batch.
- Matching logic itself is implemented in the static `ProviderIndexer`/`PatientIndexer`/ `BillIndexer` helper types, not in this class; `IndexService` only sequences the calls and persists results.
- This type largely duplicates the indexing sequence found in `EbillingService.IndexBatch`, but uses the plain `ProviderIndexer`/`PatientIndexer`/`BillIndexer` helpers instead of the `*V2`/claim-API-aware variants (`ProviderIndexerV2`, claim-API-parameterized `PatientIndexer`) used there.*

> **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
- Services/SAIF.Services/Claims/EBilling/IndexService.cs
