# stdnum.pl.regon

REGON (Rejestr Gospodarki Narodowej, Polish register of economic units).

The REGON (Rejestr Gospodarki Narodowej) is a statistical identification number for businesses. National entities are assigned a 9-digit number, while local units append 5 digits to form a 14-digit number.

More information:

- https://bip.stat.gov.pl/en/regon/

- https://wyszukiwarkaregon.stat.gov.pl/appBIR/index.aspx

    >>> validate('192598184')
    '192598184'
    >>> validate('123456785')
    '123456785'
    >>> validate('192598183')
    Traceback (most recent call last):
        ...
    InvalidChecksum: ...
    >>> validate('12345678512347')
    '12345678512347'
    >>> validate('12345678612342')  # first check digit invalid
    Traceback (most recent call last):
        ...
    InvalidChecksum: ...
    >>> validate('12345678512348')  # last check digit invalid
    Traceback (most recent call last):
        ...
    InvalidChecksum: ...

stdnum.pl.regon.calc_check_digit(number)

  Calculate the check digit for organisations. The number passed should not have the check digit included.

stdnum.pl.regon.compact(number)

  Convert the number to the minimal representation. This strips the number of any valid separators and removes surrounding whitespace.

stdnum.pl.regon.is_valid(number)

  Check if the number is a valid REGON number.

stdnum.pl.regon.validate(number)

  Check if the number is a valid REGON number. This checks the length, formatting and check digit.