Is a Phone Number

Detects values of a field that are not valid phone numbers.

The Is a Phone Number monitor checks that a string field only contains phone numbers.

When to Use

  • Contact data: A phone number field must only contain phone numbers, not free text such as unknown or call me.
  • Field mix-ups: A change in an upstream synchronization writes other values, such as email addresses, in a phone number field.

How It Works

For each data point, Sifflet counts the rows where the field value does not match the phone number format, and computes:

  • Count (default value mode): The number of invalid rows.
  • Percentage: The share of invalid rows among the rows checked for the data point, in percent. These are the rows of the period in incremental scan mode (for example, all the rows created that day), or all the rows of the table in full dataset scan mode. Rows excluded by the where clause are not counted.

Null values are not counted as invalid. To detect them, use Nulls.

The default static threshold fails when the data point is greater than 0, that is, as soon as one value is invalid.

A valid phone number contains at least one digit, and no characters other than digits, spaces, +, -, (, and ). The monitor does not check the number of digits or the country format: to enforce a stricter format, use Matches Regex.

^([() +-]*[0-9])+[() +-]*$

Example

You want every customer phone number to be a phone number. Create an Is a Phone Number monitor on customers with the following settings:

  • Column to monitor: phone_number.
  • Monitoring mode: Incremental scan, with created_at as the time window column and a daily time-based data aggregation.
  • Threshold: Static, Greater than 0 (default).

On June 12, a change in the CRM synchronization writes the email addresses of 1,200 customers in their phone_number field. The data point of June 12 is 1,200, greater than 0, so the monitor fails.

Configure the Monitor

📝 Note: This template is only available on Athena, BigQuery, Databricks, MySQL, Oracle, PostgreSQL, Redshift, and Snowflake. See Supported Data Sources.

Is a Phone Number Settings

SettingDescriptionDefault
Column to monitorThe string field to check.None

Common Settings

  • Value mode: Count (default) or Percentage.
  • Threshold: Static (default), relative, or dynamic. See Thresholds.
  • Scan mode: Incremental or full dataset. See Scan Modes.
  • Where clause and group by: See Where Clause, Group By, and Joins.
  • Joins: Join a second dataset to filter or group by its fields. See Joins.

Monitor as Code

The monitor kind is FieldFormat, with format.kind: Phone. The following YAML creates the monitor of the example:

kind: FieldFormat
field: phone_number
format:
  kind: Phone
timeWindow:
  field: created_at
  firstRun: P365D
  frequency: P1D
ParameterRequiredDescription
fieldYesThe string field to check.
format.kindYesPhone.

For the shared parameters, see the Parameters reference.

Related Templates

  • Matches Regex: Checks values against a regular expression of your own, when the built-in format does not fit your data.

Did this page help you?