Codepackr / edi / EDI Semantic Diff & Compare

EDI Semantic Diff & Compare

Compare two ANSI X12 or EDIFACT documents side-by-side or unified with loop alignment, element-level mutation highlights, and volatile envelope ignoring.

Client-Side Execution & Privacy Guarantee

This utility executes 100% locally in your web browser. Your inputs, tokens, queries, and data payloads are never transmitted to any external server or backend.

A conventional text diff treats EDI as opaque character streams and therefore flags every change in control numbers, timestamps, or whitespace as significant. The EDI Semantic Diff aligns documents by their loop structure, ignores volatile envelope fields, and highlights only the business-element mutations that actually matter.

The comparison runs entirely in the browser. Results can be viewed as a side-by-side pane or as a unified diff with loop context, making it straightforward to spot a changed quantity, a corrected address, or an added line item.

Loop-Aware Alignment

EDI documents are hierarchical. The diff engine first identifies matching loops by their identifying elements (for example the PO1 line-number or the LIN item identifier) rather than by absolute segment position. Consequently an inserted line item shifts only the subsequent items; earlier lines remain aligned.

When two loops cannot be matched, the tool reports them as added or removed and still continues alignment of the remaining content. Nested loops such as N1 name loops or SAC allowance loops are handled recursively.

Volatile Field Suppression

Interchange and group control numbers, dates and times inside ISA/GS or UNB, and the SE/GE/IEA count fields change on every transmission even when the business content is identical. These fields are excluded from the comparison by default. Users may add further element paths (for example a unique message reference) to the ignore list.

The suppression is semantic: the fields are still parsed and displayed in the raw view, but they do not generate difference markers. This prevents a clean functional acknowledgment from being reported as a massive change simply because its control numbers differ.

Element-Level Mutation Reporting

Once loops are aligned, each element is compared. Changes are classified as value mutations, qualifier changes, or presence/absence differences. In the side-by-side view the affected element is highlighted; in the unified view a context line shows the segment with the changed element annotated.

Multi-value elements and composite elements are expanded so that a change inside a single component (for example the unit-price portion of a PO1) is isolated rather than flagging the entire segment.

When to use this tool

  • Verify that an outbound 850 generated by a new mapping matches the legacy system’s output except for control numbers.
  • Locate the exact element a trading partner changed when they returned an 855 or ORDRSP.
  • Confirm that a HIPAA sanitizer altered only the intended PHI fields.
  • Diff two versions of a large claim file to see which service lines were adjusted.
  • Review the effect of a delimiter or version change without noise from envelope fields.

How to use the EDI Semantic Diff & Compare

  1. Paste or drop the first EDI document into the left pane.
  2. Paste or drop the second document into the right pane.
  3. Optionally add element paths to the ignore list (defaults already cover control numbers and timestamps).
  4. Choose side-by-side or unified presentation.
  5. Run the comparison; differing elements are highlighted and a summary count is shown.
  6. Export the diff report as text or HTML for archiving.

Worked examples

Quantity change on a purchase-order line

Input
Left:
PO1*1*10*EA*5.00**VP*WIDGET~
Right:
PO1*1*12*EA*5.00**VP*WIDGET~
Output
PO1*1*[10→12]*EA*5.00**VP*WIDGET~

Only the quantity element is marked; the rest of the segment aligns.

Ignored envelope difference

Input
Left ISA13 = 000000001; Right ISA13 = 000000099. Business content identical.
Output
No differences reported.

Control-number fields are suppressed by default.

Common mistakes and tips

  • If two line items share the same identifier, supply a secondary key (line number plus part number) to improve alignment.
  • Large files with thousands of lines still compare quickly because only parsed elements are examined.
  • Use the ignore list to suppress partner-specific reference numbers that are known to vary.
  • After a semantic diff shows no business changes, the files are functionally equivalent for acknowledgment purposes.
  • EDIFACT and X12 documents can be compared only when they represent the same business message; cross-standard comparison is not meaningful.

Frequently asked questions

Why do ordinary text diffs fail on EDI?

They treat the file as flat text, so every control number, date, and count field appears as a change even when the purchase-order or claim content is identical.

Can I compare a file with its 997 acknowledgment?

The tool will align what it can, but the structures differ; it is more useful for comparing two versions of the same transaction set.

Are composite elements expanded?

Yes. A change inside one component of a composite is reported separately.

Does the diff modify the original files?

No. Comparison is read-only; both documents remain unchanged.

How are added or deleted loops shown?

They appear as entire blocks marked added or removed, with surrounding context preserved.