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

Random identity card number #416

Open
Shinigami92 opened this issue Feb 4, 2022 · 8 comments
Open

Random identity card number #416

Shinigami92 opened this issue Feb 4, 2022 · 8 comments
Labels
c: feature Request for new feature p: 1-normal Nothing urgent s: waiting for user interest Waiting for more users interested in this feature
Milestone

Comments

@Shinigami92
Copy link
Member

Clear and concise description of the problem

I would like to have a function to generate a random identity card number

In germany the implementation would follow this pattern: https://de.wikipedia.org/wiki/Ausweisnummer

Not sure right now how patterns in other country looks like, but in the long run I would need these also.

The sequence should be seed-based

Suggested solution

Implement a function that returns an identity card number that is seed-based and related to the current selected locale

Alternative

No response

Additional context

No response

@Shinigami92 Shinigami92 added s: pending triage Pending Triage c: feature Request for new feature labels Feb 4, 2022
@Shinigami92 Shinigami92 moved this to Todo in Faker Roadmap Feb 4, 2022
@Shinigami92 Shinigami92 added this to the v7 - Next Major milestone Feb 4, 2022
@Shinigami92 Shinigami92 removed the s: pending triage Pending Triage label Feb 4, 2022
@ejcheng
Copy link
Member

ejcheng commented Feb 4, 2022

What about locales that do not have a "national identity card"? The US doesn't have anything like that, would this function generate a Social Security number? Passport number?

@ST-DDT
Copy link
Member

ST-DDT commented Feb 4, 2022

How about designing it more generic. We could use a Record<string, algorithm config> to define these things and the user has to know or lookup which generators are available for generateId(type: string).
The you can have one pattern for driving licences, for personal identity card numbers.

Or even more generically, a method that just takes the generation config and will build it for you.
You want a credit card with name, number, expiration date...? You get will get it.
You want an array of x-y foobars? You will get it.
You want a single identity card number that is generated based on a specific pattern? You will get it.
You just have to describe the thing you want.
Something like fake() and mustache() but for generic objects/arrays/elements.

@Shinigami92
Copy link
Member Author

How about designing it more generic. We could use a Record<string, algorithm config> to define these things and the user has to know or lookup which generators are available for generateId(type: string). The you can have one pattern for driving licences, for personal identity card numbers.

Or even more generically, a method that just takes the generation config and will build it for you. You want a credit card with name, number, expiration date...? You get will get it. You want an array of x-y foobars? You will get it. You want a single identity card number that is generated based on a specific pattern? You will get it. You just have to describe the thing you want. Something like fake() and mustache() but for generic objects/arrays/elements.

Yes, that would be nice in the long run, but I don't want to pass an algorithm or pattern as developer to faker, in that case I could just write it myself.
I would like to have it very basic and easy to use for now.
And if a locale doesn't have such thing, I'm satisfied with undefined for now.

@bryancross
Copy link

Algorithimically generated ID numbers like the Ausweisnummer seem like a pretty heavy lift. Seems like these should have their own defined functions, perhaps as part of a locale. US Social Security numbers are easier, as they aren't algorithimically validated. You can get a US SSN using the existing faker.helpers.regexpStyleStringParse`, e.g.:

faker.helpers.regexpStyleStringParse('[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]')

What might be cool is if this method could repeat string patterns as well as single characters, so that might condense down to:

faker.helpers.regexpStyleStringParse('[0-9](3)-[0-9](2)-[0-9](4)')l

Or perhaps with common format identifiers, e.g.:

faker.helpers.regexpStyleStringParse('us-ssn');

There are likely multiple "National ID"s for any given country. The US has SSN, passport number, driver's license number (which varies by state), PASSID/KTN, license plates (again varying by state), etc.

@ST-DDT
Copy link
Member

ST-DDT commented Aug 15, 2022

Since this varies greatly in both available ids and their implementation we have two choices:

  • Move implementation to the locales (The list of available generator varies by country and there would be no real ts support).
  • Implement it as a new (plugin-)module (per country)

I don't see this in v7 and even v8.

@ST-DDT ST-DDT added p: 1-normal Nothing urgent s: needs decision Needs team/maintainer decision labels Aug 15, 2022
@ST-DDT ST-DDT added s: waiting for user interest Waiting for more users interested in this feature and removed s: needs decision Needs team/maintainer decision labels Mar 16, 2023
@ST-DDT
Copy link
Member

ST-DDT commented Mar 16, 2023

If you are interested in this feature, please upvote this issue.

@guitartsword
Copy link

Maybe this will help create some random number SSN-like value:

faker.phone.number('###-##-####')
// Example Results:
// 771-00-9483
// 315-74-5571

For a "valid" Honduras ID number:

faker.phone.number('####-####-#####')

It creates something that may work, but may create some invalid values, for Honduras ID, the first 2 digits is the Department, the next two digits is the municipality, next 4 is year issued, next 5 are indeed random. The year is easy to generate, but the first 4 requires more development.

I like this idea:

Implement it as a new (plugin-)module (per country)

@ST-DDT ST-DDT added s: waiting for user interest Waiting for more users interested in this feature and removed s: waiting for user interest Waiting for more users interested in this feature labels May 5, 2023
@github-actions
Copy link
Contributor

github-actions bot commented May 5, 2023

Thank you for your feature proposal.

We marked it as "waiting for user interest" for now to gather some feedback from our community:

  • If you would like to see this feature be implemented, please react to the description with an up-vote (:+1:).
  • If you have a suggestion or want to point out some special cases that need to be considered, please leave a comment, so we are aware about them.

We would also like to hear about other community members' use cases for the feature to give us a better understanding of their potential implicit or explicit requirements.

We will start the implementation based on:

  • the number of votes (:+1:) and comments
  • the relevance for the ecosystem
  • availability of alternatives and workarounds
  • and the complexity of the requested feature

We do this because:

  • There are plenty of languages/countries out there and we would like to ensure that every method can cover all or almost all of them.
  • Every feature we add to faker has "costs" associated to it:
    • initial costs: design, implementation, reviews, documentation
    • running costs: awareness of the feature itself, more complex module structure, increased bundle size, more work during refactors

View more issues which are waiting for user interest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: feature Request for new feature p: 1-normal Nothing urgent s: waiting for user interest Waiting for more users interested in this feature
Projects
No open projects
Status: Todo
Development

No branches or pull requests

5 participants