Skip to content
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 Faker::NHS - Support for the British National Health Service #801

Merged
merged 8 commits into from
Jul 11, 2018

Conversation

maxehmookau
Copy link
Contributor

@maxehmookau maxehmookau commented Jan 19, 2017

Every person in the United Kingdom has a unique code which identifies them to the National Health Service (NHS). The code is in XXX XXX XXXX format where the final digit is a check digit calculated from the previous ones.

More information on NHS numbers can be found here: https://en.wikipedia.org/wiki/NHS_number

This commit adds the Faker::NHS class along with the Faker::NHS.nhs_number method to generate a valid NHS number.

Every person in the United Kingdom has a unique code which identifies them to the National Health Service (NHS). The code is in XXX XXX XXXX format where the final digit is a check digit calculated from the previous ones.

More information on NHS numbers can be found here: https://en.wikipedia.org/wiki/NHS_number

This commit adds the Faker::NHS class along with the Faker::NHS.nhs_number method to generate a valid NHS number.
@suezhou
Copy link

suezhou commented Apr 18, 2018

It would be very nice to have nhs number included!

@vbrazo vbrazo changed the title Adds support for the British National Health Service (NHS) fake data Add Faker::NHS - Support for the British National Health Service Jun 11, 2018
Copy link
Member

@vbrazo vbrazo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good. Don't forget to add documentation next time. Thanks for contributing 🥇

@vbrazo
Copy link
Member

vbrazo commented Jun 11, 2018

@maxehmookau Travis is red because of this test:

      8:   def test_nhs_british_number
      9:     sample = @tester.british_number
  => 10:     assert sample.length == 12
     11:     assert_equal ' ', sample[3]
     12:     assert_equal ' ', sample[7]
     13:     assert sample[0..2].split.map { :to_i }.all? { :is_digit? }

It seems that your algorithm fails when we run the tests in ruby 2.1.10 and 2.2.10 because it generates 13 characters instead of 12. Could you take a look at this issue and circle back with me?

@maxehmookau
Copy link
Contributor Author

@vbrazo thanks for adding some basic docs!

That's very strange, glad you had CI running to catch that. I'll load up the older ruby version and try and resolve those failures soon.

@vbrazo
Copy link
Member

vbrazo commented Jun 11, 2018

No problem. I tested in the older versions and what I noticed was that it fails because the last digit that is being generated is 10 or 11, that's why we get 13 characters.

@vbrazo
Copy link
Member

vbrazo commented Jul 11, 2018

@maxehmookau just a quick update: this commit removes 2.1.10 and 2.2.10.

@vbrazo vbrazo merged commit e7ee370 into faker-ruby:master Jul 11, 2018
davidmorton0 pushed a commit to davidmorton0/faker that referenced this pull request Jul 12, 2021
…er-ruby#801)

* Adds support for the British National Health Service fake data.

Every person in the United Kingdom has a unique code which identifies them to the National Health Service (NHS). The code is in XXX XXX XXXX format where the final digit is a check digit calculated from the previous ones.

More information on NHS numbers can be found here: https://en.wikipedia.org/wiki/NHS_number

This commit adds the Faker::NHS class along with the Faker::NHS.nhs_number method to generate a valid NHS number.

* Add docs

* Update changelog.md

* Naming fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants