-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Add en-GB ID Numbers (aka National Insurance Numbers) #3032
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add en-GB ID Numbers (aka National Insurance Numbers) #3032
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: