McoImageExporter¶
Implements IMcoImageExporter as an abstract base for exporting claim document images (via IImagingClient) to disk for claims associated with a specific Medical Care Organization (MCO) plan, tracking and retrying failed exports through the DocumentImagingError table. It depends on IUnitOfWork for error-record persistence, IEnvironmentService for JSON-encoded document-type filter configuration, IImagingClient for retrieving images/PDFs, IFileSystem (System.IO.Abstractions) for all disk operations, and IClaimDataApiClient for Guidewire claim data; concrete subclasses (e.g. MajorisImageExporter) supply the MCO-specific active/newly-enrolled claim queries via the abstract GetActiveMcoClaims/GetNewlyEnrolledMcoClaims/MCO_NAME members.
Purpose¶
- Exports document images for claims currently actively enrolled with the MCO, matching potential claim images against the active-claim list.
- Exports document images for claims newly enrolled with the MCO as of a given enrollment date.
- Establishes and validates a per-MCO working directory (under a caller-supplied root) before any export runs.
- Retries previously failed image exports recorded in the
DocumentImagingErrortable, removing successfully retried entries and leaving unresolved ones in place. - Translates raw imaging-API error text into a short, categorized error description for reporting.
Context¶
- Namespace:
SAIF.Services.Imaging - Assembly/package:
SAIF.Services(packaged inside theSAIF.SAIFCode.CoreNuGet package)
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| McoImageExporter(...) | public McoImageExporter(IUnitOfWork unitOfWork, IEnvironmentService environmentService, IImagingClient imagingClient, IFileSystem fileSystem, IClaimDataApiClient claimDataApiClient) |
Wires in all collaborators (enforcing non-null unit of work, environment service, imaging client, and file system) shared by every MCO-specific exporter subclass. |
| ExportActiveEnrollmentDocuments(imageQueryParameters) | public McoActiveEnrollmentDocumentExportResults ExportActiveEnrollmentDocuments(QueryParameters imageQueryParameters) |
Validates the working directory, retrieves active MCO claims and matching claim-document images, exports each matched image to disk (recording failures), and returns counts of active claims, potential images, and exported images plus any errors. |
| ExportActiveEnrollmentDocuments(minCreateDate, maxCreateDate, docListEnvironmentServiceKey) | public McoActiveEnrollmentDocumentExportResults ExportActiveEnrollmentDocuments(DateTime minCreateDate, DateTime maxCreateDate, string docListEnvironmentServiceKey) |
Builds query parameters for the given create-date range, loads document-type/subtype filters from the named environment configuration setting, and delegates to the QueryParameters overload. |
| ExportNewEnrollmentDocuments(dateOfEnrollment, imageQueryParameters) | public McoNewEnrollmentDocumentExportResults ExportNewEnrollmentDocuments(DateTime dateOfEnrollment, QueryParameters imageQueryParameters) |
Validates the working directory, retrieves claims newly enrolled with the MCO on dateOfEnrollment, exports each claim's matching document images to disk (recording failures and per-claim image counts), and returns the results. |
| ExportNewEnrollmentDocuments(dateOfEnrollment, docListEnvironmentServiceKey) | public McoNewEnrollmentDocumentExportResults ExportNewEnrollmentDocuments(DateTime dateOfEnrollment, string docListEnvironmentServiceKey) |
Builds default query parameters, loads document-type/subtype filters from the named environment configuration setting, and delegates to the QueryParameters overload. |
| SetWorkingDirectory | public void SetWorkingDirectory(string directory) |
Creates (if needed) and sets the MCO-specific working directory as directory\<MCO_NAME>; throws if the root directory does not exist or the subdirectory cannot be created. |
| ExportErrorEnrollmentDocuments | public MajorisErrorEnrollmentResults ExportErrorEnrollmentDocuments() |
Retries every recorded DocumentImagingError, re-fetching and writing each image's PDF to disk; removes successfully retried errors from the table and returns lists of resolved versus still-failing errors. |
| GenerateFileName | public string GenerateFileName(Image image, long uniqueFileId) |
Builds the export file name as {ClaimNumber}_{DOCUMENTTYPE}_{DOCUMENTSUBTYPE}_{DocumentDate:MM-dd-yyyy}_{uniqueFileId:00000}.pdf, defaulting the date segment to 01-01-1970 when the image has no document date. |
| TranslateError | public string TranslateError(Image image, string errorText) |
Maps known error patterns (timeout, NoMatchingDataException with a zero image ID) to fixed short messages, or otherwise extracts the text between "Exception #1 of" and "Source:" (or the first 100/300 characters as fallbacks), truncated to at most 1000 characters. |
Behavioral notes¶
ExportImagesToDirectorycontinues processing remaining images when a single image's PDF retrieval fails, recording aDocumentImagingError(via the privateInsertErrorImage) rather than aborting the whole export.InsertErrorImagewraps its check-and-insert of a new error record in its ownUnitOfWork.Begin()/Commit()transaction and skips inserting a duplicate if a record with the sameDocHandlealready exists.ValidateWorkingDirectorythrows ifSetWorkingDirectoryhas not been called first, since the working directory cannot be supplied at application-registration time for console-app callers (per the in-code comment).- Subclasses must supply
MCO_NAME(used as the working-directory subfolder name) and the two abstract claim-query methods; this base class contains no MCO-identifying logic of its own.
Sources¶
- Services/SAIF.Services/Imaging/McoImageExporter.cs