Add MCC and MNC country codes generators for phones
Describe the solution you'd like
Add Mobile Country Codes (MCC) and Mobile Network Code (MNC) generators for phone data generator.
Describe alternatives you've considered Alternative is to use numerify functions to do the same. I think having these as a generator would be helpful for others as well.
Additional context
Please let me know if you find that suitable and I will submit a PR
Were you thinking of a specific library or simply using that data to create new functions?
If the plan is to use that data that's fine I think. (Though you'd have to check the license or Ts & Cs.)
Hi @vadeg , interesting suggestion, but perhaps a bit of a niche? If you need this, it might be good to look into a custom provider perhaps? https://www.datafaker.net/documentation/custom-providers/
@bodiam how do you decide what is a niche and what is not? I see a lot of providers like "Breaking bad" or "Dark souls" which doesn't look like for a general use. Mobile Country Codes is a standard which is widely used across industry. It is like country codes or currency codes.
It's a gut feeling, and it's based on the number of requests over time. Besides that, we don't do data requests, if you really want it, submit a PR, and there's nothing which stops you from creating a custom Faker with this info added.
@vadeg I've looked deeper at MCC and MNC, and came to a conclusion similar to @bodiam: I cannot imagine a test (or even a production code) that needs a random MCC or MNC code. What could be a practical reason?
Maybe it's more realistic when you need a random phone number? Then yes, DF can generate random phone numbers. But MCC and MNC seem to be a very internal information that people don't even see neither use.
Anyway, how it's possible to generate them? DF uses library "libphonenumber" to generate random phone numbers. But this library doesn't know anything about MCC and MNC (AFAIK).
@asolntsev
I cannot imagine a test (or even a production code) that needs a random MCC or MNC code. What could be a practical reason?
There are services which based on phone number could return a lot of additional information including MCC and MNC. For me it is hard to judge how often it is used. I would assume if your domain is close to telecom then it would be useful.
Anyway, how it's possible to generate them?
For example, it could be a hardcoded dataset like the list of AWS regions or ASIN codes which are already generated by DF. This data doesn't needs to be up to date.
The same applies to MNC.
@bodiam
Besides that, we don't do data requests,
I didn't plan to do that. I wanted to do it like it is already done for other data you provide.
if you really want it, submit a PR
According to this conversation it seems that it will be rejected :)
According to this conversation it seems that it will be rejected :)
I think if you look at the PRs over the last years, you'll find that we hardly reject any PR. One of the ideas of this project is that if you think there's value, and there's not anything too controversial or impractical about this (eg please don't add 10MB of data for an incredibly niche solution), then we'll add it to the code base.
At the same time, we don't claim to produce valid data, and especially not related data. So something like Datafaker's numerify or regexify could just as well do the trick to make an MCC or MNC. It's probably more useful than Monthy Python quotes, though who knows :)
Anyway, I think if you need it, and you want to do the effort to produce the PR, there would be little to stop me. Erik Meijer once said: "talk is cheap, code wins", and I try to apply that here as much as possible too, even if sometimes I don't fully agree with the change.