stdnum.ru.ogrn

ОГРН, OGRN, PSRN, ОГРНИП, OGRNIP (Russian Primary State Registration Number).

The ОГРН (Основной государственный регистрационный номер, Primary State Registration Number) is a Russian identifier for legal entities. The number consists of 13 or 15 digits and includes information on the type of organisation, the registration year and a tax inspection code. The 15 digit variant is called ОГРНИП (Основной государственный регистрационный номер индивидуального предпринимателя, Primary State Registration Number of an Individual Entrepreneur).

More information:

  • https://ru.wikipedia.org/wiki/Основной_государственный_регистрационный_номер

  • https://ru.wikipedia.org/wiki/Основной_государственный_регистрационный_номер_индивидуального_предпринимателя

>>> validate('1022200525819')
'1022200525819'
>>> validate('385768585948949')
'385768585948949'
>>> validate('1022500001328')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
stdnum.ru.ogrn.calc_check_digit(number: str) str

Calculate the control digit of the OGRN based on its length.

stdnum.ru.ogrn.compact(number: str) str

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

stdnum.ru.ogrn.is_valid(number: str) bool

Check if the number is a valid OGRN.

stdnum.ru.ogrn.validate(number: str) str

Determine if the given number is a valid OGRN.