ActiveLogin.Identity icon indicating copy to clipboard operation
ActiveLogin.Identity copied to clipboard

Add support for Finnish personal identity number

Open nikolaykrondev opened this issue 6 years ago • 1 comments

Is your feature request related to a problem? Please describe. There is a need to have the same perfect functional of parser and validator for Finnish personal identity number.

What area is it related to New package, perhaps refactor of existing SwedishPersonalIdentityNumber parser to unify it

Describe the solution you'd like We will have to fulfil the following checklist:

  • [ ] Move common parts to a separate project
  • [ ] Create its own type for Finnish Personal Identity Number since they have a bit different format
  • [ ] Expose c# api with proper documentation
  • [ ] Refactor existing parser, add support for delimiter parser function
  • [ ] Find test data at Finnish "skatteverket" and create its own project
  • [ ] Create unit tests

Describe alternatives you've considered N/A

Additional context After quick look there is a really good description on wiki and it does not look as complex as Swedish one:

In Finland, the Personal Identity Code (Finnish: henkilötunnus (abbreviated as HETU), Swedish: personbeteckning), also known as Personal Identification Number, was introduced in 1964 and it is used for identifying the citizens in government and many corporate and other transactions. It consists of eleven characters of the form DDMMYYCZZZQ, where DDMMYY is the day, month and year of birth, C the century sign, ZZZ the individual number and Q the control character (checksum). The sign for the century is either + (1800–1899), - (1900–1999), or A (2000–2099). The individual number ZZZ distinguishes persons with the same date of birth from each other and it is odd for males and even for females and for people born in Finland its range is 002–899. Numbers 900–999 are used for temporary personal identification, for example in hospitals, when an official ID is not known or has not yet been given to a child born. Temporary IDs are not logged in the Finnish Population Information System.

An example of a valid code for a fictional female born on 13 October 1952 is 131052-308T. The control character, either a number or a letter, is calculated as the remainder of DDMMYYZZZ divided by 31, i.e. by dropping the century sign and dividing the resulting nine-digit number by 31. Taking the number series, in this case .806451613 appearing after the decimal point and multiplying it by 31 and rounding the resulting number to the nearest whole number gives the remainder. The corresponding character is then picked from the string "0123456789ABCDEFHJKLMNPRSTUVWXY" (ambiguous letters G, I, O, Q, and Z are not used). For remainders below ten, the remainder itself is the control character whereas 10 corresponds to A, 11=B, 12=C, ending up with 30=Y. In this example, 131052308 / 31 = .806451613 x 31 = 25.000000003 rounded to 25=T. Source

nikolaykrondev avatar Nov 20 '19 16:11 nikolaykrondev

More information: https://vrk.fi/en/personal-identity-code1#

viktorvan avatar Nov 21 '19 06:11 viktorvan