Add en-GB ID Numbers (aka National Insurance Numbers)#3032
Add en-GB ID Numbers (aka National Insurance Numbers)#3032stefannibrasil merged 8 commits intofaker-ruby:mainfrom
Conversation
In GB, we use [national insurance numbers](https://www.gov.uk/national-insurance/your-national-insurance-number) as our primary citizen identification numbers. These are 9 digit strings that are typically 2 alpha characters followed by 6 numbers and finally a single alpha. There are few combinations are not permitted [as seen here](https://www.gov.uk/hmrc-internal-manuals/national-insurance-manual/nim39110). The `valid` code provided will produce a subset of all legal NI numbers. A regex in the locale file to produce all combinations isn't necessary.
5fe1451 to
41ea916
Compare
stefannibrasil
left a comment
There was a problem hiding this comment.
Thank you for the screenshots! What do you think of adding a note in the documentation for this locale that the result will be normalized? The doc could have a section for locales: https://github.com/faker-ruby/faker/blob/main/doc/default/id_number.md?plain=1
|
Great shout! I've attempted to document it in the same style and writing style. Happy to rewrite according to any examples. Feedback very welcome, I doubt you could offend me. 😄 |
stefannibrasil
left a comment
There was a problem hiding this comment.
Thank you @stefanjcollier I left some suggestions.
|
just checking in on this PR, @stefanjcollier. Please address the previous comments when you have some time. Thanks! |
stefannibrasil
left a comment
There was a problem hiding this comment.
I've committed the suggestions on this branch. Thanks for improving faker!


Motivation / Background
In GB, we use national insurance numbers as our primary citizen identification numbers.
Additional information
National Insurance Numbers are 9 digit strings that are typically 2 alpha characters followed by 6 numbers and finally a single alpha. There are few combinations are not permitted as seen here.
The
validregex provided will produce a subset of all legal NI numbers. I didn't consider a regex to produce all combinations wasn't necessary.Checklist
Before submitting the PR make sure the following are checked:
[Fix #issue-number]If you're proposing a new generator or locale: