Skip to content

DocumentImager

Implements IDocumentImager to upload one or more e-bill document PDFs to the imaging API, optionally merging multiple PDFs into a single image via IPdfClient before upload. It resolves document/claim data through IEbillingQueryProvider and ICCClaimApiService, builds the upload configuration through IConfigurationService, reads/moves source files through IDocumentFileService, and performs the upload through IImagingClient.

Purpose

  • Uploads a single document's PDF as one image, then moves the source file to the destination (archive) directory (ImageDocument).
  • Merges multiple documents' PDFs (via IPdfClient.Merge) into a single combined image before uploading it and moving each source file to the destination directory (ImageDocuments).
  • Builds each upload's imaging configuration and workflow-task configuration from the resolved claim and document metadata before calling IImagingClient.Upload.
  • Captures and logs I/O and unexpected exceptions during imaging without always propagating them (I/O errors are swallowed after logging; other exceptions are logged and rethrown).

Context

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

Public members

Member Signature Purpose
DocumentImager public DocumentImager(IEbillingQueryProvider queryProvider, IConfigurationService imageConfigurationService, IDocumentFileService fileService, IPdfClient pdfClient, IImagingClient imagingClient, ICCClaimApiService claimApiService) Wires the query provider, image-configuration builder, file service, PDF client, imaging client, and claim API client used to image documents.
ImageDocument public long ImageDocument(long documentId, string sourcePath, string destinationPath, string currentUser, ILogWriter controlReport) Reads a single document's PDF from disk, uploads it as an image via the imaging API, moves the source file to the destination directory, and returns the resulting image ID (or 0 on I/O failure).
ImageDocuments public long ImageDocuments(IList<BillImageRequest.Document> documents, string sourcePath, string destinationPath, string currentUser, ILogWriter controlReport) Loads and merges multiple documents' PDFs into a single combined image, uploads the merged image, moves each source file to the destination directory, and returns the resulting image ID (or 0 on I/O failure).

Behavioral notes

  • ImageDocument and ImageDocuments both call ICCClaimApiService.GetClaim synchronously via GetAwaiter().GetResult(), blocking on the underlying async claim lookup.
  • I/O exceptions during imaging are caught, logged to controlReport, and suppressed (the methods return without rethrowing); all other exceptions are logged and rethrown.
  • ImageDocuments merges source PDFs with IPdfClient.Merge using a full-document ("*") page range per input before uploading the merged result as a single image.

Sources

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