stdnum.do.cedula

Cedula (Dominican Republic national identification number).

A cedula is is an 11-digit number issues by the Dominican Republic government to citizens or residents for identification purposes.

>>> validate('00113918205')
'00113918205'
>>> validate('00113918204')
Traceback (most recent call last):
    ...
InvalidChecksum: ...
>>> validate('0011391820A')
Traceback (most recent call last):
    ...
InvalidFormat: ...
>>> format('22400022111')
'224-0002211-1'
stdnum.do.cedula.check_dgii(number: str, timeout: float = 30, verify: bool | str = True) dict[str, str] | None

Lookup the number using the DGII online web service.

This uses the validation service run by the the Dirección General de Impuestos Internos, the Dominican Republic tax department to lookup registration information for the number. The timeout is in seconds.

Returns a dict with the following structure:

{
    'cedula': '12345678901',  # The requested number
    'name': 'The registered name',
    'commercial_name': 'An additional commercial name',
    'status': '2',            # 1: inactive, 2: active
    'category': '0',          # always 0?
    'payment_regime': '2',    # 1: N/D, 2: NORMAL, 3: PST
}

Will return None if the number is invalid or unknown.

stdnum.do.cedula.compact(number: str) str

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

stdnum.do.cedula.format(number: str) str

Reformat the number to the standard presentation format.

stdnum.do.cedula.is_valid(number: str) bool

Check if the number provided is a valid cedula.

stdnum.do.cedula.validate(number: str) str

Check if the number provided is a valid cedula.