Skip to content

DocumentFileService

Implements IDocumentFileService to locate, validate, and move the PDF files that back e-bill documents on disk before/after they are imaged, using IEbillDocumentQueryProvider to cross-check the files present in a directory against the non-imaged document records expected for a batch.

Purpose

  • Locates a document's PDF file on disk by its clearinghouse control number (GetFile), throwing if the file cannot be found.
  • Moves an imaged file from its source (staging) directory to a destination (archive) directory (MoveFile).
  • Validates that a batch's source directory exists, its destination directory exists, and that the set of PDF file names present exactly matches the batch's non-imaged document control numbers (ValidateDocuments, ValidateSourceDirectory, ValidateDestinationDirectory), raising InvalidBatchException on any mismatch.
  • Enumerates the PDF file names available for imaging in a directory (GetImageDocumentFileNames), throwing if none are found.

Context

  • Namespace: SAIF.Services.Claims.Ebilling.Imaging
  • Assembly/package: SAIF.Services (packaged inside the SAIF.SAIFCode.Core NuGet package)

Public members

Member Signature Purpose
DocumentFileService public DocumentFileService(IEbillDocumentQueryProvider queryProvider) Wires the e-bill document query provider used to look up non-imaged documents for validation.
GetFile public FileInfo GetFile(string fileName, string sourcePath) Returns the .pdf file matching the given control-number file name in the source directory, throwing FileNotFoundException if it does not exist.
MoveFile public void MoveFile(string source, string destination) Moves a file from source to destination on disk.
ValidateDocuments public void ValidateDocuments(long batchId, string sourcePath, string destinationPath) Confirms both directories exist and that the PDF files present in the source directory match, in count and control number, the batch's non-imaged e-bill documents; throws InvalidBatchException on any discrepancy.
ValidateSourceDirectory public DirectoryInfo ValidateSourceDirectory(string path) Returns the source directory info, throwing DirectoryNotFoundException if the path does not exist.
ValidateDestinationDirectory public DirectoryInfo ValidateDestinationDirectory(string path) Returns the destination directory info, throwing DirectoryNotFoundException if the path does not exist.
GetImageDocumentFileNames public IEnumerable<string> GetImageDocumentFileNames(DirectoryInfo directoryInfo) Returns the control-number file names (without extension) of all .pdf files in the directory, throwing FileNotFoundException if none are present.

Behavioral notes

  • ValidateDocuments performs a strict two-way comparison (count and control-number set) between files on disk and non-imaged document records, treating any mismatch as a fatal batch error.
  • All file I/O is synchronous and operates directly on the local/network file system paths passed in by callers.

Sources

  • Services/SAIF.Services/Claims/EBilling/Imaging/DocumentFileService.cs