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 withcpt_codeand optionaldiagnosis_codesandmodifiers.
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 anerror.- 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 asU07.1. Invalid format is anerror. - 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
Ifvalid=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_enabledis false.