Here are the references and the rules:
Briefly, here are the rules for human readable NDCs.
- HIPPA/NCPDP format NDC is always 5-4-2. If anybody enters an NDC manually, this is what we want.
- VISTA NDC format is 6-4-2. That's what's stored in the UPC/NDC file.
- On packages, manufactures put a human readable NDC of [4-5]-[3-4]-[1-2]. Yes, this is fricking confusing. If we have dashes, we can figure it out; if we don't have dashes, we can't.
Here are the rules for Barcodes: (GS1 = Various simple and stacked formats for a barcode; UPC = UPC formatted barcode) There are five formats for Barcodes on drugs. They are as follows:
- UPC or GS1 12 digit NDC (GTIN-12) number, starting with the number 3, 10 digit NDC, and a single digit checksum
- UPC 12 digit UPC number, starting with the number 0, 10 digits, and a single digit checksum.
- 14 digit GS1 GTIN (GTIN-14) code. This starts with [0-1]03, then 10 digit NDC, then a single digit for checksum.
- 16 digit GS1 GTIN (GTIN-16?) code. This appends 01 to the [0-1]03.
- Composite GS1 code containing the GTIN-16 + Expiration Date and Lot Number. An example can be found here: https://www.pfizer.com/files/do/barcode_standard.pdf. This will always start with the 16 digit GTIN.
The really sad thing is that there is no algorithm to map the barcode to NDC code; that's why we need to store them both. An NDC embedded barcode is 10 numbers; and the real NCPDP NDC is 11 numbers. We can guess, but it's only safe if the first number after the 3 is a zero.
Down to our algorithms... so, how do we decide in our software what's an NDC number and what's a barcode?
- If it's 10 or 11 digits, it's an NDC. 10 digits need to be zero padded at the left to make an 11 digit NDC.
- If it's 12, it has to start with a 3 or a zero. Starting with zero is frowned upon, but we don't have any other choice in public data sources.
- There is no such thing as 13 digit barcodes.
- 14 digits must match 1("0","1")1"03" at the beginning.
- 16 digits and higher must match 1"01"1("0","1")1"03" at the beginning. We can grab the exp date and lot number as well but we are not currently planning to since we don't have the data structures yet to support this.
Now, let's figure out what VISTA already has in PSONDCUT:
Okay, in NDCFMT^PSSNDCUT EITHER 11 digits are accepted, OR any of the 3 dashed formats are accepted. VISTA doesn't have an idea of a barcode.