checksum

checksum

Used for validating the Luhn-30 checksums used with the OpenMRS and ChildCount+ health IDs.

checksum.checksum.BASE_CHARACTERS = u'0123456789acdefghjklmnprtuvwxy'

Valid characters for health IDs

exception checksum.checksum.CheckDigitException[source]

Raised on invalid input to checksum methods

checksum.checksum.clean_chars(chars)[source]

Remove whitespace

checksum.checksum.get_check_digit(identifier, base_chars)[source]

Compute the check digit for an identifier using the specified legal characters.

Parameters:
  • identifier (unicode) – String on which to compute the checksum
  • base_chars (unicode) – String of legal characters
checksum.checksum.is_valid_identifier(identifier, base_chars=u'0123456789acdefghjklmnprtuvwxy')[source]

Use the Luhn-30 checksum to validate a string

Parameters:
  • identifier (unicode) – String whose validity should be checked
  • base_chars (unicode) – String of legal characters
Returns:

bool