Skip to content

EdiBuildSegments

Not part of the public API. EdiBuildSegments is declared internal (no access modifier) in source and is documented here for completeness only; it is intentionally excluded from the API reference index's Types table.

EdiBuildSegments is the shared, low-level EDI segment factory that the outbound builders — File277CaBuilder (OP-DOM-11), File835Builder/File837AckBuilder (OP-DOM-12), and CBP service-code composition — call to construct individual X12 segments (ISA, GS, ST, BHT, HL, NM1, N3, N4, REF, DTP/DTM, AMT, BPR, CLP, SVC, STC, TRN, LQ, LX, QTY, PER, and the composite procedure-code element) from bill, provider, and clearinghouse data, rather than each builder assembling segment objects inline. It has no state of its own — every method is a pure, static segment or composite-code builder.

Purpose

  • Centralizes construction of every individual EDI segment type used in outbound e-billing files, so segment layout (field order, defaults such as BuildBprSegment's hard-coded "CCP" payment format for ACH) is defined once and shared by every builder.
  • Builds the composite service/procedure-code element (BuildCompositeServiceId) used on SVC segments, resolving whether to report an NDC, revenue code, or CBP service code and the associated HIPAA qualifier (HC, AD, ER, N4, or NU).
  • Provides a text-sanitization helper (RemoveSpecialCharacters) that other Ebilling classes, including the provider-matching rules, reuse for address and code comparisons.

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
BuildAk1Segment public static IEdiSegment BuildAk1Segment(GsSegment segment) Builds the AK1 functional-group-response-header segment from the inbound GS segment it acknowledges.
BuildAk2Segment public static IEdiSegment BuildAk2Segment(StSegment segment) Builds the AK2 transaction-set-response-header segment from the inbound ST segment it acknowledges.
BuildAk9Segment public static IEdiSegment BuildAk9Segment(IEdiFile outFile, int stCount, string responseCode) Builds the AK9 functional-group-response-trailer segment summarizing the transaction-set count and overall response code.
BuildAmtSegment public static IEdiSegment BuildAmtSegment(string amountQualifierCode, decimal acceptedAmount) Builds an AMT monetary-amount segment for the given qualifier code and amount.
BuildBhtSegment public static IEdiSegment BuildBhtSegment(EbillBatch batch, string structureCode, bool isOriginal, string transactionType) Builds the BHT beginning-of-hierarchical-transaction segment identifying the batch, structure code, and whether the transaction is original or a resubmission.
BuildBprSegment public static IEdiSegment BuildBprSegment(string transactionHandlingCode, decimal amount, string paymentMethodCode, string senderCompanyId, DateTime effectiveDate) Builds the BPR payment-order/remittance-advice segment, applying ACH-specific defaults (payment format "CCP", fixed sender financial-institution identifiers) when the payment method is ACH.
BuildClpSegment public static IEdiSegment BuildClpSegment(string controlNumber, string claimStatus, decimal chargedAmount, decimal paymentAmount, decimal? patientResponsibilityAmount, long billId, string facilityCode, string frequencyTypeCode) Builds the CLP claim-payment-information segment for a bill, fixing the claim-filing code to "WC" (workers' compensation).
BuildDtmSegment public static IEdiSegment BuildDtmSegment(string dateTimeQualifier, DateTime dateValue) Builds a DTM date/time-reference segment for the given qualifier and date.
BuildDtpSegment public static IEdiSegment BuildDtpSegment(string dateTimeQualifier, string format, DateTime startDateTime, DateTime? endDateTime) Builds a DTP date/time-period segment, rendering a date range when an end date is supplied and a single date otherwise.
BuildGeSegment public static IEdiSegment BuildGeSegment(long batchId, int gsCount) Builds the GE functional-group-trailer segment closing out the group for the batch.
BuildGsSegment public static IEdiSegment BuildGsSegment(EbillClearinghouse clearinghouse, EbillBatch batch) Builds the GS functional-group-header segment identifying the clearinghouse and batch.
BuildHlSegment public static IEdiSegment BuildHlSegment(int hlCount, int? parentIdNumber, string levelCode, string childCode) Builds an HL hierarchical-level segment linking a level to its parent and indicating whether child levels follow.
BuildIeaSegment public static IEdiSegment BuildIeaSegment(long batchId) Builds the IEA interchange-control-trailer segment closing the interchange for the batch.
BuildIsaSegment public static IEdiSegment BuildIsaSegment(EbillClearinghouse clearinghouse, EbillBatch batch, bool isProductionRun, bool responseRequested) Builds the ISA interchange-control-header segment, flagging test versus production and whether an acknowledgement is requested.
BuildLqSegment public static IEdiSegment BuildLqSegment(string rc, string ic) Builds an LQ form-identification-code segment carrying a code-list qualifier and industry code.
BuildLxSegment public static IEdiSegment BuildLxSegment(short counter) Builds an LX transaction-set-line-number segment for the given running counter.
BuildN1Segment public static IEdiSegment BuildN1Segment(string type, string name, string qualifier, string identifier) Builds an N1 party-identification segment (name plus identifier) for the given entity type.
BuildN3Segment public static IEdiSegment BuildN3Segment(string line1, string line2) Builds an N3 party-location (street address) segment.
BuildN4Segment public static IEdiSegment BuildN4Segment(string city, string state, string zip, string zipExt) Builds an N4 geographic-location segment (city/state/zip) for a party address.
BuildNm1Segment public static IEdiSegment BuildNm1Segment(string entityIdentifierCode, string entityType, string organizationName, string firstName, string middleName, string lastName, string nameSuffix, string indentificationCodeQualifier, string identificationCode) Builds an NM1 individual-or-organizational-name segment identifying a party by role, name, and identification code.
BuildPerSegment public static IEdiSegment BuildPerSegment(string contactFunctionCode, string name, string communicationQualifier, string communicationNumber) Builds a PER administrative-communications-contact segment for a party.
BuildQtySegment public static IEdiSegment BuildQtySegment(string quantityQualifierCode, long quantity) Builds a QTY quantity segment for the given qualifier and count.
BuildRefSegment public static IEdiSegment BuildRefSegment(string referenceIdQualifier, string referenceIdentification) Builds a REF reference-identification segment for the given qualifier and value.
BuildSeSegment public static IEdiSegment BuildSeSegment(int segmentCount, int controlNumber) Builds the SE transaction-set-trailer segment closing a transaction set with its segment count and control number.
BuildStSegment public static IEdiSegment BuildStSegment(string manualVersion, string transactionSetIdentifier, int controlNumber) Builds the ST transaction-set-header segment identifying the transaction type, version, and control number.
BuildStcSegment public static IEdiSegment BuildStcSegment(string statusCategory, string statusCode, DateTime statusDate, string actionCode, decimal billTotalAmount) Builds an STC status-information segment reporting a claim/bill's status category, code, and total amount for a 277 response.
BuildSvcSegment public static IEdiSegment BuildSvcSegment(IEbillingQueryProvider queryProvider, CbpBillService bsv, CbpAuditedService asv, string revenueCode) Builds an SVC service-payment-information segment for a service, computing the paid amount as allowed minus MCO admin fee (DOM-BR-142) and composing the audited and billed procedure-code elements via BuildCompositeServiceId.
BuildCompositeServiceId public static CompositeProcedureCodeElement BuildCompositeServiceId(IEbillingQueryProvider queryProvider, string primaryServiceTypeCode, string secondaryServiceTypeCode, string nationalDrugCode, string primaryServiceCode, string secondaryCbpServiceCode, string modifier1, string modifier2, string modifier3, string modifier4) Resolves the composite procedure/service code and HIPAA qualifier to report on a service line: NDC (N4) when present, otherwise a CBP service code with qualifier HC/AD/ER, or NU when only a revenue code is available (DOM-BR-056).
BuildCompositeServiceId (overload) public static CompositeProcedureCodeElement BuildCompositeServiceId(string qualifier, string serviceId, string modifier1, string modifier2, string modifier3, string modifier4) Builds the composite procedure-code element directly from an already-resolved qualifier, code, and up to four modifiers, sanitizing each modifier through RemoveSpecialCharacters.
BuildTrnSegment public static IEdiSegment BuildTrnSegment(string traceTypeCode, string currentTransactionTraceNumber, string referenceIdentification = null, string originatingCompanyIdentifier = null) Builds a TRN trace-number segment correlating a transaction to its trace number and, optionally, an originating company identifier.
RemoveSpecialCharacters public static string RemoveSpecialCharacters(string input) Strips every character except letters, digits, and spaces from the input, returning null for a null input; used to normalize codes and address text before comparison.

Behavioral notes

  • BuildBprSegment only applies its ACH-specific field defaults when paymentMethodCode == "ACH"; other payment methods produce a segment without those fields set*.
  • BuildCompositeServiceId's NDC branch treats any 11-character primaryServiceCode as an NDC when no explicit nationalDrugCode is supplied*.

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts.

Sources

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