SvcSegment¶
SvcSegment models the X12 SVC professional/institutional service-adjudication segment used in 835 remittance advice transactions to report how a billed service line was adjudicated: it carries both the adjudicated procedure/service (AdjudicatedMedicalService) and, when it differs, the originally billed procedure/service (BilledMedicalService) as CompositeProcedureCodeElement values, along with charged/paid amounts and quantities. Build() suppresses several elements based on adjudication rules: the revenue code is omitted when the adjudicated qualifier is "NU", the adjudicated quantity is omitted when it equals 1, and the billed procedure/quantity are emitted only when they actually differ from the adjudicated values (BR-051, BR-062).
Purpose¶
- Represents the SVC segment identity via
SegmentIdreturning the literal"SVC"(BR-020). - Carries
AdjudicatedMedicalServiceandBilledMedicalServiceasCompositeProcedureCodeElementvalues representing what was actually paid versus what was originally billed. - Carries
ChargedAmount,PaymentAmount,RevenueCode,AdjudicatedQuantity, andBilledQuantitydescribing the financial and quantity aspects of the adjudication. - Suppresses the revenue code at element 4 when the adjudicated procedure's
Qualifieris"NU"(BR-051). - Suppresses
AdjudicatedQuantityat element 5 when it equals 1, and defaults it to 1 onFill()when the element is absent (BR-051). - Suppresses
BilledMedicalServiceat element 6 andBilledQuantityat element 7 when they equal the adjudicated values, usingCompositeProcedureCodeElement.Equalsfor the procedure comparison, which excludesDescription(BR-051, BR-062).
Context¶
- Namespace:
SAIF.Common.Files.Edi.Segments - Assembly/package:
SAIF.Framework.Common.Files
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| SegmentId | string SegmentId { get; } |
Returns the literal X12 segment identifier "SVC". |
| AdjudicatedMedicalService | CompositeProcedureCodeElement AdjudicatedMedicalService { get; set; } |
The procedure/service composite as actually adjudicated (SVC01), element 1. |
| ChargedAmount | decimal ChargedAmount { get; set; } |
The line-item charge amount (SVC02), element 2. |
| PaymentAmount | decimal PaymentAmount { get; set; } |
The line-item payment amount (SVC03), element 3. |
| BilledQuantity | decimal BilledQuantity { get; set; } |
The originally billed unit quantity (SVC07), written on Build() only when it differs from AdjudicatedQuantity, and defaulted to AdjudicatedQuantity on Fill() when the element is absent (BR-051). |
| RevenueCode | string RevenueCode { get; set; } |
The revenue code for the service line (SVC04), written on Build() only when non-empty and the adjudicated qualifier is not "NU" (BR-051). |
| AdjudicatedQuantity | decimal AdjudicatedQuantity { get; set; } |
The adjudicated unit quantity (SVC05), written on Build() only when it is not equal to 1, and defaulted to 1 on Fill() when the element is absent (BR-051). |
| BilledMedicalService | CompositeProcedureCodeElement BilledMedicalService { get; set; } |
The originally billed procedure/service composite (SVC06), written on Build() only when it differs from AdjudicatedMedicalService per Equals (BR-051, BR-062). |
| Build | IEdiSegment Build() |
Creates a SegmentBuilder("SVC"); adds AdjudicatedMedicalService's built composite (trimmed of trailing delimiters) at element 1 when set; adds ChargedAmount/PaymentAmount at elements 2-3; adds RevenueCode at element 4 unless the adjudicated qualifier is "NU"; adds AdjudicatedQuantity at element 5 unless it equals 1; adds BilledMedicalService's composite at element 6 when it differs from the adjudicated one; adds BilledQuantity at element 7 when it differs from AdjudicatedQuantity; returns the built segment (BR-051). |
| Fill | void Fill(IEdiSegment segment) |
Reads element 1 into AdjudicatedMedicalService.Code or via FillServiceCode depending on element type; converts elements 2-3 to decimal for ChargedAmount/PaymentAmount; reads RevenueCode at element 4; sets AdjudicatedQuantity to 1 when element 5 is absent, else converts it; reads element 6 into BilledMedicalService.Code/FillServiceCode when present; sets BilledQuantity to AdjudicatedQuantity when element 7 is absent, else converts it. |
| Parse | static Sv1Segment Parse(IEdiSegment segment) |
Declared with an Sv1Segment return type and instantiates/fills an Sv1Segment rather than an SvcSegment — a likely copy/paste defect, unlike every other segment class's Parse, which returns its own type**. |
Behavioral notes¶
SvcSegment.Parse(IEdiSegment)is declared with anSv1Segmentreturn type, and its body constructs and fills anSv1Segmentinstead of aSvcSegment; this is inconsistent with every other segment'sParsepattern in this library, which returns an instance of the declaring type, and appears to be a copy/paste defect, though it could not be confirmed whether callers rely on this behavior**.Build()andFill()dereferenceAdjudicatedMedicalService/BilledMedicalService(e.g.AdjudicatedMedicalService.Qualifier,AdjudicatedMedicalService.Code = segment.GetChildValue(1)) without checking they are non-null first; a caller must pre-assign both properties with aCompositeProcedureCodeElementinstance before calling either method, or aNullReferenceExceptionresults — this requirement is not documented or enforced by the class**.
Constraints and usage notes¶
- Callers must construct and assign
AdjudicatedMedicalService(and typicallyBilledMedicalService) before callingBuild()orFill(), since neither method allocates them**. - Because
Parseis defective, code that callsSvcSegment.Parse(segment)expecting anSvcSegmentback will actually receive anSv1Segmenttyped asSv1Segment, which will not compile as an assignment to anSvcSegmentvariable and would need to be recognized at the call site**.
Note: Statements marked with
**could not be confirmed; treat as unknown until verified.
Sources¶
- Common\SAIF.Common.Files\Edi\Segments\SvcSegment.cs