Personator Consumer Notebook: Databricks Reference Guide#

Notebook Configuration#

Follow the instructions to get the notebook and details about installation in Notebook Installation.

Check Single Contact#

The Check Single Contact notebook verifies and enriches an individual consumer contact record using the Personator Consumer API. It can return the response as JSON or write selected response fields to an output table.

Example#

  1. Set up your license key using Databricks secrets. See Databricks License Key Set Up.

  2. Fill in the required fields indicated by (*).

  3. Click Run all to run the notebook.

  4. The JSON response will be displayed in the View Results notebook section. If an output table is named, the result will append to the table.

Input Example

../../_images/Databricks-Personator-Consumer-Verify-Single-Example-Input-1.png ../../_images/Databricks-Personator-Consumer-Verify-Single-Example-Input-2.png

Output Example

../../_images/Databricks-Personator-Consumer-Verify-Single-Example-Output.png

Input Parameters#

The following table describes the input parameters for the Check Single Contact notebook. Provide at least one of the minimum input combinations.

Parameter

Data Type

Description

Example

License

STRING

Required.
The License Key with Credits issued by Melissa.

Get it here.

See more information on license key set up.

Input Fields

STRING

Provide supported input values in the corresponding fields listed under Input Fields.

AddressLine1,
City,
State

Actions

STRING

[ActionName], separated by commas (,). Blank input defaults to Check.

See endpoint actions.

Check,Move

Columns

STRING

[ColumnName,GrpColumnsName], separated by commas (,).

See endpoint columns.

Plus4,GrpGeocode

Options

STRING

[OptionName:Parameter], separated by semicolons (;).

See endpoint options.

UsePreferredCity:on;Diacritics:off

Output Table Name

STRING

The output table name.

A new table will be created if it doesn’t exist.
If the table exists, its structure must remain unchanged.
If left blank, only the JSON response is returned.

Output Table Fields

STRING

Case-sensitive.

Only valid when Output Table Name is provided.

Select fields for the output table. If left blank or Select All, all fields will output.
To output chosen fields, ensure Select All is deselected.

RecordID,
Results,
AddressExtras,
AddressKey,
AddressLine1,
AddressLine2,
City,
CompanyName,
EmailAddress,
MelissaAddressKey,
MelissaAddressKeyBase,
NameFull,
PhoneNumber,
PostalCode,
State,
DateLastConfirmed,
EstimatedHomeValue,
MedianHouseholdIncome,
MelissaIdentityKey,
MoveDate,
Occupation,
OwnRent,
PhoneCountryCode,
PhoneCountryName,
Plus4,
PrivateMailBox,
Suite,
AddressTypeCode,
CarrierRoute,
CityAbbreviation,
CountryCode,
CountryName,
DeliveryIndicator,
DeliveryPointCheckDigit,
DeliveryPointCode,
StateName,
UrbanizationName,
UTC,
CBSACode,
CBSADivisionCode,
CBSADivisionLevel,
CBSADivisionTitle,
CBSALevel,
CBSATitle,
CensusBlock,
CensusTract,
CongressionalDistrict,
CountyFIPS,
CountyName,
PlaceCode,
PlaceName,
CensusKey,
CountySubdivisionCode,
CountySubdivisionName,
ElementarySchoolDistrictCode,
ElementarySchoolDistrictName,
SecondarySchoolDistrictCode,
SecondarySchoolDistrictName,
StateDistrictLower,
StateDistrictUpper,
UnifiedSchoolDistrictCode,
UnifiedSchoolDistrictName,
Latitude,
Longitude,
ChildrenAgeRange,
CreditCardUser,
DateOfBirth,
DateOfDeath,
DemographicsGender,
DemographicsResults,
Education,
HouseholdIncome,
HouseholdSize,
LengthOfResidence,
MaritalStatus,
PoliticalParty,
PresenceOfChildren,
PresenceOfSenior,
DistanceAddressToIP,
IPAddress,
IPCity,
IPConnectionSpeed,
IPConnectionType,
IPContinent,
IPCountryAbbreviation,
IPCountryName,
IPDomainName,
IPISPName,
IPLatitude,
IPLongitude,
IPPostalCode,
IPProxyDescription,
IPProxyType,
IPRegion,
IPUTC,
Gender,
Gender2,
NameFirst,
NameFirst2,
NameLast,
NameLast2,
NameMiddle,
NameMiddle2,
NamePrefix,
NamePrefix2,
NameSuffix,
NameSuffix2,
Salutation,
AddressDeliveryInstallation,
AddressHouseNumber,
AddressLockBox,
AddressPostDirection,
AddressPreDirection,
AddressPrivateMailboxName,
AddressPrivateMailboxRange,
AddressRouteService,
AddressStreetName,
AddressStreetSuffix,
AddressSuiteName,
AddressSuiteNumber,
DomainName,
MailboxName,
TopLevelDomain,
AreaCode,
NewAreaCode,
PhoneExtension,
PhonePrefix,
PhoneSuffix

