DocsValidators

cpt_code validator

AMA CPT — exactly 5 digits, no checksum.

Format

Matches `/^\d{5}$/`. Exactly 5 digits.

Examples

  • 99213 (Office visit, established patient, 20-29 min)
  • 93000 (Electrocardiogram, routine)
  • 36415 (Routine venipuncture)

Implementation

Faithful summary of lib/validators.ts. Validators are pure functions and run identically in the worker, the Workbench, and the MCP server.

function validCpt(value) {
  return /^\d{5}$/.test(value)
    ? OK
    : fail('cpt_format', 'expected 5 digits')
}

Use in a template

Validators attach to a field on a custom template. The cascade runs them after mapping but before commit; failures surface in the per-row validation report.

fields:
  - column: cpt_code
    type: string
    validators:
      - type: cpt_code

Common gotchas

  • HCPCS Level II codes (one letter + 4 digits, e.g. `J3490`) are rejected. Use a separate validator if you mix CPT and HCPCS.
  • CPT Category II (4 digits + `F`) and Category III (4 digits + `T`) codes also fail the shape — they are not pure 5-digit.
  • No AMA registry lookup. `00000` and `99999` both pass the format check.

Related templates

  • Claims line itemsclaims_line_items_v1

    CPT/ICD-10-coded claim line items.

    Fields: cpt_code

Pricing

Validators run on every committed row

Schema-only mode (headers + ≤3 sample rows) is free and unlimited; full-data commits are metered. See plans →