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

# MedicalEdiBillService

Implements `IMedicalEdiBillService`, validating that a medical EDI 837 bill batch is eligible for further processing (exists and is in `NEW` status) using `IEdiQueryProvider`, writing outcomes to caller-supplied control/rejection log writers within a transaction opened via `IUnitOfWork`.

## Purpose
- Confirms a bill batch exists and is in the expected `NEW` state before EDI processing continues, logging the reason to a rejection report when it is not.
- Logs the batch's ID and status to a control report when validation succeeds.

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

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| MedicalEdiBillService(...) | `public MedicalEdiBillService(IUnitOfWork uow, IUserProfileService prof, IEdiQueryProvider query)` | Stores the unit of work, user-profile, and EDI query-provider collaborators, requiring all three to be non-null. |
| IsValidEdiReport | `public bool IsValidEdiReport(long batchNumber, ILogWriter controlReport, ILogWriter rejectedReport)` | Opens a unit-of-work transaction, looks up the 837 batch report for `batchNumber`, writes a rejection message and returns false if the batch is missing or not in `NEW` status, otherwise writes a control-report entry and returns true. |

## Behavioral notes
- Opens a transaction via `_unitOfWork.Begin()` at the start of the call but never explicitly commits or rolls it back within this method, relying on the unit of work's own lifecycle management for read-only queries*.

> **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/Edi/MedicalEdiBillService.cs
