Skip to main content
coding_format_validation deterministically validates the format of generated charges. It is part of the Nanonets Coding Engine tool group and implements the rules described in coding-validator-format.md. This is a pure-compute tool (no LLM, no external calls). Run it after the verifier step and before optional write-back.

Inputs

  • charges (required): array of charges, each with cpt_code and optional diagnosis_codes and modifiers.

Validation behavior

  • CPT/HCPCS format: five digits (99214), four digits + one uppercase letter (0509F), or one letter + four digits (HCPCS Level II, e.g. J3490). Invalid format is an error.
    • Note: this is a superset of the original “five digits or four digits plus one uppercase letter” rule. HCPCS Level II (letter + four digits) is included because the CPT generation step legitimately emits drug J-codes; flagging them would block valid write-backs.
  • ICD-10 format: a broad pattern accepting both dotted (F33.1) and dotless (F329) forms, including valid U-codes such as U07.1. Invalid format is an error.
  • Modifier length: each modifier is expected to be 2 characters; anything else is a warning (does not invalidate the charge).

Output

valid is false when any error-severity issue is present (warnings alone keep it true).

Human-readable text

In the task feed the tool renders a ## Format Validation table (valid, issue count) and an ## Issues table (severity, source, code, problem). The full result struct stays in structuredContent.

Agent Instruction Guidance

If valid=false, do not write back to the EHR without human review. Merge validation_issues into the final output’s validation_issues array.

Notes

  • Deterministic tool. Free to call. default_enabled is false.