# Adding Check Digits LOINC Part and Answer identifiers

**URL:** <https://forum.loinc.org/t/adding-check-digits-loinc-part-and-answer-identifiers/612>\
**Category:** data-model\
**Created:** [March 7, 2008, 6:24pm UTC](https://forum.loinc.org/t/adding-check-digits-loinc-part-and-answer-identifiers/612 "2008-03-07T18:24:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dvreeman](https://forum.loinc.org/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@dvreeman](https://forum.loinc.org/u/dvreeman)\
**Post date:** [March 7, 2008, 6:24pm UTC](https://forum.loinc.org/t/adding-check-digits-loinc-part-and-answer-identifiers/612/1 "2008-03-07T18:24:01Z")

</div>

We are considering adding a mod-10 check digit to the current identifiers for LOINC Parts and Answers, similar to how we use a check digit on the main LOINC codes. [Check digits](http://en.wikipedia.org/wiki/Check_digit) can be used to help prevent mis-keying the identifier.  
  
  
  
Would this cause major problems for any current users?

---

<div class="post-metadata">

**Author:** ![jhook](https://forum.loinc.org/letter_avatar_proxy/v4/letter/j/aca169/32.png) [@jhook](https://forum.loinc.org/u/jhook)\
**Post date:** [March 13, 2008, 3:00pm UTC](https://forum.loinc.org/t/adding-check-digits-loinc-part-and-answer-identifiers/612/2 "2008-03-13T15:00:22Z")

</div>

Strictly speaking, the mod10 check digit algorithm is only applicable to numbers. The LOINC part and answer string identifiers are prefixed by the strings “LP” and “LA” respectively. This implies that we cannot use a mod10 check digit algorithm on these identifiers. To get around this problem, we are proposing to using a modification to the algorithm that is described here [http://openmrs.org/wiki/Check\_Digit\_Algorithm#Our\_variation\_on\_the\_Luhn\_algorithm](http://http://openmrs.org/wiki/Check_Digit_Algorithm#Our_variation_on_the_Luhn_algorithm). This variation allows for the creation of a check digit on an arbitrary ASCII string.

---

<div class="post-metadata">

**Author:** ![system](https://forum.loinc.org/uploads/default/original/1X/dbab97ce9b2987d788a376e254fcaae249f3b672.png) [@system](https://forum.loinc.org/u/system)\
**Post date:** [March 26, 2008, 5:00pm UTC](https://forum.loinc.org/t/adding-check-digits-loinc-part-and-answer-identifiers/612/3 "2008-03-26T17:00:37Z")

</div>

_@jhook wrote:_

> Strictly speaking, the mod10 check digit algorithm is only applicable to numbers. The LOINC part and answer string identifiers are prefixed by the strings “LP” and “LA” respectively. This implies that we cannot use a mod10 check digit algorithm on these identifiers. To get around this problem, we are proposing to using a modification to the algorithm that is described here [http://openmrs.org/wiki/Check\_Digit\_Algorithm#Our\_variation\_on\_the\_Luhn\_algorithm](http://http://openmrs.org/wiki/Check_Digit_Algorithm#Our_variation_on_the_Luhn_algorithm). This variation allows for the creation of a check digit on an arbitrary ASCII string.

  
  
  
  
I’m not sure if it’s the same as _[Luhn mod N algorithm](http://en.wikipedia.org/wiki/Luhn_mod_N_algorithm)_, but it seems to be widely implemented too. It can support alphanumeric characters as well. From the description, it seems to support multibyte (Unicode) characters too.

---

<div class="post-metadata">

**Author:** ![system](https://forum.loinc.org/uploads/default/original/1X/dbab97ce9b2987d788a376e254fcaae249f3b672.png) [@system](https://forum.loinc.org/u/system)\
**Post date:** [June 23, 2023, 3:36pm UTC](https://forum.loinc.org/t/adding-check-digits-loinc-part-and-answer-identifiers/612/4 "2023-06-23T15:36:18Z")

</div>


