Build

Optional report autofill

Review suggestions from a report PDF and apply them to empty bill fields.

Enable access for the organization

Report autofill is an optional feature available by written agreement and operator provisioning. MindBill must enable the organization's reportAutofill capability. The component is hidden unless your host opts in; mounting it does not enable the capability.

From your authenticated server, mint a dedicated organization-wide browser session with autofill:run, backed by an approved operator server credential with embed:write and autofill:write. Check the current user's authorization before minting it. Keep this separate from bill-scoped sessions. Customer- and bill-scoped credentials cannot use report autofill. The developer console does not mint this permission.

Follow the browser-session security contract. Never put an API key in a component or browser storage.

Add the review component

React 0.67.0 adds the optional reportAutofill connection to BillSubmissionForm. Keep your existing billing session and pass a separately authorized report session.

ReportBill.tsx
import { BillSubmissionForm } from "@mindbill/react";

<BillSubmissionForm
  initialBill={draft}
  getSession={getBillSession}
  reportAutofill={{ getSession: getReportSession }}
/>

For a custom form, use ReportAutofill. It calls onApply only after the user reviews the result and explicitly chooses to apply it. Use applyReportAutofill to preserve existing values.

ReportSuggestions.tsx
import { ReportAutofill, applyReportAutofill } from "@mindbill/react";

<ReportAutofill
  getSession={getReportSession}
  onApply={(suggestions) => setDraft((current) =>
    applyReportAutofill(current, suggestions, profileOptions))}
/>

A native or custom authenticated application may instead pass analyzeReport(file: File): Promise<ReportAutofillResult>. This replaces browser-session extraction; return the unwrapped result from your authorized server endpoint. The endpoint must enforce access and the organization's capability. File validation and explicit review still apply.

Review suggestions and preserve existing data

Upload one non-empty, unencrypted PDF of 1–100 pages, no larger than 25 MiB. Review each value, its source excerpt and confidence, saved-record matches, and warnings. Extraction uses gpt-5.6-luna; every result requires human review.

Apply to empty bill fields preserves populated fields and all service lines. Already selected or partially entered provider identity groups stay together. A unique saved-profile match can fill an empty group; ambiguous matches require manual selection. Dates must be valid calendar dates. Patient addresses and service-facility addresses remain separate.

Extraction does not save or attach the PDF to a bill. Add it separately through your attachment workflow when required. Hosts that store the report themselves may set attachmentHelpText to describe that behavior; this text does not change storage or upload behavior.

Use the extraction API directly

report-autofill.ts
import { createReportAutofillClient } from "@mindbill/browser";

const client = createReportAutofillClient({ getSession: getReportSession });
const suggestions = await client.analyze(file);
// Show fields, source excerpts, confidence, matches, and warnings for review.
// Apply only after the user confirms. Never submit a bill automatically.

Browser 0.42.0 calls POST /partner/v2/report-autofill with multipart field report. Server integrations require an approved operator credential with autofill:write and the same organization capability. The HTTP response wraps the result in data; the browser client returns the unwrapped result.

  • model and requiresReview: true identify the extraction and required review.
  • fields contains key, value, sourceText, and confidence (high or medium).
  • matches contains patient, billing-provider, rendering-provider, and service-location matches. Each has a matched, ambiguous, or none status and candidate IDs/names. Only a unique match has selectedId.
  • warnings contains issues to present during review.

See the complete extraction endpoint reference. A 403 response can indicate missing permission or an organization capability that has not been enabled. Display the server error and correct access through the trusted server; the component does not provision access.

Verify with a synthetic PDF

Test an empty form, a partially completed form, ambiguous profile matches, an invalid PDF, and a denied session. Confirm users can review source excerpts, populated values and service lines remain unchanged, and no extraction or apply action submits a bill. Keep report contents and extracted personal data out of logs.