Bevaya Logo
Use Cases

Medical Bills Identification and Extraction

Automatically identify every medical bill in a package, extract it down to the line item, reconcile the bill details, and raise red flags to a human for review.

The business problem

Providers often bundle several bills into a single document — a batch scan, a fax, an emailed PDF — but each bill belongs to its own claim and needs to be identified, transcribed line by line, and verified before it can be paid or forwarded. Some downstream systems may even need each bill split out and filed on its own.

The Medical Bills Identification and Extraction template automates that pass: it splits a bundled package into individual bills with Split Documents, classifies and extracts each one down to the line item, and reconciles the charges against its own stated total — so a reviewer only sees the bills that are missing something, low-confidence, or don't add up.

Not every medical bills agent needs to split documents. Reach for Split Documents only when a downstream step needs each bill on its own — for example, filing separate bills to separate claims — or when it would improve extraction accuracy on a large combined file. See Split Documents best practices before adding it to your own flow.

Trigger and source data

The template ships with the Manual File Upload trigger. You can configure other triggers if you'd like, including a connection to an Outlook email inbox. See Configure triggers.

To run the template, upload a medical bill package — either a single bill or a bundle of several. The template recognizes:

  • Medical bill form types — CMS-1500 (professional), UB-04 (institutional/facility), itemized statements, pharmacy bills, dental bills, and other bill formats
  • Supporting content — medical records, correspondence, and other non-bill pages that may travel with a package

By default, the template works entirely from the uploaded content.

Template starting point

Create an AI agent from the Medical Bills Identification and Extraction template for a working flow that classifies, extracts, reconciles, validates, and routes for review out of the box. Open it in the canvas, select an environment, click Start Editing, and adjust it to your document mix — field prompts, extraction rules, or validation thresholds. See Create an AI Agent.

Use it standalone, or add its nodes into an existing Claim Indexing flow as a deeper extraction step once a document is classified as a medical bill.

What the template preconfigures

The template will execute the following nodes:

Step in the flowNode it usesCategory
Prepare the uploaded filesRead FilesUtility
Write a package-level overview (summary, providers, red flags, total estimate)InsurGPT: CustomInsurGPT
Decide whether the package covers one claim or severalInsurGPT: CustomInsurGPT
Branch on that resultIfControl
Split the package into separate documents (multi-claim path)Split DocumentsInsurGPT
Process each document in turn (multi-claim path)For LoopControl
Classify each documentInsurGPT: CustomInsurGPT
Route bills to extraction, skip everything elseSwitchControl
Extract the bill's header fields, then every line itemInsurGPT: CustomInsurGPT
Reconcile the line items against the bill's stated totalCustom Code BlocksUtility
Extract claim details, bill fields, and line items once for the whole package, then reconcile (single-claim path)InsurGPT: Custom / Custom Code BlocksInsurGPT / Utility
Synthesize one recommendation and reconciliation summary across every bill foundCustom Code BlocksUtility
Check extracted values and reconciliation results against rulesField ValidationUtility
Branch on whether review is requiredIfControl
Route the package to a person, only when neededReviewUtility
Close out the itemCompleteAction

What builders must configure before deployment

  • Classification and field sets. Tune the classification prompt and field sets to the bill formats and payers you actually receive.
  • Validation thresholds and review routing. Set confidence thresholds and the reviewer assignment to your standards. See Utility nodes.
  • A connection to your claim system. We recommend an HTTP node after validation to search your claim system, followed by a Custom Code Block to unpack the response and apply your own matching rules.

How the AI agent behaves

The agent first writes a reviewer-facing package overview — a summary, the providers involved, a rough total-billed estimate, and any red flags it notices on a first read — then decides whether the package covers a single claim or several, citing its evidence either way.

If the package covers multiple claims, it splits the package into separate documents and, for each one, classifies it and — if it's a medical bill — extracts the bill's header fields and every line item. If the package covers a single claim, it extracts the claim details, bill fields, and line items directly from the whole package without splitting it.

Either way, the flow then sums each bill's line items, compares them to its stated total, and returns Match, Mismatch, or Unable to Verify, before writing one consolidated reconciliation summary and recommendation across every bill in the package. Low-confidence or missing fields are flagged by validation rather than invented, and Grounding ties each extracted value back to its place on the page.

Human review model

Review happens on the item in the Bevaya Platform.

  • The Insights tab opens with an AI recommendation, key fields (bill count, estimated total billed, single vs. multiple claims), the package summary and providers involved, the reconciliation summary, and the multi-claim reasoning.
  • The Review tab is organized by group — Overview, Package, Claim Information, Document Classification, Medical Bill, and Line Items — where the reviewer confirms values, corrects a misclassification or a mistranscribed amount, and approves.

When a package is routed for review, the exception reason names the specific fields that were flagged — for example a reconciliation mismatch or a missing patient name — so the reviewer knows exactly what to check first. See Human review.

Run status and reporting

Each package becomes an item that moves through the standard lifecycle statuses — In Progress, Review, Complete, Failed, Canceled. Watch individual runs and inspect each step's input, output, and status in Run history, and see live counts of items by status on the Item status reporting page.

Example run

A claims handler uploads a package of three itemized statements tied to one claim: an ER visit, a follow-up office visit, and a round of physical therapy.

  1. The flow reads the files and writes a package overview — three bills, two providers, an estimated total billed.
  2. It determines the package covers a single claim, then extracts the claim-level details, each bill's header fields, and every line item.
  3. It reconciles each bill's line items against its stated total. Two match; the physical therapy bill's line items fall short of its stated total by $40.
  4. Validation flags the mismatch, and the package routes to review with the reconciliation mismatch named as the reason.
  5. The reviewer opens the item, checks the flagged bill's line items on the Review tab against the reconciliation detail, corrects the mistranscribed total, and submits. The item is marked complete.

Common failure modes

  • A bill's line items don't match its stated total. The flow always flags this for review rather than silently accepting or averaging it — the cause could be an extraction error, a duplicated or missing line, or a genuine billing error, and it's the reviewer's call.
  • A package mixing bills from different claims. The multi-claim check splits the package document-by-document so each claim's bills are extracted separately; the cited reasoning lets the reviewer confirm the split was correct.
  • Low-confidence or missing fields on a poor scan. Flagged by validation and surfaced for review rather than guessed.
  1. Connect it to your claim system. Add the HTTP and Custom Code Block nodes for your claim search and matching logic.
  2. Build and test on real bills. Use Run Draft on representative bill packages, inspecting each step. See Test and debug a draft.
  3. Pilot with a reviewer to confirm classification, extraction, reconciliation, and matching accuracy on your document mix.
  4. Promote to production. Publish the flow and configure your production trigger. See Drafts and publishing.

Where to go next

Last modified on