Documentation Index
Fetch the complete documentation index at: https://mintlify.com/sputhenofficial/claimjumper/llms.txt
Use this file to discover all available pages before exploring further.
prioritize() in lib/pipeline/prioritize.ts takes an array of PrioritizeInput objects and today’s ISO date, then returns a sorted PrioritizedLine[]. Every calculation is deterministic arithmetic based on the notice date, billed amount, and recovery probability from triage — no OpenAI calls occur in this step. Because prioritization is pure computation, it is straightforward to unit test and verify independently of any model behavior.
Exported functions
calculateAppealDeadline
RECEIPT_PRESUMPTION_DAYS (5) to the notice date to get the presumed receipt date, then adds REDETERMINATION_DAYS (120) to get the filing deadline. The result is an ISO 8601 date string.
Example: a notice date of 2025-01-01 produces a presumed receipt date of 2025-01-06 and a deadline of 2025-05-06.
calculateUrgency
0–1 urgency score. The formula clamps (URGENCY_SCALE_DAYS − daysRemaining) / URGENCY_SCALE_DAYS between 0 and 1. When the deadline is URGENCY_SCALE_DAYS (125) or more days away, urgency is 0. When the deadline has passed, urgency is 1.
adaptForPrioritization
PrioritizeInput from the full parsed claim, the specific service line being worked, and its triage result. It promotes notice_date from the remittance header and group_code, carc, rarc, billed_amount, description, and notes from the service line into a flat AdjustmentLine, then pairs that with the DenialTriage.
prioritize
PrioritizedLine, then sorts the result. For each item it calls calculateAppealDeadline() and calculateUrgency(), then computes priority_score.
Source
Priority score formula
billed_amount— the financial exposure. Higher billed amounts produce higher scores, reflecting the revenue at stake.recovery_probability— fromDenialTriage. A0–1float representing how likely working this denial leads to payment. A write-off line carries0; a strong timely-filing appeal may carry0.7or higher.urgency— fromcalculateUrgency(). A0–1float that rises as the deadline approaches. Lines with far-off deadlines score near0; lines whose deadlines have passed score1.
0 will score 0 regardless of urgency.
Sort order
Lines are sorted by two keys in sequence:deadlineascending — using ISO string.localeCompare(). Lines whose deadlines arrive first are worked first, regardless of score.priority_scoredescending — within lines sharing the same deadline, higher-scoring lines appear first.
Constants
| Constant | Value | Purpose |
|---|---|---|
RECEIPT_PRESUMPTION_DAYS | 5 | CMS presumed receipt window added to the notice date before the 120-day clock starts |
REDETERMINATION_DAYS | 120 | Medicare redetermination filing window in calendar days |
URGENCY_SCALE_DAYS | 125 | RECEIPT_PRESUMPTION_DAYS + REDETERMINATION_DAYS — the full window used to normalize urgency to 0–1 |
All date arithmetic uses UTC calendar days via
Date.setUTCDate() and toISOString().slice(0, 10). This prevents timezone drift from shifting a deadline by a day when the server runs in a non-UTC timezone.