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

# DiagnosisService

Resolves an ICD diagnosis code entered in varying formats (with or without a decimal point, or with an "E" prefix) to a matching `CbpDiagnosis` record, trying multiple decimal-placement variants in order of most-common non-expired code shape until a match is found. It depends on `IUnitOfWork` to query the `CbpDiagnosis` repository and can optionally filter out diagnosis codes that have expired as of the current date.

## Purpose
- Normalizes free-form diagnosis code input (dotted, undotted, or E-code formats) into the stored code representation before lookup.
- Applies a fallback search order across decimal placements to find a matching diagnosis record when the exact input format doesn't match.
- Optionally excludes diagnosis codes whose `ExpirationDate` has passed, unless the caller explicitly requests expired codes.

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

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| DiagnosisService(uow) | `DiagnosisService(IUnitOfWork uow)` | Guards against a null `IUnitOfWork` and stores it for use by all lookup operations. |
| GetDiagnosis | `CbpDiagnosis GetDiagnosis(string diagnosisCode, bool includeExpired)` | Looks up a diagnosis by code, first trying the code as-supplied if it contains a decimal, then trying stripped/re-inserted decimal variants (with special handling for codes starting with "E"), returning the first match or `null` if none is found. |

## Behavioral notes
- E-prefixed codes are tried with the decimal inserted at position 3, then as a bare 3–4 character code, then with the decimal inserted at position 4, reflecting distinct ICD E-code formatting rules.*
- Non-E codes are tried with the decimal inserted at position 3 before falling back to the bare stripped code.*
- The lookup order was deliberately chosen to match the historically most common non-expired code shape for performance, per the inline comment referencing 02/22/2019.

## Constraints and usage notes
- When `includeExpired` is `false`, only diagnosis codes with a `null` `ExpirationDate` or an expiration date later than today are returned.
- Callers must supply a non-null `diagnosisCode`; the method calls `.Contains(".")` on it without a null check.

> **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/Bills/DiagnosisService.cs`
