Skip to content

File837AckBuilder

File837AckBuilder renders a 999-style functional acknowledgement EDI file for a processed 837 batch (part of operation OP-DOM-12's EOB/acknowledgement output chain, alongside File835Builder): given the inbound IEdiFile and the batch, it writes the ISA/GS header segments, walks each functional group and transaction set to build AK2/AK9-style response segments, and writes the trailer segments, producing the outbound acknowledgement IEdiFile. Its per-segment layout was not traced statement-by-statement in the source analysis, so several individual segment-writing methods are documented from their signatures and surrounding calls*.

Purpose

  • Builds the complete outbound acknowledgement file for an inbound 837 batch: header segments, one response block per functional group/transaction set, and trailer segments.
  • Provides a batch-date/duplicate-submission guard (CheckBatchWithFileSegmentNotProcessed, GetFileBatchDate) so acknowledgement generation can detect whether a file's batch date has already been processed.

Context

  • Namespace: SAIF.Domain.Claims.Ebilling
  • Assembly/package: SAIF.Domain (Domain/SAIF.Domain/SAIF.Domain.csproj, .NET Framework 4.6.2 class library)

Public members

Member Signature Purpose
Build837AckFile public static IEdiFile Build837AckFile(IEbillingQueryProvider ebillingQueryProvider, IUserProfileService userProfileService, IEdiFile file, EbillBatch batch, bool isProductionRun) Builds the complete outbound acknowledgement IEdiFile for the batch: writes header segments, processes each functional group in the inbound file, then writes trailer segments.
ProcessFunctionalGroup public static void ProcessFunctionalGroup(EdiFile outfile, EbillBatch batch, IFunctionalGroup functionalGroup, ref int transactionSetControlCount, ref int transactionSetSegmentCount) Writes the functional-group header, per-transaction-set response segments, and functional-group trailer for one inbound functional group, updating the running control/segment counters by reference*.
WriteHeaderSegments public static void WriteHeaderSegments(EdiFile outfile, EbillClearinghouse clearinghouse, EbillBatch batch, bool isProductionRun) Writes the ISA and GS interchange/group header segments that open the acknowledgement file.
WriteFunctionalGroupHeaderSegments public static void WriteFunctionalGroupHeaderSegments(EdiFile outfile, EbillBatch batch, IFunctionalGroup functionalGroup, int transactionSetControlCount) Writes the ST/BHT-level header segments that open a functional group's response transaction set.
WriteTransactionGroupSegments public static void WriteTransactionGroupSegments(EdiFile outfile, ITransactionSet transactionGroup) Writes the response body segments for a single transaction set within a functional group*.
WriteFunctionalGroupTrailerSegments public static void WriteFunctionalGroupTrailerSegments(EdiFile outfile, IFunctionalGroup functionalGroup, int transactionSetControlCount, int stSegmentCount) Writes the SE/GE-level trailer segments that close a functional group's response transaction set.
WriteTrailerSegments public static void WriteTrailerSegments(EdiFile outfile, EbillBatch batch, int transactionSetControlCount) Writes the IEA interchange trailer segment that closes the acknowledgement file.
CheckBatchWithFileSegmentNotProcessed public static bool CheckBatchWithFileSegmentNotProcessed(DateTime fileBatchDate, IEbillingQueryProvider queryProvider, EbillClearinghouse clearinghouse) Reports whether the given file batch date has not already been processed for the clearinghouse, guarding against re-acknowledging a duplicate submission*.
GetFileBatchDate public static DateTime GetFileBatchDate(I837File file) Extracts the batch date recorded in the parsed 837 file so it can be compared against previously processed batches.

Behavioral notes

  • ProcessFunctionalGroup mutates its running counters through ref parameters rather than returning them, so callers must read the updated transactionSetControlCount/transactionSetSegmentCount values after the call rather than any return value*.
  • The exact response segments written per transaction set were not traced line by line from the source; WriteTransactionGroupSegments's purpose is inferred from its name, parameters, and position in the build pipeline**.

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

  • Domain/SAIF.Domain/Claims/Ebilling/File837AckBuilder.cs