Check Multiple Contacts#

The Check Multiple Contacts notebook processes contact information records in batches, validating and standardizing key components using the Personator Consumer API.

It can handle tables of any size, returning the results in a specified output table and supports optional fields for flexible, accurate contact verification.

Requirements#

To use this notebook, you need to prepare an input table in Databricks beforehand referencing our default input fields below.

Minimum Input Combinations#

Provide at least one of these combinations for each input record:

Set

Fields

Set A

address_line_1, postal_code

Set B

address_line_1, city, state

Set C

address_line_1, last_line

Set D

email_address

Set E

phone_number

Set F

full_name

Set G

ip_address

Set H

free_form

Set I

melissa_address_key

Set J

melissa_identity_key

Input Fields#

Every input table must include record_id and at least one minimum input combination above. The remaining fields are optional.

Column Name

Data Type

Description

record_id

STRING

Required.
Record identifier, primary key.

address_line_1

STRING

Address line 1.

address_line_2

STRING

Address line 2.

age_approximate

STRING

Return individuals within a year of this age.

age_greater_than

STRING

Return individuals older than this age.

age_less_than

STRING

Return individuals younger than this age.

birth_day

STRING

Birth day in DD format.

birth_month

STRING

Birth month in MM format.

birth_year

STRING

Birth year in YYYY format.

city

STRING

City name.

company_name

STRING

Organization name associated with the address.

country

STRING

Country name, abbreviation, or code. Supports US and Canada; other countries return AS09 (Foreign Address). Invalid or blank input defaults to US or Canada.

email_address

STRING

Email address.

first_name

STRING

First name.

free_form

STRING

Free form input for additional information.

full_name

STRING

Full name.

ip_address

STRING

IP address for the record.

last_line

STRING

City, state, and ZIP.

last_name

STRING

Last name.

melissa_address_key

STRING

Melissa unique address key.

melissa_identity_key

STRING

Melissa unique identity key.

phone_number

STRING

Phone number.

postal_code

STRING

Postal code.

state

STRING

US state.

Python Notebook Setup#

The step-by-step example below shows how to use the notebook. Replace with your values.

  • Step 0 - Prepare an input table

    Assume that the input table has the signature below:

    CREATE TABLE IF NOT EXISTS <catalog>.<schema>.<input_table> (
       RecId INT,
       Address1 STRING,
       City STRING,
       State STRING,
       Zip STRING,
       Email STRING,
       Phone STRING,
       Name STRING
    );
    

    This input table has different column names from the Input Fields. Mapping column names in Step 2 is necessary for the program to get the correct parameters.

Attention

Make sure your input table contains unique RecordID before running the next script. See more about Batch Processing Best Practices.

  • Step 1 - Required Privileges

    Ensure you have the necessary access to the input table and output table including SELECT, INSERT, UPDATE, USE SCHEMA, and USE CATALOG privileges for the tables involved.

  • Step 2 - Map Input Columns with the Default Input Fields

    Set the required parameters and map your input columns to our Input Fields.

    Check Input Parameters for more information.

    from melissadatacloudapi_databricks import Config, PERSONATOR_CONSUMER, run
    
    config = Config(
        license_key=LICENSE_KEY,
        input_table="<catalog>.<schema>.<input_table>",
        output_table="<catalog>.<schema>.<output_table>",
        # Map your input columns with our input fields, replace with your actual column names
        # For optional columns, leave the field as "".
        parameter_mapping={
          "record_id": "RecId",
          "address_line_1": "Address1",
          "city": "City",
          "state": "State",
          "postal_code": "Zip",
          "email_address": "Email",
          "phone_number": "Phone",
          "full_name": "Name",
          "last_line": "",
          "ip_address": "",
          "free_form": "",
          "melissa_address_key": "",
          "melissa_identity_key": "",
          "first_name": "",
          "last_name": "",
          "company_name": "",
          "address_line_2": "",
          "country": "",
          "birth_day": "",
          "birth_month": "",
          "birth_year": "",
          "age_approximate": "",
          "age_greater_than": "",
          "age_less_than": "",
        },
        request_parameters={
          "actions": "Check",
          "columns": "",
          "options": "",
        },
        output_columns="<field_1,field_2>",
        log_to_table=False,
        log_table="<catalog>.<schema>.<log_table>",
        duplicate_check=False,
    )
    
  • Step 3 - Call run() to verify your data

    run(PERSONATOR_CONSUMER, config, spark=spark, dbutils=dbutils)
    
    # Output table view
    display(
        spark.sql(
            f"SELECT * FROM {config.output_table} ORDER BY TRY_CAST(RecordID AS BIGINT), RecordID LIMIT 1000"
        )
    )
    

