diff --git a/README.md b/README.md index 50baec6..feb8a4e 100644 --- a/README.md +++ b/README.md @@ -154,6 +154,48 @@ parses and rejects claims, the inbox reflects the new | POST | `/api/inbox/rejected/resubmit` | `{claim_ids: [...]}`. `200` with `conflicts` for non-rejected. | | GET | `/api/inbox/export.csv?lane=` | Streams CSV of the lane's rows. | +## Per-Line Adjustment Audit + +Every 835 CAS segment is tied back to the specific 837 service line it +adjudicates, instead of being aggregated to the claim level. The match +runs **eagerly** at 835 ingest time so the audit trail is stable across +re-reads (a re-migration is required if the algorithm changes). + +### Where to find it + +- **ClaimDrawer → "Line Reconciliation" tab** — side-by-side view of the + 837 SV1 lines and 835 SVC composites with per-line CAS reasons. +- **ClaimDrawer → ServiceLinesTable** — every billed line now shows its + paid amount and adjustment sum on the right. +- **RemitDrawer → CasAdjustmentsPanel** — each CAS row carries a + `proc · #N` reference; claim-level CAS clusters separately. +- **ClaimDrawer → MatchedRemitCard** — a `lines: N/M matched` badge + lights up amber when at least one line is unmatched. + +### Match criteria (strict) + +A 835 SVC composite matches a 837 SV1 line iff all four criteria align: + +| Field | Rule | +| ------------- | ----------------------------------------------- | +| Procedure | Exact match (case-insensitive, uppercased). | +| Modifiers | Set-equal (order-independent). | +| Service date | Exact match (both null counts as a match). | +| Units | Exact match (both null counts as a match). | + +Unmatched lines surface as a **soft warning** — the claim still posts to +PAID/PARTIAL/RECEIVED, but the Inbox shows the unmatched count and the +drawer surfaces a per-line "no 837 line matched" note. + +### Line-level endpoints + +| Method | Path | Notes | +| ------ | --------------------------------------------------- | -------------------------------------------------------------------------------------- | +| GET | `/api/claims/{claim_id}/line-reconciliation` | Dedicated view for the drawer tab. | +| GET | `/api/claims/{claim_id}` | Now includes a slim `lineReconciliation[]`. | +| GET | `/api/remittances/{remittance_id}` | Now includes `serviceLinePayments[]` + `claimLevelAdjustments[]`. | +| GET | `/api/inbox/lanes` | `matched_remittance` payload gains `matched_lines` + `total_lines`. | + ### Scoring 4-field weighted (sum = 100):