Back to packs

Pharmacy Claims (NCPDP)

HIPAAfree

Validate pharmacy claims — NDC codes, days supply, quantity dispensed, DEA schedules, prescriber NPI, and dispense date sequences per NCPDP standards.

10 rules 2699 downloads4.6 avg (110)
pharmacyncpdpndcprescriptioncontrolled-substancedeapart-ddispensing
4.6(110 ratings)

Sign in to rate this pack

Test this pack with your data

Download the template, fill in your data, and see quality results instantly.

Test This Pack

Download & Install

Choose your tool — get a ready-to-run file

Run this on your data? Upload your CSV — we'll auto-map the columns, validate, and report the bad rows.Test my data
Or use the CLI
$ npx dqhub install pharmacy-claims --format soda --table YOUR_TABLE

About this pack

Data quality checks for pharmacy claims data aligned to NCPDP Telecommunication Standard and CMS Part D requirements. Covers: - NDC (National Drug Code) 11-digit format validation (5-4-2 labeler-product-package) - Days supply plausibility (1-365 range, warning at 90+) - Quantity dispensed validation (positive, reasonable limits) - Fill/refill number validation (0-99) - DEA controlled substance schedule validation (no Schedule I dispensing) - Prescriber NPI required for controlled substances - Drug-age compatibility (pediatric formulations, Beers Criteria for elderly) - Dispense date sequencing (written date <= dispense date <= today) Standards: NCPDP D.0, CMS Part D, DEA 21 CFR 1308, FDA NDC Directory

Sources & References

NCPDP — NCPDP Telecommunication Standard

NDC codes submitted on pharmacy claims must conform to the 11-digit 5-4-2 format per NCPDP standards

HIPAA — 45 CFR 162.1602

NDC is the mandated code set for reporting drugs and biologics on HIPAA standard transactions

FDA — 21 CFR Part 207

NDC format is established by FDA for drug product identification

NCPDP — NCPDP Telecommunication Standard Field 405-D5

Days supply must be a valid numeric value representing the estimated number of days the prescription will last

CMS — Medicare Part D Claims Processing

Days supply is required on Part D claims and must be clinically plausible for the dispensed quantity

NCPDP — NCPDP Telecommunication Standard Field 442-E7

Quantity dispensed must be a positive numeric value representing the metric quantity actually dispensed

CMS — Medicare Part D Claims Processing Manual

Quantity dispensed is required and must accurately reflect the amount of drug provided to the beneficiary

NCPDP — NCPDP Telecommunication Standard Field 403-D3

Fill number must be a valid numeric value where 0 represents the original fill and 1-99 represent refills

DEA — 21 CFR Part 1308

The Controlled Substances Act establishes five schedules; only Schedules II-V may be dispensed by a pharmacy

DEA — 21 CFR 1306.05

All controlled substance prescriptions must include the prescriber's identification, including their NPI

HIPAA — 45 CFR 162.406

NPI is the standard unique health identifier for healthcare providers in all HIPAA transactions

NCPDP — NCPDP Telecommunication Standard Field 411-DB

Prescriber ID must be present and valid on pharmacy claims, particularly for controlled substances

CMS — Medicare Part D Medication Therapy Management

Plans must ensure medications are appropriate for the patient population, including age-based contraindication screening

USP — USP General Chapter 795 / Beers Criteria

American Geriatrics Society Beers Criteria identifies potentially inappropriate medications for older adults

NCPDP — NCPDP Telecommunication Standard Fields 401-D1, 414-DE

Date of service (dispense date) and date prescription written must be logically consistent

CMS — Medicare Part D Claims Processing Manual Chapter 5

Dispense date must be on or after the written date and cannot be a future date for claim adjudication

HIPAA — HIPAA Transaction Standards

Date fields on claims must be accurate and chronologically valid

CMS — NPPES National Provider Identifier Standard

All HIPAA-covered entities must use NPIs that conform to the 10-digit format starting with 1 or 2

CMS — 45 CFR 162.406 - Standard unique health identifier for health care providers

The check digit in position 10 must satisfy the Luhn algorithm when prefixed with the constant 80840

HIPAA — 45 CFR Part 162 Subpart D

NPI check digit validation is required per the National Provider Identifier standard

What's included

4format rules
3range rules
2consistency rules
1completeness rules

Checks included (10)

NDC 11-Digit Format Validation(ndc_code)

Validates that National Drug Code (NDC) values conform to the 11-digit format. NDCs identify the labeler (5 digits), product (4 digits), and package (2 digits). Accepts both hyphenated 5-4-2 format and unhyphenated 11-digit format. NDCs are required on all pharmacy claims and must be properly formatted for adjudication.

DEA Schedule Validation(dea_schedule)

Validates that the DEA controlled substance schedule on pharmacy claims contains only permitted values for dispensing. Valid values are II, III, IV, V (or their numeric equivalents 2-5), or null/blank for unscheduled drugs. Schedule I substances cannot be legally dispensed in a pharmacy setting and are flagged as invalid.

National Provider Identifier (NPI) Format(npi)

Validates that values conform to the NPI (National Provider Identifier) basic format. An NPI is exactly 10 digits and must begin with 1 (individual providers) or 2 (organizational providers). This check validates structure only; use the npi-luhn-check rule to verify the check digit.

NPI Luhn Check Digit Validation(npi)

Validates the NPI check digit using the Luhn algorithm as specified in 45 CFR 162.406. The algorithm prefixes '80840' to the first 9 digits of the NPI, then applies the Luhn mod-10 formula. The 10th digit of the NPI must equal the computed check digit. This ensures the NPI is not just well-formed but mathematically valid.

Days Supply Plausibility Check(days_supply)

Validates that the days supply field on pharmacy claims is within a plausible range. Days supply must be between 1 and 365 (inclusive). Values exceeding the warning threshold (default 90 days) are flagged as warnings, as they may indicate data entry errors or require clinical review. Zero or negative values are invalid.

Quantity Dispensed Positive Value Check(quantity_dispensed)

Validates that the quantity dispensed on pharmacy claims is a positive value greater than zero and does not exceed 9999. Quantity dispensed represents the total units (tablets, capsules, mL, etc.) provided to the patient and must be a clinically reasonable positive number.

Fill Number (Refill Count) Validation(fill_number)

Validates that the fill number (refill count) on pharmacy claims is within the valid range of 0 to 99. A fill number of 0 indicates the original dispensing (first fill), while values 1-99 represent subsequent refills. This field is critical for tracking prescription utilization and detecting potential fraud or abuse.

Drug-Age Compatibility Check

Validates that prescribed drugs are age-appropriate for the patient. Flags pediatric-only formulations (liquid suspensions, chewable tablets) dispensed to adults over the configurable adult age threshold, and identifies drugs contraindicated for elderly patients (over 65) based on the Beers Criteria. This rule uses drug name pattern matching as a first-pass screen and should be supplemented with a clinical formulary reference for production use.

Dispense Date Sequence Validation

Validates the chronological sequence of pharmacy claim dates. The written date (date prescription was written) must be on or before the dispense date (date medication was dispensed), and the dispense date must not be in the future. This ensures temporal consistency of pharmacy claims and catches backdated or future-dated prescriptions that may indicate fraud or data entry errors.

Prescriber NPI Present for Controlled Substances

Validates that a valid 10-digit NPI (National Provider Identifier) is present for the prescriber on all controlled substance claims (DEA Schedule II-V). Federal and state regulations require prescriber identification on controlled substance prescriptions. The NPI must conform to the standard 10-digit format beginning with 1 or 2.