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

# BillDiagnosisValidator

Validates a `BillDiagnosis` entry, requiring a diagnosis code and, when a diagnosis type is present, checking that its code is one of a fixed set of valid single-character codes (`A`, `P`, `O`, `E`, `R`) representing diagnosis classification categories. It has no external dependencies and performs all checks against a hard-coded in-memory list rather than a database lookup, with a code comment noting that database-backed validation was considered but not implemented.*

## Purpose
- Requires `DiagnosisCode` to be non-null and non-empty.
- Requires `DiagnosisType` to be non-null, and when present, requires `DiagnosisType.Code` to be non-null/non-empty and to match one of the allowed codes `A`, `P`, `O`, `E`, `R`.

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

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| BillDiagnosisValidator | `BillDiagnosisValidator()` | Wires required/non-empty rules for `DiagnosisCode` and `DiagnosisType`, plus a conditional `Must` check restricting `DiagnosisType.Code` to a fixed allow-list of diagnosis category codes.* |

## Behavioral notes
- Validation is enforced via FluentValidation's `AbstractValidator<T>` base.*
- The `DiagnosisType.Code` allow-list rules only run inside a `When(x => x.DiagnosisType != null, ...)` block, so they are skipped entirely if `DiagnosisType` is null.*
- The allow-list of valid diagnosis type codes is hard-coded (`A`, `P`, `O`, `E`, `R`) rather than sourced from a lookup table; a source comment notes this may later be validated against the database.*

## Constraints and usage notes
- Takes no constructor dependencies; all validation is self-contained and does not query external data.

> **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/Validators/BillDiagnosisValidator.cs
