Skip to main content

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.

ClaimJumper processes a PNG remittance image through five sequential steps. Each step has a clear input/output contract and can be tested independently using injected dependencies. Model calls are isolated to ingest, triage, and draft — prioritization and invariant enforcement are deterministic code that never touch the OpenAI API.

Pipeline diagram

The following diagram shows the full flow from image upload to human-approved download:
PNG EOB/remittance
  → structured ingest
  → denial triage + invariant enforcement
  → deterministic prioritization
  → draft or human-review brief
  → human approval
  → citation-preserving download

Modules

Ingest

lib/pipeline/ingest.ts sends the PNG to GPT-5.6 Sol via the OpenAI Responses API using a base64-encoded image input. The model extracts every claim, service line, and adjustment code legend entry into a strict IngestOutput validated by Zod. Results are cached to disk using a SHA-256 + schema-version key so the same image never triggers a redundant API call during development or testing. See the Ingest page for the full function signature, caching strategy, output schema, and prompt design.

Triage

lib/pipeline/triage.ts sends each AdjustmentLine to GPT-5.6 Sol for a lane decision. The model reads Group Code, CARC, and RARC together and returns a structured TriageModelOutput containing the lane, root cause, rationale, evidence needed, confidence, and recovery probability. See the Triage page for all model output fields, prompt constraints, and invariant integration.

Invariants

lib/pipeline/invariants.ts runs synchronously after every triage model call — before the result is returned to the caller. It enforces three non-negotiable safety rules in code:
  • A CO group-code adjustment can never be routed to patient_bill.
  • A CARC 197 denial can never be automatically written off.
  • Any triage with confidence < 0.6 is escalated to human_review.
When any rule fires, the lane is overridden to human_review and the override reasons are attached as a string[] on the DenialTriage object. Invariant enforcement is covered inline on the Triage page.

Prioritize

lib/pipeline/prioritize.ts ranks triaged denial lines by appeal deadline, urgency, and a weighted financial score. Every calculation is deterministic arithmetic — no model calls occur in this step. Lines sort first by deadline ascending, then by priority_score descending within the same deadline. See the Prioritize page for the score formula, deadline arithmetic, urgency calculation, and exported helper functions.

Draft

lib/pipeline/draft.ts produces the work artifact for each line in the queue. For appeal and corrected_claim lanes it calls GPT-5.6 Terra, then validates every citation against the original parsed data before the artifact is returned. For human_review it constructs a deterministic plain-text brief without a model call. For patient_bill and write_off it throws — those lanes never receive drafted artifacts. See the Draft page for citation validation, content safety checks, and prompt design.

Dependency injection

All pipeline functions accept an optional dependencies argument so tests can substitute mock implementations without live API calls or a real filesystem. The runTriagePipeline() function in app/api/triage/route.ts is the server-side composition point — it wires each module together and exposes the same seam for integration tests:
interface PipelineDependencies {
  ingest?: (imageBytes: Uint8Array) => Promise<IngestOutput>;
  triage?: typeof triage;
  draft?: DraftModelClient;
  today?: () => string;
}

export async function runTriagePipeline(
  imageBytes: Uint8Array,
  dependencies: PipelineDependencies = {},
): Promise<TriageResponse>
Injected triage functions must return an already-enforced DenialTriage — the same guarantee that triage() itself provides by always calling enforceInvariants() before returning.

Model configuration

All model IDs are declared in a single file so they can be updated in one place:
export const MODELS = {
  ingest: "gpt-5.6-sol",
  triage: "gpt-5.6-sol",
  draft: "gpt-5.6-terra",
} as const;
MODELS.ingest and MODELS.triage use GPT-5.6 Sol for its vision capability and structured-output reliability. MODELS.draft uses GPT-5.6 Terra for its grounded, citation-quality text generation.
All OpenAI calls in ClaimJumper go through lib/openai.ts — the fetch() API is never called directly. responseWithSchema() handles text input and responseWithImageSchema() handles base64-encoded PNG input; both enforce Zod-validated structured outputs and read OPENAI_API_KEY from the environment.

Build docs developers (and LLMs) love