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

# PatientIndexer

`PatientIndexer` matches an e-billing patient to a WCIS claim in ClaimCenter and validates the resulting claim state, implementing operation OP-DOM-02: it validates the claim number format, calls the Guidewire `ICCClaimApiService` to fetch the claim, compares worker and patient birth dates, sets the e-bill's `ClaimId`, and checks the indexed claim for void/draft status and non-complying-employer flags. All errors are reported through the supplied `IErrorConditionHandler` rather than thrown, except for a wrapping exception at the batch level.

## Purpose
- Validates that a patient's claim number is present and correctly formatted before attempting to index it, rejecting `"UNKNOWN"` and any number outside the 7–8 character rule ([DOM-BR-010](../../business-rules.md#dom-br-010-patient-indexing), [DOM-BR-011](../../business-rules.md#dom-br-011-patient-indexing)).
- Retrieves the claim from ClaimCenter and records specific error conditions for an API failure or a missing claim, so callers can distinguish "claim service unavailable" from "claim does not exist" ([DOM-BR-012](../../business-rules.md#dom-br-012-api-exception), [DOM-BR-013](../../business-rules.md#dom-br-013-null-claim)).
- Confirms the worker's and patient's birth dates match before setting the e-bill's `ClaimId`, and flags void/draft claim status and non-complying-employer claims once indexed ([DOM-BR-014](../../business-rules.md#dom-br-014-indexing), [DOM-BR-015](../../business-rules.md#dom-br-015-post-index-check), [DOM-BR-016](../../business-rules.md#dom-br-016-post-index-check)).

## Context
- Namespace: `SAIF.Domain.Claims.Ebilling.Indexing`
- Assembly/package: `SAIF.Domain` (`Domain/SAIF.Domain/SAIF.Domain.csproj`, .NET Framework 4.6.2 class library)

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| IndexPatientsToClaim | `public static ResultCount IndexPatientsToClaim(long batchId, IEbillingQueryProvider queryProvider, IErrorConditionHandler errorConditionHandler, string updateUser, ICCClaimApiService ccclaimApiService)` | Indexes every non-indexed patient on the batch to its claim, tallying successes/failures into a `ResultCount` and rethrowing any per-patient exception with the patient id attached. |
| IndexPatientToClaim | `public static bool IndexPatientToClaim(EbillPatient patient, IEbillingQueryProvider queryProvider, IErrorConditionHandler errorConditionHandler, string updateUser, ICCClaimApiService ccclaimApiService)` | Validates the patient's claim number, fetches the claim from ClaimCenter, confirms the birth dates match, sets `ClaimId`, and delegates to `CheckIndexedPatientForClaimErrors` for post-index validation ([DOM-BR-010](../../business-rules.md#dom-br-010-patient-indexing)–[DOM-BR-014](../../business-rules.md#dom-br-014-indexing)). |
| CheckIndexedPatientForClaimErrors | `public static bool CheckIndexedPatientForClaimErrors(EbillPatient patient, InjuryClaim claim, IErrorConditionHandler errorConditionHandler)` | Flags an indexed claim as an error when its WCD status is void, its claim state is draft, or it is a non-complying-employer claim, recording each condition independently ([DOM-BR-015](../../business-rules.md#dom-br-015-post-index-check), [DOM-BR-016](../../business-rules.md#dom-br-016-post-index-check)). |

## Behavioral notes
- The ClaimCenter lookup calls `ICCClaimApiService.GetClaim` synchronously via `GetAwaiter().GetResult()`, so a slow or failing call blocks the indexing loop for that patient*.
- `IndexPatientToClaim` returns `false` on every validation failure rather than throwing, so callers must check the return value (and the error condition recorded by `IErrorConditionHandler`) to detect a failed match.

> **Note:** Statements marked with `*` were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts.

## Sources
- `Domain/SAIF.Domain/Claims/Ebilling/Indexing/PatientIndexer.cs`
