lists.arthurdejong.org
RSS feed

Re: Stdnum: Mauritian national identifier number

[Date Prev][Date Next] [Thread Prev][Thread Next]

Re: Stdnum: Mauritian national identifier number



Hi Arthur

I got a response from the senior technical advisor to the Mauritian minister of Technology and communication with a description of how the check digit is generated and validated. There is some code below if you're interested in implementing it.

def get_check_digit(id_number, alphabet='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'):
    sum = 0
    for i in range(13):
        char_value = alphabet.find(id_number[i])
        weight = 14 - i
        sum += char_value * weight

    difference = 17 - (sum % 17)
    return alphabet[difference]

def is_valid(id_number):
    return get_check_digit(id_number) == id_number[-1] 

On Thu, Jul 12, 2018 at 9:09 PM, Bradley Smith <brad [at] businessoptics.biz> wrote:
Hi Arthur

I came across your stdnum library when looking for implementations of the Luhn and Verhoeff algorithms. I'm working on a project for the largest Mauritian insurance company trying to unify customer records across about 7 different systems. Ideally we would just match on the customers national identifier, but there are tons of data capture errors so we want to be able to validate these. All the Mauritians we've spoken to seem to think there is a check digit, but know one knows what the validation algorithm is. I also can't find anything online. The basic format of the ID numbers are:
  • First digit of the person's surname at birth
  • 2 digits for day of birth
  • 2 digits for month of birth
  • 2 digits for year of birth
  • 6 digit unique id
  • check character at the end (appears that it can be a digit or letter)
This forms a 14 character number. It seems a perfect candidate for the Luhn and Verhoeff algorithms. I've tried a number of customer IDs on both of these algorithms with the alphabet being a concatenation of digits and letters, also trying to reverse the letters and characters as well as changing the order of their concatenation. None of this seems to work.

I was hoping that given your experience in building these you either may know how to perform the checksum validation for Mauritius ID numbers or may be able to figure it out given a few sample ID numbers. 

Best

--
Brad Smith
Director at BusinessOptics



brad [at] businessoptics.biz
+27 83 6601869



--
Brad Smith
Director at BusinessOptics



brad [at] businessoptics.biz
+27 83 6601869
-- 
To unsubscribe send an email to
python-stdnum-users-unsubscribe@lists.arthurdejong.org or see
https://lists.arthurdejong.org/python-stdnum-users/