From d4a142aa83a7558a71ef9ae2c2db2f1a130cbe80 Mon Sep 17 00:00:00 2001 From: Tyler Date: Fri, 19 Jun 2026 23:45:11 -0600 Subject: [PATCH] feat(frontend): add ClaimState enum + Match/Unmatched types --- src/types/index.ts | 67 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/src/types/index.ts b/src/types/index.ts index 580c02b..839633e 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -312,3 +312,70 @@ export interface ParsedBatch { claimIds: string[]; summary: BatchSummary; } + +// --------------------------------------------------------------------------- +// Reconciliation (7-state claim model + match audit trail) +// Mirrors cyclone.db.ClaimState (Python enum) 1:1. The reconciliation page +// uses these to drive the unmatched bucket and the manual-match UI. +// --------------------------------------------------------------------------- + +export type ClaimState = + | "submitted" + | "received" + | "paid" + | "partial" + | "denied" + | "reconciled" + | "reversed"; + +export const CLAIM_STATES: ClaimState[] = [ + "submitted", + "received", + "paid", + "partial", + "denied", + "reconciled", + "reversed", +]; + +export interface Match { + id: number; + claim_id: string; + remittance_id: string; + strategy: "auto" | "manual"; + matched_at: string; + prior_claim_state?: ClaimState | null; + is_reversal: boolean; +} + +export interface UnmatchedClaim { + id: string; + patientControlNumber: string; + serviceDate: string | null; + chargeAmount: number; + providerNpi: string | null; + payerId: string | null; + state: ClaimState; +} + +export interface UnmatchedRemittance { + id: string; + payerClaimControlNumber: string; + statusCode: string; + totalCharge: number; + totalPaid: number; + adjustmentAmount: number; + serviceDate: string | null; + isReversal: boolean; + batchId: string; +} + +export interface UnmatchedResponse { + claims: UnmatchedClaim[]; + remittances: UnmatchedRemittance[]; +} + +export interface MatchResponse { + claim: UnmatchedClaim; + match: { id: number; strategy: "auto" | "manual" }; +}