Components: <ID number (NM)> ^ <check digit (NM)> ^ <code identifying the check digit scheme employed (ID)> ^ < assigning authority (HD)>
Example:
|128952^6^M11^ADT01|
This data type is used for certain fields that commonly contain check digits, e.g., PID-3-patient ID (internal). If a site is not using check-digits for a particular CK field, the second and third components are not valued.
The check digit in this data type is not an add-on produced by the message processor. It is the check digit that is part of the identifying number used in the sending application. If the sending application does not include a self-generated check digit in the indentifying number, this component should be valued null.
The check digit scheme codes are defined in HL7 table 0061 - Check digit scheme.
Table 0061 - Check digit scheme
Value |
Description |
M10 |
Mod 10 algorithm |
M11 |
Mod 11 algorithm |
The algorithm for calculating a Mod10 check digit is as follows:
Assume you have an identifier = 12345. Take the odd digit positions, counting from the right, i.e., 531, multiply this number by 2 to get 1062. Take the even digit positions, starting from the right (i.e., 42), prepend these to the 1062 to get 421062. Add all of these six digits together to get 15. Subtract this number from the next highest multiple of 10, i.e., 20 - 15 to get 5. The Mod10 check digit is 5. The Mod10 check digit for 401 is 0; for 9999, its 4; for 99999999, its 8.
The algorithm for calculating a Mod11 check digit is as follows:
Terms
d |
= |
digit of number starting from units digit, followed by 10s position, followed by 100s position, etc. |
w |
= |
weight of digit position starting with the units position, followed by 10s position, followed by 100s position etc. Values for w = 2, 3, 4, 5, 6, 7, 2, 3, 4, 5, 6, 7, etc. (repeats for each group of 6 digits) |
c |
= |
check digit |
Calculation
(Step 1) m |
= |
sum of (d * w) for positions 1, 2, etc. starting with units digit for d = digit value starting with units position to highest order for w = weight value from 2 to 7 for every six positions starting with units digit |
(Step 2) c1 |
= |
m mod 11 |
(Step 3) if c1 |
= |
0 then reset c1 = 1 |
(Step 4) |
= |
(11 - c1) mod 10 |
Example:
if the number is 1234567, then the mod 11 check digit = 4
The calculations are:
M = (7*2)+(6*3)+(5*4)+(4*5)+(3*6)+(2*7)+(1*2)
= 14 + 18 + 20 + 20 + 18 + 14 + 2
= 106
c1 = 106 mod 11
= 7
c = (11-c1) mod 10
= 4 mod 10
= 4
Other variants of these check digit algorithms exist and may be used by local bilateral site agreement.
The assigning authority is a unique name of the system that creates the data. It is an HD data type. It is equivalent to the application ID of the placer or filler order number (see Chapter 4). Assigning authorities are unique across a given HL7 implementation.