Input Parameters#

The following table describes the input parameters for the Check Multiple Contacts notebook.

Parameter

Data Type

Description

Example

license_key

STRING

Required.
The License Key with Credits issued by Melissa.

Get it here.

See more information on license key set up.

parameter_mapping

Connects each Melissa field to a column in your input table. See Input Fields.

request_parameters

Sent once with every batch, applied to every record.

actions
[ActionName], separated by commas (,). Blank input defaults to Check. See endpoint actions.

columns
[ColumnName,GrpColumnsName], separated by commas (,). See endpoint columns.

options
[OptionName:Parameter], separated by semicolons (;). See endpoint options.
If omitted, Default Input Options will be applied.

Check,Move
Plus4,GrpGeocode
UsePreferredCity:on;Diacritics:off

input_table

STRING

Required.
Name of the input table.

catalog.schema.input_table_name

output_table

STRING

Required.
The output table name.

A new table will be created if it doesn’t exist.
If the table exists, its structure must remain unchanged.

catalog.schema.output_table_name

output_columns

STRING

Case-sensitive.

Fields in the output table; fields separated by commas (,) if not ‘ALL’.
Field names must match the available response fields. Use ALL to include every available field. This significantly increases the writing time to the output table, so we recommend using the default or specifying the output fields.
If omitted, see Default Output Fields.

RecordID,
InAddressLine1,
InAddressLine2,
InCity,
InCompany,
InCountry,
InEmail,
InFirstName,
InFullName,
InIPAddress,
InLastName,
InMelissaAddressKey,
InMelissaIdentityKey,
InPhone,
InPostalCode,
InState,
Results,
AddressExtras,
AddressKey,
AddressLine1,
AddressLine2,
City,
CompanyName,
EmailAddress,
MelissaAddressKey,
MelissaAddressKeyBase,
NameFull,
PhoneNumber,
PostalCode,
State,
DateLastConfirmed,
EstimatedHomeValue,
MedianHouseholdIncome,
MelissaIdentityKey,
MoveDate,
Occupation,
OwnRent,
PhoneCountryCode,
PhoneCountryName,
Plus4,
PrivateMailBox,
Suite,
AddressTypeCode,
CarrierRoute,
CityAbbreviation,
CountryCode,
CountryName,
DeliveryIndicator,
DeliveryPointCheckDigit,
DeliveryPointCode,
StateName,
UrbanizationName,
UTC,
CBSACode,
CBSADivisionCode,
CBSADivisionLevel,
CBSADivisionTitle,
CBSALevel,
CBSATitle,
CensusBlock,
CensusTract,
CongressionalDistrict,
CountyFIPS,
CountyName,
PlaceCode,
PlaceName,
CensusKey,
CountySubdivisionCode,
CountySubdivisionName,
ElementarySchoolDistrictCode,
ElementarySchoolDistrictName,
SecondarySchoolDistrictCode,
SecondarySchoolDistrictName,
StateDistrictLower,
StateDistrictUpper,
UnifiedSchoolDistrictCode,
UnifiedSchoolDistrictName,
Latitude,
Longitude,
ChildrenAgeRange,
CreditCardUser,
DateOfBirth,
DateOfDeath,
DemographicsGender,
DemographicsResults,
Education,
HouseholdIncome,
HouseholdSize,
LengthOfResidence,
MaritalStatus,
PoliticalParty,
PresenceOfChildren,
PresenceOfSenior,
DistanceAddressToIP,
IPAddress,
IPCity,
IPConnectionSpeed,
IPConnectionType,
IPContinent,
IPCountryAbbreviation,
IPCountryName,
IPDomainName,
IPISPName,
IPLatitude,
IPLongitude,
IPPostalCode,
IPProxyDescription,
IPProxyType,
IPRegion,
IPUTC,
Gender,
Gender2,
NameFirst,
NameFirst2,
NameLast,
NameLast2,
NameMiddle,
NameMiddle2,
NamePrefix,
NamePrefix2,
NameSuffix,
NameSuffix2,
Salutation,
AddressDeliveryInstallation,
AddressHouseNumber,
AddressLockBox,
AddressPostDirection,
AddressPreDirection,
AddressPrivateMailboxName,
AddressPrivateMailboxRange,
AddressRouteService,
AddressStreetName,
AddressStreetSuffix,
AddressSuiteName,
AddressSuiteNumber,
DomainName,
MailboxName,
TopLevelDomain,
AreaCode,
NewAreaCode,
PhoneExtension,
PhonePrefix,
PhoneSuffix,
RecordExtras,
Reserved,
Response,
Timestamp

