EAN
identity.commerce.eanEuropean Article Number (also called Universal Product Code / UPC). Standard versions: EAN-8 (8 digits) and EAN-13 (13 digits). Last digit is check digit.
Worked samples
DuckDB 1.5.5 · finetype 0.6.64
| Value | As VARCHAR | ean_version |
|---|---|---|
| 5901234123457 | 5901234123457 | EAN-13 |
| 96385074 | 96385074 | EAN-8 |
| 4006381333931 | 4006381333931 | EAN-13 |
Shape
^[0-9]{8}$|^[0-9]{13}$| Value | Length | Shape |
|---|---|---|
| 5901234123457 | 13 | matches |
| 96385074 | 8 | matches |
| 4006381333931 | 13 | matches |
| 590123412345 | 12 | rejected: one character short |
Told apart
Going the other way, this type's own rule accepts 1 of 3 samples of ISBN.
Background
Origin
In 1974 the U.S.-based Uniform Code Council (UCC) was appointed as administrator of the new Universal Product Code (U.P.C) barcode.[1] In 1977 the European Article Numbering Association (EAN) was established as an international, not-for-profit standards organisation in Brussels, Belgium.[1] The UCC and EAN merged in 2005, creating a single international organisation with 101 local GS1 Member Organisations.[1]
The EAN system has been integrated into the broader Global Trade Item Number (GTIN) standard.[2]
Use
The first three digits usually identify the GS1 Member Organisation the manufacturer joined, but do not necessarily declare where the product is made.[2] So a prefix is a poor guide to a product's country of origin, and it is best not to derive one from it. (Meridian's view)
EAN-13 codes beginning with 0 are 12-digit UPC codes with a 0 prepended.[2] Keep these codes as text: a spreadsheet or numeric column that drops that leading zero turns a valid EAN-13 into a 12-digit string. (Meridian's view) When a file mixes 12- and 13-digit codes, padding the shorter ones with a leading zero is usually the fair way to compare them. (Meridian's view)
The EAN prefix 978, and later 979, has been allocated since the 1980s for books, so that ISBNs can be carried as EANs.[2] The prefix 977 indicates an International Standard Serial Number (ISSN).[2] A 13-digit code starting 978 or 979 is likely a book's ISBN, so check that prefix before you classify a column as general product codes. (Meridian's view)
Where you'll meet it
Open Food Facts describes the code field in its CSV export as the product barcode, which can be EAN-13 or an internal code for some food stores.[3] For products without a barcode, Open Food Facts assigns a number starting with the reserved prefix 200.[3]
Sources
- [1]The History of GS1 Barcodes: First Scan to QR Code Futureorganisation
- [2]International Article Numbersecondary source
- [3]data-fields.txtdataset
Detection notes
v1 migration: Was code.ean. EAN-13 is most common. EAN-8 used for small packages. Check digit via Luhn algorithm (validated in crate).
Use it
$ finetype infer -i "5901234123457" --mode column
→ identity.commerce.ean
SELECT ft_infer('5901234123457');
-- → 'identity.commerce.ean'CAST({col} AS VARCHAR)Schema
https://meridian.online/schemas/identity.commerce.ean · Frictionless type string
finetype taxonomy identity.commerce.ean -o json-schema