Summary
Support a new optional region property on the phone number filter (filterPhoneNumber.region) so a policy can set the default region(s) used to detect phone numbers written without an international + country code. This is the runtime half of PhiSQL RFC philterd/phisql#22.
region is a single ISO 3166-1 alpha-2 string or an array of them (default "US"). Numbers with a + prefix are detected regardless; the region only affects bare national-format numbers.
Requires phisql 1.2.0, the schema version that defines filterPhoneNumber.region. Blocked until this schema version is targeted.
Prerequisite
phileas-python's phone filter (phileas/filters/phone_number_filter.py) is currently a set of NANP regex patterns and does not use a phone-number library. The phonenumbers package (the Python port of libphonenumber) is not a dependency. region has no meaning until detection runs through phonenumbers, so this depends on first adopting phonenumbers and using its PhoneNumberMatcher / find API (the analog of the Java libphonenumber path). That library adoption is the prerequisite and should land first (and would also close the international-detection gap that the regex filter has today).
What to change (after adopting phonenumbers)
- Add
phonenumbers as a dependency and detect phone numbers with it (default region "US", a leniency comparable to libphonenumber POSSIBLE).
- Read
region from the phone filter config, accepting either a string or a list of strings (default ["US"]).
- Scan once per configured region and merge, de-duplicating overlapping spans.
+-prefixed numbers are found regardless of region.
Backward compatibility
Additive. A policy without region behaves as the default "US".
Acceptance criteria
Reference: PhiSQL RFC philterd/phisql#22.
Summary
Support a new optional
regionproperty on the phone number filter (filterPhoneNumber.region) so a policy can set the default region(s) used to detect phone numbers written without an international+country code. This is the runtime half of PhiSQL RFC philterd/phisql#22.regionis a single ISO 3166-1 alpha-2 string or an array of them (default"US"). Numbers with a+prefix are detected regardless; the region only affects bare national-format numbers.Requires phisql 1.2.0, the schema version that defines
filterPhoneNumber.region. Blocked until this schema version is targeted.Prerequisite
phileas-python's phone filter (
phileas/filters/phone_number_filter.py) is currently a set of NANP regex patterns and does not use a phone-number library. Thephonenumberspackage (the Python port of libphonenumber) is not a dependency.regionhas no meaning until detection runs throughphonenumbers, so this depends on first adoptingphonenumbersand using itsPhoneNumberMatcher/findAPI (the analog of the Java libphonenumber path). That library adoption is the prerequisite and should land first (and would also close the international-detection gap that the regex filter has today).What to change (after adopting
phonenumbers)phonenumbersas a dependency and detect phone numbers with it (default region"US", a leniency comparable to libphonenumberPOSSIBLE).regionfrom the phone filter config, accepting either a string or a list of strings (default["US"]).+-prefixed numbers are found regardless of region.Backward compatibility
Additive. A policy without
regionbehaves as the default"US".Acceptance criteria
phonenumbers-based detection is in place (prerequisite).regionas either a string or a list, defaulting toUS.region: "GB"detects UK national-format numbers;region: ["US","GB","FR"]detects national-format numbers from each.+-prefixed international numbers are detected regardless ofregion.Reference: PhiSQL RFC philterd/phisql#22.