Skip to content

Validate US phone area-code candidates using sources with documented reuse terms #1140

Open

Description

@nabinchha

Removing NANPA-derived screening in #1139 restores erroneous Wikidata dialing-code statements to the US phone sampler. We are accepting this data-quality regression for that PR and tracking replacement validation here.

At PR commit 2a6126e0643ad4017ecd5bf78e44077c2b9e31cf:

Reproduce the first example through the public sampler helper:

from data_designer.engine.sampling_gen.entities.phone_number import PhoneNumber

print(PhoneNumber.from_zip_prefix("98933"))
# The area code is always 590.

Comparison with the previously pinned screening reference found 19 newly sampleable codes that fail US/geographic/in-service checks. In total, 91 ZIPs contain a non-US, non-geographic, or out-of-service candidate, accounting for approximately 0.253% of the nationwide sampler probability. This is separate from approximate ZIP boundaries or uncertain overlay market shares.

The current 307 sampler/rebuild tests pass because they verify artifact consistency, weights, numeric shape, and selected regional examples; they do not establish numbering validity.

Expected outcome

  • Establish replacement validation for country, geographic use, active status, and state association using sources with documented reuse terms and reproducible inputs.
  • Regenerate the lookup and update its manifest, NOTICE, build report, and reconciliation.
  • Add regression coverage for invalid/foreign codes and wrong-state associations while preserving ZIP identifiers, population weights, and valid overlay candidates.
  • Keep NANPA-derived exclusions out of the replacement; copying the old list back would restore the dependency chore: remove NANPA screening from phone sampling data #1139 removes.

Review evidence: #1139 (comment)

Activity

  1. andreatnvidia commented on Nov 6, 2026

    @andreatnvidia
    Contributor

    Thanks for tracking this, @nabinchha. Google’s libphonenumber metadata looks like a candidate for the replacement validation.

    • The actual numbering XML and English +1 geocoding data carry Apache-2.0 headers, beyond the repository-level license.
    • A prototype using the US/Puerto Rico fixed-line and mobile patterns rejects all 19 newly sampleable problematic codes identified here, including 590, 486, 639, 519, 456, and 877. Filtering by number type matters because toll-free numbers can otherwise be valid US numbers.
    • It retains 328 of the 333 codes accepted by the previous screening. The five gaps are 436, 621, 624, 837, and 861, so this needs a coverage audit before adoption. The geocoding data provides state information, but coverage and granularity vary.
    • We could pin the files and hashes, retain their license notices, and read them during rebuilding with standard-library XML/text parsing, without adding a runtime dependency. The US metadata cites NANPA upstream; that provenance should be documented alongside the explicit Apache-2.0 grant.

    Dane (@danecor) also highlighted a separate completeness issue in his comparison of the #1134 build: 41 in-service geographic codes were absent:

    • 19 were missing from the Wikidata input, including 771 (DC), 351 (MA), 743 (NC), 943, 826, and 948.
    • 22 were present but never selected, including 737 (Austin), 463 (Indianapolis), 380 (Columbus), 279 (Sacramento), 689 (Orlando), 938, and 567. These were reported as not_selected in that build; the current report also includes additional source values, so its raw status count differs.

    The mechanism Dane pointed to is that alternatives are retained only at the chosen locality point. An overlay recorded on a different, less central locality can therefore consistently lose selection. His suggestion was to expand a selected code with its confirmed overlay partners. That would require a mapping with documented permissive reuse terms and tests that preserve geographic splits. Libphonenumber is a validation candidate; an appropriate overlay-partner source still needs investigation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions