Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
97
rated 0 times [  104] [ 7]  / answers: 1 / hits: 26071  / 14 Years ago, sat, august 28, 2010, 12:00:00

I'm developing an online form in which user-entered Medicare numbers will need to be validated.



(My specific problem concerns Australian Medicare numbers, but I'm happy for answers regarding American ones too. This question is about Medicare numbers in general.)



So how should I do it?



(It would be good to have the answer in Javascript or a regex.)


More From » validation

 Answers
201

The regex supplied by Jeffrey Kemp (March 11) would help to validate the allowed characters, but the check algorithm below should be enough to validate that the number conforms to Medicare's rules.



The Medicare card number comprises:




  • Eight digits;

  • A check digit (one digit); and

  • An issue number (one digit).



Note: the first digit of the Medicare card number should be in the range 2 to 6.



Medicare card number check digit calculation




  1. Calculate the sum of: ((digit 1) + (digit 2 * 3) + (digit 3 * 7) + (digit 4 * 9) + (digit 5) + (digit 6 * 3) + (digit 7 * 7) + (digit 8 * 9))



where digit 1 is the highest place value digit of the Medicare card number and digit 8 is the lowest place value digit of the Medicare card number.



Example: for Medicare card number '2123 45670 1', digit 1 is 2 and digit 8 is 7.




  1. Divide the calculated sum by 10.

  2. The check digit is the remainder.



Example: For Medicare card number 2123 4567.




  1. (2) + (1 * 3) + (2 * 7) + (3 * 9) + (4) + (5 * 3) + (6 * 7) + (7 * 9) = 170

  2. Divide 170 by 10. The remainder is 0.

  3. The check digit for this Medicare number is 0.



Source: Use of Healthcare Identifiers in Health Software Systems - Software Conformance Requirements, Version 1.4, NEHTA, 3/05/2011


[#95777] Thursday, August 26, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
turnerf

Total Points: 620
Total Questions: 101
Total Answers: 109

Location: French Polynesia
Member since Tue, Jul 7, 2020
4 Years ago
turnerf questions
;