How NPIGrid Verifies NPIs, Crosswalks Taxonomies & Parses X12 EDI
Every calculation, reference dictionary, and EDI segment parser in NPIGrid is grounded directly in federal CMS regulations, NUCC code sets, and ASC X12 005010 implementation guides.
1. ISO/IEC 7812 Luhn Check-Digit Verification (80840 Prefix)
Per 45 CFR § 162.406, a National Provider Identifier is a 10-digit numeric string whose 10th digit is a Luhn check digit calculated after prepending the 5-digit constant 80840 (80 = health applications, 840 = United States ISO 3166 numeric code) to the first 9 digits.
Because 80840 occupies positions 11–15 from the right in the full 15-digit string, its Luhn weighted sum is always the constant 24. NPIGrid doubles alternating digits starting from position 2 (the 9th NPI digit), sums individual digits of any product ≥ 10, adds 24, and computes (10 - (sum % 10)) % 10. When a check digit fails, NPIGrid immediately computes and suggests the expected 10th digit.
2. Live CMS NPPES v2.1 API Proxy Architecture
The CMS NPPES v2.1 API does not expose browser CORS headers for direct front-end fetches. NPIGrid operates a hardened, read-only server proxy at /api/npi/search locked strictly to https://npiregistry.cms.hhs.gov/api/ with Zod parameter allowlisting, strict Origin/Sec-Fetch-Site verification, per-IP sliding-window and daily rate limiting, a 12-second upstream timeout, zero retry amplification, a 2 MB streaming payload ceiling, and a 10-minute in-memory server instance cache for repeat queries.
3. Local In-Browser ASC X12 005010 (835 & 837) Parsing
Our client-side X12 tokenizer auto-detects the element separator (character 4 of ISA), component/sub-element separator (ISA16), repetition separator (ISA11), and segment terminator directly from the file's ISA envelope — supporting both single-line streams and CRLF/LF formatted clearinghouse files.
- 835 ERA (005010X221A1): Parses
BPR,TRN,N1/N3/N4/REF,CLP,NM1,SVC, multi-tripletCAS,AMT*B6,LQ*HE,MOA/MIA, andPLBwith automatic BPR net payment reconciliation. - 837P / 837I (005010X222A1 / X223A2): Tracks
HLbilling/subscriber/patient hierarchies, validatesNM1*85andNM1*82NPIs with Luhn 80840 math, formatsHIICD-10-CM codes, and resolvesSV1diagnosis pointers directly onto exported CSV rows. - CSV Safety: All client-side CSV downloads follow RFC-4180 quoting and neutralize spreadsheet formula-injection prefixes (
=,+,-,@).
4. Reference Data Verification & SHA-256 Integrity
Our curated NUCC Taxonomy and X12 CARC/RARC reference tables are verified automatically on every build and weekly CI schedule against a tracked SHA-256 integrity manifest (src/data/manifest.json) to ensure format compliance and prevent silent drift.
Authoritative Federal & Standards Sources
CMS NPPES NPI Registry (Public Search & Enumeration)
Primary federal registry for Type 1 (Individual) and Type 2 (Organization) National Provider Identifiers.
CMS NPPES Read-Only API v2.1 Documentation
Official REST endpoint specification proxied live by NPIGrid's /api/npi/search service.
NUCC Health Care Provider Taxonomy Code Set
Authoritative 10-character alphanumeric Grouping → Classification → Specialization taxonomy code standard.
CMS HIPAA Administrative Simplification & X12 835 / 837 Transactions
Federal adoption standards for ASC X12 005010X221A1 (835 ERA) and 005010X222A1 / 005010X223A2 (837P/837I).
ASC X12 External Code Lists (CARC & RARC)
Official Claim Adjustment Reason Codes (CARC) and Remittance Advice Remark Codes (RARC) decoded in our directory and 835 viewer.
HHS HIPAA Privacy & Security Rules
Regulatory framework guiding NPIGrid's zero-upload, 100% client-side EDI processing architecture.