log_to_table

BOOLEAN

Enable or disable logs to facilitate troubleshooting in case of any issues.
- False (Default): No action will be taken. The notebook will process with no log writes.
- True: Enable event, batch progress, and error logging.

True

log_table

STRING

Name of the log table. Only valid when log_to_table = True.

catalog.schema.log_table_name

duplicate_check

BOOLEAN

Enable or disable several checks for duplicate RecordID.
- False (Default): No action will be taken. The notebook will process records coming from the input source as is.
- True: Enable several checks for duplicate RecordID. When enabled, a repeated RecordID stops the run before anything is sent, and records already in the output table are skipped. This makes it safe to rerun after a failure without submitting the same records to the service again.

True

Default Output Fields#

If output_columns is an empty string or not provided, output table will have a default schema as below.

Column Name

Data Type

RecordID

STRING

MelissaAddressKey

STRING

MelissaAddressKeyBase

STRING

InCompany

STRING

InFullName

STRING

InEmail

STRING

InPhone

STRING

InAddressLine1

STRING

InAddressLine2

STRING

InCity

STRING

InState

STRING

InPostalCode

STRING

InCountry

STRING

InMelissaAddressKey

STRING

InFirstName

STRING

InLastName

STRING

InIPAddress

STRING

InMelissaIdentityKey

STRING

Results

STRING

CompanyName

STRING

NameFull

STRING

AddressLine1

STRING

AddressLine2

STRING

City

STRING

State

STRING

PostalCode

STRING

AddressKey

STRING

Reserved

STRING

Timestamp

TIMESTAMP

Result Codes#

For the full list of result codes returned by Personator Consumer Notebook: Databricks, please visit here.

Interpreting Results#

The SE## and GE## codes (Transmission Service Error and General Transmission Error) are used to signify more general errors, and are returned under the key TransmissionResults in the outermost level of our responses.

The Personator API and other Melissa APIs will have a Results Output. Several different Result Codes may be returned by the service in order to give you detailed information about the status of the record submitted.

It is important to understand these result codes in order for you to make a determination of good vs bad data and how you would want to use it.

The following shows you the indicators for the different results:

Code

Description

Quality Indicator

AS01

The address is valid and deliverable according to official postal agencies.

Good Data

AS02

The building address was verified but the suite/apartment number is missing or invalid.

Good Data

AS03

US Only. This US address is not serviced by the USPS but does exist and may receive mail through third party carriers like UPS.

Good Data

PS01

The phone number has been verified as valid.

Good Data

ES01

This email address has correct syntax and belongs to a domain known to receive mail. This does not indicate a mailbox-level deliverability check was performed. To perform real-time checks and see DCS score, use Global Email with option VerifyMailbox:Premium.

Good Data

NS01

Name parsing was successful.

Good Data

AE**

Results that begin with AE are an indication of address errors

Bad Data

PE**

Results that begin with PE are an indication of phone errors

Bad Data

EE**

Results that begin with EE are an indication of email errors

Bad Data

NE**

Results that begin with NE are an indication of name errors

Bad Data

GS05

The record was geocoded down to the rooftop level, meaning the point is within the property boundaries, usually the center.

High Accuracy GeoCoding

GS06

The record was geocoded down to the rooftop level using interpolation (educated estimations using street coordinates). The point may be in or close to the property boundaries.

High Accuracy GeoCoding

GS01

The record was coded to the street level (Zip+4 for US, full postal code for CA).

Medium Accuracy GeoCoding