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
DiagnosisCodeto be non-null and non-empty. - Requires
DiagnosisTypeto be non-null, and when present, requiresDiagnosisType.Codeto be non-null/non-empty and to match one of the allowed codesA,P,O,E,R.
Context¶
- Namespace:
SAIF.Services.Claims.Bills.Validators - Assembly/package:
SAIF.Services(packaged inside theSAIF.SAIFCode.CoreNuGet 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.Codeallow-list rules only run inside aWhen(x => x.DiagnosisType != null, ...)block, so they are skipped entirely ifDiagnosisTypeis 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