A python package for validating and processing JMBG numbers (Eng: UMCN).
(Kliknite ovde za verziju na Srpskom)
Unique Master Citizen Number (Cr/Ba/Srb: Jedinstveni matični broj građana, JMBG) is an identification number that is assigned to every citizen of former Yugoslav republics of the SFR Yugoslavia. This function can be used to efficiently verify a JMBG number, and to simply access all data contained inside.
Check wiki for more information.
from jmbg import jmbg
# initializes a JMBG object
x = jmbg('0404003710088')
x.is_valid()
# returns: True
Checks if the JMBG number is valid according to the official format 'abcdefghijklm', using the control digit and the formula:
m = 11 − (( 7×(a + g) + 6×(b + h) + 5×(c + i) + 4×(d + j) + 3×(e + k) + 2×(f + l) ) mod 11)
x.date()
# returns: datetime.date(2003, 4, 4)
x.political_region()
# returns: 'Beograd'
Gets the name of the political region where the person was born (containing č,ć,š...), or the string 'Foreigner' when the person was not born in one of the political regions, or the string 'Temporary residence' when a person is a temporary resident.
x.ordinal()
# returns: '008'
Gets the unique ordinal number of the particular RR (represents a person within the DDMMYYYRR section in the particular political region).
000–499 codes are used for male gender, while 500–999 codes are used for female gender.
x.gender()
# returns: 'Male'
x.control_digit()
# returns: '8'
Gets the control digit (last digit)
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please contact me for any requests and suggestions.
Mail: Radomir Perišić